Add docbook/4.87.1/*xml
[exim-website.git] / docbook / 4.87.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 17 Dec 2016
17 </date>
18 <author><firstname>Exim</firstname><surname>Maintainers</surname></author>
19 <authorinitials>EM</authorinitials>
20 <revhistory><revision>
21 <revnumber>4.87.1</revnumber>
22 <date>17 Dec 2016</date>
23   <authorinitials>EM</authorinitials>
24 </revision></revhistory>
25 <copyright><year>
26 2016
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.87.1 of Exim.
206 Substantive changes from the 4.86 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 </tbody>
314 </tgroup>
315 </informaltable>
316 <para>
317 The main specification and the specification of the filtering language are also
318 available in other formats (HTML, PostScript, PDF, and Texinfo). Section
319 <xref linkend="SECTavail"/> below tells you how to get hold of these.
320 </para>
321 </section>
322 <section id="SECID2">
323 <title>FTP and web sites</title>
324 <para>
325 <indexterm role="concept">
326 <primary>web site</primary>
327 </indexterm>
328 <indexterm role="concept">
329 <primary>FTP site</primary>
330 </indexterm>
331 The primary site for Exim source distributions is currently the University of
332 Cambridge&#x2019;s FTP site, whose contents are described in <emphasis>Where to find the Exim
333 distribution</emphasis> below. In addition, there is a web site and an FTP site at
334 <option>exim.org</option>. These are now also hosted at the University of Cambridge. The
335 <option>exim.org</option> site was previously hosted for a number of years by Energis
336 Squared, formerly Planet Online Ltd, whose support I gratefully acknowledge.
337 </para>
338 <para>
339 <indexterm role="concept">
340 <primary>wiki</primary>
341 </indexterm>
342 <indexterm role="concept">
343 <primary>FAQ</primary>
344 </indexterm>
345 As well as Exim distribution tar files, the Exim web site contains a number of
346 differently formatted versions of the documentation. A recent addition to the
347 online information is the Exim wiki (<emphasis role="bold"><ulink url="http://wiki.exim.org">http://wiki.exim.org</ulink></emphasis>),
348 which contains what used to be a separate FAQ, as well as various other
349 examples, tips, and know-how that have been contributed by Exim users.
350 </para>
351 <para>
352 <indexterm role="concept">
353 <primary>Bugzilla</primary>
354 </indexterm>
355 An Exim Bugzilla exists at <emphasis role="bold"><ulink url="http://bugs.exim.org">http://bugs.exim.org</ulink></emphasis>. You can use
356 this to report bugs, and also to add items to the wish list. Please search
357 first to check that you are not duplicating a previous entry.
358 </para>
359 </section>
360 <section id="SECID3">
361 <title>Mailing lists</title>
362 <para>
363 <indexterm role="concept">
364 <primary>mailing lists</primary>
365 <secondary>for Exim users</secondary>
366 </indexterm>
367 The following Exim mailing lists exist:
368 </para>
369 <informaltable frame="none">
370 <tgroup cols="2" colsep="0" rowsep="0">
371 <colspec colwidth="140pt" align="left"/>
372 <colspec colwidth="254pt" align="left"/>
373 <tbody>
374 <row>
375 <entry><emphasis>exim-announce@exim.org</emphasis></entry>
376 <entry>Moderated, low volume announcements list</entry>
377 </row>
378 <row>
379 <entry><emphasis>exim-users@exim.org</emphasis></entry>
380 <entry>General discussion list</entry>
381 </row>
382 <row>
383 <entry><emphasis>exim-dev@exim.org</emphasis></entry>
384 <entry>Discussion of bugs, enhancements, etc.</entry>
385 </row>
386 <row>
387 <entry><emphasis>exim-cvs@exim.org</emphasis></entry>
388 <entry>Automated commit messages from the VCS</entry>
389 </row>
390 </tbody>
391 </tgroup>
392 </informaltable>
393 <para>
394 You can subscribe to these lists, change your existing subscriptions, and view
395 or search the archives via the mailing lists link on the Exim home page.
396 <indexterm role="concept">
397 <primary>Debian</primary>
398 <secondary>mailing list for</secondary>
399 </indexterm>
400 If you are using a Debian distribution of Exim, you may wish to subscribe to
401 the Debian-specific mailing list <emphasis>pkg-exim4-users@lists.alioth.debian.org</emphasis>
402 via this web page:
403 </para>
404 <literallayout>
405 <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>
406 </literallayout>
407 <para>
408 Please ask Debian-specific questions on this list and not on the general Exim
409 lists.
410 </para>
411 </section>
412 <section id="SECID4">
413 <title>Exim training</title>
414 <para>
415 <indexterm role="concept">
416 <primary>training courses</primary>
417 </indexterm>
418 Training courses in Cambridge (UK) used to be run annually by the author of
419 Exim, before he retired. At the time of writing, there are no plans to run
420 further Exim courses in Cambridge. However, if that changes, relevant
421 information will be posted at <emphasis role="bold"><ulink url="http://www-tus.csx.cam.ac.uk/courses/exim/">http://www-tus.csx.cam.ac.uk/courses/exim/</ulink></emphasis>.
422 </para>
423 </section>
424 <section id="SECID5">
425 <title>Bug reports</title>
426 <para>
427 <indexterm role="concept">
428 <primary>bug reports</primary>
429 </indexterm>
430 <indexterm role="concept">
431 <primary>reporting bugs</primary>
432 </indexterm>
433 Reports of obvious bugs can be emailed to <emphasis>bugs@exim.org</emphasis> or reported
434 via the Bugzilla (<emphasis role="bold"><ulink url="http://bugs.exim.org">http://bugs.exim.org</ulink></emphasis>). However, if you are unsure
435 whether some behaviour is a bug or not, the best thing to do is to post a
436 message to the <emphasis>exim-dev</emphasis> mailing list and have it discussed.
437 </para>
438 </section>
439 <section id="SECTavail">
440 <title>Where to find the Exim distribution</title>
441 <para>
442 <indexterm role="concept">
443 <primary>FTP site</primary>
444 </indexterm>
445 <indexterm role="concept">
446 <primary>distribution</primary>
447 <secondary>ftp site</secondary>
448 </indexterm>
449 The master ftp site for the Exim distribution is
450 </para>
451 <literallayout>
452 <emphasis role="bold">ftp://ftp.csx.cam.ac.uk/pub/software/email/exim</emphasis>
453 </literallayout>
454 <para>
455 This is mirrored by
456 </para>
457 <literallayout>
458 <emphasis role="bold">ftp://ftp.exim.org/pub/exim</emphasis>
459 </literallayout>
460 <para>
461 The file references that follow are relative to the <filename>exim</filename> directories at
462 these sites. There are now quite a number of independent mirror sites around
463 the world. Those that I know about are listed in the file called <filename>Mirrors</filename>.
464 </para>
465 <para>
466 Within the <filename>exim</filename> directory there are subdirectories called <filename>exim3</filename> (for
467 previous Exim 3 distributions), <filename>exim4</filename> (for the latest Exim 4
468 distributions), and <filename>Testing</filename> for testing versions. In the <filename>exim4</filename>
469 subdirectory, the current release can always be found in files called
470 </para>
471 <literallayout>
472 <filename>exim-n.nn.tar.gz</filename>
473 <filename>exim-n.nn.tar.bz2</filename>
474 </literallayout>
475 <para>
476 where <emphasis>n.nn</emphasis> is the highest such version number in the directory. The two
477 files contain identical data; the only difference is the type of compression.
478 The <filename>.bz2</filename> file is usually a lot smaller than the <filename>.gz</filename> file.
479 </para>
480 <para>
481 <indexterm role="concept">
482 <primary>distribution</primary>
483 <secondary>signing details</secondary>
484 </indexterm>
485 <indexterm role="concept">
486 <primary>distribution</primary>
487 <secondary>public key</secondary>
488 </indexterm>
489 <indexterm role="concept">
490 <primary>public key for signed distribution</primary>
491 </indexterm>
492 The distributions will be PGP signed by an individual key of the Release
493 Coordinator.  This key will have a uid containing an email address in the
494 <emphasis>exim.org</emphasis> domain and will have signatures from other people, including
495 other Exim maintainers.  We expect that the key will be in the "strong set" of
496 PGP keys.  There should be a trust path to that key from Nigel Metheringham&#x2019;s
497 PGP key, a version of which can be found in the release directory in the file
498 <filename>nigel-pubkey.asc</filename>.  All keys used will be available in public keyserver pools,
499 such as <emphasis>pool.sks-keyservers.net</emphasis>.
500 </para>
501 <para>
502 At time of last update, releases were being made by Phil Pennock and signed with
503 key <emphasis>0x403043153903637F</emphasis>, although that key is expected to be replaced in 2013.
504 A trust path from Nigel&#x2019;s key to Phil&#x2019;s can be observed at
505 <emphasis role="bold"><ulink url="https://www.security.spodhuis.org/exim-trustpath">https://www.security.spodhuis.org/exim-trustpath</ulink></emphasis>.
506 </para>
507 <para>
508 Releases have also been authorized to be performed by Todd Lyons who signs with
509 key <emphasis>0xC4F4F94804D29EBA</emphasis>. A direct trust path exists between previous RE Phil
510 Pennock and Todd Lyons through a common associate.
511 </para>
512 <para>
513 The signatures for the tar bundles are in:
514 </para>
515 <literallayout>
516 <filename>exim-n.nn.tar.gz.asc</filename>
517 <filename>exim-n.nn.tar.bz2.asc</filename>
518 </literallayout>
519 <para>
520 For each released version, the log of changes is made separately available in a
521 separate file in the directory <filename>ChangeLogs</filename> so that it is possible to
522 find out what has changed without having to download the entire distribution.
523 </para>
524 <para>
525 <indexterm role="concept">
526 <primary>documentation</primary>
527 <secondary>available formats</secondary>
528 </indexterm>
529 The main distribution contains ASCII versions of this specification and other
530 documentation; other formats of the documents are available in separate files
531 inside the <filename>exim4</filename> directory of the FTP site:
532 </para>
533 <literallayout>
534 <filename>exim-html-n.nn.tar.gz</filename>
535 <filename>exim-pdf-n.nn.tar.gz</filename>
536 <filename>exim-postscript-n.nn.tar.gz</filename>
537 <filename>exim-texinfo-n.nn.tar.gz</filename>
538 </literallayout>
539 <para>
540 These tar files contain only the <filename>doc</filename> directory, not the complete
541 distribution, and are also available in <filename>.bz2</filename> as well as <filename>.gz</filename> forms.
542 </para>
543 </section>
544 <section id="SECID6">
545 <title>Limitations</title>
546 <itemizedlist>
547 <listitem>
548 <para>
549 <indexterm role="concept">
550 <primary>limitations of Exim</primary>
551 </indexterm>
552 <indexterm role="concept">
553 <primary>bang paths</primary>
554 <secondary>not handled by Exim</secondary>
555 </indexterm>
556 Exim is designed for use as an Internet MTA, and therefore handles addresses in
557 RFC 2822 domain format only. It cannot handle UUCP <quote>bang paths</quote>, though
558 simple two-component bang paths can be converted by a straightforward rewriting
559 configuration. This restriction does not prevent Exim from being interfaced to
560 UUCP as a transport mechanism, provided that domain addresses are used.
561 </para>
562 </listitem>
563 <listitem>
564 <para>
565 <indexterm role="concept">
566 <primary>domainless addresses</primary>
567 </indexterm>
568 <indexterm role="concept">
569 <primary>address</primary>
570 <secondary>without domain</secondary>
571 </indexterm>
572 Exim insists that every address it handles has a domain attached. For incoming
573 local messages, domainless addresses are automatically qualified with a
574 configured domain value. Configuration options specify from which remote
575 systems unqualified addresses are acceptable. These are then qualified on
576 arrival.
577 </para>
578 </listitem>
579 <listitem>
580 <para>
581 <indexterm role="concept">
582 <primary>transport</primary>
583 <secondary>external</secondary>
584 </indexterm>
585 <indexterm role="concept">
586 <primary>external transports</primary>
587 </indexterm>
588 The only external transport mechanisms that are currently implemented are SMTP
589 and LMTP over a TCP/IP network (including support for IPv6). However, a pipe
590 transport is available, and there are facilities for writing messages to files
591 and pipes, optionally in <emphasis>batched SMTP</emphasis> format; these facilities can be used
592 to send messages to other transport mechanisms such as UUCP, provided they can
593 handle domain-style addresses. Batched SMTP input is also catered for.
594 </para>
595 </listitem>
596 <listitem>
597 <para>
598 Exim is not designed for storing mail for dial-in hosts. When the volumes of
599 such mail are large, it is better to get the messages <quote>delivered</quote> into files
600 (that is, off Exim&#x2019;s queue) and subsequently passed on to the dial-in hosts by
601 other means.
602 </para>
603 </listitem>
604 <listitem>
605 <para>
606 Although Exim does have basic facilities for scanning incoming messages, these
607 are not comprehensive enough to do full virus or spam scanning. Such operations
608 are best carried out using additional specialized software packages. If you
609 compile Exim with the content-scanning extension, straightforward interfaces to
610 a number of common scanners are provided.
611 </para>
612 </listitem>
613 </itemizedlist>
614 </section>
615 <section id="SECID7">
616 <title>Run time configuration</title>
617 <para>
618 Exim&#x2019;s run time configuration is held in a single text file that is divided
619 into a number of sections. The entries in this file consist of keywords and
620 values, in the style of Smail 3 configuration files. A default configuration
621 file which is suitable for simple online installations is provided in the
622 distribution, and is described in chapter <xref linkend="CHAPdefconfil"/> below.
623 </para>
624 </section>
625 <section id="SECID8">
626 <title>Calling interface</title>
627 <para>
628 <indexterm role="concept">
629 <primary>Sendmail compatibility</primary>
630 <secondary>command line interface</secondary>
631 </indexterm>
632 Like many MTAs, Exim has adopted the Sendmail command line interface so that it
633 can be a straight replacement for <filename>/usr/lib/sendmail</filename> or
634 <filename>/usr/sbin/sendmail</filename> when sending mail, but you do not need to know anything
635 about Sendmail in order to run Exim. For actions other than sending messages,
636 Sendmail-compatible options also exist, but those that produce output (for
637 example, <option>-bp</option>, which lists the messages on the queue) do so in Exim&#x2019;s own
638 format. There are also some additional options that are compatible with Smail
639 3, and some further options that are new to Exim. Chapter <xref linkend="CHAPcommandline"/>
640 documents all Exim&#x2019;s command line options. This information is automatically
641 made into the man page that forms part of the Exim distribution.
642 </para>
643 <para>
644 Control of messages on the queue can be done via certain privileged command
645 line options. There is also an optional monitor program called <emphasis>eximon</emphasis>,
646 which displays current information in an X window, and which contains a menu
647 interface to Exim&#x2019;s command line administration options.
648 </para>
649 </section>
650 <section id="SECID9">
651 <title>Terminology</title>
652 <para>
653 <indexterm role="concept">
654 <primary>terminology definitions</primary>
655 </indexterm>
656 <indexterm role="concept">
657 <primary>body of message</primary>
658 <secondary>definition of</secondary>
659 </indexterm>
660 The <emphasis>body</emphasis> of a message is the actual data that the sender wants to transmit.
661 It is the last part of a message, and is separated from the <emphasis>header</emphasis> (see
662 below) by a blank line.
663 </para>
664 <para>
665 <indexterm role="concept">
666 <primary>bounce message</primary>
667 <secondary>definition of</secondary>
668 </indexterm>
669 When a message cannot be delivered, it is normally returned to the sender in a
670 delivery failure message or a <quote>non-delivery report</quote> (NDR). The term
671 <emphasis>bounce</emphasis> is commonly used for this action, and the error reports are often
672 called <emphasis>bounce messages</emphasis>. This is a convenient shorthand for <quote>delivery
673 failure error report</quote>. Such messages have an empty sender address in the
674 message&#x2019;s <emphasis>envelope</emphasis> (see below) to ensure that they cannot themselves give
675 rise to further bounce messages.
676 </para>
677 <para>
678 The term <emphasis>default</emphasis> appears frequently in this manual. It is used to qualify a
679 value which is used in the absence of any setting in the configuration. It may
680 also qualify an action which is taken unless a configuration setting specifies
681 otherwise.
682 </para>
683 <para>
684 The term <emphasis>defer</emphasis> is used when the delivery of a message to a specific
685 destination cannot immediately take place for some reason (a remote host may be
686 down, or a user&#x2019;s local mailbox may be full). Such deliveries are <emphasis>deferred</emphasis>
687 until a later time.
688 </para>
689 <para>
690 The word <emphasis>domain</emphasis> is sometimes used to mean all but the first component of a
691 host&#x2019;s name. It is <emphasis>not</emphasis> used in that sense here, where it normally refers to
692 the part of an email address following the @ sign.
693 </para>
694 <para>
695 <indexterm role="concept">
696 <primary>envelope, definition of</primary>
697 </indexterm>
698 <indexterm role="concept">
699 <primary>sender</primary>
700 <secondary>definition of</secondary>
701 </indexterm>
702 A message in transit has an associated <emphasis>envelope</emphasis>, as well as a header and a
703 body. The envelope contains a sender address (to which bounce messages should
704 be delivered), and any number of recipient addresses. References to the
705 sender or the recipients of a message usually mean the addresses in the
706 envelope. An MTA uses these addresses for delivery, and for returning bounce
707 messages, not the addresses that appear in the header lines.
708 </para>
709 <para>
710 <indexterm role="concept">
711 <primary>message</primary>
712 <secondary>header, definition of</secondary>
713 </indexterm>
714 <indexterm role="concept">
715 <primary>header section</primary>
716 <secondary>definition of</secondary>
717 </indexterm>
718 The <emphasis>header</emphasis> of a message is the first part of a message&#x2019;s text, consisting
719 of a number of lines, each of which has a name such as <emphasis>From:</emphasis>, <emphasis>To:</emphasis>,
720 <emphasis>Subject:</emphasis>, etc. Long header lines can be split over several text lines by
721 indenting the continuations. The header is separated from the body by a blank
722 line.
723 </para>
724 <para>
725 <indexterm role="concept">
726 <primary>local part</primary>
727 <secondary>definition of</secondary>
728 </indexterm>
729 <indexterm role="concept">
730 <primary>domain</primary>
731 <secondary>definition of</secondary>
732 </indexterm>
733 The term <emphasis>local part</emphasis>, which is taken from RFC 2822, is used to refer to that
734 part of an email address that precedes the @ sign. The part that follows the
735 @ sign is called the <emphasis>domain</emphasis> or <emphasis>mail domain</emphasis>.
736 </para>
737 <para>
738 <indexterm role="concept">
739 <primary>local delivery</primary>
740 <secondary>definition of</secondary>
741 </indexterm>
742 <indexterm role="concept">
743 <primary>remote delivery, definition of</primary>
744 </indexterm>
745 The terms <emphasis>local delivery</emphasis> and <emphasis>remote delivery</emphasis> are used to distinguish
746 delivery to a file or a pipe on the local host from delivery by SMTP over
747 TCP/IP to another host. As far as Exim is concerned, all hosts other than the
748 host it is running on are <emphasis>remote</emphasis>.
749 </para>
750 <para>
751 <indexterm role="concept">
752 <primary>return path</primary>
753 <secondary>definition of</secondary>
754 </indexterm>
755 <emphasis>Return path</emphasis> is another name that is used for the sender address in a
756 message&#x2019;s envelope.
757 </para>
758 <para>
759 <indexterm role="concept">
760 <primary>queue</primary>
761 <secondary>definition of</secondary>
762 </indexterm>
763 The term <emphasis>queue</emphasis> is used to refer to the set of messages awaiting delivery,
764 because this term is in widespread use in the context of MTAs. However, in
765 Exim&#x2019;s case the reality is more like a pool than a queue, because there is
766 normally no ordering of waiting messages.
767 </para>
768 <para>
769 <indexterm role="concept">
770 <primary>queue runner</primary>
771 <secondary>definition of</secondary>
772 </indexterm>
773 The term <emphasis>queue runner</emphasis> is used to describe a process that scans the queue
774 and attempts to deliver those messages whose retry times have come. This term
775 is used by other MTAs, and also relates to the command <option>runq</option>, but in Exim
776 the waiting messages are normally processed in an unpredictable order.
777 </para>
778 <para>
779 <indexterm role="concept">
780 <primary>spool directory</primary>
781 <secondary>definition of</secondary>
782 </indexterm>
783 The term <emphasis>spool directory</emphasis> is used for a directory in which Exim keeps the
784 messages on its queue &ndash; that is, those that it is in the process of
785 delivering. This should not be confused with the directory in which local
786 mailboxes are stored, which is called a <quote>spool directory</quote> by some people. In
787 the Exim documentation, <quote>spool</quote> is always used in the first sense.
788 </para>
789 </section>
790 </chapter>
791
792 <chapter id="CHID2">
793 <title>Incorporated code</title>
794 <para>
795 <indexterm role="concept">
796 <primary>incorporated code</primary>
797 </indexterm>
798 <indexterm role="concept">
799 <primary>regular expressions</primary>
800 <secondary>library</secondary>
801 </indexterm>
802 <indexterm role="concept">
803 <primary>PCRE</primary>
804 </indexterm>
805 <indexterm role="concept">
806 <primary>OpenDMARC</primary>
807 </indexterm>
808 A number of pieces of external code are included in the Exim distribution.
809 </para>
810 <itemizedlist>
811 <listitem>
812 <para>
813 Regular expressions are supported in the main Exim program and in the
814 Exim monitor using the freely-distributable PCRE library, copyright
815 &copy; University of Cambridge. The source to PCRE is no longer shipped with
816 Exim, so you will need to use the version of PCRE shipped with your system,
817 or obtain and install the full version of the library from
818 <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>.
819 </para>
820 </listitem>
821 <listitem>
822 <para>
823 <indexterm role="concept">
824 <primary>cdb</primary>
825 <secondary>acknowledgment</secondary>
826 </indexterm>
827 Support for the cdb (Constant DataBase) lookup method is provided by code
828 contributed by Nigel Metheringham of (at the time he contributed it) Planet
829 Online Ltd. The implementation is completely contained within the code of Exim.
830 It does not link against an external cdb library. The code contains the
831 following statements:
832 </para>
833 <blockquote>
834 <para>
835 Copyright &copy; 1998 Nigel Metheringham, Planet Online Ltd
836 </para>
837 <para>
838 This program is free software; you can redistribute it and/or modify it under
839 the terms of the GNU General Public License as published by the Free Software
840 Foundation; either version 2 of the License, or (at your option) any later
841 version.
842 This code implements Dan Bernstein&#x2019;s Constant DataBase (cdb) spec. Information,
843 the spec and sample code for cdb can be obtained from
844 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>. This implementation borrows
845 some code from Dan Bernstein&#x2019;s implementation (which has no license
846 restrictions applied to it).
847 </para>
848 </blockquote>
849 </listitem>
850 <listitem>
851 <para>
852 <indexterm role="concept">
853 <primary>SPA authentication</primary>
854 </indexterm>
855 <indexterm role="concept">
856 <primary>Samba project</primary>
857 </indexterm>
858 <indexterm role="concept">
859 <primary>Microsoft Secure Password Authentication</primary>
860 </indexterm>
861 Client support for Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> is provided
862 by code contributed by Marc Prud&#x2019;hommeaux. Server support was contributed by
863 Tom Kistner. This includes code taken from the Samba project, which is released
864 under the Gnu GPL.
865 </para>
866 </listitem>
867 <listitem>
868 <para>
869 <indexterm role="concept">
870 <primary>Cyrus</primary>
871 </indexterm>
872 <indexterm role="concept">
873 <primary><emphasis>pwcheck</emphasis> daemon</primary>
874 </indexterm>
875 <indexterm role="concept">
876 <primary><emphasis>pwauthd</emphasis> daemon</primary>
877 </indexterm>
878 Support for calling the Cyrus <emphasis>pwcheck</emphasis> and <emphasis>saslauthd</emphasis> daemons is provided
879 by code taken from the Cyrus-SASL library and adapted by Alexander S.
880 Sabourenkov. The permission notice appears below, in accordance with the
881 conditions expressed therein.
882 </para>
883 <blockquote>
884 <para>
885 Copyright &copy; 2001 Carnegie Mellon University.  All rights reserved.
886 </para>
887 <para>
888 Redistribution and use in source and binary forms, with or without
889 modification, are permitted provided that the following conditions
890 are met:
891 </para>
892 <orderedlist numeration="arabic">
893 <listitem>
894 <para>
895 Redistributions of source code must retain the above copyright
896 notice, this list of conditions and the following disclaimer.
897 </para>
898 </listitem>
899 <listitem>
900 <para>
901 Redistributions in binary form must reproduce the above copyright
902 notice, this list of conditions and the following disclaimer in
903 the documentation and/or other materials provided with the
904 distribution.
905 </para>
906 </listitem>
907 <listitem>
908 <para>
909 The name <quote>Carnegie Mellon University</quote> must not be used to
910 endorse or promote products derived from this software without
911 prior written permission. For permission or any other legal
912 details, please contact
913 </para>
914 <literallayout>
915               Office of Technology Transfer
916               Carnegie Mellon University
917               5000 Forbes Avenue
918               Pittsburgh, PA  15213-3890
919               (412) 268-4387, fax: (412) 268-7395
920               tech-transfer@andrew.cmu.edu
921 </literallayout>
922 </listitem>
923 <listitem>
924 <para>
925 Redistributions of any form whatsoever must retain the following
926 acknowledgment:
927 </para>
928 <para>
929 <quote>This product includes software developed by Computing Services
930 at Carnegie Mellon University (<emphasis role="bold"><ulink url="http://www.cmu.edu/computing/">http://www.cmu.edu/computing/</ulink></emphasis>.</quote>
931 </para>
932 <para>
933 CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
934 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
935 AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
936 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
937 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
938 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
939 OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
940 </para>
941 </listitem>
942 </orderedlist>
943 </blockquote>
944 </listitem>
945 <listitem>
946 <para>
947 <indexterm role="concept">
948 <primary>Exim monitor</primary>
949 <secondary>acknowledgment</secondary>
950 </indexterm>
951 <indexterm role="concept">
952 <primary>X-windows</primary>
953 </indexterm>
954 <indexterm role="concept">
955 <primary>Athena</primary>
956 </indexterm>
957 The Exim Monitor program, which is an X-Window application, includes
958 modified versions of the Athena StripChart and TextPop widgets.
959 This code is copyright by DEC and MIT, and their permission notice appears
960 below, in accordance with the conditions expressed therein.
961 </para>
962 <blockquote>
963 <para>
964 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
965 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
966 </para>
967 <para>
968 All Rights Reserved
969 </para>
970 <para>
971 Permission to use, copy, modify, and distribute this software and its
972 documentation for any purpose and without fee is hereby granted,
973 provided that the above copyright notice appear in all copies and that
974 both that copyright notice and this permission notice appear in
975 supporting documentation, and that the names of Digital or MIT not be
976 used in advertising or publicity pertaining to distribution of the
977 software without specific, written prior permission.
978 </para>
979 <para>
980 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
981 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
982 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
983 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
984 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
985 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
986 SOFTWARE.
987 </para>
988 </blockquote>
989 </listitem>
990 <listitem>
991 <para>
992 <indexterm role="concept">
993 <primary>opendmarc</primary>
994 <secondary>acknowledgment</secondary>
995 </indexterm>
996 The DMARC implementation uses the OpenDMARC library which is Copyrighted by
997 The Trusted Domain Project. Portions of Exim source which use OpenDMARC
998 derived code are indicated in the respective source files. The full OpenDMARC
999 license is provided in the LICENSE.opendmarc file contained in the distributed
1000 source code.
1001 </para>
1002 </listitem>
1003 <listitem>
1004 <para>
1005 Many people have contributed code fragments, some large, some small, that were
1006 not covered by any specific licence requirements. It is assumed that the
1007 contributors are happy to see their code incorporated into Exim under the GPL.
1008 </para>
1009 </listitem>
1010 </itemizedlist>
1011 </chapter>
1012
1013 <chapter id="CHID11">
1014 <title>How Exim receives and delivers mail</title>
1015 <titleabbrev>Receiving and delivering mail</titleabbrev>
1016 <section id="SECID10">
1017 <title>Overall philosophy</title>
1018 <para>
1019 <indexterm role="concept">
1020 <primary>design philosophy</primary>
1021 </indexterm>
1022 Exim is designed to work efficiently on systems that are permanently connected
1023 to the Internet and are handling a general mix of mail. In such circumstances,
1024 most messages can be delivered immediately. Consequently, Exim does not
1025 maintain independent queues of messages for specific domains or hosts, though
1026 it does try to send several messages in a single SMTP connection after a host
1027 has been down, and it also maintains per-host retry information.
1028 </para>
1029 </section>
1030 <section id="SECID11">
1031 <title>Policy control</title>
1032 <para>
1033 <indexterm role="concept">
1034 <primary>policy control</primary>
1035 <secondary>overview</secondary>
1036 </indexterm>
1037 Policy controls are now an important feature of MTAs that are connected to the
1038 Internet. Perhaps their most important job is to stop MTAs being abused as
1039 <quote>open relays</quote> by misguided individuals who send out vast amounts of
1040 unsolicited junk, and want to disguise its source. Exim provides flexible
1041 facilities for specifying policy controls on incoming mail:
1042 </para>
1043 <itemizedlist>
1044 <listitem>
1045 <para>
1046 <indexterm role="concept">
1047 <primary>access control lists (ACLs)</primary>
1048 <secondary>introduction</secondary>
1049 </indexterm>
1050 Exim 4 (unlike previous versions of Exim) implements policy controls on
1051 incoming mail by means of <emphasis>Access Control Lists</emphasis> (ACLs). Each list is a
1052 series of statements that may either grant or deny access. ACLs can be used at
1053 several places in the SMTP dialogue while receiving a message from a remote
1054 host. However, the most common places are after each RCPT command, and at the
1055 very end of the message. The sysadmin can specify conditions for accepting or
1056 rejecting individual recipients or the entire message, respectively, at these
1057 two points (see chapter <xref linkend="CHAPACL"/>). Denial of access results in an SMTP
1058 error code.
1059 </para>
1060 </listitem>
1061 <listitem>
1062 <para>
1063 An ACL is also available for locally generated, non-SMTP messages. In this
1064 case, the only available actions are to accept or deny the entire message.
1065 </para>
1066 </listitem>
1067 <listitem>
1068 <para>
1069 When Exim is compiled with the content-scanning extension, facilities are
1070 provided in the ACL mechanism for passing the message to external virus and/or
1071 spam scanning software. The result of such a scan is passed back to the ACL,
1072 which can then use it to decide what to do with the message.
1073 </para>
1074 </listitem>
1075 <listitem>
1076 <para>
1077 When a message has been received, either from a remote host or from the local
1078 host, but before the final acknowledgment has been sent, a locally supplied C
1079 function called <function>local_scan()</function> can be run to inspect the message and decide
1080 whether to accept it or not (see chapter <xref linkend="CHAPlocalscan"/>). If the message
1081 is accepted, the list of recipients can be modified by the function.
1082 </para>
1083 </listitem>
1084 <listitem>
1085 <para>
1086 Using the <function>local_scan()</function> mechanism is another way of calling external scanner
1087 software. The <option>SA-Exim</option> add-on package works this way. It does not require
1088 Exim to be compiled with the content-scanning extension.
1089 </para>
1090 </listitem>
1091 <listitem>
1092 <para>
1093 After a message has been accepted, a further checking mechanism is available in
1094 the form of the <emphasis>system filter</emphasis> (see chapter <xref linkend="CHAPsystemfilter"/>). This
1095 runs at the start of every delivery process.
1096 </para>
1097 </listitem>
1098 </itemizedlist>
1099 </section>
1100 <section id="SECID12">
1101 <title>User filters</title>
1102 <para>
1103 <indexterm role="concept">
1104 <primary>filter</primary>
1105 <secondary>introduction</secondary>
1106 </indexterm>
1107 <indexterm role="concept">
1108 <primary>Sieve filter</primary>
1109 </indexterm>
1110 In a conventional Exim configuration, users are able to run private filters by
1111 setting up appropriate <filename>.forward</filename> files in their home directories. See
1112 chapter <xref linkend="CHAPredirect"/> (about the <command>redirect</command> router) for the
1113 configuration needed to support this, and the separate document entitled
1114 <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis> for user details. Two different kinds
1115 of filtering are available:
1116 </para>
1117 <itemizedlist>
1118 <listitem>
1119 <para>
1120 Sieve filters are written in the standard filtering language that is defined
1121 by RFC 3028.
1122 </para>
1123 </listitem>
1124 <listitem>
1125 <para>
1126 Exim filters are written in a syntax that is unique to Exim, but which is more
1127 powerful than Sieve, which it pre-dates.
1128 </para>
1129 </listitem>
1130 </itemizedlist>
1131 <para>
1132 User filters are run as part of the routing process, described below.
1133 </para>
1134 </section>
1135 <section id="SECTmessiden">
1136 <title>Message identification</title>
1137 <para>
1138 <indexterm role="concept">
1139 <primary>message ids</primary>
1140 <secondary>details of format</secondary>
1141 </indexterm>
1142 <indexterm role="concept">
1143 <primary>format</primary>
1144 <secondary>of message id</secondary>
1145 </indexterm>
1146 <indexterm role="concept">
1147 <primary>id of message</primary>
1148 </indexterm>
1149 <indexterm role="concept">
1150 <primary>base62</primary>
1151 </indexterm>
1152 <indexterm role="concept">
1153 <primary>base36</primary>
1154 </indexterm>
1155 <indexterm role="concept">
1156 <primary>Darwin</primary>
1157 </indexterm>
1158 <indexterm role="concept">
1159 <primary>Cygwin</primary>
1160 </indexterm>
1161 Every message handled by Exim is given a <emphasis>message id</emphasis> which is sixteen
1162 characters long. It is divided into three parts, separated by hyphens, for
1163 example <literal>16VDhn-0001bo-D3</literal>. Each part is a sequence of letters and digits,
1164 normally encoding numbers in base 62. However, in the Darwin operating
1165 system (Mac OS X) and when Exim is compiled to run under Cygwin, base 36
1166 (avoiding the use of lower case letters) is used instead, because the message
1167 id is used to construct file names, and the names of files in those systems are
1168 not always case-sensitive.
1169 </para>
1170 <para>
1171 <indexterm role="concept">
1172 <primary>pid (process id)</primary>
1173 <secondary>re-use of</secondary>
1174 </indexterm>
1175 The detail of the contents of the message id have changed as Exim has evolved.
1176 Earlier versions relied on the operating system not re-using a process id (pid)
1177 within one second. On modern operating systems, this assumption can no longer
1178 be made, so the algorithm had to be changed. To retain backward compatibility,
1179 the format of the message id was retained, which is why the following rules are
1180 somewhat eccentric:
1181 </para>
1182 <itemizedlist>
1183 <listitem>
1184 <para>
1185 The first six characters of the message id are the time at which the message
1186 started to be received, to a granularity of one second. That is, this field
1187 contains the number of seconds since the start of the epoch (the normal Unix
1188 way of representing the date and time of day).
1189 </para>
1190 </listitem>
1191 <listitem>
1192 <para>
1193 After the first hyphen, the next six characters are the id of the process that
1194 received the message.
1195 </para>
1196 </listitem>
1197 <listitem>
1198 <para>
1199 There are two different possibilities for the final two characters:
1200 </para>
1201 <orderedlist numeration="arabic">
1202 <listitem>
1203 <para>
1204 <indexterm role="option">
1205 <primary><option>localhost_number</option></primary>
1206 </indexterm>
1207 If <option>localhost_number</option> is not set, this value is the fractional part of the
1208 time of reception, normally in units of 1/2000 of a second, but for systems
1209 that must use base 36 instead of base 62 (because of case-insensitive file
1210 systems), the units are 1/1000 of a second.
1211 </para>
1212 </listitem>
1213 <listitem>
1214 <para>
1215 If <option>localhost_number</option> is set, it is multiplied by 200 (100) and added to
1216 the fractional part of the time, which in this case is in units of 1/200
1217 (1/100) of a second.
1218 </para>
1219 </listitem>
1220 </orderedlist>
1221 </listitem>
1222 </itemizedlist>
1223 <para>
1224 After a message has been received, Exim waits for the clock to tick at the
1225 appropriate resolution before proceeding, so that if another message is
1226 received by the same process, or by another process with the same (re-used)
1227 pid, it is guaranteed that the time will be different. In most cases, the clock
1228 will already have ticked while the message was being received.
1229 </para>
1230 </section>
1231 <section id="SECID13">
1232 <title>Receiving mail</title>
1233 <para>
1234 <indexterm role="concept">
1235 <primary>receiving mail</primary>
1236 </indexterm>
1237 <indexterm role="concept">
1238 <primary>message</primary>
1239 <secondary>reception</secondary>
1240 </indexterm>
1241 The only way Exim can receive mail from another host is using SMTP over
1242 TCP/IP, in which case the sender and recipient addresses are transferred using
1243 SMTP commands. However, from a locally running process (such as a user&#x2019;s MUA),
1244 there are several possibilities:
1245 </para>
1246 <itemizedlist>
1247 <listitem>
1248 <para>
1249 If the process runs Exim with the <option>-bm</option> option, the message is read
1250 non-interactively (usually via a pipe), with the recipients taken from the
1251 command line, or from the body of the message if <option>-t</option> is also used.
1252 </para>
1253 </listitem>
1254 <listitem>
1255 <para>
1256 If the process runs Exim with the <option>-bS</option> option, the message is also read
1257 non-interactively, but in this case the recipients are listed at the start of
1258 the message in a series of SMTP RCPT commands, terminated by a DATA
1259 command. This is so-called <quote>batch SMTP</quote> format,
1260 but it isn&#x2019;t really SMTP. The SMTP commands are just another way of passing
1261 envelope addresses in a non-interactive submission.
1262 </para>
1263 </listitem>
1264 <listitem>
1265 <para>
1266 If the process runs Exim with the <option>-bs</option> option, the message is read
1267 interactively, using the SMTP protocol. A two-way pipe is normally used for
1268 passing data between the local process and the Exim process.
1269 This is <quote>real</quote> SMTP and is handled in the same way as SMTP over TCP/IP. For
1270 example, the ACLs for SMTP commands are used for this form of submission.
1271 </para>
1272 </listitem>
1273 <listitem>
1274 <para>
1275 A local process may also make a TCP/IP call to the host&#x2019;s loopback address
1276 (127.0.0.1) or any other of its IP addresses. When receiving messages, Exim
1277 does not treat the loopback address specially. It treats all such connections
1278 in the same way as connections from other hosts.
1279 </para>
1280 </listitem>
1281 </itemizedlist>
1282 <para>
1283 <indexterm role="concept">
1284 <primary>message sender, constructed by Exim</primary>
1285 </indexterm>
1286 <indexterm role="concept">
1287 <primary>sender</primary>
1288 <secondary>constructed by Exim</secondary>
1289 </indexterm>
1290 In the three cases that do not involve TCP/IP, the sender address is
1291 constructed from the login name of the user that called Exim and a default
1292 qualification domain (which can be set by the <option>qualify_domain</option> configuration
1293 option). For local or batch SMTP, a sender address that is passed using the
1294 SMTP MAIL command is ignored. However, the system administrator may allow
1295 certain users (<quote>trusted users</quote>) to specify a different sender address
1296 unconditionally, or all users to specify certain forms of different sender
1297 address. The <option>-f</option> option or the SMTP MAIL command is used to specify these
1298 different addresses. See section <xref linkend="SECTtrustedadmin"/> for details of trusted
1299 users, and the <option>untrusted_set_sender</option> option for a way of allowing untrusted
1300 users to change sender addresses.
1301 </para>
1302 <para>
1303 Messages received by either of the non-interactive mechanisms are subject to
1304 checking by the non-SMTP ACL, if one is defined. Messages received using SMTP
1305 (either over TCP/IP, or interacting with a local process) can be checked by a
1306 number of ACLs that operate at different times during the SMTP session. Either
1307 individual recipients, or the entire message, can be rejected if local policy
1308 requirements are not met. The <function>local_scan()</function> function (see chapter
1309 <xref linkend="CHAPlocalscan"/>) is run for all incoming messages.
1310 </para>
1311 <para>
1312 Exim can be configured not to start a delivery process when a message is
1313 received; this can be unconditional, or depend on the number of incoming SMTP
1314 connections or the system load. In these situations, new messages wait on the
1315 queue until a queue runner process picks them up. However, in standard
1316 configurations under normal conditions, delivery is started as soon as a
1317 message is received.
1318 </para>
1319 </section>
1320 <section id="SECID14">
1321 <title>Handling an incoming message</title>
1322 <para>
1323 <indexterm role="concept">
1324 <primary>spool directory</primary>
1325 <secondary>files that hold a message</secondary>
1326 </indexterm>
1327 <indexterm role="concept">
1328 <primary>file</primary>
1329 <secondary>how a message is held</secondary>
1330 </indexterm>
1331 When Exim accepts a message, it writes two files in its spool directory. The
1332 first contains the envelope information, the current status of the message, and
1333 the header lines, and the second contains the body of the message. The names of
1334 the two spool files consist of the message id, followed by <literal>-H</literal> for the
1335 file containing the envelope and header, and <literal>-D</literal> for the data file.
1336 </para>
1337 <para>
1338 <indexterm role="concept">
1339 <primary>spool directory</primary>
1340 <secondary><filename>input</filename> sub-directory</secondary>
1341 </indexterm>
1342 By default all these message files are held in a single directory called
1343 <filename>input</filename> inside the general Exim spool directory. Some operating systems do
1344 not perform very well if the number of files in a directory gets large; to
1345 improve performance in such cases, the <option>split_spool_directory</option> option can be
1346 used. This causes Exim to split up the input files into 62 sub-directories
1347 whose names are single letters or digits. When this is done, the queue is
1348 processed one sub-directory at a time instead of all at once, which can improve
1349 overall performance even when there are not enough files in each directory to
1350 affect file system performance.
1351 </para>
1352 <para>
1353 The envelope information consists of the address of the message&#x2019;s sender and
1354 the addresses of the recipients. This information is entirely separate from
1355 any addresses contained in the header lines. The status of the message includes
1356 a list of recipients who have already received the message. The format of the
1357 first spool file is described in chapter <xref linkend="CHAPspool"/>.
1358 </para>
1359 <para>
1360 <indexterm role="concept">
1361 <primary>rewriting</primary>
1362 <secondary>addresses</secondary>
1363 </indexterm>
1364 Address rewriting that is specified in the rewrite section of the configuration
1365 (see chapter <xref linkend="CHAPrewrite"/>) is done once and for all on incoming addresses,
1366 both in the header lines and the envelope, at the time the message is accepted.
1367 If during the course of delivery additional addresses are generated (for
1368 example, via aliasing), these new addresses are rewritten as soon as they are
1369 generated. At the time a message is actually delivered (transported) further
1370 rewriting can take place; because this is a transport option, it can be
1371 different for different forms of delivery. It is also possible to specify the
1372 addition or removal of certain header lines at the time the message is
1373 delivered (see chapters <xref linkend="CHAProutergeneric"/> and
1374 <xref linkend="CHAPtransportgeneric"/>).
1375 </para>
1376 </section>
1377 <section id="SECID15">
1378 <title>Life of a message</title>
1379 <para>
1380 <indexterm role="concept">
1381 <primary>message</primary>
1382 <secondary>life of</secondary>
1383 </indexterm>
1384 <indexterm role="concept">
1385 <primary>message</primary>
1386 <secondary>frozen</secondary>
1387 </indexterm>
1388 A message remains in the spool directory until it is completely delivered to
1389 its recipients or to an error address, or until it is deleted by an
1390 administrator or by the user who originally created it. In cases when delivery
1391 cannot proceed &ndash; for example, when a message can neither be delivered to its
1392 recipients nor returned to its sender, the message is marked <quote>frozen</quote> on the
1393 spool, and no more deliveries are attempted.
1394 </para>
1395 <para>
1396 <indexterm role="concept">
1397 <primary>frozen messages</primary>
1398 <secondary>thawing</secondary>
1399 </indexterm>
1400 <indexterm role="concept">
1401 <primary>message</primary>
1402 <secondary>thawing frozen</secondary>
1403 </indexterm>
1404 An administrator can <quote>thaw</quote> such messages when the problem has been
1405 corrected, and can also freeze individual messages by hand if necessary. In
1406 addition, an administrator can force a delivery error, causing a bounce message
1407 to be sent.
1408 </para>
1409 <para>
1410 <indexterm role="option">
1411 <primary><option>timeout_frozen_after</option></primary>
1412 </indexterm>
1413 <indexterm role="option">
1414 <primary><option>ignore_bounce_errors_after</option></primary>
1415 </indexterm>
1416 There are options called <option>ignore_bounce_errors_after</option> and
1417 <option>timeout_frozen_after</option>, which discard frozen messages after a certain time.
1418 The first applies only to frozen bounces, the second to any frozen messages.
1419 </para>
1420 <para>
1421 <indexterm role="concept">
1422 <primary>message</primary>
1423 <secondary>log file for</secondary>
1424 </indexterm>
1425 <indexterm role="concept">
1426 <primary>log</primary>
1427 <secondary>file for each message</secondary>
1428 </indexterm>
1429 While Exim is working on a message, it writes information about each delivery
1430 attempt to its main log file. This includes successful, unsuccessful, and
1431 delayed deliveries for each recipient (see chapter <xref linkend="CHAPlog"/>). The log
1432 lines are also written to a separate <emphasis>message log</emphasis> file for each message.
1433 These logs are solely for the benefit of the administrator, and are normally
1434 deleted along with the spool files when processing of a message is complete.
1435 The use of individual message logs can be disabled by setting
1436 <option>no_message_logs</option>; this might give an improvement in performance on very busy
1437 systems.
1438 </para>
1439 <para>
1440 <indexterm role="concept">
1441 <primary>journal file</primary>
1442 </indexterm>
1443 <indexterm role="concept">
1444 <primary>file</primary>
1445 <secondary>journal</secondary>
1446 </indexterm>
1447 All the information Exim itself needs to set up a delivery is kept in the first
1448 spool file, along with the header lines. When a successful delivery occurs, the
1449 address is immediately written at the end of a journal file, whose name is the
1450 message id followed by <literal>-J</literal>. At the end of a delivery run, if there are some
1451 addresses left to be tried again later, the first spool file (the <literal>-H</literal> file)
1452 is updated to indicate which these are, and the journal file is then deleted.
1453 Updating the spool file is done by writing a new file and renaming it, to
1454 minimize the possibility of data loss.
1455 </para>
1456 <para>
1457 Should the system or the program crash after a successful delivery but before
1458 the spool file has been updated, the journal is left lying around. The next
1459 time Exim attempts to deliver the message, it reads the journal file and
1460 updates the spool file before proceeding. This minimizes the chances of double
1461 deliveries caused by crashes.
1462 </para>
1463 </section>
1464 <section id="SECTprocaddress">
1465 <title>Processing an address for delivery</title>
1466 <para>
1467 <indexterm role="concept">
1468 <primary>drivers</primary>
1469 <secondary>definition of</secondary>
1470 </indexterm>
1471 <indexterm role="concept">
1472 <primary>router</primary>
1473 <secondary>definition of</secondary>
1474 </indexterm>
1475 <indexterm role="concept">
1476 <primary>transport</primary>
1477 <secondary>definition of</secondary>
1478 </indexterm>
1479 The main delivery processing elements of Exim are called <emphasis>routers</emphasis> and
1480 <emphasis>transports</emphasis>, and collectively these are known as <emphasis>drivers</emphasis>. Code for a
1481 number of them is provided in the source distribution, and compile-time options
1482 specify which ones are included in the binary. Run time options specify which
1483 ones are actually used for delivering messages.
1484 </para>
1485 <para>
1486 <indexterm role="concept">
1487 <primary>drivers</primary>
1488 <secondary>instance definition</secondary>
1489 </indexterm>
1490 Each driver that is specified in the run time configuration is an <emphasis>instance</emphasis>
1491 of that particular driver type. Multiple instances are allowed; for example,
1492 you can set up several different <command>smtp</command> transports, each with different
1493 option values that might specify different ports or different timeouts. Each
1494 instance has its own identifying name. In what follows we will normally use the
1495 instance name when discussing one particular instance (that is, one specific
1496 configuration of the driver), and the generic driver name when discussing
1497 the driver&#x2019;s features in general.
1498 </para>
1499 <para>
1500 A <emphasis>router</emphasis> is a driver that operates on an address, either determining how
1501 its delivery should happen, by assigning it to a specific transport, or
1502 converting the address into one or more new addresses (for example, via an
1503 alias file). A router may also explicitly choose to fail an address, causing it
1504 to be bounced.
1505 </para>
1506 <para>
1507 A <emphasis>transport</emphasis> is a driver that transmits a copy of the message from Exim&#x2019;s
1508 spool to some destination. There are two kinds of transport: for a <emphasis>local</emphasis>
1509 transport, the destination is a file or a pipe on the local host, whereas for a
1510 <emphasis>remote</emphasis> transport the destination is some other host. A message is passed
1511 to a specific transport as a result of successful routing. If a message has
1512 several recipients, it may be passed to a number of different transports.
1513 </para>
1514 <para>
1515 <indexterm role="concept">
1516 <primary>preconditions</primary>
1517 <secondary>definition of</secondary>
1518 </indexterm>
1519 An address is processed by passing it to each configured router instance in
1520 turn, subject to certain preconditions, until a router accepts the address or
1521 specifies that it should be bounced. We will describe this process in more
1522 detail shortly. First, as a simple example, we consider how each recipient
1523 address in a message is processed in a small configuration of three routers.
1524 </para>
1525 <para>
1526 To make this a more concrete example, it is described in terms of some actual
1527 routers, but remember, this is only an example. You can configure Exim&#x2019;s
1528 routers in many different ways, and there may be any number of routers in a
1529 configuration.
1530 </para>
1531 <para>
1532 The first router that is specified in a configuration is often one that handles
1533 addresses in domains that are not recognized specially by the local host. These
1534 are typically addresses for arbitrary domains on the Internet. A precondition
1535 is set up which looks for the special domains known to the host (for example,
1536 its own domain name), and the router is run for addresses that do <emphasis>not</emphasis>
1537 match. Typically, this is a router that looks up domains in the DNS in order to
1538 find the hosts to which this address routes. If it succeeds, the address is
1539 assigned to a suitable SMTP transport; if it does not succeed, the router is
1540 configured to fail the address.
1541 </para>
1542 <para>
1543 The second router is reached only when the domain is recognized as one that
1544 <quote>belongs</quote> to the local host. This router does redirection &ndash; also known as
1545 aliasing and forwarding. When it generates one or more new addresses from the
1546 original, each of them is routed independently from the start. Otherwise, the
1547 router may cause an address to fail, or it may simply decline to handle the
1548 address, in which case the address is passed to the next router.
1549 </para>
1550 <para>
1551 The final router in many configurations is one that checks to see if the
1552 address belongs to a local mailbox. The precondition may involve a check to
1553 see if the local part is the name of a login account, or it may look up the
1554 local part in a file or a database. If its preconditions are not met, or if
1555 the router declines, we have reached the end of the routers. When this happens,
1556 the address is bounced.
1557 </para>
1558 </section>
1559 <section id="SECID16">
1560 <title>Processing an address for verification</title>
1561 <para>
1562 <indexterm role="concept">
1563 <primary>router</primary>
1564 <secondary>for verification</secondary>
1565 </indexterm>
1566 <indexterm role="concept">
1567 <primary>verifying address</primary>
1568 <secondary>overview</secondary>
1569 </indexterm>
1570 As well as being used to decide how to deliver to an address, Exim&#x2019;s routers
1571 are also used for <emphasis>address verification</emphasis>. Verification can be requested as
1572 one of the checks to be performed in an ACL for incoming messages, on both
1573 sender and recipient addresses, and it can be tested using the <option>-bv</option> and
1574 <option>-bvs</option> command line options.
1575 </para>
1576 <para>
1577 When an address is being verified, the routers are run in <quote>verify mode</quote>. This
1578 does not affect the way the routers work, but it is a state that can be
1579 detected. By this means, a router can be skipped or made to behave differently
1580 when verifying. A common example is a configuration in which the first router
1581 sends all messages to a message-scanning program, unless they have been
1582 previously scanned. Thus, the first router accepts all addresses without any
1583 checking, making it useless for verifying. Normally, the <option>no_verify</option> option
1584 would be set for such a router, causing it to be skipped in verify mode.
1585 </para>
1586 </section>
1587 <section id="SECTrunindrou">
1588 <title>Running an individual router</title>
1589 <para>
1590 <indexterm role="concept">
1591 <primary>router</primary>
1592 <secondary>running details</secondary>
1593 </indexterm>
1594 <indexterm role="concept">
1595 <primary>preconditions</primary>
1596 <secondary>checking</secondary>
1597 </indexterm>
1598 <indexterm role="concept">
1599 <primary>router</primary>
1600 <secondary>result of running</secondary>
1601 </indexterm>
1602 As explained in the example above, a number of preconditions are checked before
1603 running a router. If any are not met, the router is skipped, and the address is
1604 passed to the next router. When all the preconditions on a router <emphasis>are</emphasis> met,
1605 the router is run. What happens next depends on the outcome, which is one of
1606 the following:
1607 </para>
1608 <itemizedlist>
1609 <listitem>
1610 <para>
1611 <emphasis>accept</emphasis>: The router accepts the address, and either assigns it to a
1612 transport, or generates one or more <quote>child</quote> addresses. Processing the
1613 original address ceases,
1614 <indexterm role="option">
1615 <primary><option>unseen</option></primary>
1616 </indexterm>
1617 unless the <option>unseen</option> option is set on the router. This option
1618 can be used to set up multiple deliveries with different routing (for example,
1619 for keeping archive copies of messages). When <option>unseen</option> is set, the address is
1620 passed to the next router. Normally, however, an <emphasis>accept</emphasis> return marks the
1621 end of routing.
1622 </para>
1623 <para>
1624 Any child addresses generated by the router are processed independently,
1625 starting with the first router by default. It is possible to change this by
1626 setting the <option>redirect_router</option> option to specify which router to start at for
1627 child addresses. Unlike <option>pass_router</option> (see below) the router specified by
1628 <option>redirect_router</option> may be anywhere in the router configuration.
1629 </para>
1630 </listitem>
1631 <listitem>
1632 <para>
1633 <emphasis>pass</emphasis>: The router recognizes the address, but cannot handle it itself. It
1634 requests that the address be passed to another router. By default the address
1635 is passed to the next router, but this can be changed by setting the
1636 <option>pass_router</option> option. However, (unlike <option>redirect_router</option>) the named router
1637 must be below the current router (to avoid loops).
1638 </para>
1639 </listitem>
1640 <listitem>
1641 <para>
1642 <emphasis>decline</emphasis>: The router declines to accept the address because it does not
1643 recognize it at all. By default, the address is passed to the next router, but
1644 this can be prevented by setting the <option>no_more</option> option. When <option>no_more</option> is
1645 set, all the remaining routers are skipped. In effect, <option>no_more</option> converts
1646 <emphasis>decline</emphasis> into <emphasis>fail</emphasis>.
1647 </para>
1648 </listitem>
1649 <listitem>
1650 <para>
1651 <emphasis>fail</emphasis>: The router determines that the address should fail, and queues it for
1652 the generation of a bounce message. There is no further processing of the
1653 original address unless <option>unseen</option> is set on the router.
1654 </para>
1655 </listitem>
1656 <listitem>
1657 <para>
1658 <emphasis>defer</emphasis>: The router cannot handle the address at the present time. (A
1659 database may be offline, or a DNS lookup may have timed out.) No further
1660 processing of the address happens in this delivery attempt. It is tried again
1661 next time the message is considered for delivery.
1662 </para>
1663 </listitem>
1664 <listitem>
1665 <para>
1666 <emphasis>error</emphasis>: There is some error in the router (for example, a syntax error in
1667 its configuration). The action is as for defer.
1668 </para>
1669 </listitem>
1670 </itemizedlist>
1671 <para>
1672 If an address reaches the end of the routers without having been accepted by
1673 any of them, it is bounced as unrouteable. The default error message in this
1674 situation is <quote>unrouteable address</quote>, but you can set your own message by
1675 making use of the <option>cannot_route_message</option> option. This can be set for any
1676 router; the value from the last router that <quote>saw</quote> the address is used.
1677 </para>
1678 <para>
1679 Sometimes while routing you want to fail a delivery when some conditions are
1680 met but others are not, instead of passing the address on for further routing.
1681 You can do this by having a second router that explicitly fails the delivery
1682 when the relevant conditions are met. The <command>redirect</command> router has a <quote>fail</quote>
1683 facility for this purpose.
1684 </para>
1685 </section>
1686 <section id="SECID17">
1687 <title>Duplicate addresses</title>
1688 <para>
1689 <indexterm role="concept">
1690 <primary>case of local parts</primary>
1691 </indexterm>
1692 <indexterm role="concept">
1693 <primary>address duplicate, discarding</primary>
1694 </indexterm>
1695 <indexterm role="concept">
1696 <primary>duplicate addresses</primary>
1697 </indexterm>
1698 Once routing is complete, Exim scans the addresses that are assigned to local
1699 and remote transports, and discards any duplicates that it finds. During this
1700 check, local parts are treated as case-sensitive. This happens only when
1701 actually delivering a message; when testing routers with <option>-bt</option>, all the
1702 routed addresses are shown.
1703 </para>
1704 </section>
1705 <section id="SECTrouprecon">
1706 <title>Router preconditions</title>
1707 <para>
1708 <indexterm role="concept">
1709 <primary>router</primary>
1710 <secondary>preconditions, order of processing</secondary>
1711 </indexterm>
1712 <indexterm role="concept">
1713 <primary>preconditions</primary>
1714 <secondary>order of processing</secondary>
1715 </indexterm>
1716 The preconditions that are tested for each router are listed below, in the
1717 order in which they are tested. The individual configuration options are
1718 described in more detail in chapter <xref linkend="CHAProutergeneric"/>.
1719 </para>
1720 <itemizedlist>
1721 <listitem>
1722 <para>
1723 The <option>local_part_prefix</option> and <option>local_part_suffix</option> options can specify that
1724 the local parts handled by the router may or must have certain prefixes and/or
1725 suffixes. If a mandatory affix (prefix or suffix) is not present, the router is
1726 skipped. These conditions are tested first. When an affix is present, it is
1727 removed from the local part before further processing, including the evaluation
1728 of any other conditions.
1729 </para>
1730 </listitem>
1731 <listitem>
1732 <para>
1733 Routers can be designated for use only when not verifying an address, that is,
1734 only when routing it for delivery (or testing its delivery routing). If the
1735 <option>verify</option> option is set false, the router is skipped when Exim is verifying an
1736 address.
1737 Setting the <option>verify</option> option actually sets two options, <option>verify_sender</option> and
1738 <option>verify_recipient</option>, which independently control the use of the router for
1739 sender and recipient verification. You can set these options directly if
1740 you want a router to be used for only one type of verification.
1741 Note that cutthrough delivery is classed as a recipient verification for this purpose.
1742 </para>
1743 </listitem>
1744 <listitem>
1745 <para>
1746 If the <option>address_test</option> option is set false, the router is skipped when Exim is
1747 run with the <option>-bt</option> option to test an address routing. This can be helpful
1748 when the first router sends all new messages to a scanner of some sort; it
1749 makes it possible to use <option>-bt</option> to test subsequent delivery routing without
1750 having to simulate the effect of the scanner.
1751 </para>
1752 </listitem>
1753 <listitem>
1754 <para>
1755 Routers can be designated for use only when verifying an address, as
1756 opposed to routing it for delivery. The <option>verify_only</option> option controls this.
1757 Again, cutthrough delivery counts as a verification.
1758 </para>
1759 </listitem>
1760 <listitem>
1761 <para>
1762 Individual routers can be explicitly skipped when running the routers to
1763 check an address given in the SMTP EXPN command (see the <option>expn</option> option).
1764 </para>
1765 </listitem>
1766 <listitem>
1767 <para>
1768 If the <option>domains</option> option is set, the domain of the address must be in the set
1769 of domains that it defines.
1770 </para>
1771 </listitem>
1772 <listitem>
1773 <para>
1774 <indexterm role="variable">
1775 <primary><varname>$local_part_prefix</varname></primary>
1776 </indexterm>
1777 <indexterm role="variable">
1778 <primary><varname>$local_part</varname></primary>
1779 </indexterm>
1780 <indexterm role="variable">
1781 <primary><varname>$local_part_suffix</varname></primary>
1782 </indexterm>
1783 If the <option>local_parts</option> option is set, the local part of the address must be in
1784 the set of local parts that it defines. If <option>local_part_prefix</option> or
1785 <option>local_part_suffix</option> is in use, the prefix or suffix is removed from the local
1786 part before this check. If you want to do precondition tests on local parts
1787 that include affixes, you can do so by using a <option>condition</option> option (see below)
1788 that uses the variables <varname>$local_part</varname>, <varname>$local_part_prefix</varname>, and
1789 <varname>$local_part_suffix</varname> as necessary.
1790 </para>
1791 </listitem>
1792 <listitem>
1793 <para>
1794 <indexterm role="variable">
1795 <primary><varname>$local_user_uid</varname></primary>
1796 </indexterm>
1797 <indexterm role="variable">
1798 <primary><varname>$local_user_gid</varname></primary>
1799 </indexterm>
1800 <indexterm role="variable">
1801 <primary><varname>$home</varname></primary>
1802 </indexterm>
1803 If the <option>check_local_user</option> option is set, the local part must be the name of
1804 an account on the local host. If this check succeeds, the uid and gid of the
1805 local user are placed in <varname>$local_user_uid</varname> and <varname>$local_user_gid</varname> and the
1806 user&#x2019;s home directory is placed in <varname>$home</varname>; these values can be used in the
1807 remaining preconditions.
1808 </para>
1809 </listitem>
1810 <listitem>
1811 <para>
1812 If the <option>router_home_directory</option> option is set, it is expanded at this point,
1813 because it overrides the value of <varname>$home</varname>. If this expansion were left till
1814 later, the value of <varname>$home</varname> as set by <option>check_local_user</option> would be used in
1815 subsequent tests. Having two different values of <varname>$home</varname> in the same router
1816 could lead to confusion.
1817 </para>
1818 </listitem>
1819 <listitem>
1820 <para>
1821 If the <option>senders</option> option is set, the envelope sender address must be in the
1822 set of addresses that it defines.
1823 </para>
1824 </listitem>
1825 <listitem>
1826 <para>
1827 If the <option>require_files</option> option is set, the existence or non-existence of
1828 specified files is tested.
1829 </para>
1830 </listitem>
1831 <listitem>
1832 <para>
1833 <indexterm role="concept">
1834 <primary>customizing</primary>
1835 <secondary>precondition</secondary>
1836 </indexterm>
1837 If the <option>condition</option> option is set, it is evaluated and tested. This option
1838 uses an expanded string to allow you to set up your own custom preconditions.
1839 Expanded strings are described in chapter <xref linkend="CHAPexpand"/>.
1840 </para>
1841 </listitem>
1842 </itemizedlist>
1843 <para>
1844 Note that <option>require_files</option> comes near the end of the list, so you cannot use
1845 it to check for the existence of a file in which to lookup up a domain, local
1846 part, or sender. However, as these options are all expanded, you can use the
1847 <option>exists</option> expansion condition to make such tests within each condition. The
1848 <option>require_files</option> option is intended for checking files that the router may be
1849 going to use internally, or which are needed by a specific transport (for
1850 example, <filename>.procmailrc</filename>).
1851 </para>
1852 </section>
1853 <section id="SECID18">
1854 <title>Delivery in detail</title>
1855 <para>
1856 <indexterm role="concept">
1857 <primary>delivery</primary>
1858 <secondary>in detail</secondary>
1859 </indexterm>
1860 When a message is to be delivered, the sequence of events is as follows:
1861 </para>
1862 <itemizedlist>
1863 <listitem>
1864 <para>
1865 If a system-wide filter file is specified, the message is passed to it. The
1866 filter may add recipients to the message, replace the recipients, discard the
1867 message, cause a new message to be generated, or cause the message delivery to
1868 fail. The format of the system filter file is the same as for Exim user filter
1869 files, described in the separate document entitled <emphasis>Exim&#x2019;s interfaces to mail
1870 filtering</emphasis>.
1871 <indexterm role="concept">
1872 <primary>Sieve filter</primary>
1873 <secondary>not available for system filter</secondary>
1874 </indexterm>
1875 (<emphasis role="bold">Note</emphasis>: Sieve cannot be used for system filter files.)
1876 </para>
1877 <para>
1878 Some additional features are available in system filters &ndash; see chapter
1879 <xref linkend="CHAPsystemfilter"/> for details. Note that a message is passed to the system
1880 filter only once per delivery attempt, however many recipients it has. However,
1881 if there are several delivery attempts because one or more addresses could not
1882 be immediately delivered, the system filter is run each time. The filter
1883 condition <option>first_delivery</option> can be used to detect the first run of the system
1884 filter.
1885 </para>
1886 </listitem>
1887 <listitem>
1888 <para>
1889 Each recipient address is offered to each configured router in turn, subject to
1890 its preconditions, until one is able to handle it. If no router can handle the
1891 address, that is, if they all decline, the address is failed. Because routers
1892 can be targeted at particular domains, several locally handled domains can be
1893 processed entirely independently of each other.
1894 </para>
1895 </listitem>
1896 <listitem>
1897 <para>
1898 <indexterm role="concept">
1899 <primary>routing</primary>
1900 <secondary>loops in</secondary>
1901 </indexterm>
1902 <indexterm role="concept">
1903 <primary>loop</primary>
1904 <secondary>while routing</secondary>
1905 </indexterm>
1906 A router that accepts an address may assign it to a local or a remote
1907 transport. However, the transport is not run at this time. Instead, the address
1908 is placed on a list for the particular transport, which will be run later.
1909 Alternatively, the router may generate one or more new addresses (typically
1910 from alias, forward, or filter files). New addresses are fed back into this
1911 process from the top, but in order to avoid loops, a router ignores any address
1912 which has an identically-named ancestor that was processed by itself.
1913 </para>
1914 </listitem>
1915 <listitem>
1916 <para>
1917 When all the routing has been done, addresses that have been successfully
1918 handled are passed to their assigned transports. When local transports are
1919 doing real local deliveries, they handle only one address at a time, but if a
1920 local transport is being used as a pseudo-remote transport (for example, to
1921 collect batched SMTP messages for transmission by some other means) multiple
1922 addresses can be handled. Remote transports can always handle more than one
1923 address at a time, but can be configured not to do so, or to restrict multiple
1924 addresses to the same domain.
1925 </para>
1926 </listitem>
1927 <listitem>
1928 <para>
1929 Each local delivery to a file or a pipe runs in a separate process under a
1930 non-privileged uid, and these deliveries are run one at a time. Remote
1931 deliveries also run in separate processes, normally under a uid that is private
1932 to Exim (<quote>the Exim user</quote>), but in this case, several remote deliveries can be
1933 run in parallel. The maximum number of simultaneous remote deliveries for any
1934 one message is set by the <option>remote_max_parallel</option> option.
1935 The order in which deliveries are done is not defined, except that all local
1936 deliveries happen before any remote deliveries.
1937 </para>
1938 </listitem>
1939 <listitem>
1940 <para>
1941 <indexterm role="concept">
1942 <primary>queue runner</primary>
1943 </indexterm>
1944 When it encounters a local delivery during a queue run, Exim checks its retry
1945 database to see if there has been a previous temporary delivery failure for the
1946 address before running the local transport. If there was a previous failure,
1947 Exim does not attempt a new delivery until the retry time for the address is
1948 reached. However, this happens only for delivery attempts that are part of a
1949 queue run. Local deliveries are always attempted when delivery immediately
1950 follows message reception, even if retry times are set for them. This makes for
1951 better behaviour if one particular message is causing problems (for example,
1952 causing quota overflow, or provoking an error in a filter file).
1953 </para>
1954 </listitem>
1955 <listitem>
1956 <para>
1957 <indexterm role="concept">
1958 <primary>delivery</primary>
1959 <secondary>retry in remote transports</secondary>
1960 </indexterm>
1961 Remote transports do their own retry handling, since an address may be
1962 deliverable to one of a number of hosts, each of which may have a different
1963 retry time. If there have been previous temporary failures and no host has
1964 reached its retry time, no delivery is attempted, whether in a queue run or
1965 not. See chapter <xref linkend="CHAPretry"/> for details of retry strategies.
1966 </para>
1967 </listitem>
1968 <listitem>
1969 <para>
1970 If there were any permanent errors, a bounce message is returned to an
1971 appropriate address (the sender in the common case), with details of the error
1972 for each failing address. Exim can be configured to send copies of bounce
1973 messages to other addresses.
1974 </para>
1975 </listitem>
1976 <listitem>
1977 <para>
1978 <indexterm role="concept">
1979 <primary>delivery</primary>
1980 <secondary>deferral</secondary>
1981 </indexterm>
1982 If one or more addresses suffered a temporary failure, the message is left on
1983 the queue, to be tried again later. Delivery of these addresses is said to be
1984 <emphasis>deferred</emphasis>.
1985 </para>
1986 </listitem>
1987 <listitem>
1988 <para>
1989 When all the recipient addresses have either been delivered or bounced,
1990 handling of the message is complete. The spool files and message log are
1991 deleted, though the message log can optionally be preserved if required.
1992 </para>
1993 </listitem>
1994 </itemizedlist>
1995 </section>
1996 <section id="SECID19">
1997 <title>Retry mechanism</title>
1998 <para>
1999 <indexterm role="concept">
2000 <primary>delivery</primary>
2001 <secondary>retry mechanism</secondary>
2002 </indexterm>
2003 <indexterm role="concept">
2004 <primary>retry</primary>
2005 <secondary>description of mechanism</secondary>
2006 </indexterm>
2007 <indexterm role="concept">
2008 <primary>queue runner</primary>
2009 </indexterm>
2010 Exim&#x2019;s mechanism for retrying messages that fail to get delivered at the first
2011 attempt is the queue runner process. You must either run an Exim daemon that
2012 uses the <option>-q</option> option with a time interval to start queue runners at regular
2013 intervals, or use some other means (such as <emphasis>cron</emphasis>) to start them. If you do
2014 not arrange for queue runners to be run, messages that fail temporarily at the
2015 first attempt will remain on your queue for ever. A queue runner process works
2016 its way through the queue, one message at a time, trying each delivery that has
2017 passed its retry time.
2018 You can run several queue runners at once.
2019 </para>
2020 <para>
2021 Exim uses a set of configured rules to determine when next to retry the failing
2022 address (see chapter <xref linkend="CHAPretry"/>). These rules also specify when Exim
2023 should give up trying to deliver to the address, at which point it generates a
2024 bounce message. If no retry rules are set for a particular host, address, and
2025 error combination, no retries are attempted, and temporary errors are treated
2026 as permanent.
2027 </para>
2028 </section>
2029 <section id="SECID20">
2030 <title>Temporary delivery failure</title>
2031 <para>
2032 <indexterm role="concept">
2033 <primary>delivery</primary>
2034 <secondary>temporary failure</secondary>
2035 </indexterm>
2036 There are many reasons why a message may not be immediately deliverable to a
2037 particular address. Failure to connect to a remote machine (because it, or the
2038 connection to it, is down) is one of the most common. Temporary failures may be
2039 detected during routing as well as during the transport stage of delivery.
2040 Local deliveries may be delayed if NFS files are unavailable, or if a mailbox
2041 is on a file system where the user is over quota. Exim can be configured to
2042 impose its own quotas on local mailboxes; where system quotas are set they will
2043 also apply.
2044 </para>
2045 <para>
2046 If a host is unreachable for a period of time, a number of messages may be
2047 waiting for it by the time it recovers, and sending them in a single SMTP
2048 connection is clearly beneficial. Whenever a delivery to a remote host is
2049 deferred,
2050 <indexterm role="concept">
2051 <primary>hints database</primary>
2052 <secondary>deferred deliveries</secondary>
2053 </indexterm>
2054 Exim makes a note in its hints database, and whenever a successful
2055 SMTP delivery has happened, it looks to see if any other messages are waiting
2056 for the same host. If any are found, they are sent over the same SMTP
2057 connection, subject to a configuration limit as to the maximum number in any
2058 one connection.
2059 </para>
2060 </section>
2061 <section id="SECID21">
2062 <title>Permanent delivery failure</title>
2063 <para>
2064 <indexterm role="concept">
2065 <primary>delivery</primary>
2066 <secondary>permanent failure</secondary>
2067 </indexterm>
2068 <indexterm role="concept">
2069 <primary>bounce message</primary>
2070 <secondary>when generated</secondary>
2071 </indexterm>
2072 When a message cannot be delivered to some or all of its intended recipients, a
2073 bounce message is generated. Temporary delivery failures turn into permanent
2074 errors when their timeout expires. All the addresses that fail in a given
2075 delivery attempt are listed in a single message. If the original message has
2076 many recipients, it is possible for some addresses to fail in one delivery
2077 attempt and others to fail subsequently, giving rise to more than one bounce
2078 message. The wording of bounce messages can be customized by the administrator.
2079 See chapter <xref linkend="CHAPemsgcust"/> for details.
2080 </para>
2081 <para>
2082 <indexterm role="concept">
2083 <primary><emphasis>X-Failed-Recipients:</emphasis> header line</primary>
2084 </indexterm>
2085 Bounce messages contain an <emphasis>X-Failed-Recipients:</emphasis> header line that lists the
2086 failed addresses, for the benefit of programs that try to analyse such messages
2087 automatically.
2088 </para>
2089 <para>
2090 <indexterm role="concept">
2091 <primary>bounce message</primary>
2092 <secondary>recipient of</secondary>
2093 </indexterm>
2094 A bounce message is normally sent to the sender of the original message, as
2095 obtained from the message&#x2019;s envelope. For incoming SMTP messages, this is the
2096 address given in the MAIL command. However, when an address is expanded via a
2097 forward or alias file, an alternative address can be specified for delivery
2098 failures of the generated addresses. For a mailing list expansion (see section
2099 <xref linkend="SECTmailinglists"/>) it is common to direct bounce messages to the manager
2100 of the list.
2101 </para>
2102 </section>
2103 <section id="SECID22">
2104 <title>Failures to deliver bounce messages</title>
2105 <para>
2106 <indexterm role="concept">
2107 <primary>bounce message</primary>
2108 <secondary>failure to deliver</secondary>
2109 </indexterm>
2110 If a bounce message (either locally generated or received from a remote host)
2111 itself suffers a permanent delivery failure, the message is left on the queue,
2112 but it is frozen, awaiting the attention of an administrator. There are options
2113 that can be used to make Exim discard such failed messages, or to keep them
2114 for only a short time (see <option>timeout_frozen_after</option> and
2115 <option>ignore_bounce_errors_after</option>).
2116 </para>
2117 </section>
2118 </chapter>
2119
2120 <chapter id="CHID3">
2121 <title>Building and installing Exim</title>
2122 <para>
2123 <indexterm role="concept" id="IIDbuex" class="startofrange">
2124 <primary>building Exim</primary>
2125 </indexterm>
2126 </para>
2127 <section id="SECID23">
2128 <title>Unpacking</title>
2129 <para>
2130 Exim is distributed as a gzipped or bzipped tar file which, when unpacked,
2131 creates a directory with the name of the current release (for example,
2132 <filename>exim-4.87.1</filename>) into which the following files are placed:
2133 </para>
2134 <informaltable frame="none">
2135 <tgroup cols="2" colsep="0" rowsep="0">
2136 <colspec colwidth="140pt" align="left"/>
2137 <colspec colwidth="254pt" align="left"/>
2138 <tbody>
2139 <row>
2140 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>ACKNOWLEDGMENTS</filename></entry>
2141 <entry>contains some acknowledgments</entry>
2142 </row>
2143 <row>
2144 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>CHANGES</filename></entry>
2145 <entry>contains a reference to where changes are documented</entry>
2146 </row>
2147 <row>
2148 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>LICENCE</filename></entry>
2149 <entry>the GNU General Public Licence</entry>
2150 </row>
2151 <row>
2152 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Makefile</filename></entry>
2153 <entry>top-level make file</entry>
2154 </row>
2155 <row>
2156 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>NOTICE</filename></entry>
2157 <entry>conditions for the use of Exim</entry>
2158 </row>
2159 <row>
2160 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>README</filename></entry>
2161 <entry>list of files, directories and simple build instructions</entry>
2162 </row>
2163 </tbody>
2164 </tgroup>
2165 </informaltable>
2166 <para>
2167 Other files whose names begin with <filename>README</filename> may also be present. The
2168 following subdirectories are created:
2169 </para>
2170 <informaltable frame="none">
2171 <tgroup cols="2" colsep="0" rowsep="0">
2172 <colspec colwidth="140pt" align="left"/>
2173 <colspec colwidth="254pt" align="left"/>
2174 <tbody>
2175 <row>
2176 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Local</filename></entry>
2177 <entry>an empty directory for local configuration files</entry>
2178 </row>
2179 <row>
2180 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>OS</filename></entry>
2181 <entry>OS-specific files</entry>
2182 </row>
2183 <row>
2184 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>doc</filename></entry>
2185 <entry>documentation files</entry>
2186 </row>
2187 <row>
2188 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>exim_monitor</filename></entry>
2189 <entry>source files for the Exim monitor</entry>
2190 </row>
2191 <row>
2192 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>scripts</filename></entry>
2193 <entry>scripts used in the build process</entry>
2194 </row>
2195 <row>
2196 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>src</filename></entry>
2197 <entry>remaining source files</entry>
2198 </row>
2199 <row>
2200 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>util</filename></entry>
2201 <entry>independent utilities</entry>
2202 </row>
2203 </tbody>
2204 </tgroup>
2205 </informaltable>
2206 <para>
2207 The main utility programs are contained in the <filename>src</filename> directory, and are built
2208 with the Exim binary. The <filename>util</filename> directory contains a few optional scripts
2209 that may be useful to some sites.
2210 </para>
2211 </section>
2212 <section id="SECID24">
2213 <title>Multiple machine architectures and operating systems</title>
2214 <para>
2215 <indexterm role="concept">
2216 <primary>building Exim</primary>
2217 <secondary>multiple OS/architectures</secondary>
2218 </indexterm>
2219 The building process for Exim is arranged to make it easy to build binaries for
2220 a number of different architectures and operating systems from the same set of
2221 source files. Compilation does not take place in the <filename>src</filename> directory.
2222 Instead, a <emphasis>build directory</emphasis> is created for each architecture and operating
2223 system.
2224 <indexterm role="concept">
2225 <primary>symbolic link</primary>
2226 <secondary>to build directory</secondary>
2227 </indexterm>
2228 Symbolic links to the sources are installed in this directory, which is where
2229 the actual building takes place. In most cases, Exim can discover the machine
2230 architecture and operating system for itself, but the defaults can be
2231 overridden if necessary.
2232 </para>
2233 </section>
2234 <section id="SECTpcre">
2235 <title>PCRE library</title>
2236 <para>
2237 <indexterm role="concept">
2238 <primary>PCRE library</primary>
2239 </indexterm>
2240 Exim no longer has an embedded PCRE library as the vast majority of
2241 modern systems include PCRE as a system library, although you may need
2242 to install the PCRE or PCRE development package for your operating
2243 system. If your system has a normal PCRE installation the Exim build
2244 process will need no further configuration. If the library or the
2245 headers are in an unusual location you will need to either set the PCRE_LIBS
2246 and INCLUDE directives appropriately,
2247 or set PCRE_CONFIG=yes to use the installed <command>pcre-config</command> command.
2248 If your operating system has no
2249 PCRE support then you will need to obtain and build the current PCRE
2250 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>.
2251 More information on PCRE is available at <emphasis role="bold"><ulink url="http://www.pcre.org/">http://www.pcre.org/</ulink></emphasis>.
2252 </para>
2253 </section>
2254 <section id="SECTdb">
2255 <title>DBM libraries</title>
2256 <para>
2257 <indexterm role="concept">
2258 <primary>DBM libraries</primary>
2259 <secondary>discussion of</secondary>
2260 </indexterm>
2261 <indexterm role="concept">
2262 <primary>hints database</primary>
2263 <secondary>DBM files used for</secondary>
2264 </indexterm>
2265 Even if you do not use any DBM files in your configuration, Exim still needs a
2266 DBM library in order to operate, because it uses indexed files for its hints
2267 databases. Unfortunately, there are a number of DBM libraries in existence, and
2268 different operating systems often have different ones installed.
2269 </para>
2270 <para>
2271 <indexterm role="concept">
2272 <primary>Solaris</primary>
2273 <secondary>DBM library for</secondary>
2274 </indexterm>
2275 <indexterm role="concept">
2276 <primary>IRIX, DBM library for</primary>
2277 </indexterm>
2278 <indexterm role="concept">
2279 <primary>BSD, DBM library for</primary>
2280 </indexterm>
2281 <indexterm role="concept">
2282 <primary>Linux, DBM library for</primary>
2283 </indexterm>
2284 If you are using Solaris, IRIX, one of the modern BSD systems, or a modern
2285 Linux distribution, the DBM configuration should happen automatically, and you
2286 may be able to ignore this section. Otherwise, you may have to learn more than
2287 you would like about DBM libraries from what follows.
2288 </para>
2289 <para>
2290 <indexterm role="concept">
2291 <primary><emphasis>ndbm</emphasis> DBM library</primary>
2292 </indexterm>
2293 Licensed versions of Unix normally contain a library of DBM functions operating
2294 via the <emphasis>ndbm</emphasis> interface, and this is what Exim expects by default. Free
2295 versions of Unix seem to vary in what they contain as standard. In particular,
2296 some early versions of Linux have no default DBM library, and different
2297 distributors have chosen to bundle different libraries with their packaged
2298 versions. However, the more recent releases seem to have standardized on the
2299 Berkeley DB library.
2300 </para>
2301 <para>
2302 Different DBM libraries have different conventions for naming the files they
2303 use. When a program opens a file called <filename>dbmfile</filename>, there are several
2304 possibilities:
2305 </para>
2306 <orderedlist numeration="arabic">
2307 <listitem>
2308 <para>
2309 A traditional <emphasis>ndbm</emphasis> implementation, such as that supplied as part of
2310 Solaris, operates on two files called <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>.
2311 </para>
2312 </listitem>
2313 <listitem>
2314 <para>
2315 <indexterm role="concept">
2316 <primary><emphasis>gdbm</emphasis> DBM library</primary>
2317 </indexterm>
2318 The GNU library, <emphasis>gdbm</emphasis>, operates on a single file. If used via its <emphasis>ndbm</emphasis>
2319 compatibility interface it makes two different hard links to it with names
2320 <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>, but if used via its native interface, the
2321 file name is used unmodified.
2322 </para>
2323 </listitem>
2324 <listitem>
2325 <para>
2326 <indexterm role="concept">
2327 <primary>Berkeley DB library</primary>
2328 </indexterm>
2329 The Berkeley DB package, if called via its <emphasis>ndbm</emphasis> compatibility interface,
2330 operates on a single file called <filename>dbmfile.db</filename>, but otherwise looks to the
2331 programmer exactly the same as the traditional <emphasis>ndbm</emphasis> implementation.
2332 </para>
2333 </listitem>
2334 <listitem>
2335 <para>
2336 If the Berkeley package is used in its native mode, it operates on a single
2337 file called <filename>dbmfile</filename>; the programmer&#x2019;s interface is somewhat different to
2338 the traditional <emphasis>ndbm</emphasis> interface.
2339 </para>
2340 </listitem>
2341 <listitem>
2342 <para>
2343 To complicate things further, there are several very different versions of the
2344 Berkeley DB package. Version 1.85 was stable for a very long time, releases
2345 2.<emphasis>x</emphasis> and 3.<emphasis>x</emphasis> were current for a while, but the latest versions are now
2346 numbered 4.<emphasis>x</emphasis>. Maintenance of some of the earlier releases has ceased. All
2347 versions of Berkeley DB can be obtained from
2348 <emphasis role="bold"><ulink url="http://www.sleepycat.com/">http://www.sleepycat.com/</ulink></emphasis>.
2349 </para>
2350 </listitem>
2351 <listitem>
2352 <para>
2353 <indexterm role="concept">
2354 <primary><emphasis>tdb</emphasis> DBM library</primary>
2355 </indexterm>
2356 Yet another DBM library, called <emphasis>tdb</emphasis>, is available from
2357 <emphasis role="bold"><ulink url="http://download.sourceforge.net/tdb">http://download.sourceforge.net/tdb</ulink></emphasis>. It has its own interface, and also
2358 operates on a single file.
2359 </para>
2360 </listitem>
2361 </orderedlist>
2362 <para>
2363 <indexterm role="concept">
2364 <primary>USE_DB</primary>
2365 </indexterm>
2366 <indexterm role="concept">
2367 <primary>DBM libraries</primary>
2368 <secondary>configuration for building</secondary>
2369 </indexterm>
2370 Exim and its utilities can be compiled to use any of these interfaces. In order
2371 to use any version of the Berkeley DB package in native mode, you must set
2372 USE_DB in an appropriate configuration file (typically
2373 <filename>Local/Makefile</filename>). For example:
2374 </para>
2375 <literallayout class="monospaced">
2376 USE_DB=yes
2377 </literallayout>
2378 <para>
2379 Similarly, for gdbm you set USE_GDBM, and for tdb you set USE_TDB. An
2380 error is diagnosed if you set more than one of these.
2381 </para>
2382 <para>
2383 At the lowest level, the build-time configuration sets none of these options,
2384 thereby assuming an interface of type (1). However, some operating system
2385 configuration files (for example, those for the BSD operating systems and
2386 Linux) assume type (4) by setting USE_DB as their default, and the
2387 configuration files for Cygwin set USE_GDBM. Anything you set in
2388 <filename>Local/Makefile</filename>, however, overrides these system defaults.
2389 </para>
2390 <para>
2391 As well as setting USE_DB, USE_GDBM, or USE_TDB, it may also be
2392 necessary to set DBMLIB, to cause inclusion of the appropriate library, as
2393 in one of these lines:
2394 </para>
2395 <literallayout class="monospaced">
2396 DBMLIB = -ldb
2397 DBMLIB = -ltdb
2398 </literallayout>
2399 <para>
2400 Settings like that will work if the DBM library is installed in the standard
2401 place. Sometimes it is not, and the library&#x2019;s header file may also not be in
2402 the default path. You may need to set INCLUDE to specify where the header
2403 file is, and to specify the path to the library more fully in DBMLIB, as in
2404 this example:
2405 </para>
2406 <literallayout class="monospaced">
2407 INCLUDE=-I/usr/local/include/db-4.1
2408 DBMLIB=/usr/local/lib/db-4.1/libdb.a
2409 </literallayout>
2410 <para>
2411 There is further detailed discussion about the various DBM libraries in the
2412 file <filename>doc/dbm.discuss.txt</filename> in the Exim distribution.
2413 </para>
2414 </section>
2415 <section id="SECID25">
2416 <title>Pre-building configuration</title>
2417 <para>
2418 <indexterm role="concept">
2419 <primary>building Exim</primary>
2420 <secondary>pre-building configuration</secondary>
2421 </indexterm>
2422 <indexterm role="concept">
2423 <primary>configuration for building Exim</primary>
2424 </indexterm>
2425 <indexterm role="concept">
2426 <primary><filename>Local/Makefile</filename></primary>
2427 </indexterm>
2428 <indexterm role="concept">
2429 <primary><filename>src/EDITME</filename></primary>
2430 </indexterm>
2431 Before building Exim, a local configuration file that specifies options
2432 independent of any operating system has to be created with the name
2433 <filename>Local/Makefile</filename>. A template for this file is supplied as the file
2434 <filename>src/EDITME</filename>, and it contains full descriptions of all the option settings
2435 therein. These descriptions are therefore not repeated here. If you are
2436 building Exim for the first time, the simplest thing to do is to copy
2437 <filename>src/EDITME</filename> to <filename>Local/Makefile</filename>, then read it and edit it appropriately.
2438 </para>
2439 <para>
2440 There are three settings that you must supply, because Exim will not build
2441 without them. They are the location of the run time configuration file
2442 (CONFIGURE_FILE), the directory in which Exim binaries will be installed
2443 (BIN_DIRECTORY), and the identity of the Exim user (EXIM_USER and
2444 maybe EXIM_GROUP as well). The value of CONFIGURE_FILE can in fact be
2445 a colon-separated list of file names; Exim uses the first of them that exists.
2446 </para>
2447 <para>
2448 There are a few other parameters that can be specified either at build time or
2449 at run time, to enable the same binary to be used on a number of different
2450 machines. However, if the locations of Exim&#x2019;s spool directory and log file
2451 directory (if not within the spool directory) are fixed, it is recommended that
2452 you specify them in <filename>Local/Makefile</filename> instead of at run time, so that errors
2453 detected early in Exim&#x2019;s execution (such as a malformed configuration file) can
2454 be logged.
2455 </para>
2456 <para>
2457 <indexterm role="concept">
2458 <primary>content scanning</primary>
2459 <secondary>specifying at build time</secondary>
2460 </indexterm>
2461 Exim&#x2019;s interfaces for calling virus and spam scanning software directly from
2462 access control lists are not compiled by default. If you want to include these
2463 facilities, you need to set
2464 </para>
2465 <literallayout class="monospaced">
2466 WITH_CONTENT_SCAN=yes
2467 </literallayout>
2468 <para>
2469 in your <filename>Local/Makefile</filename>. For details of the facilities themselves, see
2470 chapter <xref linkend="CHAPexiscan"/>.
2471 </para>
2472 <para>
2473 <indexterm role="concept">
2474 <primary><filename>Local/eximon.conf</filename></primary>
2475 </indexterm>
2476 <indexterm role="concept">
2477 <primary><filename>exim_monitor/EDITME</filename></primary>
2478 </indexterm>
2479 If you are going to build the Exim monitor, a similar configuration process is
2480 required. The file <filename>exim_monitor/EDITME</filename> must be edited appropriately for
2481 your installation and saved under the name <filename>Local/eximon.conf</filename>. If you are
2482 happy with the default settings described in <filename>exim_monitor/EDITME</filename>,
2483 <filename>Local/eximon.conf</filename> can be empty, but it must exist.
2484 </para>
2485 <para>
2486 This is all the configuration that is needed in straightforward cases for known
2487 operating systems. However, the building process is set up so that it is easy
2488 to override options that are set by default or by operating-system-specific
2489 configuration files, for example to change the name of the C compiler, which
2490 defaults to <option>gcc</option>. See section <xref linkend="SECToverride"/> below for details of how to
2491 do this.
2492 </para>
2493 </section>
2494 <section id="SECID26">
2495 <title>Support for iconv()</title>
2496 <para>
2497 <indexterm role="concept">
2498 <primary><function>iconv()</function> support</primary>
2499 </indexterm>
2500 <indexterm role="concept">
2501 <primary>RFC 2047</primary>
2502 </indexterm>
2503 The contents of header lines in messages may be encoded according to the rules
2504 described RFC 2047. This makes it possible to transmit characters that are not
2505 in the ASCII character set, and to label them as being in a particular
2506 character set. When Exim is inspecting header lines by means of the <option>$h_</option>
2507 mechanism, it decodes them, and translates them into a specified character set
2508 (default is set at build time). The translation is possible only if the operating system
2509 supports the <function>iconv()</function> function.
2510 </para>
2511 <para>
2512 However, some of the operating systems that supply <function>iconv()</function> do not support
2513 very many conversions. The GNU <option>libiconv</option> library (available from
2514 <emphasis role="bold"><ulink url="http://www.gnu.org/software/libiconv/">http://www.gnu.org/software/libiconv/</ulink></emphasis>) can be installed on such
2515 systems to remedy this deficiency, as well as on systems that do not supply
2516 <function>iconv()</function> at all. After installing <option>libiconv</option>, you should add
2517 </para>
2518 <literallayout class="monospaced">
2519 HAVE_ICONV=yes
2520 </literallayout>
2521 <para>
2522 to your <filename>Local/Makefile</filename> and rebuild Exim.
2523 </para>
2524 </section>
2525 <section id="SECTinctlsssl">
2526 <title>Including TLS/SSL encryption support</title>
2527 <para>
2528 <indexterm role="concept">
2529 <primary>TLS</primary>
2530 <secondary>including support for TLS</secondary>
2531 </indexterm>
2532 <indexterm role="concept">
2533 <primary>encryption</primary>
2534 <secondary>including support for</secondary>
2535 </indexterm>
2536 <indexterm role="concept">
2537 <primary>SUPPORT_TLS</primary>
2538 </indexterm>
2539 <indexterm role="concept">
2540 <primary>OpenSSL</primary>
2541 <secondary>building Exim with</secondary>
2542 </indexterm>
2543 <indexterm role="concept">
2544 <primary>GnuTLS</primary>
2545 <secondary>building Exim with</secondary>
2546 </indexterm>
2547 Exim can be built to support encrypted SMTP connections, using the STARTTLS
2548 command as per RFC 2487. It can also support legacy clients that expect to
2549 start a TLS session immediately on connection to a non-standard port (see the
2550 <option>tls_on_connect_ports</option> runtime option and the <option>-tls-on-connect</option> command
2551 line option).
2552 </para>
2553 <para>
2554 If you want to build Exim with TLS support, you must first install either the
2555 OpenSSL or GnuTLS library. There is no cryptographic code in Exim itself for
2556 implementing SSL.
2557 </para>
2558 <para>
2559 If OpenSSL is installed, you should set
2560 </para>
2561 <literallayout class="monospaced">
2562 SUPPORT_TLS=yes
2563 TLS_LIBS=-lssl -lcrypto
2564 </literallayout>
2565 <para>
2566 in <filename>Local/Makefile</filename>. You may also need to specify the locations of the
2567 OpenSSL library and include files. For example:
2568 </para>
2569 <literallayout class="monospaced">
2570 SUPPORT_TLS=yes
2571 TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto
2572 TLS_INCLUDE=-I/usr/local/openssl/include/
2573 </literallayout>
2574 <para>
2575 <indexterm role="concept">
2576 <primary>pkg-config</primary>
2577 <secondary>OpenSSL</secondary>
2578 </indexterm>
2579 If you have <emphasis>pkg-config</emphasis> available, then instead you can just use:
2580 </para>
2581 <literallayout class="monospaced">
2582 SUPPORT_TLS=yes
2583 USE_OPENSSL_PC=openssl
2584 </literallayout>
2585 <para>
2586 <indexterm role="concept">
2587 <primary>USE_GNUTLS</primary>
2588 </indexterm>
2589 If GnuTLS is installed, you should set
2590 </para>
2591 <literallayout class="monospaced">
2592 SUPPORT_TLS=yes
2593 USE_GNUTLS=yes
2594 TLS_LIBS=-lgnutls -ltasn1 -lgcrypt
2595 </literallayout>
2596 <para>
2597 in <filename>Local/Makefile</filename>, and again you may need to specify the locations of the
2598 library and include files. For example:
2599 </para>
2600 <literallayout class="monospaced">
2601 SUPPORT_TLS=yes
2602 USE_GNUTLS=yes
2603 TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt
2604 TLS_INCLUDE=-I/usr/gnu/include
2605 </literallayout>
2606 <para>
2607 <indexterm role="concept">
2608 <primary>pkg-config</primary>
2609 <secondary>GnuTLS</secondary>
2610 </indexterm>
2611 If you have <emphasis>pkg-config</emphasis> available, then instead you can just use:
2612 </para>
2613 <literallayout class="monospaced">
2614 SUPPORT_TLS=yes
2615 USE_GNUTLS=yes
2616 USE_GNUTLS_PC=gnutls
2617 </literallayout>
2618 <para>
2619 You do not need to set TLS_INCLUDE if the relevant directory is already
2620 specified in INCLUDE. Details of how to configure Exim to make use of TLS are
2621 given in chapter <xref linkend="CHAPTLS"/>.
2622 </para>
2623 </section>
2624 <section id="SECID27">
2625 <title>Use of tcpwrappers</title>
2626 <para>
2627 <indexterm role="concept">
2628 <primary>tcpwrappers, building Exim to support</primary>
2629 </indexterm>
2630 <indexterm role="concept">
2631 <primary>USE_TCP_WRAPPERS</primary>
2632 </indexterm>
2633 <indexterm role="concept">
2634 <primary>TCP_WRAPPERS_DAEMON_NAME</primary>
2635 </indexterm>
2636 <indexterm role="concept">
2637 <primary>tcp_wrappers_daemon_name</primary>
2638 </indexterm>
2639 Exim can be linked with the <emphasis>tcpwrappers</emphasis> library in order to check incoming
2640 SMTP calls using the <emphasis>tcpwrappers</emphasis> control files. This may be a convenient
2641 alternative to Exim&#x2019;s own checking facilities for installations that are
2642 already making use of <emphasis>tcpwrappers</emphasis> for other purposes. To do this, you
2643 should set USE_TCP_WRAPPERS in <filename>Local/Makefile</filename>, arrange for the file
2644 <filename>tcpd.h</filename> to be available at compile time, and also ensure that the library
2645 <filename>libwrap.a</filename> is available at link time, typically by including <option>-lwrap</option> in
2646 EXTRALIBS_EXIM. For example, if <emphasis>tcpwrappers</emphasis> is installed in <filename>/usr/local</filename>,
2647 you might have
2648 </para>
2649 <literallayout class="monospaced">
2650 USE_TCP_WRAPPERS=yes
2651 CFLAGS=-O -I/usr/local/include
2652 EXTRALIBS_EXIM=-L/usr/local/lib -lwrap
2653 </literallayout>
2654 <para>
2655 in <filename>Local/Makefile</filename>. The daemon name to use in the <emphasis>tcpwrappers</emphasis> control
2656 files is <quote>exim</quote>. For example, the line
2657 </para>
2658 <literallayout class="monospaced">
2659 exim : LOCAL  192.168.1.  .friendly.domain.example
2660 </literallayout>
2661 <para>
2662 in your <filename>/etc/hosts.allow</filename> file allows connections from the local host, from
2663 the subnet 192.168.1.0/24, and from all hosts in <emphasis>friendly.domain.example</emphasis>.
2664 All other connections are denied. The daemon name used by <emphasis>tcpwrappers</emphasis>
2665 can be changed at build time by setting TCP_WRAPPERS_DAEMON_NAME in
2666 <filename>Local/Makefile</filename>, or by setting tcp_wrappers_daemon_name in the
2667 configure file. Consult the <emphasis>tcpwrappers</emphasis> documentation for
2668 further details.
2669 </para>
2670 </section>
2671 <section id="SECID28">
2672 <title>Including support for IPv6</title>
2673 <para>
2674 <indexterm role="concept">
2675 <primary>IPv6</primary>
2676 <secondary>including support for</secondary>
2677 </indexterm>
2678 Exim contains code for use on systems that have IPv6 support. Setting
2679 <literal>HAVE_IPV6=YES</literal> in <filename>Local/Makefile</filename> causes the IPv6 code to be included;
2680 it may also be necessary to set IPV6_INCLUDE and IPV6_LIBS on systems
2681 where the IPv6 support is not fully integrated into the normal include and
2682 library files.
2683 </para>
2684 <para>
2685 Two different types of DNS record for handling IPv6 addresses have been
2686 defined. AAAA records (analogous to A records for IPv4) are in use, and are
2687 currently seen as the mainstream. Another record type called A6 was proposed
2688 as better than AAAA because it had more flexibility. However, it was felt to be
2689 over-complex, and its status was reduced to <quote>experimental</quote>.
2690 Exim used to
2691 have a compile option for including A6 record support but this has now been
2692 withdrawn.
2693 </para>
2694 </section>
2695 <section id="SECTdynamicmodules">
2696 <title>Dynamically loaded lookup module support</title>
2697 <para>
2698 <indexterm role="concept">
2699 <primary>lookup modules</primary>
2700 </indexterm>
2701 <indexterm role="concept">
2702 <primary>dynamic modules</primary>
2703 </indexterm>
2704 <indexterm role="concept">
2705 <primary>.so building</primary>
2706 </indexterm>
2707 On some platforms, Exim supports not compiling all lookup types directly into
2708 the main binary, instead putting some into external modules which can be loaded
2709 on demand.
2710 This permits packagers to build Exim with support for lookups with extensive
2711 library dependencies without requiring all users to install all of those
2712 dependencies.
2713 Most, but not all, lookup types can be built this way.
2714 </para>
2715 <para>
2716 Set <literal>LOOKUP_MODULE_DIR</literal> to the directory into which the modules will be
2717 installed; Exim will only load modules from that directory, as a security
2718 measure.  You will need to set <literal>CFLAGS_DYNAMIC</literal> if not already defined
2719 for your OS; see <filename>OS/Makefile-Linux</filename> for an example.
2720 Some other requirements for adjusting <literal>EXTRALIBS</literal> may also be necessary,
2721 see <filename>src/EDITME</filename> for details.
2722 </para>
2723 <para>
2724 Then, for each module to be loaded dynamically, define the relevant
2725 <literal>LOOKUP_</literal>&lt;<emphasis>lookup_type</emphasis>&gt; flags to have the value "2" instead of "yes".
2726 For example, this will build in lsearch but load sqlite and mysql support
2727 on demand:
2728 </para>
2729 <literallayout class="monospaced">
2730 LOOKUP_LSEARCH=yes
2731 LOOKUP_SQLITE=2
2732 LOOKUP_MYSQL=2
2733 </literallayout>
2734 </section>
2735 <section id="SECID29">
2736 <title>The building process</title>
2737 <para>
2738 <indexterm role="concept">
2739 <primary>build directory</primary>
2740 </indexterm>
2741 Once <filename>Local/Makefile</filename> (and <filename>Local/eximon.conf</filename>, if required) have been
2742 created, run <emphasis>make</emphasis> at the top level. It determines the architecture and
2743 operating system types, and creates a build directory if one does not exist.
2744 For example, on a Sun system running Solaris 8, the directory
2745 <filename>build-SunOS5-5.8-sparc</filename> is created.
2746 <indexterm role="concept">
2747 <primary>symbolic link</primary>
2748 <secondary>to source files</secondary>
2749 </indexterm>
2750 Symbolic links to relevant source files are installed in the build directory.
2751 </para>
2752 <para>
2753 If this is the first time <emphasis>make</emphasis> has been run, it calls a script that builds
2754 a make file inside the build directory, using the configuration files from the
2755 <filename>Local</filename> directory. The new make file is then passed to another instance of
2756 <emphasis>make</emphasis>. This does the real work, building a number of utility scripts, and
2757 then compiling and linking the binaries for the Exim monitor (if configured), a
2758 number of utility programs, and finally Exim itself. The command <literal>make
2759 makefile</literal> can be used to force a rebuild of the make file in the build
2760 directory, should this ever be necessary.
2761 </para>
2762 <para>
2763 If you have problems building Exim, check for any comments there may be in the
2764 <filename>README</filename> file concerning your operating system, and also take a look at the
2765 FAQ, where some common problems are covered.
2766 </para>
2767 </section>
2768 <section id="SECID283">
2769 <title>Output from <quote>make</quote></title>
2770 <para>
2771 The output produced by the <emphasis>make</emphasis> process for compile lines is often very
2772 unreadable, because these lines can be very long. For this reason, the normal
2773 output is suppressed by default, and instead output similar to that which
2774 appears when compiling the 2.6 Linux kernel is generated: just a short line for
2775 each module that is being compiled or linked. However, it is still possible to
2776 get the full output, by calling <emphasis>make</emphasis> like this:
2777 </para>
2778 <literallayout class="monospaced">
2779 FULLECHO='' make -e
2780 </literallayout>
2781 <para>
2782 The value of FULLECHO defaults to <quote>@</quote>, the flag character that suppresses
2783 command reflection in <emphasis>make</emphasis>. When you ask for the full output, it is
2784 given in addition to the short output.
2785 </para>
2786 </section>
2787 <section id="SECToverride">
2788 <title>Overriding build-time options for Exim</title>
2789 <para>
2790 <indexterm role="concept">
2791 <primary>build-time options, overriding</primary>
2792 </indexterm>
2793 The main make file that is created at the beginning of the building process
2794 consists of the concatenation of a number of files which set configuration
2795 values, followed by a fixed set of <emphasis>make</emphasis> instructions. If a value is set
2796 more than once, the last setting overrides any previous ones. This provides a
2797 convenient way of overriding defaults. The files that are concatenated are, in
2798 order:
2799 </para>
2800 <literallayout>
2801 <filename>OS/Makefile-Default</filename>
2802 <filename>OS/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2803 <filename>Local/Makefile</filename>
2804 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2805 <filename>Local/Makefile-</filename>&lt;<emphasis>archtype</emphasis>&gt;
2806 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
2807 <filename>OS/Makefile-Base</filename>
2808 </literallayout>
2809 <para>
2810 <indexterm role="concept">
2811 <primary><filename>Local/Makefile</filename></primary>
2812 </indexterm>
2813 <indexterm role="concept">
2814 <primary>building Exim</primary>
2815 <secondary>operating system type</secondary>
2816 </indexterm>
2817 <indexterm role="concept">
2818 <primary>building Exim</primary>
2819 <secondary>architecture type</secondary>
2820 </indexterm>
2821 where &lt;<emphasis>ostype</emphasis>&gt; is the operating system type and &lt;<emphasis>archtype</emphasis>&gt; is the
2822 architecture type. <filename>Local/Makefile</filename> is required to exist, and the building
2823 process fails if it is absent. The other three <filename>Local</filename> files are optional,
2824 and are often not needed.
2825 </para>
2826 <para>
2827 The values used for &lt;<emphasis>ostype</emphasis>&gt; and &lt;<emphasis>archtype</emphasis>&gt; are obtained from scripts
2828 called <filename>scripts/os-type</filename> and <filename>scripts/arch-type</filename> respectively. If either of
2829 the environment variables EXIM_OSTYPE or EXIM_ARCHTYPE is set, their
2830 values are used, thereby providing a means of forcing particular settings.
2831 Otherwise, the scripts try to get values from the <option>uname</option> command. If this
2832 fails, the shell variables OSTYPE and ARCHTYPE are inspected. A number
2833 of <emphasis>ad hoc</emphasis> transformations are then applied, to produce the standard names
2834 that Exim expects. You can run these scripts directly from the shell in order
2835 to find out what values are being used on your system.
2836 </para>
2837 <para>
2838 <filename>OS/Makefile-Default</filename> contains comments about the variables that are set
2839 therein. Some (but not all) are mentioned below. If there is something that
2840 needs changing, review the contents of this file and the contents of the make
2841 file for your operating system (<filename>OS/Makefile-&lt;ostype&gt;</filename>) to see what the
2842 default values are.
2843 </para>
2844 <para>
2845 <indexterm role="concept">
2846 <primary>building Exim</primary>
2847 <secondary>overriding default settings</secondary>
2848 </indexterm>
2849 If you need to change any of the values that are set in <filename>OS/Makefile-Default</filename>
2850 or in <filename>OS/Makefile-&lt;ostype&gt;</filename>, or to add any new definitions, you do not
2851 need to change the original files. Instead, you should make the changes by
2852 putting the new values in an appropriate <filename>Local</filename> file. For example,
2853 <indexterm role="concept">
2854 <primary>Tru64-Unix build-time settings</primary>
2855 </indexterm>
2856 when building Exim in many releases of the Tru64-Unix (formerly Digital UNIX,
2857 formerly DEC-OSF1) operating system, it is necessary to specify that the C
2858 compiler is called <emphasis>cc</emphasis> rather than <emphasis>gcc</emphasis>. Also, the compiler must be
2859 called with the option <option>-std1</option>, to make it recognize some of the features of
2860 Standard C that Exim uses. (Most other compilers recognize Standard C by
2861 default.) To do this, you should create a file called <filename>Local/Makefile-OSF1</filename>
2862 containing the lines
2863 </para>
2864 <literallayout class="monospaced">
2865 CC=cc
2866 CFLAGS=-std1
2867 </literallayout>
2868 <para>
2869 If you are compiling for just one operating system, it may be easier to put
2870 these lines directly into <filename>Local/Makefile</filename>.
2871 </para>
2872 <para>
2873 Keeping all your local configuration settings separate from the distributed
2874 files makes it easy to transfer them to new versions of Exim simply by copying
2875 the contents of the <filename>Local</filename> directory.
2876 </para>
2877 <para>
2878 <indexterm role="concept">
2879 <primary>NIS lookup type</primary>
2880 <secondary>including support for</secondary>
2881 </indexterm>
2882 <indexterm role="concept">
2883 <primary>NIS+ lookup type</primary>
2884 <secondary>including support for</secondary>
2885 </indexterm>
2886 <indexterm role="concept">
2887 <primary>LDAP</primary>
2888 <secondary>including support for</secondary>
2889 </indexterm>
2890 <indexterm role="concept">
2891 <primary>lookup</primary>
2892 <secondary>inclusion in binary</secondary>
2893 </indexterm>
2894 Exim contains support for doing LDAP, NIS, NIS+, and other kinds of file
2895 lookup, but not all systems have these components installed, so the default is
2896 not to include the relevant code in the binary. All the different kinds of file
2897 and database lookup that Exim supports are implemented as separate code modules
2898 which are included only if the relevant compile-time options are set. In the
2899 case of LDAP, NIS, and NIS+, the settings for <filename>Local/Makefile</filename> are:
2900 </para>
2901 <literallayout class="monospaced">
2902 LOOKUP_LDAP=yes
2903 LOOKUP_NIS=yes
2904 LOOKUP_NISPLUS=yes
2905 </literallayout>
2906 <para>
2907 and similar settings apply to the other lookup types. They are all listed in
2908 <filename>src/EDITME</filename>. In many cases the relevant include files and interface
2909 libraries need to be installed before compiling Exim.
2910 <indexterm role="concept">
2911 <primary>cdb</primary>
2912 <secondary>including support for</secondary>
2913 </indexterm>
2914 However, there are some optional lookup types (such as cdb) for which
2915 the code is entirely contained within Exim, and no external include
2916 files or libraries are required. When a lookup type is not included in the
2917 binary, attempts to configure Exim to use it cause run time configuration
2918 errors.
2919 </para>
2920 <para>
2921 <indexterm role="concept">
2922 <primary>pkg-config</primary>
2923 <secondary>lookups</secondary>
2924 </indexterm>
2925 <indexterm role="concept">
2926 <primary>pkg-config</primary>
2927 <secondary>authenticators</secondary>
2928 </indexterm>
2929 Many systems now use a tool called <emphasis>pkg-config</emphasis> to encapsulate information
2930 about how to compile against a library; Exim has some initial support for
2931 being able to use pkg-config for lookups and authenticators.  For any given
2932 makefile variable which starts <literal>LOOKUP_</literal> or <literal>AUTH_</literal>, you can add a new
2933 variable with the <literal>_PC</literal> suffix in the name and assign as the value the
2934 name of the package to be queried.  The results of querying via the
2935 <emphasis>pkg-config</emphasis> command will be added to the appropriate Makefile variables
2936 with <literal>+=</literal> directives, so your version of <emphasis>make</emphasis> will need to support that
2937 syntax.  For instance:
2938 </para>
2939 <literallayout class="monospaced">
2940 LOOKUP_SQLITE=yes
2941 LOOKUP_SQLITE_PC=sqlite3
2942 AUTH_GSASL=yes
2943 AUTH_GSASL_PC=libgsasl
2944 AUTH_HEIMDAL_GSSAPI=yes
2945 AUTH_HEIMDAL_GSSAPI_PC=heimdal-gssapi
2946 </literallayout>
2947 <para>
2948 <indexterm role="concept">
2949 <primary>Perl</primary>
2950 <secondary>including support for</secondary>
2951 </indexterm>
2952 Exim can be linked with an embedded Perl interpreter, allowing Perl
2953 subroutines to be called during string expansion. To enable this facility,
2954 </para>
2955 <literallayout class="monospaced">
2956 EXIM_PERL=perl.o
2957 </literallayout>
2958 <para>
2959 must be defined in <filename>Local/Makefile</filename>. Details of this facility are given in
2960 chapter <xref linkend="CHAPperl"/>.
2961 </para>
2962 <para>
2963 <indexterm role="concept">
2964 <primary>X11 libraries, location of</primary>
2965 </indexterm>
2966 The location of the X11 libraries is something that varies a lot between
2967 operating systems, and there may be different versions of X11 to cope
2968 with. Exim itself makes no use of X11, but if you are compiling the Exim
2969 monitor, the X11 libraries must be available.
2970 The following three variables are set in <filename>OS/Makefile-Default</filename>:
2971 </para>
2972 <literallayout class="monospaced">
2973 X11=/usr/X11R6
2974 XINCLUDE=-I$(X11)/include
2975 XLFLAGS=-L$(X11)/lib
2976 </literallayout>
2977 <para>
2978 These are overridden in some of the operating-system configuration files. For
2979 example, in <filename>OS/Makefile-SunOS5</filename> there is
2980 </para>
2981 <literallayout class="monospaced">
2982 X11=/usr/openwin
2983 XINCLUDE=-I$(X11)/include
2984 XLFLAGS=-L$(X11)/lib -R$(X11)/lib
2985 </literallayout>
2986 <para>
2987 If you need to override the default setting for your operating system, place a
2988 definition of all three of these variables into your
2989 <filename>Local/Makefile-&lt;ostype&gt;</filename> file.
2990 </para>
2991 <para>
2992 <indexterm role="concept">
2993 <primary>EXTRALIBS</primary>
2994 </indexterm>
2995 If you need to add any extra libraries to the link steps, these can be put in a
2996 variable called EXTRALIBS, which appears in all the link commands, but by
2997 default is not defined. In contrast, EXTRALIBS_EXIM is used only on the
2998 command for linking the main Exim binary, and not for any associated utilities.
2999 </para>
3000 <para>
3001 <indexterm role="concept">
3002 <primary>DBM libraries</primary>
3003 <secondary>configuration for building</secondary>
3004 </indexterm>
3005 There is also DBMLIB, which appears in the link commands for binaries that
3006 use DBM functions (see also section <xref linkend="SECTdb"/>). Finally, there is
3007 EXTRALIBS_EXIMON, which appears only in the link step for the Exim monitor
3008 binary, and which can be used, for example, to include additional X11
3009 libraries.
3010 </para>
3011 <para>
3012 <indexterm role="concept">
3013 <primary>configuration file</primary>
3014 <secondary>editing</secondary>
3015 </indexterm>
3016 The make file copes with rebuilding Exim correctly if any of the configuration
3017 files are edited. However, if an optional configuration file is deleted, it is
3018 necessary to touch the associated non-optional file (that is,
3019 <filename>Local/Makefile</filename> or <filename>Local/eximon.conf</filename>) before rebuilding.
3020 </para>
3021 </section>
3022 <section id="SECID30">
3023 <title>OS-specific header files</title>
3024 <para>
3025 <indexterm role="concept">
3026 <primary><filename>os.h</filename></primary>
3027 </indexterm>
3028 <indexterm role="concept">
3029 <primary>building Exim</primary>
3030 <secondary>OS-specific C header files</secondary>
3031 </indexterm>
3032 The <filename>OS</filename> directory contains a number of files with names of the form
3033 <filename>os.h-&lt;ostype&gt;</filename>. These are system-specific C header files that should not
3034 normally need to be changed. There is a list of macro settings that are
3035 recognized in the file <filename>OS/os.configuring</filename>, which should be consulted if you
3036 are porting Exim to a new operating system.
3037 </para>
3038 </section>
3039 <section id="SECID31">
3040 <title>Overriding build-time options for the monitor</title>
3041 <para>
3042 <indexterm role="concept">
3043 <primary>building Eximon</primary>
3044 </indexterm>
3045 A similar process is used for overriding things when building the Exim monitor,
3046 where the files that are involved are
3047 </para>
3048 <literallayout>
3049 <filename>OS/eximon.conf-Default</filename>
3050 <filename>OS/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
3051 <filename>Local/eximon.conf</filename>
3052 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
3053 <filename>Local/eximon.conf-</filename>&lt;<emphasis>archtype</emphasis>&gt;
3054 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
3055 </literallayout>
3056 <para>
3057 <indexterm role="concept">
3058 <primary><filename>Local/eximon.conf</filename></primary>
3059 </indexterm>
3060 As with Exim itself, the final three files need not exist, and in this case the
3061 <filename>OS/eximon.conf-&lt;ostype&gt;</filename> file is also optional. The default values in
3062 <filename>OS/eximon.conf-Default</filename> can be overridden dynamically by setting environment
3063 variables of the same name, preceded by EXIMON_. For example, setting
3064 EXIMON_LOG_DEPTH in the environment overrides the value of
3065 LOG_DEPTH at run time.
3066 <indexterm role="concept" startref="IIDbuex" class="endofrange"/>
3067 </para>
3068 </section>
3069 <section id="SECID32">
3070 <title>Installing Exim binaries and scripts</title>
3071 <para>
3072 <indexterm role="concept">
3073 <primary>installing Exim</primary>
3074 </indexterm>
3075 <indexterm role="concept">
3076 <primary>BIN_DIRECTORY</primary>
3077 </indexterm>
3078 The command <literal>make install</literal> runs the <command>exim_install</command> script with no
3079 arguments. The script copies binaries and utility scripts into the directory
3080 whose name is specified by the BIN_DIRECTORY setting in <filename>Local/Makefile</filename>.
3081 <indexterm role="concept">
3082 <primary>setuid</primary>
3083 <secondary>installing Exim with</secondary>
3084 </indexterm>
3085 The install script copies files only if they are newer than the files they are
3086 going to replace. The Exim binary is required to be owned by root and have the
3087 <emphasis>setuid</emphasis> bit set, for normal configurations. Therefore, you must run <literal>make
3088 install</literal> as root so that it can set up the Exim binary in this way. However, in
3089 some special situations (for example, if a host is doing no local deliveries)
3090 it may be possible to run Exim without making the binary setuid root (see
3091 chapter <xref linkend="CHAPsecurity"/> for details).
3092 </para>
3093 <para>
3094 <indexterm role="concept">
3095 <primary>CONFIGURE_FILE</primary>
3096 </indexterm>
3097 Exim&#x2019;s run time configuration file is named by the CONFIGURE_FILE setting
3098 in <filename>Local/Makefile</filename>. If this names a single file, and the file does not
3099 exist, the default configuration file <filename>src/configure.default</filename> is copied there
3100 by the installation script. If a run time configuration file already exists, it
3101 is left alone. If CONFIGURE_FILE is a colon-separated list, naming several
3102 alternative files, no default is installed.
3103 </para>
3104 <para>
3105 <indexterm role="concept">
3106 <primary>system aliases file</primary>
3107 </indexterm>
3108 <indexterm role="concept">
3109 <primary><filename>/etc/aliases</filename></primary>
3110 </indexterm>
3111 One change is made to the default configuration file when it is installed: the
3112 default configuration contains a router that references a system aliases file.
3113 The path to this file is set to the value specified by
3114 SYSTEM_ALIASES_FILE in <filename>Local/Makefile</filename> (<filename>/etc/aliases</filename> by default).
3115 If the system aliases file does not exist, the installation script creates it,
3116 and outputs a comment to the user.
3117 </para>
3118 <para>
3119 The created file contains no aliases, but it does contain comments about the
3120 aliases a site should normally have. Mail aliases have traditionally been
3121 kept in <filename>/etc/aliases</filename>. However, some operating systems are now using
3122 <filename>/etc/mail/aliases</filename>. You should check if yours is one of these, and change
3123 Exim&#x2019;s configuration if necessary.
3124 </para>
3125 <para>
3126 The default configuration uses the local host&#x2019;s name as the only local domain,
3127 and is set up to do local deliveries into the shared directory <filename>/var/mail</filename>,
3128 running as the local user. System aliases and <filename>.forward</filename> files in users&#x2019; home
3129 directories are supported, but no NIS or NIS+ support is configured. Domains
3130 other than the name of the local host are routed using the DNS, with delivery
3131 over SMTP.
3132 </para>
3133 <para>
3134 It is possible to install Exim for special purposes (such as building a binary
3135 distribution) in a private part of the file system. You can do this by a
3136 command such as
3137 </para>
3138 <literallayout class="monospaced">
3139 make DESTDIR=/some/directory/ install
3140 </literallayout>
3141 <para>
3142 This has the effect of pre-pending the specified directory to all the file
3143 paths, except the name of the system aliases file that appears in the default
3144 configuration. (If a default alias file is created, its name <emphasis>is</emphasis> modified.)
3145 For backwards compatibility, ROOT is used if DESTDIR is not set,
3146 but this usage is deprecated.
3147 </para>
3148 <para>
3149 <indexterm role="concept">
3150 <primary>installing Exim</primary>
3151 <secondary>what is not installed</secondary>
3152 </indexterm>
3153 Running <emphasis>make install</emphasis> does not copy the Exim 4 conversion script
3154 <emphasis>convert4r4</emphasis>. You will probably run this only once if you are
3155 upgrading from Exim 3. None of the documentation files in the <filename>doc</filename>
3156 directory are copied, except for the info files when you have set
3157 INFO_DIRECTORY, as described in section <xref linkend="SECTinsinfdoc"/> below.
3158 </para>
3159 <para>
3160 For the utility programs, old versions are renamed by adding the suffix <filename>.O</filename>
3161 to their names. The Exim binary itself, however, is handled differently. It is
3162 installed under a name that includes the version number and the compile number,
3163 for example <filename>exim-4.87.1-1</filename>. The script then arranges for a symbolic link
3164 called <filename>exim</filename> to point to the binary. If you are updating a previous version
3165 of Exim, the script takes care to ensure that the name <filename>exim</filename> is never absent
3166 from the directory (as seen by other processes).
3167 </para>
3168 <para>
3169 <indexterm role="concept">
3170 <primary>installing Exim</primary>
3171 <secondary>testing the script</secondary>
3172 </indexterm>
3173 If you want to see what the <emphasis>make install</emphasis> will do before running it for
3174 real, you can pass the <option>-n</option> option to the installation script by this
3175 command:
3176 </para>
3177 <literallayout class="monospaced">
3178 make INSTALL_ARG=-n install
3179 </literallayout>
3180 <para>
3181 The contents of the variable INSTALL_ARG are passed to the installation
3182 script. You do not need to be root to run this test. Alternatively, you can run
3183 the installation script directly, but this must be from within the build
3184 directory. For example, from the top-level Exim directory you could use this
3185 command:
3186 </para>
3187 <literallayout class="monospaced">
3188 (cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n)
3189 </literallayout>
3190 <para>
3191 <indexterm role="concept">
3192 <primary>installing Exim</primary>
3193 <secondary>install script options</secondary>
3194 </indexterm>
3195 There are two other options that can be supplied to the installation script.
3196 </para>
3197 <itemizedlist>
3198 <listitem>
3199 <para>
3200 <option>-no_chown</option> bypasses the call to change the owner of the installed binary
3201 to root, and the call to make it a setuid binary.
3202 </para>
3203 </listitem>
3204 <listitem>
3205 <para>
3206 <option>-no_symlink</option> bypasses the setting up of the symbolic link <filename>exim</filename> to the
3207 installed binary.
3208 </para>
3209 </listitem>
3210 </itemizedlist>
3211 <para>
3212 INSTALL_ARG can be used to pass these options to the script. For example:
3213 </para>
3214 <literallayout class="monospaced">
3215 make INSTALL_ARG=-no_symlink install
3216 </literallayout>
3217 <para>
3218 The installation script can also be given arguments specifying which files are
3219 to be copied. For example, to install just the Exim binary, and nothing else,
3220 without creating the symbolic link, you could use:
3221 </para>
3222 <literallayout class="monospaced">
3223 make INSTALL_ARG='-no_symlink exim' install
3224 </literallayout>
3225 </section>
3226 <section id="SECTinsinfdoc">
3227 <title>Installing info documentation</title>
3228 <para>
3229 <indexterm role="concept">
3230 <primary>installing Exim</primary>
3231 <secondary><emphasis>info</emphasis> documentation</secondary>
3232 </indexterm>
3233 Not all systems use the GNU <emphasis>info</emphasis> system for documentation, and for this
3234 reason, the Texinfo source of Exim&#x2019;s documentation is not included in the main
3235 distribution. Instead it is available separately from the ftp site (see section
3236 <xref linkend="SECTavail"/>).
3237 </para>
3238 <para>
3239 If you have defined INFO_DIRECTORY in <filename>Local/Makefile</filename> and the Texinfo
3240 source of the documentation is found in the source tree, running <literal>make
3241 install</literal> automatically builds the info files and installs them.
3242 </para>
3243 </section>
3244 <section id="SECID33">
3245 <title>Setting up the spool directory</title>
3246 <para>
3247 <indexterm role="concept">
3248 <primary>spool directory</primary>
3249 <secondary>creating</secondary>
3250 </indexterm>
3251 When it starts up, Exim tries to create its spool directory if it does not
3252 exist. The Exim uid and gid are used for the owner and group of the spool
3253 directory. Sub-directories are automatically created in the spool directory as
3254 necessary.
3255 </para>
3256 </section>
3257 <section id="SECID34">
3258 <title>Testing</title>
3259 <para>
3260 <indexterm role="concept">
3261 <primary>testing</primary>
3262 <secondary>installation</secondary>
3263 </indexterm>
3264 Having installed Exim, you can check that the run time configuration file is
3265 syntactically valid by running the following command, which assumes that the
3266 Exim binary directory is within your PATH environment variable:
3267 </para>
3268 <literallayout class="monospaced">
3269 exim -bV
3270 </literallayout>
3271 <para>
3272 If there are any errors in the configuration file, Exim outputs error messages.
3273 Otherwise it outputs the version number and build date,
3274 the DBM library that is being used, and information about which drivers and
3275 other optional code modules are included in the binary.
3276 Some simple routing tests can be done by using the address testing option. For
3277 example,
3278 </para>
3279 <literallayout>
3280 <literal>exim -bt</literal> &lt;<emphasis>local username</emphasis>&gt;
3281 </literallayout>
3282 <para>
3283 should verify that it recognizes a local mailbox, and
3284 </para>
3285 <literallayout>
3286 <literal>exim -bt</literal> &lt;<emphasis>remote address</emphasis>&gt;
3287 </literallayout>
3288 <para>
3289 a remote one. Then try getting it to deliver mail, both locally and remotely.
3290 This can be done by passing messages directly to Exim, without going through a
3291 user agent. For example:
3292 </para>
3293 <literallayout class="monospaced">
3294 exim -v postmaster@your.domain.example
3295 From: user@your.domain.example
3296 To: postmaster@your.domain.example
3297 Subject: Testing Exim
3298
3299 This is a test message.
3300 ^D
3301 </literallayout>
3302 <para>
3303 The <option>-v</option> option causes Exim to output some verification of what it is doing.
3304 In this case you should see copies of three log lines, one for the message&#x2019;s
3305 arrival, one for its delivery, and one containing <quote>Completed</quote>.
3306 </para>
3307 <para>
3308 <indexterm role="concept">
3309 <primary>delivery</primary>
3310 <secondary>problems with</secondary>
3311 </indexterm>
3312 If you encounter problems, look at Exim&#x2019;s log files (<emphasis>mainlog</emphasis> and
3313 <emphasis>paniclog</emphasis>) to see if there is any relevant information there. Another source
3314 of information is running Exim with debugging turned on, by specifying the
3315 <option>-d</option> option. If a message is stuck on Exim&#x2019;s spool, you can force a delivery
3316 with debugging turned on by a command of the form
3317 </para>
3318 <literallayout>
3319 <literal>exim -d -M</literal> &lt;<emphasis>exim-message-id</emphasis>&gt;
3320 </literallayout>
3321 <para>
3322 You must be root or an <quote>admin user</quote> in order to do this. The <option>-d</option> option
3323 produces rather a lot of output, but you can cut this down to specific areas.
3324 For example, if you use <option>-d-all+route</option> only the debugging information
3325 relevant to routing is included. (See the <option>-d</option> option in chapter
3326 <xref linkend="CHAPcommandline"/> for more details.)
3327 </para>
3328 <para>
3329 <indexterm role="concept">
3330 <primary><quote>sticky</quote> bit</primary>
3331 </indexterm>
3332 <indexterm role="concept">
3333 <primary>lock files</primary>
3334 </indexterm>
3335 One specific problem that has shown up on some sites is the inability to do
3336 local deliveries into a shared mailbox directory, because it does not have the
3337 <quote>sticky bit</quote> set on it. By default, Exim tries to create a lock file before
3338 writing to a mailbox file, and if it cannot create the lock file, the delivery
3339 is deferred. You can get round this either by setting the <quote>sticky bit</quote> on the
3340 directory, or by setting a specific group for local deliveries and allowing
3341 that group to create files in the directory (see the comments above the
3342 <command>local_delivery</command> transport in the default configuration file). Another
3343 approach is to configure Exim not to use lock files, but just to rely on
3344 <function>fcntl()</function> locking instead. However, you should do this only if all user
3345 agents also use <function>fcntl()</function> locking. For further discussion of locking issues,
3346 see chapter <xref linkend="CHAPappendfile"/>.
3347 </para>
3348 <para>
3349 One thing that cannot be tested on a system that is already running an MTA is
3350 the receipt of incoming SMTP mail on the standard SMTP port. However, the
3351 <option>-oX</option> option can be used to run an Exim daemon that listens on some other
3352 port, or <emphasis>inetd</emphasis> can be used to do this. The <option>-bh</option> option and the
3353 <emphasis>exim_checkaccess</emphasis> utility can be used to check out policy controls on
3354 incoming SMTP mail.
3355 </para>
3356 <para>
3357 Testing a new version on a system that is already running Exim can most easily
3358 be done by building a binary with a different CONFIGURE_FILE setting. From
3359 within the run time configuration, all other file and directory names
3360 that Exim uses can be altered, in order to keep it entirely clear of the
3361 production version.
3362 </para>
3363 </section>
3364 <section id="SECID35">
3365 <title>Replacing another MTA with Exim</title>
3366 <para>
3367 <indexterm role="concept">
3368 <primary>replacing another MTA</primary>
3369 </indexterm>
3370 Building and installing Exim for the first time does not of itself put it in
3371 general use. The name by which the system&#x2019;s MTA is called by mail user agents
3372 is either <filename>/usr/sbin/sendmail</filename>, or <filename>/usr/lib/sendmail</filename> (depending on the
3373 operating system), and it is necessary to make this name point to the <emphasis>exim</emphasis>
3374 binary in order to get the user agents to pass messages to Exim. This is
3375 normally done by renaming any existing file and making <filename>/usr/sbin/sendmail</filename>
3376 or <filename>/usr/lib/sendmail</filename>
3377 <indexterm role="concept">
3378 <primary>symbolic link</primary>
3379 <secondary>to <emphasis>exim</emphasis> binary</secondary>
3380 </indexterm>
3381 a symbolic link to the <emphasis>exim</emphasis> binary. It is a good idea to remove any setuid
3382 privilege and executable status from the old MTA. It is then necessary to stop
3383 and restart the mailer daemon, if one is running.
3384 </para>
3385 <para>
3386 <indexterm role="concept">
3387 <primary>FreeBSD, MTA indirection</primary>
3388 </indexterm>
3389 <indexterm role="concept">
3390 <primary><filename>/etc/mail/mailer.conf</filename></primary>
3391 </indexterm>
3392 Some operating systems have introduced alternative ways of switching MTAs. For
3393 example, if you are running FreeBSD, you need to edit the file
3394 <filename>/etc/mail/mailer.conf</filename> instead of setting up a symbolic link as just
3395 described. A typical example of the contents of this file for running Exim is
3396 as follows:
3397 </para>
3398 <literallayout class="monospaced">
3399 sendmail            /usr/exim/bin/exim
3400 send-mail           /usr/exim/bin/exim
3401 mailq               /usr/exim/bin/exim -bp
3402 newaliases          /usr/bin/true
3403 </literallayout>
3404 <para>
3405 Once you have set up the symbolic link, or edited <filename>/etc/mail/mailer.conf</filename>,
3406 your Exim installation is <quote>live</quote>. Check it by sending a message from your
3407 favourite user agent.
3408 </para>
3409 <para>
3410 You should consider what to tell your users about the change of MTA. Exim may
3411 have different capabilities to what was previously running, and there are
3412 various operational differences such as the text of messages produced by
3413 command line options and in bounce messages. If you allow your users to make
3414 use of Exim&#x2019;s filtering capabilities, you should make the document entitled
3415 <emphasis>Exim&#x2019;s interface to mail filtering</emphasis> available to them.
3416 </para>
3417 </section>
3418 <section id="SECID36">
3419 <title>Upgrading Exim</title>
3420 <para>
3421 <indexterm role="concept">
3422 <primary>upgrading Exim</primary>
3423 </indexterm>
3424 If you are already running Exim on your host, building and installing a new
3425 version automatically makes it available to MUAs, or any other programs that
3426 call the MTA directly. However, if you are running an Exim daemon, you do need
3427 to send it a HUP signal, to make it re-execute itself, and thereby pick up the
3428 new binary. You do not need to stop processing mail in order to install a new
3429 version of Exim. The install script does not modify an existing runtime
3430 configuration file.
3431 </para>
3432 </section>
3433 <section id="SECID37">
3434 <title>Stopping the Exim daemon on Solaris</title>
3435 <para>
3436 <indexterm role="concept">
3437 <primary>Solaris</primary>
3438 <secondary>stopping Exim on</secondary>
3439 </indexterm>
3440 The standard command for stopping the mailer daemon on Solaris is
3441 </para>
3442 <literallayout class="monospaced">
3443 /etc/init.d/sendmail stop
3444 </literallayout>
3445 <para>
3446 If <filename>/usr/lib/sendmail</filename> has been turned into a symbolic link, this script
3447 fails to stop Exim because it uses the command <emphasis>ps -e</emphasis> and greps the output
3448 for the text <quote>sendmail</quote>; this is not present because the actual program name
3449 (that is, <quote>exim</quote>) is given by the <emphasis>ps</emphasis> command with these options. A
3450 solution is to replace the line that finds the process id with something like
3451 </para>
3452 <literallayout class="monospaced">
3453 pid=`cat /var/spool/exim/exim-daemon.pid`
3454 </literallayout>
3455 <para>
3456 to obtain the daemon&#x2019;s pid directly from the file that Exim saves it in.
3457 </para>
3458 <para>
3459 Note, however, that stopping the daemon does not <quote>stop Exim</quote>. Messages can
3460 still be received from local processes, and if automatic delivery is configured
3461 (the normal case), deliveries will still occur.
3462 </para>
3463 </section>
3464 </chapter>
3465
3466 <chapter id="CHAPcommandline">
3467 <title>The Exim command line</title>
3468 <para>
3469 <indexterm role="concept" id="IIDclo1" class="startofrange">
3470 <primary>command line</primary>
3471 <secondary>options</secondary>
3472 </indexterm>
3473 <indexterm role="concept" id="IIDclo2" class="startofrange">
3474 <primary>options</primary>
3475 <secondary>command line</secondary>
3476 </indexterm>
3477 Exim&#x2019;s command line takes the standard Unix form of a sequence of options,
3478 each starting with a hyphen character, followed by a number of arguments. The
3479 options are compatible with the main options of Sendmail, and there are also
3480 some additional options, some of which are compatible with Smail 3. Certain
3481 combinations of options do not make sense, and provoke an error if used.
3482 The form of the arguments depends on which options are set.
3483 </para>
3484 <section id="SECID38">
3485 <title>Setting options by program name</title>
3486 <para>
3487 <indexterm role="concept">
3488 <primary><emphasis>mailq</emphasis></primary>
3489 </indexterm>
3490 If Exim is called under the name <emphasis>mailq</emphasis>, it behaves as if the option <option>-bp</option>
3491 were present before any other options.
3492 The <option>-bp</option> option requests a listing of the contents of the mail queue on the
3493 standard output.
3494 This feature is for compatibility with some systems that contain a command of
3495 that name in one of the standard libraries, symbolically linked to
3496 <filename>/usr/sbin/sendmail</filename> or <filename>/usr/lib/sendmail</filename>.
3497 </para>
3498 <para>
3499 <indexterm role="concept">
3500 <primary><emphasis>rsmtp</emphasis></primary>
3501 </indexterm>
3502 If Exim is called under the name <emphasis>rsmtp</emphasis> it behaves as if the option <option>-bS</option>
3503 were present before any other options, for compatibility with Smail. The
3504 <option>-bS</option> option is used for reading in a number of messages in batched SMTP
3505 format.
3506 </para>
3507 <para>
3508 <indexterm role="concept">
3509 <primary><emphasis>rmail</emphasis></primary>
3510 </indexterm>
3511 If Exim is called under the name <emphasis>rmail</emphasis> it behaves as if the <option>-i</option> and
3512 <option>-oee</option> options were present before any other options, for compatibility with
3513 Smail. The name <emphasis>rmail</emphasis> is used as an interface by some UUCP systems.
3514 </para>
3515 <para>
3516 <indexterm role="concept">
3517 <primary><emphasis>runq</emphasis></primary>
3518 </indexterm>
3519 <indexterm role="concept">
3520 <primary>queue runner</primary>
3521 </indexterm>
3522 If Exim is called under the name <emphasis>runq</emphasis> it behaves as if the option <option>-q</option>
3523 were present before any other options, for compatibility with Smail. The <option>-q</option>
3524 option causes a single queue runner process to be started.
3525 </para>
3526 <para>
3527 <indexterm role="concept">
3528 <primary><emphasis>newaliases</emphasis></primary>
3529 </indexterm>
3530 <indexterm role="concept">
3531 <primary>alias file</primary>
3532 <secondary>building</secondary>
3533 </indexterm>
3534 <indexterm role="concept">
3535 <primary>Sendmail compatibility</primary>
3536 <secondary>calling Exim as <emphasis>newaliases</emphasis></secondary>
3537 </indexterm>
3538 If Exim is called under the name <emphasis>newaliases</emphasis> it behaves as if the option
3539 <option>-bi</option> were present before any other options, for compatibility with Sendmail.
3540 This option is used for rebuilding Sendmail&#x2019;s alias file. Exim does not have
3541 the concept of a single alias file, but can be configured to run a given
3542 command if called with the <option>-bi</option> option.
3543 </para>
3544 </section>
3545 <section id="SECTtrustedadmin">
3546 <title>Trusted and admin users</title>
3547 <para>
3548 Some Exim options are available only to <emphasis>trusted users</emphasis> and others are
3549 available only to <emphasis>admin users</emphasis>. In the description below, the phrases <quote>Exim
3550 user</quote> and <quote>Exim group</quote> mean the user and group defined by EXIM_USER and
3551 EXIM_GROUP in <filename>Local/Makefile</filename> or set by the <option>exim_user</option> and
3552 <option>exim_group</option> options. These do not necessarily have to use the name <quote>exim</quote>.
3553 </para>
3554 <itemizedlist>
3555 <listitem>
3556 <para>
3557 <indexterm role="concept">
3558 <primary>trusted users</primary>
3559 <secondary>definition of</secondary>
3560 </indexterm>
3561 <indexterm role="concept">
3562 <primary>user</primary>
3563 <secondary>trusted definition of</secondary>
3564 </indexterm>
3565 The trusted users are root, the Exim user, any user listed in the
3566 <option>trusted_users</option> configuration option, and any user whose current group or any
3567 supplementary group is one of those listed in the <option>trusted_groups</option>
3568 configuration option. Note that the Exim group is not automatically trusted.
3569 </para>
3570 <para>
3571 <indexterm role="concept">
3572 <primary><quote>From</quote> line</primary>
3573 </indexterm>
3574 <indexterm role="concept">
3575 <primary>envelope sender</primary>
3576 </indexterm>
3577 Trusted users are always permitted to use the <option>-f</option> option or a leading
3578 <quote>From&nbsp;</quote> line to specify the envelope sender of a message that is passed to
3579 Exim through the local interface (see the <option>-bm</option> and <option>-f</option> options below).
3580 See the <option>untrusted_set_sender</option> option for a way of permitting non-trusted
3581 users to set envelope senders.
3582 </para>
3583 <para>
3584 <indexterm role="concept">
3585 <primary><emphasis>From:</emphasis> header line</primary>
3586 </indexterm>
3587 <indexterm role="concept">
3588 <primary><emphasis>Sender:</emphasis> header line</primary>
3589 </indexterm>
3590 For a trusted user, there is never any check on the contents of the <emphasis>From:</emphasis>
3591 header line, and a <emphasis>Sender:</emphasis> line is never added. Furthermore, any existing
3592 <emphasis>Sender:</emphasis> line in incoming local (non-TCP/IP) messages is not removed.
3593 </para>
3594 <para>
3595 Trusted users may also specify a host name, host address, interface address,
3596 protocol name, ident value, and authentication data when submitting a message
3597 locally. Thus, they are able to insert messages into Exim&#x2019;s queue locally that
3598 have the characteristics of messages received from a remote host. Untrusted
3599 users may in some circumstances use <option>-f</option>, but can never set the other values
3600 that are available to trusted users.
3601 </para>
3602 </listitem>
3603 <listitem>
3604 <para>
3605 <indexterm role="concept">
3606 <primary>user</primary>
3607 <secondary>admin definition of</secondary>
3608 </indexterm>
3609 <indexterm role="concept">
3610 <primary>admin user</primary>
3611 <secondary>definition of</secondary>
3612 </indexterm>
3613 The admin users are root, the Exim user, and any user that is a member of the
3614 Exim group or of any group listed in the <option>admin_groups</option> configuration option.
3615 The current group does not have to be one of these groups.
3616 </para>
3617 <para>
3618 Admin users are permitted to list the queue, and to carry out certain
3619 operations on messages, for example, to force delivery failures. It is also
3620 necessary to be an admin user in order to see the full information provided by
3621 the Exim monitor, and full debugging output.
3622 </para>
3623 <para>
3624 By default, the use of the <option>-M</option>, <option>-q</option>, <option>-R</option>, and <option>-S</option> options to cause
3625 Exim to attempt delivery of messages on its queue is restricted to admin users.
3626 However, this restriction can be relaxed by setting the <option>prod_requires_admin</option>
3627 option false (that is, specifying <option>no_prod_requires_admin</option>).
3628 </para>
3629 <para>
3630 Similarly, the use of the <option>-bp</option> option to list all the messages in the queue
3631 is restricted to admin users unless <option>queue_list_requires_admin</option> is set
3632 false.
3633 </para>
3634 </listitem>
3635 </itemizedlist>
3636 <para>
3637 <emphasis role="bold">Warning</emphasis>: If you configure your system so that admin users are able to
3638 edit Exim&#x2019;s configuration file, you are giving those users an easy way of
3639 getting root. There is further discussion of this issue at the start of chapter
3640 <xref linkend="CHAPconf"/>.
3641 </para>
3642 </section>
3643 <section id="SECID39">
3644 <title>Command line options</title>
3645 <para>
3646 Exim&#x2019;s command line options are described in alphabetical order below. If none
3647 of the options that specifies a specific action (such as starting the daemon or
3648 a queue runner, or testing an address, or receiving a message in a specific
3649 format, or listing the queue) are present, and there is at least one argument
3650 on the command line, <option>-bm</option> (accept a local message on the standard input,
3651 with the arguments specifying the recipients) is assumed. Otherwise, Exim
3652 outputs a brief message about itself and exits.
3653 </para>
3654 <!-- === Start of command line options === -->
3655 <variablelist>
3656 <varlistentry>
3657 <term><option>--</option></term>
3658 <listitem>
3659 <para>
3660 <indexterm role="option">
3661 <primary>--</primary>
3662 </indexterm>
3663 <indexterm role="concept">
3664 <primary>options</primary>
3665 <secondary>command line; terminating</secondary>
3666 </indexterm>
3667 This is a pseudo-option whose only purpose is to terminate the options and
3668 therefore to cause subsequent command line items to be treated as arguments
3669 rather than options, even if they begin with hyphens.
3670 </para>
3671 </listitem></varlistentry>
3672 <varlistentry>
3673 <term><option>--help</option></term>
3674 <listitem>
3675 <para>
3676 <indexterm role="option">
3677 <primary><option>--help</option></primary>
3678 </indexterm>
3679 This option causes Exim to output a few sentences stating what it is.
3680 The same output is generated if the Exim binary is called with no options and
3681 no arguments.
3682 </para>
3683 </listitem></varlistentry>
3684 <varlistentry>
3685 <term><option>--version</option></term>
3686 <listitem>
3687 <para>
3688 <indexterm role="option">
3689 <primary><option>--version</option></primary>
3690 </indexterm>
3691 This option is an alias for <option>-bV</option> and causes version information to be
3692 displayed.
3693 </para>
3694 </listitem></varlistentry>
3695 <varlistentry>
3696 <term><option>-Ac</option></term>
3697 <term><option>-Am</option></term>
3698 <listitem>
3699 <para>
3700 <indexterm role="option">
3701 <primary><option>-Ac</option></primary>
3702 </indexterm>
3703 <indexterm role="option">
3704 <primary><option>-Am</option></primary>
3705 </indexterm>
3706 These options are used by Sendmail for selecting configuration files and are
3707 ignored by Exim.
3708 </para>
3709 </listitem></varlistentry>
3710 <varlistentry>
3711 <term><option>-B</option>&lt;<emphasis>type</emphasis>&gt;</term>
3712 <listitem>
3713 <para>
3714 <indexterm role="option">
3715 <primary><option>-B</option></primary>
3716 </indexterm>
3717 <indexterm role="concept">
3718 <primary>8-bit characters</primary>
3719 </indexterm>
3720 <indexterm role="concept">
3721 <primary>Sendmail compatibility</primary>
3722 <secondary>8-bit characters</secondary>
3723 </indexterm>
3724 This is a Sendmail option for selecting 7 or 8 bit processing. Exim is 8-bit
3725 clean; it ignores this option.
3726 </para>
3727 </listitem></varlistentry>
3728 <varlistentry>
3729 <term><option>-bd</option></term>
3730 <listitem>
3731 <para>
3732 <indexterm role="option">
3733 <primary><option>-bd</option></primary>
3734 </indexterm>
3735 <indexterm role="concept">
3736 <primary>daemon</primary>
3737 </indexterm>
3738 <indexterm role="concept">
3739 <primary>SMTP</primary>
3740 <secondary>listener</secondary>
3741 </indexterm>
3742 <indexterm role="concept">
3743 <primary>queue runner</primary>
3744 </indexterm>
3745 This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually
3746 the <option>-bd</option> option is combined with the <option>-q</option>&lt;<emphasis>time</emphasis>&gt; option, to specify
3747 that the daemon should also initiate periodic queue runs.
3748 </para>
3749 <para>
3750 The <option>-bd</option> option can be used only by an admin user. If either of the <option>-d</option>
3751 (debugging) or <option>-v</option> (verifying) options are set, the daemon does not
3752 disconnect from the controlling terminal. When running this way, it can be
3753 stopped by pressing ctrl-C.
3754 </para>
3755 <para>
3756 By default, Exim listens for incoming connections to the standard SMTP port on
3757 all the host&#x2019;s running interfaces. However, it is possible to listen on other
3758 ports, on multiple ports, and only on specific interfaces. Chapter
3759 <xref linkend="CHAPinterfaces"/> contains a description of the options that control this.
3760 </para>
3761 <para>
3762 When a listening daemon
3763 <indexterm role="concept">
3764 <primary>daemon</primary>
3765 <secondary>process id (pid)</secondary>
3766 </indexterm>
3767 <indexterm role="concept">
3768 <primary>pid (process id)</primary>
3769 <secondary>of daemon</secondary>
3770 </indexterm>
3771 is started without the use of <option>-oX</option> (that is, without overriding the normal
3772 configuration), it writes its process id to a file called <filename>exim-daemon.pid</filename>
3773 in Exim&#x2019;s spool directory. This location can be overridden by setting
3774 PID_FILE_PATH in <filename>Local/Makefile</filename>. The file is written while Exim is still
3775 running as root.
3776 </para>
3777 <para>
3778 When <option>-oX</option> is used on the command line to start a listening daemon, the
3779 process id is not written to the normal pid file path. However, <option>-oP</option> can be
3780 used to specify a path on the command line if a pid file is required.
3781 </para>
3782 <para>
3783 The SIGHUP signal
3784 <indexterm role="concept">
3785 <primary>SIGHUP</primary>
3786 </indexterm>
3787 <indexterm role="concept">
3788 <primary>daemon</primary>
3789 <secondary>restarting</secondary>
3790 </indexterm>
3791 can be used to cause the daemon to re-execute itself. This should be done
3792 whenever Exim&#x2019;s configuration file, or any file that is incorporated into it by
3793 means of the <option>.include</option> facility, is changed, and also whenever a new version
3794 of Exim is installed. It is not necessary to do this when other files that are
3795 referenced from the configuration (for example, alias files) are changed,
3796 because these are reread each time they are used.
3797 </para>
3798 </listitem></varlistentry>
3799 <varlistentry>
3800 <term><option>-bdf</option></term>
3801 <listitem>
3802 <para>
3803 <indexterm role="option">
3804 <primary><option>-bdf</option></primary>
3805 </indexterm>
3806 This option has the same effect as <option>-bd</option> except that it never disconnects
3807 from the controlling terminal, even when no debugging is specified.
3808 </para>
3809 </listitem></varlistentry>
3810 <varlistentry>
3811 <term><option>-be</option></term>
3812 <listitem>
3813 <para>
3814 <indexterm role="option">
3815 <primary><option>-be</option></primary>
3816 </indexterm>
3817 <indexterm role="concept">
3818 <primary>testing</primary>
3819 <secondary>string expansion</secondary>
3820 </indexterm>
3821 <indexterm role="concept">
3822 <primary>expansion</primary>
3823 <secondary>testing</secondary>
3824 </indexterm>
3825 Run Exim in expansion testing mode. Exim discards its root privilege, to
3826 prevent ordinary users from using this mode to read otherwise inaccessible
3827 files. If no arguments are given, Exim runs interactively, prompting for lines
3828 of data. Otherwise, it processes each argument in turn.
3829 </para>
3830 <para>
3831 If Exim was built with USE_READLINE=yes in <filename>Local/Makefile</filename>, it tries
3832 to load the <option>libreadline</option> library dynamically whenever the <option>-be</option> option is
3833 used without command line arguments. If successful, it uses the <function>readline()</function>
3834 function, which provides extensive line-editing facilities, for reading the
3835 test data. A line history is supported.
3836 </para>
3837 <para>
3838 Long expansion expressions can be split over several lines by using backslash
3839 continuations. As in Exim&#x2019;s run time configuration, white space at the start of
3840 continuation lines is ignored. Each argument or data line is passed through the
3841 string expansion mechanism, and the result is output. Variable values from the
3842 configuration file (for example, <varname>$qualify_domain</varname>) are available, but no
3843 message-specific values (such as <varname>$message_exim_id</varname>) are set, because no message
3844 is being processed (but see <option>-bem</option> and <option>-Mset</option>).
3845 </para>
3846 <para>
3847 <emphasis role="bold">Note</emphasis>: If you use this mechanism to test lookups, and you change the data
3848 files or databases you are using, you must exit and restart Exim before trying
3849 the same lookup again. Otherwise, because each Exim process caches the results
3850 of lookups, you will just get the same result as before.
3851 </para>
3852 </listitem></varlistentry>
3853 <varlistentry>
3854 <term><option>-bem</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3855 <listitem>
3856 <para>
3857 <indexterm role="option">
3858 <primary><option>-bem</option></primary>
3859 </indexterm>
3860 <indexterm role="concept">
3861 <primary>testing</primary>
3862 <secondary>string expansion</secondary>
3863 </indexterm>
3864 <indexterm role="concept">
3865 <primary>expansion</primary>
3866 <secondary>testing</secondary>
3867 </indexterm>
3868 This option operates like <option>-be</option> except that it must be followed by the name
3869 of a file. For example:
3870 </para>
3871 <literallayout class="monospaced">
3872 exim -bem /tmp/testmessage
3873 </literallayout>
3874 <para>
3875 The file is read as a message (as if receiving a locally-submitted non-SMTP
3876 message) before any of the test expansions are done. Thus, message-specific
3877 variables such as <varname>$message_size</varname> and <varname>$header_from:</varname> are available. However,
3878 no <emphasis>Received:</emphasis> header is added to the message. If the <option>-t</option> option is set,
3879 recipients are read from the headers in the normal way, and are shown in the
3880 <varname>$recipients</varname> variable. Note that recipients cannot be given on the command
3881 line, because further arguments are taken as strings to expand (just like
3882 <option>-be</option>).
3883 </para>
3884 </listitem></varlistentry>
3885 <varlistentry>
3886 <term><option>-bF</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3887 <listitem>
3888 <para>
3889 <indexterm role="option">
3890 <primary><option>-bF</option></primary>
3891 </indexterm>
3892 <indexterm role="concept">
3893 <primary>system filter</primary>
3894 <secondary>testing</secondary>
3895 </indexterm>
3896 <indexterm role="concept">
3897 <primary>testing</primary>
3898 <secondary>system filter</secondary>
3899 </indexterm>
3900 This option is the same as <option>-bf</option> except that it assumes that the filter being
3901 tested is a system filter. The additional commands that are available only in
3902 system filters are recognized.
3903 </para>
3904 </listitem></varlistentry>
3905 <varlistentry>
3906 <term><option>-bf</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3907 <listitem>
3908 <para>
3909 <indexterm role="option">
3910 <primary><option>-bf</option></primary>
3911 </indexterm>
3912 <indexterm role="concept">
3913 <primary>filter</primary>
3914 <secondary>testing</secondary>
3915 </indexterm>
3916 <indexterm role="concept">
3917 <primary>testing</primary>
3918 <secondary>filter file</secondary>
3919 </indexterm>
3920 <indexterm role="concept">
3921 <primary>forward file</primary>
3922 <secondary>testing</secondary>
3923 </indexterm>
3924 <indexterm role="concept">
3925 <primary>testing</primary>
3926 <secondary>forward file</secondary>
3927 </indexterm>
3928 <indexterm role="concept">
3929 <primary>Sieve filter</primary>
3930 <secondary>testing</secondary>
3931 </indexterm>
3932 This option runs Exim in user filter testing mode; the file is the filter file
3933 to be tested, and a test message must be supplied on the standard input. If
3934 there are no message-dependent tests in the filter, an empty file can be
3935 supplied.
3936 </para>
3937 <para>
3938 If you want to test a system filter file, use <option>-bF</option> instead of <option>-bf</option>. You
3939 can use both <option>-bF</option> and <option>-bf</option> on the same command, in order to test a system
3940 filter and a user filter in the same run. For example:
3941 </para>
3942 <literallayout class="monospaced">
3943 exim -bF /system/filter -bf /user/filter &lt;/test/message
3944 </literallayout>
3945 <para>
3946 This is helpful when the system filter adds header lines or sets filter
3947 variables that are used by the user filter.
3948 </para>
3949 <para>
3950 If the test filter file does not begin with one of the special lines
3951 </para>
3952 <literallayout class="monospaced">
3953 # Exim filter
3954 # Sieve filter
3955 </literallayout>
3956 <para>
3957 it is taken to be a normal <filename>.forward</filename> file, and is tested for validity under
3958 that interpretation. See sections <xref linkend="SECTitenonfilred"/> to
3959 <xref linkend="SECTspecitredli"/> for a description of the possible contents of non-filter
3960 redirection lists.
3961 </para>
3962 <para>
3963 The result of an Exim command that uses <option>-bf</option>, provided no errors are
3964 detected, is a list of the actions that Exim would try to take if presented
3965 with the message for real. More details of filter testing are given in the
3966 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
3967 </para>
3968 <para>
3969 When testing a filter file,
3970 <indexterm role="concept">
3971 <primary><quote>From</quote> line</primary>
3972 </indexterm>
3973 <indexterm role="concept">
3974 <primary>envelope sender</primary>
3975 </indexterm>
3976 <indexterm role="option">
3977 <primary><option>-f</option></primary>
3978 <secondary>for filter testing</secondary>
3979 </indexterm>
3980 the envelope sender can be set by the <option>-f</option> option,
3981 or by a <quote>From&nbsp;</quote> line at the start of the test message. Various parameters
3982 that would normally be taken from the envelope recipient address of the message
3983 can be set by means of additional command line options (see the next four
3984 options).
3985 </para>
3986 </listitem></varlistentry>
3987 <varlistentry>
3988 <term><option>-bfd</option>&nbsp;&lt;<emphasis>domain</emphasis>&gt;</term>
3989 <listitem>
3990 <para>
3991 <indexterm role="option">
3992 <primary><option>-bfd</option></primary>
3993 </indexterm>
3994 <indexterm role="variable">
3995 <primary><varname>$qualify_domain</varname></primary>
3996 </indexterm>
3997 This sets the domain of the recipient address when a filter file is being
3998 tested by means of the <option>-bf</option> option. The default is the value of
3999 <varname>$qualify_domain</varname>.
4000 </para>
4001 </listitem></varlistentry>
4002 <varlistentry>
4003 <term><option>-bfl</option>&nbsp;&lt;<emphasis>local&nbsp;part</emphasis>&gt;</term>
4004 <listitem>
4005 <para>
4006 <indexterm role="option">
4007 <primary><option>-bfl</option></primary>
4008 </indexterm>
4009 This sets the local part of the recipient address when a filter file is being
4010 tested by means of the <option>-bf</option> option. The default is the username of the
4011 process that calls Exim. A local part should be specified with any prefix or
4012 suffix stripped, because that is how it appears to the filter when a message is
4013 actually being delivered.
4014 </para>
4015 </listitem></varlistentry>
4016 <varlistentry>
4017 <term><option>-bfp</option>&nbsp;&lt;<emphasis>prefix</emphasis>&gt;</term>
4018 <listitem>
4019 <para>
4020 <indexterm role="option">
4021 <primary><option>-bfp</option></primary>
4022 </indexterm>
4023 This sets the prefix of the local part of the recipient address when a filter
4024 file is being tested by means of the <option>-bf</option> option. The default is an empty
4025 prefix.
4026 </para>
4027 </listitem></varlistentry>
4028 <varlistentry>
4029 <term><option>-bfs</option>&nbsp;&lt;<emphasis>suffix</emphasis>&gt;</term>
4030 <listitem>
4031 <para>
4032 <indexterm role="option">
4033 <primary><option>-bfs</option></primary>
4034 </indexterm>
4035 This sets the suffix of the local part of the recipient address when a filter
4036 file is being tested by means of the <option>-bf</option> option. The default is an empty
4037 suffix.
4038 </para>
4039 </listitem></varlistentry>
4040 <varlistentry>
4041 <term><option>-bh</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4042 <listitem>
4043 <para>
4044 <indexterm role="option">
4045 <primary><option>-bh</option></primary>
4046 </indexterm>
4047 <indexterm role="concept">
4048 <primary>testing</primary>
4049 <secondary>incoming SMTP</secondary>
4050 </indexterm>
4051 <indexterm role="concept">
4052 <primary>SMTP</primary>
4053 <secondary>testing incoming</secondary>
4054 </indexterm>
4055 <indexterm role="concept">
4056 <primary>testing</primary>
4057 <secondary>relay control</secondary>
4058 </indexterm>
4059 <indexterm role="concept">
4060 <primary>relaying</primary>
4061 <secondary>testing configuration</secondary>
4062 </indexterm>
4063 <indexterm role="concept">
4064 <primary>policy control</primary>
4065 <secondary>testing</secondary>
4066 </indexterm>
4067 <indexterm role="concept">
4068 <primary>debugging</primary>
4069 <secondary><option>-bh</option> option</secondary>
4070 </indexterm>
4071 This option runs a fake SMTP session as if from the given IP address, using the
4072 standard input and output. The IP address may include a port number at the end,
4073 after a full stop. For example:
4074 </para>
4075 <literallayout class="monospaced">
4076 exim -bh 10.9.8.7.1234
4077 exim -bh fe80::a00:20ff:fe86:a061.5678
4078 </literallayout>
4079 <para>
4080 When an IPv6 address is given, it is converted into canonical form. In the case
4081 of the second example above, the value of <varname>$sender_host_address</varname> after
4082 conversion to the canonical form is
4083 <literal>fe80:0000:0000:0a00:20ff:fe86:a061.5678</literal>.
4084 </para>
4085 <para>
4086 Comments as to what is going on are written to the standard error file. These
4087 include lines beginning with <quote>LOG</quote> for anything that would have been logged.
4088 This facility is provided for testing configuration options for incoming
4089 messages, to make sure they implement the required policy. For example, you can
4090 test your relay controls using <option>-bh</option>.
4091 </para>
4092 <para>
4093 <emphasis role="bold">Warning 1</emphasis>:
4094 <indexterm role="concept">
4095 <primary>RFC 1413</primary>
4096 </indexterm>
4097 You can test features of the configuration that rely on ident (RFC 1413)
4098 information by using the <option>-oMt</option> option. However, Exim cannot actually perform
4099 an ident callout when testing using <option>-bh</option> because there is no incoming SMTP
4100 connection.
4101 </para>
4102 <para>
4103 <emphasis role="bold">Warning 2</emphasis>: Address verification callouts (see section <xref linkend="SECTcallver"/>)
4104 are also skipped when testing using <option>-bh</option>. If you want these callouts to
4105 occur, use <option>-bhc</option> instead.
4106 </para>
4107 <para>
4108 Messages supplied during the testing session are discarded, and nothing is
4109 written to any of the real log files. There may be pauses when DNS (and other)
4110 lookups are taking place, and of course these may time out. The <option>-oMi</option> option
4111 can be used to specify a specific IP interface and port if this is important,
4112 and <option>-oMaa</option> and <option>-oMai</option> can be used to set parameters as if the SMTP
4113 session were authenticated.
4114 </para>
4115 <para>
4116 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option> whose
4117 output just states whether a given recipient address from a given host is
4118 acceptable or not. See section <xref linkend="SECTcheckaccess"/>.
4119 </para>
4120 <para>
4121 Features such as authentication and encryption, where the client input is not
4122 plain text, cannot easily be tested with <option>-bh</option>. Instead, you should use a
4123 specialized SMTP test program such as
4124 <emphasis role="bold"><ulink url="http://jetmore.org/john/code/#swaks">swaks</ulink></emphasis>.
4125 </para>
4126 </listitem></varlistentry>
4127 <varlistentry>
4128 <term><option>-bhc</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4129 <listitem>
4130 <para>
4131 <indexterm role="option">
4132 <primary><option>-bhc</option></primary>
4133 </indexterm>
4134 This option operates in the same way as <option>-bh</option>, except that address
4135 verification callouts are performed if required. This includes consulting and
4136 updating the callout cache database.
4137 </para>
4138 </listitem></varlistentry>
4139 <varlistentry>
4140 <term><option>-bi</option></term>
4141 <listitem>
4142 <para>
4143 <indexterm role="option">
4144 <primary><option>-bi</option></primary>
4145 </indexterm>
4146 <indexterm role="concept">
4147 <primary>alias file</primary>
4148 <secondary>building</secondary>
4149 </indexterm>
4150 <indexterm role="concept">
4151 <primary>building alias file</primary>
4152 </indexterm>
4153 <indexterm role="concept">
4154 <primary>Sendmail compatibility</primary>
4155 <secondary><option>-bi</option> option</secondary>
4156 </indexterm>
4157 Sendmail interprets the <option>-bi</option> option as a request to rebuild its alias file.
4158 Exim does not have the concept of a single alias file, and so it cannot mimic
4159 this behaviour. However, calls to <filename>/usr/lib/sendmail</filename> with the <option>-bi</option> option
4160 tend to appear in various scripts such as NIS make files, so the option must be
4161 recognized.
4162 </para>
4163 <para>
4164 If <option>-bi</option> is encountered, the command specified by the <option>bi_command</option>
4165 configuration option is run, under the uid and gid of the caller of Exim. If
4166 the <option>-oA</option> option is used, its value is passed to the command as an argument.
4167 The command set by <option>bi_command</option> may not contain arguments. The command can
4168 use the <emphasis>exim_dbmbuild</emphasis> utility, or some other means, to rebuild alias files
4169 if this is required. If the <option>bi_command</option> option is not set, calling Exim with
4170 <option>-bi</option> is a no-op.
4171 </para>
4172 </listitem></varlistentry>
4173 <varlistentry>
4174 <term><option>-bI:help</option></term>
4175 <listitem>
4176 <para>
4177 <indexterm role="option">
4178 <primary><option>-bI:help</option></primary>
4179 </indexterm>
4180 <indexterm role="concept">
4181 <primary>querying exim information</primary>
4182 </indexterm>
4183 We shall provide various options starting <literal>-bI:</literal> for querying Exim for
4184 information.  The output of many of these will be intended for machine
4185 consumption.  This one is not.  The <option>-bI:help</option> option asks Exim for a
4186 synopsis of supported options beginning <literal>-bI:</literal>.  Use of any of these
4187 options shall cause Exim to exit after producing the requested output.
4188 </para>
4189 </listitem></varlistentry>
4190 <varlistentry>
4191 <term><option>-bI:dscp</option></term>
4192 <listitem>
4193 <para>
4194 <indexterm role="option">
4195 <primary><option>-bI:dscp</option></primary>
4196 </indexterm>
4197 <indexterm role="concept">
4198 <primary>DSCP</primary>
4199 <secondary>values</secondary>
4200 </indexterm>
4201 This option causes Exim to emit an alphabetically sorted list of all
4202 recognised DSCP names.
4203 </para>
4204 </listitem></varlistentry>
4205 <varlistentry>
4206 <term><option>-bI:sieve</option></term>
4207 <listitem>
4208 <para>
4209 <indexterm role="option">
4210 <primary><option>-bI:sieve</option></primary>
4211 </indexterm>
4212 <indexterm role="concept">
4213 <primary>Sieve filter</primary>
4214 <secondary>capabilities</secondary>
4215 </indexterm>
4216 This option causes Exim to emit an alphabetically sorted list of all supported
4217 Sieve protocol extensions on stdout, one per line.  This is anticipated to be
4218 useful for ManageSieve (RFC 5804) implementations, in providing that protocol&#x2019;s
4219 <literal>SIEVE</literal> capability response line.  As the precise list may depend upon
4220 compile-time build options, which this option will adapt to, this is the only
4221 way to guarantee a correct response.
4222 </para>
4223 </listitem></varlistentry>
4224 <varlistentry>
4225 <term><option>-bm</option></term>
4226 <listitem>
4227 <para>
4228 <indexterm role="option">
4229 <primary><option>-bm</option></primary>
4230 </indexterm>
4231 <indexterm role="concept">
4232 <primary>local message reception</primary>
4233 </indexterm>
4234 This option runs an Exim receiving process that accepts an incoming,
4235 locally-generated message on the standard input. The recipients are given as the
4236 command arguments (except when <option>-t</option> is also present &ndash; see below). Each
4237 argument can be a comma-separated list of RFC 2822 addresses. This is the
4238 default option for selecting the overall action of an Exim call; it is assumed
4239 if no other conflicting option is present.
4240 </para>
4241 <para>
4242 If any addresses in the message are unqualified (have no domain), they are
4243 qualified by the values of the <option>qualify_domain</option> or <option>qualify_recipient</option>
4244 options, as appropriate. The <option>-bnq</option> option (see below) provides a way of
4245 suppressing this for special cases.
4246 </para>
4247 <para>
4248 Policy checks on the contents of local messages can be enforced by means of
4249 the non-SMTP ACL. See chapter <xref linkend="CHAPACL"/> for details.
4250 </para>
4251 <para>
4252 <indexterm role="concept">
4253 <primary>return code</primary>
4254 <secondary>for <option>-bm</option></secondary>
4255 </indexterm>
4256 The return code is zero if the message is successfully accepted. Otherwise, the
4257 action is controlled by the <option>-oe</option><emphasis>x</emphasis> option setting &ndash; see below.
4258 </para>
4259 <para>
4260 The format
4261 <indexterm role="concept">
4262 <primary>message</primary>
4263 <secondary>format</secondary>
4264 </indexterm>
4265 <indexterm role="concept">
4266 <primary>format</primary>
4267 <secondary>message</secondary>
4268 </indexterm>
4269 <indexterm role="concept">
4270 <primary><quote>From</quote> line</primary>
4271 </indexterm>
4272 <indexterm role="concept">
4273 <primary>UUCP</primary>
4274 <secondary><quote>From</quote> line</secondary>
4275 </indexterm>
4276 <indexterm role="concept">
4277 <primary>Sendmail compatibility</primary>
4278 <secondary><quote>From</quote> line</secondary>
4279 </indexterm>
4280 of the message must be as defined in RFC 2822, except that, for
4281 compatibility with Sendmail and Smail, a line in one of the forms
4282 </para>
4283 <literallayout class="monospaced">
4284 From sender Fri Jan  5 12:55 GMT 1997
4285 From sender Fri, 5 Jan 97 12:55:01
4286 </literallayout>
4287 <para>
4288 (with the weekday optional, and possibly with additional text after the date)
4289 is permitted to appear at the start of the message. There appears to be no
4290 authoritative specification of the format of this line. Exim recognizes it by
4291 matching against the regular expression defined by the <option>uucp_from_pattern</option>
4292 option, which can be changed if necessary.
4293 </para>
4294 <para>
4295 <indexterm role="option">
4296 <primary><option>-f</option></primary>
4297 <secondary>overriding <quote>From</quote> line</secondary>
4298 </indexterm>
4299 The specified sender is treated as if it were given as the argument to the
4300 <option>-f</option> option, but if a <option>-f</option> option is also present, its argument is used in
4301 preference to the address taken from the message. The caller of Exim must be a
4302 trusted user for the sender of a message to be set in this way.
4303 </para>
4304 </listitem></varlistentry>
4305 <varlistentry>
4306 <term><option>-bmalware</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
4307 <listitem>
4308 <para>
4309 <indexterm role="option">
4310 <primary><option>-bmalware</option></primary>
4311 </indexterm>
4312 <indexterm role="concept">
4313 <primary>testing</primary>
4314 <secondary>,</secondary>
4315 </indexterm>
4316 <indexterm role="concept">
4317 <primary>malware scan test</primary>
4318 </indexterm>
4319 This debugging option causes Exim to scan the given file,
4320 using the malware scanning framework.  The option of <option>av_scanner</option> influences
4321 this option, so if <option>av_scanner</option>&#x2019;s value is dependent upon an expansion then
4322 the expansion should have defaults which apply to this invocation.  ACLs are
4323 not invoked, so if <option>av_scanner</option> references an ACL variable then that variable
4324 will never be populated and <option>-bmalware</option> will fail.
4325 </para>
4326 <para>
4327 Exim will have changed working directory before resolving the filename, so
4328 using fully qualified pathnames is advisable.  Exim will be running as the Exim
4329 user when it tries to open the file, rather than as the invoking user.
4330 This option requires admin privileges.
4331 </para>
4332 <para>
4333 The <option>-bmalware</option> option will not be extended to be more generally useful,
4334 there are better tools for file-scanning.  This option exists to help
4335 administrators verify their Exim and AV scanner configuration.
4336 </para>
4337 </listitem></varlistentry>
4338 <varlistentry>
4339 <term><option>-bnq</option></term>
4340 <listitem>
4341 <para>
4342 <indexterm role="option">
4343 <primary><option>-bnq</option></primary>
4344 </indexterm>
4345 <indexterm role="concept">
4346 <primary>address qualification, suppressing</primary>
4347 </indexterm>
4348 By default, Exim automatically qualifies unqualified addresses (those
4349 without domains) that appear in messages that are submitted locally (that
4350 is, not over TCP/IP). This qualification applies both to addresses in
4351 envelopes, and addresses in header lines. Sender addresses are qualified using
4352 <option>qualify_domain</option>, and recipient addresses using <option>qualify_recipient</option> (which
4353 defaults to the value of <option>qualify_domain</option>).
4354 </para>
4355 <para>
4356 Sometimes, qualification is not wanted. For example, if <option>-bS</option> (batch SMTP) is
4357 being used to re-submit messages that originally came from remote hosts after
4358 content scanning, you probably do not want to qualify unqualified addresses in
4359 header lines. (Such lines will be present only if you have not enabled a header
4360 syntax check in the appropriate ACL.)
4361 </para>
4362 <para>
4363 The <option>-bnq</option> option suppresses all qualification of unqualified addresses in
4364 messages that originate on the local host. When this is used, unqualified
4365 addresses in the envelope provoke errors (causing message rejection) and
4366 unqualified addresses in header lines are left alone.
4367 </para>
4368 </listitem></varlistentry>
4369 <varlistentry>
4370 <term><option>-bP</option></term>
4371 <listitem>
4372 <para>
4373 <indexterm role="option">
4374 <primary><option>-bP</option></primary>
4375 </indexterm>
4376 <indexterm role="concept">
4377 <primary>configuration options</primary>
4378 <secondary>extracting</secondary>
4379 </indexterm>
4380 <indexterm role="concept">
4381 <primary>options</primary>
4382 <secondary>configuration &ndash; extracting</secondary>
4383 </indexterm>
4384 If this option is given with no arguments, it causes the values of all Exim&#x2019;s
4385 main configuration options to be written to the standard output. The values
4386 of one or more specific options can be requested by giving their names as
4387 arguments, for example:
4388 </para>
4389 <literallayout class="monospaced">
4390 exim -bP qualify_domain hold_domains
4391 </literallayout>
4392 <para>
4393 <indexterm role="concept">
4394 <primary>hiding configuration option values</primary>
4395 </indexterm>
4396 <indexterm role="concept">
4397 <primary>configuration options</primary>
4398 <secondary>hiding value of</secondary>
4399 </indexterm>
4400 <indexterm role="concept">
4401 <primary>options</primary>
4402 <secondary>hiding value of</secondary>
4403 </indexterm>
4404 However, any option setting that is preceded by the word <quote>hide</quote> in the
4405 configuration file is not shown in full, except to an admin user. For other
4406 users, the output is as in this example:
4407 </para>
4408 <literallayout class="monospaced">
4409 mysql_servers = &lt;value not displayable&gt;
4410 </literallayout>
4411 <para>
4412 If <option>config</option> is given as an argument, the config is
4413 output, as it was parsed, any include file resolved, any comment removed.
4414 </para>
4415 <para>
4416 If <option>config_file</option> is given as an argument, the name of the run time
4417 configuration file is output. (<option>configure_file</option> works too, for
4418 backward compatibility.)
4419 If a list of configuration files was supplied, the value that is output here
4420 is the name of the file that was actually used.
4421 </para>
4422 <para>
4423 <indexterm role="concept">
4424 <primary>options</primary>
4425 <secondary>hiding name of</secondary>
4426 </indexterm>
4427 If the <option>-n</option> flag is given, then for most modes of <option>-bP</option> operation the
4428 name will not be output.
4429 </para>
4430 <para>
4431 <indexterm role="concept">
4432 <primary>daemon</primary>
4433 <secondary>process id (pid)</secondary>
4434 </indexterm>
4435 <indexterm role="concept">
4436 <primary>pid (process id)</primary>
4437 <secondary>of daemon</secondary>
4438 </indexterm>
4439 If <option>log_file_path</option> or <option>pid_file_path</option> are given, the names of the
4440 directories where log files and daemon pid files are written are output,
4441 respectively. If these values are unset, log files are written in a
4442 sub-directory of the spool directory called <option>log</option>, and the pid file is
4443 written directly into the spool directory.
4444 </para>
4445 <para>
4446 If <option>-bP</option> is followed by a name preceded by <literal>+</literal>, for example,
4447 </para>
4448 <literallayout class="monospaced">
4449 exim -bP +local_domains
4450 </literallayout>
4451 <para>
4452 it searches for a matching named list of any type (domain, host, address, or
4453 local part) and outputs what it finds.
4454 </para>
4455 <para>
4456 <indexterm role="concept">
4457 <primary>options</primary>
4458 <secondary>router &ndash; extracting</secondary>
4459 </indexterm>
4460 <indexterm role="concept">
4461 <primary>options</primary>
4462 <secondary>transport &ndash; extracting</secondary>
4463 </indexterm>
4464 <indexterm role="concept">
4465 <primary>options</primary>
4466 <secondary>authenticator &ndash; extracting</secondary>
4467 </indexterm>
4468 If one of the words <option>router</option>, <option>transport</option>, or <option>authenticator</option> is given,
4469 followed by the name of an appropriate driver instance, the option settings for
4470 that driver are output. For example:
4471 </para>
4472 <literallayout class="monospaced">
4473 exim -bP transport local_delivery
4474 </literallayout>
4475 <para>
4476 The generic driver options are output first, followed by the driver&#x2019;s private
4477 options. A list of the names of drivers of a particular type can be obtained by
4478 using one of the words <option>router_list</option>, <option>transport_list</option>, or
4479 <option>authenticator_list</option>, and a complete list of all drivers with their option
4480 settings can be obtained by using <option>routers</option>, <option>transports</option>, or
4481 <option>authenticators</option>.
4482 </para>
4483 <para>
4484 <indexterm role="concept">
4485 <primary>environment</primary>
4486 </indexterm>
4487 If <option>environment</option> is given as an argument, the set of environment
4488 variables is output, line by line. Using the <option>-n</option> flag suppresses the value of the
4489 variables.
4490 </para>
4491 <para>
4492 <indexterm role="concept">
4493 <primary>options</primary>
4494 <secondary>macro &ndash; extracting</secondary>
4495 </indexterm>
4496 If invoked by an admin user, then <option>macro</option>, <option>macro_list</option> and <option>macros</option>
4497 are available, similarly to the drivers.  Because macros are sometimes used
4498 for storing passwords, this option is restricted.
4499 The output format is one item per line.
4500 </para>
4501 </listitem></varlistentry>
4502 <varlistentry>
4503 <term><option>-bp</option></term>
4504 <listitem>
4505 <para>
4506 <indexterm role="option">
4507 <primary><option>-bp</option></primary>
4508 </indexterm>
4509 <indexterm role="concept">
4510 <primary>queue</primary>
4511 <secondary>listing messages on</secondary>
4512 </indexterm>
4513 <indexterm role="concept">
4514 <primary>listing</primary>
4515 <secondary>messages on the queue</secondary>
4516 </indexterm>
4517 This option requests a listing of the contents of the mail queue on the
4518 standard output. If the <option>-bp</option> option is followed by a list of message ids,
4519 just those messages are listed. By default, this option can be used only by an
4520 admin user. However, the <option>queue_list_requires_admin</option> option can be set false
4521 to allow any user to see the queue.
4522 </para>
4523 <para>
4524 Each message on the queue is displayed as in the following example:
4525 </para>
4526 <literallayout class="monospaced">
4527 25m  2.9K 0t5C6f-0000c8-00 &lt;alice@wonderland.fict.example&gt;
4528           red.king@looking-glass.fict.example
4529           &lt;other addresses&gt;
4530 </literallayout>
4531 <para>
4532 <indexterm role="concept">
4533 <primary>message</primary>
4534 <secondary>size in queue listing</secondary>
4535 </indexterm>
4536 <indexterm role="concept">
4537 <primary>size</primary>
4538 <secondary>of message</secondary>
4539 </indexterm>
4540 The first line contains the length of time the message has been on the queue
4541 (in this case 25 minutes), the size of the message (2.9K), the unique local
4542 identifier for the message, and the message sender, as contained in the
4543 envelope. For bounce messages, the sender address is empty, and appears as
4544 <quote>&lt;&gt;</quote>. If the message was submitted locally by an untrusted user who overrode
4545 the default sender address, the user&#x2019;s login name is shown in parentheses
4546 before the sender address.
4547 </para>
4548 <para>
4549 <indexterm role="concept">
4550 <primary>frozen messages</primary>
4551 <secondary>in queue listing</secondary>
4552 </indexterm>
4553 If the message is frozen (attempts to deliver it are suspended) then the text
4554 <quote>*** frozen ***</quote> is displayed at the end of this line.
4555 </para>
4556 <para>
4557 The recipients of the message (taken from the envelope, not the headers) are
4558 displayed on subsequent lines. Those addresses to which the message has already
4559 been delivered are marked with the letter D. If an original address gets
4560 expanded into several addresses via an alias or forward file, the original is
4561 displayed with a D only when deliveries for all of its child addresses are
4562 complete.
4563 </para>
4564 </listitem></varlistentry>
4565 <varlistentry>
4566 <term><option>-bpa</option></term>
4567 <listitem>
4568 <para>
4569 <indexterm role="option">
4570 <primary><option>-bpa</option></primary>
4571 </indexterm>
4572 This option operates like <option>-bp</option>, but in addition it shows delivered addresses
4573 that were generated from the original top level address(es) in each message by
4574 alias or forwarding operations. These addresses are flagged with <quote>+D</quote> instead
4575 of just <quote>D</quote>.
4576 </para>
4577 </listitem></varlistentry>
4578 <varlistentry>
4579 <term><option>-bpc</option></term>
4580 <listitem>
4581 <para>
4582 <indexterm role="option">
4583 <primary><option>-bpc</option></primary>
4584 </indexterm>
4585 <indexterm role="concept">
4586 <primary>queue</primary>
4587 <secondary>count of messages on</secondary>
4588 </indexterm>
4589 This option counts the number of messages on the queue, and writes the total
4590 to the standard output. It is restricted to admin users, unless
4591 <option>queue_list_requires_admin</option> is set false.
4592 </para>
4593 </listitem></varlistentry>
4594 <varlistentry>
4595 <term><option>-bpr</option></term>
4596 <listitem>
4597 <para>
4598 <indexterm role="option">
4599 <primary><option>-bpr</option></primary>
4600 </indexterm>
4601 This option operates like <option>-bp</option>, but the output is not sorted into
4602 chronological order of message arrival. This can speed it up when there are
4603 lots of messages on the queue, and is particularly useful if the output is
4604 going to be post-processed in a way that doesn&#x2019;t need the sorting.
4605 </para>
4606 </listitem></varlistentry>
4607 <varlistentry>
4608 <term><option>-bpra</option></term>
4609 <listitem>
4610 <para>
4611 <indexterm role="option">
4612 <primary><option>-bpra</option></primary>
4613 </indexterm>
4614 This option is a combination of <option>-bpr</option> and <option>-bpa</option>.
4615 </para>
4616 </listitem></varlistentry>
4617 <varlistentry>
4618 <term><option>-bpru</option></term>
4619 <listitem>
4620 <para>
4621 <indexterm role="option">
4622 <primary><option>-bpru</option></primary>
4623 </indexterm>
4624 This option is a combination of <option>-bpr</option> and <option>-bpu</option>.
4625 </para>
4626 </listitem></varlistentry>
4627 <varlistentry>
4628 <term><option>-bpu</option></term>
4629 <listitem>
4630 <para>
4631 <indexterm role="option">
4632 <primary><option>-bpu</option></primary>
4633 </indexterm>
4634 This option operates like <option>-bp</option> but shows only undelivered top-level
4635 addresses for each message displayed. Addresses generated by aliasing or
4636 forwarding are not shown, unless the message was deferred after processing by a
4637 router with the <option>one_time</option> option set.
4638 </para>
4639 </listitem></varlistentry>
4640 <varlistentry>
4641 <term><option>-brt</option></term>
4642 <listitem>
4643 <para>
4644 <indexterm role="option">
4645 <primary><option>-brt</option></primary>
4646 </indexterm>
4647 <indexterm role="concept">
4648 <primary>testing</primary>
4649 <secondary>retry configuration</secondary>
4650 </indexterm>
4651 <indexterm role="concept">
4652 <primary>retry</primary>
4653 <secondary>configuration testing</secondary>
4654 </indexterm>
4655 This option is for testing retry rules, and it must be followed by up to three
4656 arguments. It causes Exim to look for a retry rule that matches the values
4657 and to write it to the standard output. For example:
4658 </para>
4659 <literallayout class="monospaced">
4660 exim -brt bach.comp.mus.example
4661 Retry rule: *.comp.mus.example  F,2h,15m; F,4d,30m;
4662 </literallayout>
4663 <para>
4664 See chapter <xref linkend="CHAPretry"/> for a description of Exim&#x2019;s retry rules. The first
4665 argument, which is required, can be a complete address in the form
4666 <emphasis>local_part@domain</emphasis>, or it can be just a domain name. If the second argument
4667 contains a dot, it is interpreted as an optional second domain name; if no
4668 retry rule is found for the first argument, the second is tried. This ties in
4669 with Exim&#x2019;s behaviour when looking for retry rules for remote hosts &ndash; if no
4670 rule is found that matches the host, one that matches the mail domain is
4671 sought. Finally, an argument that is the name of a specific delivery error, as
4672 used in setting up retry rules, can be given. For example:
4673 </para>
4674 <literallayout class="monospaced">
4675 exim -brt haydn.comp.mus.example quota_3d
4676 Retry rule: *@haydn.comp.mus.example quota_3d  F,1h,15m
4677 </literallayout>
4678 </listitem></varlistentry>
4679 <varlistentry>
4680 <term><option>-brw</option></term>
4681 <listitem>
4682 <para>
4683 <indexterm role="option">
4684 <primary><option>-brw</option></primary>
4685 </indexterm>
4686 <indexterm role="concept">
4687 <primary>testing</primary>
4688 <secondary>rewriting</secondary>
4689 </indexterm>
4690 <indexterm role="concept">
4691 <primary>rewriting</primary>
4692 <secondary>testing</secondary>
4693 </indexterm>
4694 This option is for testing address rewriting rules, and it must be followed by
4695 a single argument, consisting of either a local part without a domain, or a
4696 complete address with a fully qualified domain. Exim outputs how this address
4697 would be rewritten for each possible place it might appear. See chapter
4698 <xref linkend="CHAPrewrite"/> for further details.
4699 </para>
4700 </listitem></varlistentry>
4701 <varlistentry>
4702 <term><option>-bS</option></term>
4703 <listitem>
4704 <para>
4705 <indexterm role="option">
4706 <primary><option>-bS</option></primary>
4707 </indexterm>
4708 <indexterm role="concept">
4709 <primary>SMTP</primary>
4710 <secondary>batched incoming</secondary>
4711 </indexterm>
4712 <indexterm role="concept">
4713 <primary>batched SMTP input</primary>
4714 </indexterm>
4715 This option is used for batched SMTP input, which is an alternative interface
4716 for non-interactive local message submission. A number of messages can be
4717 submitted in a single run. However, despite its name, this is not really SMTP
4718 input. Exim reads each message&#x2019;s envelope from SMTP commands on the standard
4719 input, but generates no responses. If the caller is trusted, or
4720 <option>untrusted_set_sender</option> is set, the senders in the SMTP MAIL commands are
4721 believed; otherwise the sender is always the caller of Exim.
4722 </para>
4723 <para>
4724 The message itself is read from the standard input, in SMTP format (leading
4725 dots doubled), terminated by a line containing just a single dot. An error is
4726 provoked if the terminating dot is missing. A further message may then follow.
4727 </para>
4728 <para>
4729 As for other local message submissions, the contents of incoming batch SMTP
4730 messages can be checked using the non-SMTP ACL (see chapter <xref linkend="CHAPACL"/>).
4731 Unqualified addresses are automatically qualified using <option>qualify_domain</option> and
4732 <option>qualify_recipient</option>, as appropriate, unless the <option>-bnq</option> option is used.
4733 </para>
4734 <para>
4735 Some other SMTP commands are recognized in the input. HELO and EHLO act
4736 as RSET; VRFY, EXPN, ETRN, and HELP act as NOOP;
4737 QUIT quits, ignoring the rest of the standard input.
4738 </para>
4739 <para>
4740 <indexterm role="concept">
4741 <primary>return code</primary>
4742 <secondary>for <option>-bS</option></secondary>
4743 </indexterm>
4744 If any error is encountered, reports are written to the standard output and
4745 error streams, and Exim gives up immediately. The return code is 0 if no error
4746 was detected; it is 1 if one or more messages were accepted before the error
4747 was detected; otherwise it is 2.
4748 </para>
4749 <para>
4750 More details of input using batched SMTP are given in section
4751 <xref linkend="SECTincomingbatchedSMTP"/>.
4752 </para>
4753 </listitem></varlistentry>
4754 <varlistentry>
4755 <term><option>-bs</option></term>
4756 <listitem>
4757 <para>
4758 <indexterm role="option">
4759 <primary><option>-bs</option></primary>
4760 </indexterm>
4761 <indexterm role="concept">
4762 <primary>SMTP</primary>
4763 <secondary>local input</secondary>
4764 </indexterm>
4765 <indexterm role="concept">
4766 <primary>local SMTP input</primary>
4767 </indexterm>
4768 This option causes Exim to accept one or more messages by reading SMTP commands
4769 on the standard input, and producing SMTP replies on the standard output. SMTP
4770 policy controls, as defined in ACLs (see chapter <xref linkend="CHAPACL"/>) are applied.
4771 Some user agents use this interface as a way of passing locally-generated
4772 messages to the MTA.
4773 </para>
4774 <para>
4775 In
4776 <indexterm role="concept">
4777 <primary>sender</primary>
4778 <secondary>source of</secondary>
4779 </indexterm>
4780 this usage, if the caller of Exim is trusted, or <option>untrusted_set_sender</option> is
4781 set, the senders of messages are taken from the SMTP MAIL commands.
4782 Otherwise the content of these commands is ignored and the sender is set up as
4783 the calling user. Unqualified addresses are automatically qualified using
4784 <option>qualify_domain</option> and <option>qualify_recipient</option>, as appropriate, unless the
4785 <option>-bnq</option> option is used.
4786 </para>
4787 <para>
4788 <indexterm role="concept">
4789 <primary>inetd</primary>
4790 </indexterm>
4791 The
4792 <option>-bs</option> option is also used to run Exim from <emphasis>inetd</emphasis>, as an alternative to
4793 using a listening daemon. Exim can distinguish the two cases by checking
4794 whether the standard input is a TCP/IP socket. When Exim is called from
4795 <emphasis>inetd</emphasis>, the source of the mail is assumed to be remote, and the comments
4796 above concerning senders and qualification do not apply. In this situation,
4797 Exim behaves in exactly the same way as it does when receiving a message via
4798 the listening daemon.
4799 </para>
4800 </listitem></varlistentry>
4801 <varlistentry>
4802 <term><option>-bt</option></term>
4803 <listitem>
4804 <para>
4805 <indexterm role="option">
4806 <primary><option>-bt</option></primary>
4807 </indexterm>
4808 <indexterm role="concept">
4809 <primary>testing</primary>
4810 <secondary>addresses</secondary>
4811 </indexterm>
4812 <indexterm role="concept">
4813 <primary>address</primary>
4814 <secondary>testing</secondary>
4815 </indexterm>
4816 This option runs Exim in address testing mode, in which each argument is taken
4817 as a recipient address to be tested for deliverability. The results are
4818 written to the standard output. If a test fails, and the caller is not an admin
4819 user, no details of the failure are output, because these might contain
4820 sensitive information such as usernames and passwords for database lookups.
4821 </para>
4822 <para>
4823 If no arguments are given, Exim runs in an interactive manner, prompting with a
4824 right angle bracket for addresses to be tested.
4825 </para>
4826 <para>
4827 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4828 <function>readline()</function> function, because it is running as <emphasis>root</emphasis> and there are
4829 security issues.
4830 </para>
4831 <para>
4832 Each address is handled as if it were the recipient address of a message
4833 (compare the <option>-bv</option> option). It is passed to the routers and the result is
4834 written to the standard output. However, any router that has
4835 <option>no_address_test</option> set is bypassed. This can make <option>-bt</option> easier to use for
4836 genuine routing tests if your first router passes everything to a scanner
4837 program.
4838 </para>
4839 <para>
4840 <indexterm role="concept">
4841 <primary>return code</primary>
4842 <secondary>for <option>-bt</option></secondary>
4843 </indexterm>
4844 The return code is 2 if any address failed outright; it is 1 if no address
4845 failed outright but at least one could not be resolved for some reason. Return
4846 code 0 is given only when all addresses succeed.
4847 </para>
4848 <para>
4849 <indexterm role="concept">
4850 <primary>duplicate addresses</primary>
4851 </indexterm>
4852 <emphasis role="bold">Note</emphasis>: When actually delivering a message, Exim removes duplicate recipient
4853 addresses after routing is complete, so that only one delivery takes place.
4854 This does not happen when testing with <option>-bt</option>; the full results of routing are
4855 always shown.
4856 </para>
4857 <para>
4858 <emphasis role="bold">Warning</emphasis>: <option>-bt</option> can only do relatively simple testing. If any of the
4859 routers in the configuration makes any tests on the sender address of a
4860 message,
4861 <indexterm role="option">
4862 <primary><option>-f</option></primary>
4863 <secondary>for address testing</secondary>
4864 </indexterm>
4865 you can use the <option>-f</option> option to set an appropriate sender when running
4866 <option>-bt</option> tests. Without it, the sender is assumed to be the calling user at the
4867 default qualifying domain. However, if you have set up (for example) routers
4868 whose behaviour depends on the contents of an incoming message, you cannot test
4869 those conditions using <option>-bt</option>. The <option>-N</option> option provides a possible way of
4870 doing such tests.
4871 </para>
4872 </listitem></varlistentry>
4873 <varlistentry>
4874 <term><option>-bV</option></term>
4875 <listitem>
4876 <para>
4877 <indexterm role="option">
4878 <primary><option>-bV</option></primary>
4879 </indexterm>
4880 <indexterm role="concept">
4881 <primary>version number of Exim</primary>
4882 </indexterm>
4883 This option causes Exim to write the current version number, compilation
4884 number, and compilation date of the <emphasis>exim</emphasis> binary to the standard output.
4885 It also lists the DBM library that is being used, the optional modules (such as
4886 specific lookup types), the drivers that are included in the binary, and the
4887 name of the run time configuration file that is in use.
4888 </para>
4889 <para>
4890 As part of its operation, <option>-bV</option> causes Exim to read and syntax check its
4891 configuration file. However, this is a static check only. It cannot check
4892 values that are to be expanded. For example, although a misspelt ACL verb is
4893 detected, an error in the verb&#x2019;s arguments is not. You cannot rely on <option>-bV</option>
4894 alone to discover (for example) all the typos in the configuration; some
4895 realistic testing is needed. The <option>-bh</option> and <option>-N</option> options provide more
4896 dynamic testing facilities.
4897 </para>
4898 </listitem></varlistentry>
4899 <varlistentry>
4900 <term><option>-bv</option></term>
4901 <listitem>
4902 <para>
4903 <indexterm role="option">
4904 <primary><option>-bv</option></primary>
4905 </indexterm>
4906 <indexterm role="concept">
4907 <primary>verifying address</primary>
4908 <secondary>using <option>-bv</option></secondary>
4909 </indexterm>
4910 <indexterm role="concept">
4911 <primary>address</primary>
4912 <secondary>verification</secondary>
4913 </indexterm>
4914 This option runs Exim in address verification mode, in which each argument is
4915 taken as a recipient address to be verified by the routers. (This does
4916 not involve any verification callouts). During normal operation, verification
4917 happens mostly as a consequence processing a <option>verify</option> condition in an ACL
4918 (see chapter <xref linkend="CHAPACL"/>). If you want to test an entire ACL, possibly
4919 including callouts, see the <option>-bh</option> and <option>-bhc</option> options.
4920 </para>
4921 <para>
4922 If verification fails, and the caller is not an admin user, no details of the
4923 failure are output, because these might contain sensitive information such as
4924 usernames and passwords for database lookups.
4925 </para>
4926 <para>
4927 If no arguments are given, Exim runs in an interactive manner, prompting with a
4928 right angle bracket for addresses to be verified.
4929 </para>
4930 <para>
4931 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4932 <function>readline()</function> function, because it is running as <emphasis>exim</emphasis> and there are
4933 security issues.
4934 </para>
4935 <para>
4936 Verification differs from address testing (the <option>-bt</option> option) in that routers
4937 that have <option>no_verify</option> set are skipped, and if the address is accepted by a
4938 router that has <option>fail_verify</option> set, verification fails. The address is
4939 verified as a recipient if <option>-bv</option> is used; to test verification for a sender
4940 address, <option>-bvs</option> should be used.
4941 </para>
4942 <para>
4943 If the <option>-v</option> option is not set, the output consists of a single line for each
4944 address, stating whether it was verified or not, and giving a reason in the
4945 latter case. Without <option>-v</option>, generating more than one address by redirection
4946 causes verification to end successfully, without considering the generated
4947 addresses. However, if just one address is generated, processing continues,
4948 and the generated address must verify successfully for the overall verification
4949 to succeed.
4950 </para>
4951 <para>
4952 When <option>-v</option> is set, more details are given of how the address has been handled,
4953 and in the case of address redirection, all the generated addresses are also
4954 considered. Verification may succeed for some and fail for others.
4955 </para>
4956 <para>
4957 The
4958 <indexterm role="concept">
4959 <primary>return code</primary>
4960 <secondary>for <option>-bv</option></secondary>
4961 </indexterm>
4962 return code is 2 if any address failed outright; it is 1 if no address
4963 failed outright but at least one could not be resolved for some reason. Return
4964 code 0 is given only when all addresses succeed.
4965 </para>
4966 <para>
4967 If any of the routers in the configuration makes any tests on the sender
4968 address of a message, you should use the <option>-f</option> option to set an appropriate
4969 sender when running <option>-bv</option> tests. Without it, the sender is assumed to be the
4970 calling user at the default qualifying domain.
4971 </para>
4972 </listitem></varlistentry>
4973 <varlistentry>
4974 <term><option>-bvs</option></term>
4975 <listitem>
4976 <para>
4977 <indexterm role="option">
4978 <primary><option>-bvs</option></primary>
4979 </indexterm>
4980 This option acts like <option>-bv</option>, but verifies the address as a sender rather
4981 than a recipient address. This affects any rewriting and qualification that
4982 might happen.
4983 </para>
4984 </listitem></varlistentry>
4985 <varlistentry>
4986 <term><option>-bw</option></term>
4987 <listitem>
4988 <para>
4989 <indexterm role="option">
4990 <primary><option>-bw</option></primary>
4991 </indexterm>
4992 <indexterm role="concept">
4993 <primary>daemon</primary>
4994 </indexterm>
4995 <indexterm role="concept">
4996 <primary>inetd</primary>
4997 </indexterm>
4998 <indexterm role="concept">
4999 <primary>inetd</primary>
5000 <secondary>wait mode</secondary>
5001 </indexterm>
5002 This option runs Exim as a daemon, awaiting incoming SMTP connections,
5003 similarly to the <option>-bd</option> option.  All port specifications on the command-line
5004 and in the configuration file are ignored.  Queue-running may not be specified.
5005 </para>
5006 <para>
5007 In this mode, Exim expects to be passed a socket as fd 0 (stdin) which is
5008 listening for connections.  This permits the system to start up and have
5009 inetd (or equivalent) listen on the SMTP ports, starting an Exim daemon for
5010 each port only when the first connection is received.
5011 </para>
5012 <para>
5013 If the option is given as <option>-bw</option>&lt;<emphasis>time</emphasis>&gt; then the time is a timeout, after
5014 which the daemon will exit, which should cause inetd to listen once more.
5015 </para>
5016 </listitem></varlistentry>
5017 <varlistentry>
5018 <term><option>-C</option>&nbsp;&lt;<emphasis>filelist</emphasis>&gt;</term>
5019 <listitem>
5020 <para>
5021 <indexterm role="option">
5022 <primary><option>-C</option></primary>
5023 </indexterm>
5024 <indexterm role="concept">
5025 <primary>configuration file</primary>
5026 <secondary>alternate</secondary>
5027 </indexterm>
5028 <indexterm role="concept">
5029 <primary>CONFIGURE_FILE</primary>
5030 </indexterm>
5031 <indexterm role="concept">
5032 <primary>alternate configuration file</primary>
5033 </indexterm>
5034 This option causes Exim to find the run time configuration file from the given
5035 list instead of from the list specified by the CONFIGURE_FILE
5036 compile-time setting. Usually, the list will consist of just a single file
5037 name, but it can be a colon-separated list of names. In this case, the first
5038 file that exists is used. Failure to open an existing file stops Exim from
5039 proceeding any further along the list, and an error is generated.
5040 </para>
5041 <para>
5042 When this option is used by a caller other than root, and the list is different
5043 from the compiled-in list, Exim gives up its root privilege immediately, and
5044 runs with the real and effective uid and gid set to those of the caller.
5045 However, if a TRUSTED_CONFIG_LIST file is defined in <filename>Local/Makefile</filename>, that
5046 file contains a list of full pathnames, one per line, for configuration files
5047 which are trusted. Root privilege is retained for any configuration file so
5048 listed, as long as the caller is the Exim user (or the user specified in the
5049 CONFIGURE_OWNER option, if any), and as long as the configuration file is
5050 not writeable by inappropriate users or groups.
5051 </para>
5052 <para>
5053 Leaving TRUSTED_CONFIG_LIST unset precludes the possibility of testing a
5054 configuration using <option>-C</option> right through message reception and delivery,
5055 even if the caller is root. The reception works, but by that time, Exim is
5056 running as the Exim user, so when it re-executes to regain privilege for the
5057 delivery, the use of <option>-C</option> causes privilege to be lost. However, root can
5058 test reception and delivery using two separate commands (one to put a message
5059 on the queue, using <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
5060 </para>
5061 <para>
5062 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
5063 prefix string with which any file named in a <option>-C</option> command line option
5064 must start. In addition, the file name must not contain the sequence <literal>/../</literal>.
5065 However, if the value of the <option>-C</option> option is identical to the value of
5066 CONFIGURE_FILE in <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as
5067 usual. There is no default setting for ALT_CONFIG_PREFIX; when it is
5068 unset, any file name can be used with <option>-C</option>.
5069 </para>
5070 <para>
5071 ALT_CONFIG_PREFIX can be used to confine alternative configuration files
5072 to a directory to which only root has access. This prevents someone who has
5073 broken into the Exim account from running a privileged Exim with an arbitrary
5074 configuration file.
5075 </para>
5076 <para>
5077 The <option>-C</option> facility is useful for ensuring that configuration files are
5078 syntactically correct, but cannot be used for test deliveries, unless the
5079 caller is privileged, or unless it is an exotic configuration that does not
5080 require privilege. No check is made on the owner or group of the files
5081 specified by this option.
5082 </para>
5083 </listitem></varlistentry>
5084 <varlistentry>
5085 <term><option>-D</option>&lt;<emphasis>macro</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;</term>
5086 <listitem>
5087 <para>
5088 <indexterm role="option">
5089 <primary><option>-D</option></primary>
5090 </indexterm>
5091 <indexterm role="concept">
5092 <primary>macro</primary>
5093 <secondary>setting on command line</secondary>
5094 </indexterm>
5095 This option can be used to override macro definitions in the configuration file
5096 (see section <xref linkend="SECTmacrodefs"/>). However, like <option>-C</option>, if it is used by an
5097 unprivileged caller, it causes Exim to give up its root privilege.
5098 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
5099 completely disabled, and its use causes an immediate error exit.
5100 </para>
5101 <para>
5102 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename> then it should be a
5103 colon-separated list of macros which are considered safe and, if <option>-D</option> only
5104 supplies macros from this list, and the values are acceptable, then Exim will
5105 not give up root privilege if the caller is root, the Exim run-time user, or
5106 the CONFIGURE_OWNER, if set.  This is a transition mechanism and is expected
5107 to be removed in the future.  Acceptable values for the macros satisfy the
5108 regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
5109 </para>
5110 <para>
5111 The entire option (including equals sign if present) must all be within one
5112 command line item. <option>-D</option> can be used to set the value of a macro to the empty
5113 string, in which case the equals sign is optional. These two commands are
5114 synonymous:
5115 </para>
5116 <literallayout class="monospaced">
5117 exim -DABC  ...
5118 exim -DABC= ...
5119 </literallayout>
5120 <para>
5121 To include spaces in a macro definition item, quotes must be used. If you use
5122 quotes, spaces are permitted around the macro name and the equals sign. For
5123 example:
5124 </para>
5125 <literallayout class="monospaced">
5126 exim '-D ABC = something' ...
5127 </literallayout>
5128 <para>
5129 <option>-D</option> may be repeated up to 10 times on a command line.
5130 </para>
5131 <para revisionflag="changed">
5132 Only macro names up to 22 letters long can be set.
5133 </para>
5134 </listitem></varlistentry>
5135 <varlistentry>
5136 <term><option>-d</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5137 <listitem>
5138 <para>
5139 <indexterm role="option">
5140 <primary><option>-d</option></primary>
5141 </indexterm>
5142 <indexterm role="concept">
5143 <primary>debugging</primary>
5144 <secondary>list of selectors</secondary>
5145 </indexterm>
5146 <indexterm role="concept">
5147 <primary>debugging</primary>
5148 <secondary><option>-d</option> option</secondary>
5149 </indexterm>
5150 This option causes debugging information to be written to the standard
5151 error stream. It is restricted to admin users because debugging output may show
5152 database queries that contain password information. Also, the details of users&#x2019;
5153 filter files should be protected. If a non-admin user uses <option>-d</option>, Exim
5154 writes an error message to the standard error stream and exits with a non-zero
5155 return code.
5156 </para>
5157 <para>
5158 When <option>-d</option> is used, <option>-v</option> is assumed. If <option>-d</option> is given on its own, a lot of
5159 standard debugging data is output. This can be reduced, or increased to include
5160 some more rarely needed information, by directly following <option>-d</option> with a string
5161 made up of names preceded by plus or minus characters. These add or remove sets
5162 of debugging data, respectively. For example, <option>-d+filter</option> adds filter
5163 debugging, whereas <option>-d-all+filter</option> selects only filter debugging. Note that
5164 no spaces are allowed in the debug setting. The available debugging categories
5165 are:
5166 </para>
5167 <literallayout>
5168 <literal>acl            </literal> ACL interpretation
5169 <literal>auth           </literal> authenticators
5170 <literal>deliver        </literal> general delivery logic
5171 <literal>dns            </literal> DNS lookups (see also resolver)
5172 <literal>dnsbl          </literal> DNS black list (aka RBL) code
5173 <literal>exec           </literal> arguments for <function>execv()</function> calls
5174 <literal>expand         </literal> detailed debugging for string expansions
5175 <literal>filter         </literal> filter handling
5176 <literal>hints_lookup   </literal> hints data lookups
5177 <literal>host_lookup    </literal> all types of name-to-IP address handling
5178 <literal>ident          </literal> ident lookup
5179 <literal>interface      </literal> lists of local interfaces
5180 <literal>lists          </literal> matching things in lists
5181 <literal>load           </literal> system load checks
5182 <literal>local_scan     </literal> can be used by <function>local_scan()</function> (see chapter <xref linkend="CHAPlocalscan"/>)
5183 <literal>lookup         </literal> general lookup code and all lookups
5184 <literal>memory         </literal> memory handling
5185 <literal>pid            </literal> add pid to debug output lines
5186 <literal>process_info   </literal> setting info for the process log
5187 <literal>queue_run      </literal> queue runs
5188 <literal>receive        </literal> general message reception logic
5189 <literal>resolver       </literal> turn on the DNS resolver&#x2019;s debugging output
5190 <literal>retry          </literal> retry handling
5191 <literal>rewrite        </literal> address rewriting
5192 <literal>route          </literal> address routing
5193 <literal>timestamp      </literal> add timestamp to debug output lines
5194 <literal>tls            </literal> TLS logic
5195 <literal>transport      </literal> transports
5196 <literal>uid            </literal> changes of uid/gid and looking up uid/gid
5197 <literal>verify         </literal> address verification logic
5198 <literal>all            </literal> almost all of the above (see below), and also <option>-v</option>
5199 </literallayout>
5200 <para>
5201 The <literal>all</literal> option excludes <literal>memory</literal> when used as <literal>+all</literal>, but includes it
5202 for <literal>-all</literal>. The reason for this is that <literal>+all</literal> is something that people
5203 tend to use when generating debug output for Exim maintainers. If <literal>+memory</literal>
5204 is included, an awful lot of output that is very rarely of interest is
5205 generated, so it now has to be explicitly requested. However, <literal>-all</literal> does
5206 turn everything off.
5207 </para>
5208 <para>
5209 <indexterm role="concept">
5210 <primary>resolver, debugging output</primary>
5211 </indexterm>
5212 <indexterm role="concept">
5213 <primary>DNS resolver, debugging output</primary>
5214 </indexterm>
5215 The <literal>resolver</literal> option produces output only if the DNS resolver was compiled
5216 with DEBUG enabled. This is not the case in some operating systems. Also,
5217 unfortunately, debugging output from the DNS resolver is written to stdout
5218 rather than stderr.
5219 </para>
5220 <para>
5221 The default (<option>-d</option> with no argument) omits <literal>expand</literal>, <literal>filter</literal>,
5222 <literal>interface</literal>, <literal>load</literal>, <literal>memory</literal>, <literal>pid</literal>, <literal>resolver</literal>, and <literal>timestamp</literal>.
5223 However, the <literal>pid</literal> selector is forced when debugging is turned on for a
5224 daemon, which then passes it on to any re-executed Exims. Exim also
5225 automatically adds the pid to debug lines when several remote deliveries are
5226 run in parallel.
5227 </para>
5228 <para>
5229 The <literal>timestamp</literal> selector causes the current time to be inserted at the start
5230 of all debug output lines. This can be useful when trying to track down delays
5231 in processing.
5232 </para>
5233 <para>
5234 If the <option>debug_print</option> option is set in any driver, it produces output whenever
5235 any debugging is selected, or if <option>-v</option> is used.
5236 </para>
5237 </listitem></varlistentry>
5238 <varlistentry>
5239 <term><option>-dd</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5240 <listitem>
5241 <para>
5242 <indexterm role="option">
5243 <primary><option>-dd</option></primary>
5244 </indexterm>
5245 This option behaves exactly like <option>-d</option> except when used on a command that
5246 starts a daemon process. In that case, debugging is turned off for the
5247 subprocesses that the daemon creates. Thus, it is useful for monitoring the
5248 behaviour of the daemon without creating as much output as full debugging does.
5249 </para>
5250 </listitem></varlistentry>
5251 <varlistentry>
5252 <term><option>-dropcr</option></term>
5253 <listitem>
5254 <para>
5255 <indexterm role="option">
5256 <primary><option>-dropcr</option></primary>
5257 </indexterm>
5258 This is an obsolete option that is now a no-op. It used to affect the way Exim
5259 handled CR and LF characters in incoming messages. What happens now is
5260 described in section <xref linkend="SECTlineendings"/>.
5261 </para>
5262 </listitem></varlistentry>
5263 <varlistentry>
5264 <term><option>-E</option></term>
5265 <listitem>
5266 <para>
5267 <indexterm role="option">
5268 <primary><option>-E</option></primary>
5269 </indexterm>
5270 <indexterm role="concept">
5271 <primary>bounce message</primary>
5272 <secondary>generating</secondary>
5273 </indexterm>
5274 This option specifies that an incoming message is a locally-generated delivery
5275 failure report. It is used internally by Exim when handling delivery failures
5276 and is not intended for external use. Its only effect is to stop Exim
5277 generating certain messages to the postmaster, as otherwise message cascades
5278 could occur in some situations. As part of the same option, a message id may
5279 follow the characters <option>-E</option>. If it does, the log entry for the receipt of the
5280 new message contains the id, following <quote>R=</quote>, as a cross-reference.
5281 </para>
5282 </listitem></varlistentry>
5283 <varlistentry>
5284 <term><option>-e</option><emphasis>x</emphasis></term>
5285 <listitem>
5286 <para>
5287 <indexterm role="option">
5288 <primary><option>-e</option><emphasis>x</emphasis></primary>
5289 </indexterm>
5290 There are a number of Sendmail options starting with <option>-oe</option> which seem to be
5291 called by various programs without the leading <option>o</option> in the option. For
5292 example, the <option>vacation</option> program uses <option>-eq</option>. Exim treats all options of the
5293 form <option>-e</option><emphasis>x</emphasis> as synonymous with the corresponding <option>-oe</option><emphasis>x</emphasis> options.
5294 </para>
5295 </listitem></varlistentry>
5296 <varlistentry>
5297 <term><option>-F</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
5298 <listitem>
5299 <para>
5300 <indexterm role="option">
5301 <primary><option>-F</option></primary>
5302 </indexterm>
5303 <indexterm role="concept">
5304 <primary>sender</primary>
5305 <secondary>name</secondary>
5306 </indexterm>
5307 <indexterm role="concept">
5308 <primary>name</primary>
5309 <secondary>of sender</secondary>
5310 </indexterm>
5311 This option sets the sender&#x2019;s full name for use when a locally-generated
5312 message is being accepted. In the absence of this option, the user&#x2019;s <emphasis>gecos</emphasis>
5313 entry from the password data is used. As users are generally permitted to alter
5314 their <emphasis>gecos</emphasis> entries, no security considerations are involved. White space
5315 between <option>-F</option> and the &lt;<emphasis>string</emphasis>&gt; is optional.
5316 </para>
5317 </listitem></varlistentry>
5318 <varlistentry>
5319 <term><option>-f</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5320 <listitem>
5321 <para>
5322 <indexterm role="option">
5323 <primary><option>-f</option></primary>
5324 </indexterm>
5325 <indexterm role="concept">
5326 <primary>sender</primary>
5327 <secondary>address</secondary>
5328 </indexterm>
5329 <indexterm role="concept">
5330 <primary>address</primary>
5331 <secondary>sender</secondary>
5332 </indexterm>
5333 <indexterm role="concept">
5334 <primary>trusted users</primary>
5335 </indexterm>
5336 <indexterm role="concept">
5337 <primary>envelope sender</primary>
5338 </indexterm>
5339 <indexterm role="concept">
5340 <primary>user</primary>
5341 <secondary>trusted</secondary>
5342 </indexterm>
5343 This option sets the address of the envelope sender of a locally-generated
5344 message (also known as the return path). The option can normally be used only
5345 by a trusted user, but <option>untrusted_set_sender</option> can be set to allow untrusted
5346 users to use it.
5347 </para>
5348 <para>
5349 Processes running as root or the Exim user are always trusted. Other
5350 trusted users are defined by the <option>trusted_users</option> or <option>trusted_groups</option>
5351 options. In the absence of <option>-f</option>, or if the caller is not trusted, the sender
5352 of a local message is set to the caller&#x2019;s login name at the default qualify
5353 domain.
5354 </para>
5355 <para>
5356 There is one exception to the restriction on the use of <option>-f</option>: an empty sender
5357 can be specified by any user, trusted or not, to create a message that can
5358 never provoke a bounce. An empty sender can be specified either as an empty
5359 string, or as a pair of angle brackets with nothing between them, as in these
5360 examples of shell commands:
5361 </para>
5362 <literallayout class="monospaced">
5363 exim -f '&lt;&gt;' user@domain
5364 exim -f "" user@domain
5365 </literallayout>
5366 <para>
5367 In addition, the use of <option>-f</option> is not restricted when testing a filter file
5368 with <option>-bf</option> or when testing or verifying addresses using the <option>-bt</option> or
5369 <option>-bv</option> options.
5370 </para>
5371 <para>
5372 Allowing untrusted users to change the sender address does not of itself make
5373 it possible to send anonymous mail. Exim still checks that the <emphasis>From:</emphasis> header
5374 refers to the local user, and if it does not, it adds a <emphasis>Sender:</emphasis> header,
5375 though this can be overridden by setting <option>no_local_from_check</option>.
5376 </para>
5377 <para>
5378 White
5379 <indexterm role="concept">
5380 <primary><quote>From</quote> line</primary>
5381 </indexterm>
5382 space between <option>-f</option> and the &lt;<emphasis>address</emphasis>&gt; is optional (that is, they can be
5383 given as two arguments or one combined argument). The sender of a
5384 locally-generated message can also be set (when permitted) by an initial
5385 <quote>From&nbsp;</quote> line in the message &ndash; see the description of <option>-bm</option> above &ndash; but
5386 if <option>-f</option> is also present, it overrides <quote>From&nbsp;</quote>.
5387 </para>
5388 </listitem></varlistentry>
5389 <varlistentry>
5390 <term><option>-G</option></term>
5391 <listitem>
5392 <para>
5393 <indexterm role="option">
5394 <primary><option>-G</option></primary>
5395 </indexterm>
5396 <indexterm role="concept">
5397 <primary>submission fixups, suppressing (command-line)</primary>
5398 </indexterm>
5399 This option is equivalent to an ACL applying:
5400 </para>
5401 <literallayout class="monospaced">
5402 control = suppress_local_fixups
5403 </literallayout>
5404 <para>
5405 for every message received.  Note that Sendmail will complain about such
5406 bad formatting, where Exim silently just does not fix it up.  This may change
5407 in future.
5408 </para>
5409 <para>
5410 As this affects audit information, the caller must be a trusted user to use
5411 this option.
5412 </para>
5413 </listitem></varlistentry>
5414 <varlistentry>
5415 <term><option>-h</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
5416 <listitem>
5417 <para>
5418 <indexterm role="option">
5419 <primary><option>-h</option></primary>
5420 </indexterm>
5421 <indexterm role="concept">
5422 <primary>Sendmail compatibility</primary>
5423 <secondary><option>-h</option> option ignored</secondary>
5424 </indexterm>
5425 This option is accepted for compatibility with Sendmail, but has no effect. (In
5426 Sendmail it overrides the <quote>hop count</quote> obtained by counting <emphasis>Received:</emphasis>
5427 headers.)
5428 </para>
5429 </listitem></varlistentry>
5430 <varlistentry>
5431 <term><option>-i</option></term>
5432 <listitem>
5433 <para>
5434 <indexterm role="option">
5435 <primary><option>-i</option></primary>
5436 </indexterm>
5437 <indexterm role="concept">
5438 <primary>Solaris</primary>
5439 <secondary><emphasis>mail</emphasis> command</secondary>
5440 </indexterm>
5441 <indexterm role="concept">
5442 <primary>dot</primary>
5443 <secondary>in incoming non-SMTP message</secondary>
5444 </indexterm>
5445 This option, which has the same effect as <option>-oi</option>, specifies that a dot on a
5446 line by itself should not terminate an incoming, non-SMTP message. I can find
5447 no documentation for this option in Solaris 2.4 Sendmail, but the <emphasis>mailx</emphasis>
5448 command in Solaris 2.4 uses it. See also <option>-ti</option>.
5449 </para>
5450 </listitem></varlistentry>
5451 <varlistentry>
5452 <term><option>-L</option>&nbsp;&lt;<emphasis>tag</emphasis>&gt;</term>
5453 <listitem>
5454 <para>
5455 <indexterm role="option">
5456 <primary><option>-L</option></primary>
5457 </indexterm>
5458 <indexterm role="concept">
5459 <primary>syslog</primary>
5460 <secondary>process name; set with flag</secondary>
5461 </indexterm>
5462 This option is equivalent to setting <option>syslog_processname</option> in the config
5463 file and setting <option>log_file_path</option> to <literal>syslog</literal>.
5464 Its use is restricted to administrators.  The configuration file has to be
5465 read and parsed, to determine access rights, before this is set and takes
5466 effect, so early configuration file errors will not honour this flag.
5467 </para>
5468 <para>
5469 The tag should not be longer than 32 characters.
5470 </para>
5471 </listitem></varlistentry>
5472 <varlistentry>
5473 <term><option>-M</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5474 <listitem>
5475 <para>
5476 <indexterm role="option">
5477 <primary><option>-M</option></primary>
5478 </indexterm>
5479 <indexterm role="concept">
5480 <primary>forcing delivery</primary>
5481 </indexterm>
5482 <indexterm role="concept">
5483 <primary>delivery</primary>
5484 <secondary>forcing attempt</secondary>
5485 </indexterm>
5486 <indexterm role="concept">
5487 <primary>frozen messages</primary>
5488 <secondary>forcing delivery</secondary>
5489 </indexterm>
5490 This option requests Exim to run a delivery attempt on each message in turn. If
5491 any of the messages are frozen, they are automatically thawed before the
5492 delivery attempt. The settings of <option>queue_domains</option>, <option>queue_smtp_domains</option>,
5493 and <option>hold_domains</option> are ignored.
5494 </para>
5495 <para>
5496 Retry
5497 <indexterm role="concept">
5498 <primary>hints database</primary>
5499 <secondary>overriding retry hints</secondary>
5500 </indexterm>
5501 hints for any of the addresses are overridden &ndash; Exim tries to deliver even if
5502 the normal retry time has not yet been reached. This option requires the caller
5503 to be an admin user. However, there is an option called <option>prod_requires_admin</option>
5504 which can be set false to relax this restriction (and also the same requirement
5505 for the <option>-q</option>, <option>-R</option>, and <option>-S</option> options).
5506 </para>
5507 <para>
5508 The deliveries happen synchronously, that is, the original Exim process does
5509 not terminate until all the delivery attempts have finished. No output is
5510 produced unless there is a serious error. If you want to see what is happening,
5511 use the <option>-v</option> option as well, or inspect Exim&#x2019;s main log.
5512 </para>
5513 </listitem></varlistentry>
5514 <varlistentry>
5515 <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>
5516 <listitem>
5517 <para>
5518 <indexterm role="option">
5519 <primary><option>-Mar</option></primary>
5520 </indexterm>
5521 <indexterm role="concept">
5522 <primary>message</primary>
5523 <secondary>adding recipients</secondary>
5524 </indexterm>
5525 <indexterm role="concept">
5526 <primary>recipient</primary>
5527 <secondary>adding</secondary>
5528 </indexterm>
5529 This option requests Exim to add the addresses to the list of recipients of the
5530 message (<quote>ar</quote> for <quote>add recipients</quote>). The first argument must be a message
5531 id, and the remaining ones must be email addresses. However, if the message is
5532 active (in the middle of a delivery attempt), it is not altered. This option
5533 can be used only by an admin user.
5534 </para>
5535 </listitem></varlistentry>
5536 <varlistentry>
5537 <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>
5538 <listitem>
5539 <para>
5540 <indexterm role="option">
5541 <primary><option>-MC</option></primary>
5542 </indexterm>
5543 <indexterm role="concept">
5544 <primary>SMTP</primary>
5545 <secondary>passed connection</secondary>
5546 </indexterm>
5547 <indexterm role="concept">
5548 <primary>SMTP</primary>
5549 <secondary>multiple deliveries</secondary>
5550 </indexterm>
5551 <indexterm role="concept">
5552 <primary>multiple SMTP deliveries</primary>
5553 </indexterm>
5554 This option is not intended for use by external callers. It is used internally
5555 by Exim to invoke another instance of itself to deliver a waiting message using
5556 an existing SMTP connection, which is passed as the standard input. Details are
5557 given in chapter <xref linkend="CHAPSMTP"/>. This must be the final option, and the caller
5558 must be root or the Exim user in order to use it.
5559 </para>
5560 </listitem></varlistentry>
5561 <varlistentry>
5562 <term><option>-MCA</option></term>
5563 <listitem>
5564 <para>
5565 <indexterm role="option">
5566 <primary><option>-MCA</option></primary>
5567 </indexterm>
5568 This option is not intended for use by external callers. It is used internally
5569 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5570 connection to the remote host has been authenticated.
5571 </para>
5572 </listitem></varlistentry>
5573 <varlistentry>
5574 <term><option>-MCD</option></term>
5575 <listitem>
5576 <para>
5577 <indexterm role="option">
5578 <primary><option>-MCD</option></primary>
5579 </indexterm>
5580 This option is not intended for use by external callers. It is used internally
5581 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5582 remote host supports the ESMTP <filename>DSN</filename> extension.
5583 </para>
5584 </listitem></varlistentry>
5585 <varlistentry>
5586 <term><option>-MCP</option></term>
5587 <listitem>
5588 <para>
5589 <indexterm role="option">
5590 <primary><option>-MCP</option></primary>
5591 </indexterm>
5592 This option is not intended for use by external callers. It is used internally
5593 by Exim in conjunction with the <option>-MC</option> option. It signifies that the server to
5594 which Exim is connected supports pipelining.
5595 </para>
5596 </listitem></varlistentry>
5597 <varlistentry>
5598 <term><option>-MCQ</option>&nbsp;&lt;<emphasis>process&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>pipe&nbsp;fd</emphasis>&gt;</term>
5599 <listitem>
5600 <para>
5601 <indexterm role="option">
5602 <primary><option>-MCQ</option></primary>
5603 </indexterm>
5604 This option is not intended for use by external callers. It is used internally
5605 by Exim in conjunction with the <option>-MC</option> option when the original delivery was
5606 started by a queue runner. It passes on the process id of the queue runner,
5607 together with the file descriptor number of an open pipe. Closure of the pipe
5608 signals the final completion of the sequence of processes that are passing
5609 messages through the same SMTP connection.
5610 </para>
5611 </listitem></varlistentry>
5612 <varlistentry>
5613 <term><option>-MCS</option></term>
5614 <listitem>
5615 <para>
5616 <indexterm role="option">
5617 <primary><option>-MCS</option></primary>
5618 </indexterm>
5619 This option is not intended for use by external callers. It is used internally
5620 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5621 SMTP SIZE option should be used on messages delivered down the existing
5622 connection.
5623 </para>
5624 </listitem></varlistentry>
5625 <varlistentry>
5626 <term><option>-MCT</option></term>
5627 <listitem>
5628 <para>
5629 <indexterm role="option">
5630 <primary><option>-MCT</option></primary>
5631 </indexterm>
5632 This option is not intended for use by external callers. It is used internally
5633 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5634 host to which Exim is connected supports TLS encryption.
5635 </para>
5636 </listitem></varlistentry>
5637 <varlistentry>
5638 <term><option>-Mc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5639 <listitem>
5640 <para>
5641 <indexterm role="option">
5642 <primary><option>-Mc</option></primary>
5643 </indexterm>
5644 <indexterm role="concept">
5645 <primary>hints database</primary>
5646 <secondary>not overridden by <option>-Mc</option></secondary>
5647 </indexterm>
5648 <indexterm role="concept">
5649 <primary>delivery</primary>
5650 <secondary>manually started &ndash; not forced</secondary>
5651 </indexterm>
5652 This option requests Exim to run a delivery attempt on each message in turn,
5653 but unlike the <option>-M</option> option, it does check for retry hints, and respects any
5654 that are found. This option is not very useful to external callers. It is
5655 provided mainly for internal use by Exim when it needs to re-invoke itself in
5656 order to regain root privilege for a delivery (see chapter <xref linkend="CHAPsecurity"/>).
5657 However, <option>-Mc</option> can be useful when testing, in order to run a delivery that
5658 respects retry times and other options such as <option>hold_domains</option> that are
5659 overridden when <option>-M</option> is used. Such a delivery does not count as a queue run.
5660 If you want to run a specific delivery as if in a queue run, you should use
5661 <option>-q</option> with a message id argument. A distinction between queue run deliveries
5662 and other deliveries is made in one or two places.
5663 </para>
5664 </listitem></varlistentry>
5665 <varlistentry>
5666 <term><option>-Mes</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5667 <listitem>
5668 <para>
5669 <indexterm role="option">
5670 <primary><option>-Mes</option></primary>
5671 </indexterm>
5672 <indexterm role="concept">
5673 <primary>message</primary>
5674 <secondary>changing sender</secondary>
5675 </indexterm>
5676 <indexterm role="concept">
5677 <primary>sender</primary>
5678 <secondary>changing</secondary>
5679 </indexterm>
5680 This option requests Exim to change the sender address in the message to the
5681 given address, which must be a fully qualified address or <quote>&lt;&gt;</quote> (<quote>es</quote> for
5682 <quote>edit sender</quote>). There must be exactly two arguments. The first argument must
5683 be a message id, and the second one an email address. However, if the message
5684 is active (in the middle of a delivery attempt), its status is not altered.
5685 This option can be used only by an admin user.
5686 </para>
5687 </listitem></varlistentry>
5688 <varlistentry>
5689 <term><option>-Mf</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5690 <listitem>
5691 <para>
5692 <indexterm role="option">
5693 <primary><option>-Mf</option></primary>
5694 </indexterm>
5695 <indexterm role="concept">
5696 <primary>freezing messages</primary>
5697 </indexterm>
5698 <indexterm role="concept">
5699 <primary>message</primary>
5700 <secondary>manually freezing</secondary>
5701 </indexterm>
5702 This option requests Exim to mark each listed message as <quote>frozen</quote>. This
5703 prevents any delivery attempts taking place until the message is <quote>thawed</quote>,
5704 either manually or as a result of the <option>auto_thaw</option> configuration option.
5705 However, if any of the messages are active (in the middle of a delivery
5706 attempt), their status is not altered. This option can be used only by an admin
5707 user.
5708 </para>
5709 </listitem></varlistentry>
5710 <varlistentry>
5711 <term><option>-Mg</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5712 <listitem>
5713 <para>
5714 <indexterm role="option">
5715 <primary><option>-Mg</option></primary>
5716 </indexterm>
5717 <indexterm role="concept">
5718 <primary>giving up on messages</primary>
5719 </indexterm>
5720 <indexterm role="concept">
5721 <primary>message</primary>
5722 <secondary>abandoning delivery attempts</secondary>
5723 </indexterm>
5724 <indexterm role="concept">
5725 <primary>delivery</primary>
5726 <secondary>abandoning further attempts</secondary>
5727 </indexterm>
5728 This option requests Exim to give up trying to deliver the listed messages,
5729 including any that are frozen. However, if any of the messages are active,
5730 their status is not altered. For non-bounce messages, a delivery error message
5731 is sent to the sender, containing the text <quote>cancelled by administrator</quote>.
5732 Bounce messages are just discarded. This option can be used only by an admin
5733 user.
5734 </para>
5735 </listitem></varlistentry>
5736 <varlistentry>
5737 <term><option>-Mmad</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5738 <listitem>
5739 <para>
5740 <indexterm role="option">
5741 <primary><option>-Mmad</option></primary>
5742 </indexterm>
5743 <indexterm role="concept">
5744 <primary>delivery</primary>
5745 <secondary>cancelling all</secondary>
5746 </indexterm>
5747 This option requests Exim to mark all the recipient addresses in the messages
5748 as already delivered (<quote>mad</quote> for <quote>mark all delivered</quote>). However, if any
5749 message is active (in the middle of a delivery attempt), its status is not
5750 altered. This option can be used only by an admin user.
5751 </para>
5752 </listitem></varlistentry>
5753 <varlistentry>
5754 <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>
5755 <listitem>
5756 <para>
5757 <indexterm role="option">
5758 <primary><option>-Mmd</option></primary>
5759 </indexterm>
5760 <indexterm role="concept">
5761 <primary>delivery</primary>
5762 <secondary>cancelling by address</secondary>
5763 </indexterm>
5764 <indexterm role="concept">
5765 <primary>recipient</primary>
5766 <secondary>removing</secondary>
5767 </indexterm>
5768 <indexterm role="concept">
5769 <primary>removing recipients</primary>
5770 </indexterm>
5771 This option requests Exim to mark the given addresses as already delivered
5772 (<quote>md</quote> for <quote>mark delivered</quote>). The first argument must be a message id, and
5773 the remaining ones must be email addresses. These are matched to recipient
5774 addresses in the message in a case-sensitive manner. If the message is active
5775 (in the middle of a delivery attempt), its status is not altered. This option
5776 can be used only by an admin user.
5777 </para>
5778 </listitem></varlistentry>
5779 <varlistentry>
5780 <term><option>-Mrm</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5781 <listitem>
5782 <para>
5783 <indexterm role="option">
5784 <primary><option>-Mrm</option></primary>
5785 </indexterm>
5786 <indexterm role="concept">
5787 <primary>removing messages</primary>
5788 </indexterm>
5789 <indexterm role="concept">
5790 <primary>abandoning mail</primary>
5791 </indexterm>
5792 <indexterm role="concept">
5793 <primary>message</primary>
5794 <secondary>manually discarding</secondary>
5795 </indexterm>
5796 This option requests Exim to remove the given messages from the queue. No
5797 bounce messages are sent; each message is simply forgotten. However, if any of
5798 the messages are active, their status is not altered. This option can be used
5799 only by an admin user or by the user who originally caused the message to be
5800 placed on the queue.
5801 </para>
5802 </listitem></varlistentry>
5803 <varlistentry>
5804 <term><option>-Mset</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5805 <listitem>
5806 <para>
5807 <indexterm role="option">
5808 <primary><option>-Mset</option></primary>
5809 </indexterm>
5810 <indexterm role="concept">
5811 <primary>testing</primary>
5812 <secondary>string expansion</secondary>
5813 </indexterm>
5814 <indexterm role="concept">
5815 <primary>expansion</primary>
5816 <secondary>testing</secondary>
5817 </indexterm>
5818 This option is useful only in conjunction with <option>-be</option> (that is, when testing
5819 string expansions). Exim loads the given message from its spool before doing
5820 the test expansions, thus setting message-specific variables such as
5821 <varname>$message_size</varname> and the header variables. The <varname>$recipients</varname> variable is made
5822 available. This feature is provided to make it easier to test expansions that
5823 make use of these variables. However, this option can be used only by an admin
5824 user. See also <option>-bem</option>.
5825 </para>
5826 </listitem></varlistentry>
5827 <varlistentry>
5828 <term><option>-Mt</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5829 <listitem>
5830 <para>
5831 <indexterm role="option">
5832 <primary><option>-Mt</option></primary>
5833 </indexterm>
5834 <indexterm role="concept">
5835 <primary>thawing messages</primary>
5836 </indexterm>
5837 <indexterm role="concept">
5838 <primary>unfreezing messages</primary>
5839 </indexterm>
5840 <indexterm role="concept">
5841 <primary>frozen messages</primary>
5842 <secondary>thawing</secondary>
5843 </indexterm>
5844 <indexterm role="concept">
5845 <primary>message</primary>
5846 <secondary>thawing frozen</secondary>
5847 </indexterm>
5848 This option requests Exim to <quote>thaw</quote> any of the listed messages that are
5849 <quote>frozen</quote>, so that delivery attempts can resume. However, if any of the
5850 messages are active, their status is not altered. This option can be used only
5851 by an admin user.
5852 </para>
5853 </listitem></varlistentry>
5854 <varlistentry>
5855 <term><option>-Mvb</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5856 <listitem>
5857 <para>
5858 <indexterm role="option">
5859 <primary><option>-Mvb</option></primary>
5860 </indexterm>
5861 <indexterm role="concept">
5862 <primary>listing</primary>
5863 <secondary>message body</secondary>
5864 </indexterm>
5865 <indexterm role="concept">
5866 <primary>message</primary>
5867 <secondary>listing body of</secondary>
5868 </indexterm>
5869 This option causes the contents of the message body (-D) spool file to be
5870 written to the standard output. This option can be used only by an admin user.
5871 </para>
5872 </listitem></varlistentry>
5873 <varlistentry>
5874 <term><option>-Mvc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5875 <listitem>
5876 <para>
5877 <indexterm role="option">
5878 <primary><option>-Mvc</option></primary>
5879 </indexterm>
5880 <indexterm role="concept">
5881 <primary>message</primary>
5882 <secondary>listing in RFC 2822 format</secondary>
5883 </indexterm>
5884 <indexterm role="concept">
5885 <primary>listing</primary>
5886 <secondary>message in RFC 2822 format</secondary>
5887 </indexterm>
5888 This option causes a copy of the complete message (header lines plus body) to
5889 be written to the standard output in RFC 2822 format. This option can be used
5890 only by an admin user.
5891 </para>
5892 </listitem></varlistentry>
5893 <varlistentry>
5894 <term><option>-Mvh</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5895 <listitem>
5896 <para>
5897 <indexterm role="option">
5898 <primary><option>-Mvh</option></primary>
5899 </indexterm>
5900 <indexterm role="concept">
5901 <primary>listing</primary>
5902 <secondary>message headers</secondary>
5903 </indexterm>
5904 <indexterm role="concept">
5905 <primary>header lines</primary>
5906 <secondary>listing</secondary>
5907 </indexterm>
5908 <indexterm role="concept">
5909 <primary>message</primary>
5910 <secondary>listing header lines</secondary>
5911 </indexterm>
5912 This option causes the contents of the message headers (-H) spool file to be
5913 written to the standard output. This option can be used only by an admin user.
5914 </para>
5915 </listitem></varlistentry>
5916 <varlistentry>
5917 <term><option>-Mvl</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5918 <listitem>
5919 <para>
5920 <indexterm role="option">
5921 <primary><option>-Mvl</option></primary>
5922 </indexterm>
5923 <indexterm role="concept">
5924 <primary>listing</primary>
5925 <secondary>message log</secondary>
5926 </indexterm>
5927 <indexterm role="concept">
5928 <primary>message</primary>
5929 <secondary>listing message log</secondary>
5930 </indexterm>
5931 This option causes the contents of the message log spool file to be written to
5932 the standard output. This option can be used only by an admin user.
5933 </para>
5934 </listitem></varlistentry>
5935 <varlistentry>
5936 <term><option>-m</option></term>
5937 <listitem>
5938 <para>
5939 <indexterm role="option">
5940 <primary><option>-m</option></primary>
5941 </indexterm>
5942 This is apparently a synonym for <option>-om</option> that is accepted by Sendmail, so Exim
5943 treats it that way too.
5944 </para>
5945 </listitem></varlistentry>
5946 <varlistentry>
5947 <term><option>-N</option></term>
5948 <listitem>
5949 <para>
5950 <indexterm role="option">
5951 <primary><option>-N</option></primary>
5952 </indexterm>
5953 <indexterm role="concept">
5954 <primary>debugging</primary>
5955 <secondary><option>-N</option> option</secondary>
5956 </indexterm>
5957 <indexterm role="concept">
5958 <primary>debugging</primary>
5959 <secondary>suppressing delivery</secondary>
5960 </indexterm>
5961 This is a debugging option that inhibits delivery of a message at the transport
5962 level. It implies <option>-v</option>. Exim goes through many of the motions of delivery &ndash;
5963 it just doesn&#x2019;t actually transport the message, but instead behaves as if it
5964 had successfully done so. However, it does not make any updates to the retry
5965 database, and the log entries for deliveries are flagged with <quote>*&gt;</quote> rather
5966 than <quote>=&gt;</quote>.
5967 </para>
5968 <para>
5969 Because <option>-N</option> discards any message to which it applies, only root or the Exim
5970 user are allowed to use it with <option>-bd</option>, <option>-q</option>, <option>-R</option> or <option>-M</option>. In other
5971 words, an ordinary user can use it only when supplying an incoming message to
5972 which it will apply. Although transportation never fails when <option>-N</option> is set, an
5973 address may be deferred because of a configuration problem on a transport, or a
5974 routing problem. Once <option>-N</option> has been used for a delivery attempt, it sticks to
5975 the message, and applies to any subsequent delivery attempts that may happen
5976 for that message.
5977 </para>
5978 </listitem></varlistentry>
5979 <varlistentry>
5980 <term><option>-n</option></term>
5981 <listitem>
5982 <para>
5983 <indexterm role="option">
5984 <primary><option>-n</option></primary>
5985 </indexterm>
5986 This option is interpreted by Sendmail to mean <quote>no aliasing</quote>.
5987 For normal modes of operation, it is ignored by Exim.
5988 When combined with <option>-bP</option> it makes the output more terse (suppresses
5989 option names, environment values and config pretty printing).
5990 </para>
5991 </listitem></varlistentry>
5992 <varlistentry>
5993 <term><option>-O</option>&nbsp;&lt;<emphasis>data</emphasis>&gt;</term>
5994 <listitem>
5995 <para>
5996 <indexterm role="option">
5997 <primary><option>-O</option></primary>
5998 </indexterm>
5999 This option is interpreted by Sendmail to mean <literal>set option</literal>. It is ignored by
6000 Exim.
6001 </para>
6002 </listitem></varlistentry>
6003 <varlistentry>
6004 <term><option>-oA</option>&nbsp;&lt;<emphasis>file&nbsp;name</emphasis>&gt;</term>
6005 <listitem>
6006 <para>
6007 <indexterm role="option">
6008 <primary><option>-oA</option></primary>
6009 </indexterm>
6010 <indexterm role="concept">
6011 <primary>Sendmail compatibility</primary>
6012 <secondary><option>-oA</option> option</secondary>
6013 </indexterm>
6014 This option is used by Sendmail in conjunction with <option>-bi</option> to specify an
6015 alternative alias file name. Exim handles <option>-bi</option> differently; see the
6016 description above.
6017 </para>
6018 </listitem></varlistentry>
6019 <varlistentry>
6020 <term><option>-oB</option>&nbsp;&lt;<emphasis>n</emphasis>&gt;</term>
6021 <listitem>
6022 <para>
6023 <indexterm role="option">
6024 <primary><option>-oB</option></primary>
6025 </indexterm>
6026 <indexterm role="concept">
6027 <primary>SMTP</primary>
6028 <secondary>passed connection</secondary>
6029 </indexterm>
6030 <indexterm role="concept">
6031 <primary>SMTP</primary>
6032 <secondary>multiple deliveries</secondary>
6033 </indexterm>
6034 <indexterm role="concept">
6035 <primary>multiple SMTP deliveries</primary>
6036 </indexterm>
6037 This is a debugging option which limits the maximum number of messages that can
6038 be delivered down one SMTP connection, overriding the value set in any <command>smtp</command>
6039 transport. If &lt;<emphasis>n</emphasis>&gt; is omitted, the limit is set to 1.
6040 </para>
6041 </listitem></varlistentry>
6042 <varlistentry>
6043 <term><option>-odb</option></term>
6044 <listitem>
6045 <para>
6046 <indexterm role="option">
6047 <primary><option>-odb</option></primary>
6048 </indexterm>
6049 <indexterm role="concept">
6050 <primary>background delivery</primary>
6051 </indexterm>
6052 <indexterm role="concept">
6053 <primary>delivery</primary>
6054 <secondary>in the background</secondary>
6055 </indexterm>
6056 This option applies to all modes in which Exim accepts incoming messages,
6057 including the listening daemon. It requests <quote>background</quote> delivery of such
6058 messages, which means that the accepting process automatically starts a
6059 delivery process for each message received, but does not wait for the delivery
6060 processes to finish.
6061 </para>
6062 <para>
6063 When all the messages have been received, the reception process exits,
6064 leaving the delivery processes to finish in their own time. The standard output
6065 and error streams are closed at the start of each delivery process.
6066 This is the default action if none of the <option>-od</option> options are present.
6067 </para>
6068 <para>
6069 If one of the queueing options in the configuration file
6070 (<option>queue_only</option> or <option>queue_only_file</option>, for example) is in effect, <option>-odb</option>
6071 overrides it if <option>queue_only_override</option> is set true, which is the default
6072 setting. If <option>queue_only_override</option> is set false, <option>-odb</option> has no effect.
6073 </para>
6074 </listitem></varlistentry>
6075 <varlistentry>
6076 <term><option>-odf</option></term>
6077 <listitem>
6078 <para>
6079 <indexterm role="option">
6080 <primary><option>-odf</option></primary>
6081 </indexterm>
6082 <indexterm role="concept">
6083 <primary>foreground delivery</primary>
6084 </indexterm>
6085 <indexterm role="concept">
6086 <primary>delivery</primary>
6087 <secondary>in the foreground</secondary>
6088 </indexterm>
6089 This option requests <quote>foreground</quote> (synchronous) delivery when Exim has
6090 accepted a locally-generated message. (For the daemon it is exactly the same as
6091 <option>-odb</option>.) A delivery process is automatically started to deliver the message,
6092 and Exim waits for it to complete before proceeding.
6093 </para>
6094 <para>
6095 The original Exim reception process does not finish until the delivery
6096 process for the final message has ended. The standard error stream is left open
6097 during deliveries.
6098 </para>
6099 <para>
6100 However, like <option>-odb</option>, this option has no effect if <option>queue_only_override</option> is
6101 false and one of the queueing options in the configuration file is in effect.
6102 </para>
6103 <para>
6104 If there is a temporary delivery error during foreground delivery, the
6105 message is left on the queue for later delivery, and the original reception
6106 process exits. See chapter <xref linkend="CHAPnonqueueing"/> for a way of setting up a
6107 restricted configuration that never queues messages.
6108 </para>
6109 </listitem></varlistentry>
6110 <varlistentry>
6111 <term><option>-odi</option></term>
6112 <listitem>
6113 <para>
6114 <indexterm role="option">
6115 <primary><option>-odi</option></primary>
6116 </indexterm>
6117 This option is synonymous with <option>-odf</option>. It is provided for compatibility with
6118 Sendmail.
6119 </para>
6120 </listitem></varlistentry>
6121 <varlistentry>
6122 <term><option>-odq</option></term>
6123 <listitem>
6124 <para>
6125 <indexterm role="option">
6126 <primary><option>-odq</option></primary>
6127 </indexterm>
6128 <indexterm role="concept">
6129 <primary>non-immediate delivery</primary>
6130 </indexterm>
6131 <indexterm role="concept">
6132 <primary>delivery</primary>
6133 <secondary>suppressing immediate</secondary>
6134 </indexterm>
6135 <indexterm role="concept">
6136 <primary>queueing incoming messages</primary>
6137 </indexterm>
6138 This option applies to all modes in which Exim accepts incoming messages,
6139 including the listening daemon. It specifies that the accepting process should
6140 not automatically start a delivery process for each message received. Messages
6141 are placed on the queue, and remain there until a subsequent queue runner
6142 process encounters them. There are several configuration options (such as
6143 <option>queue_only</option>) that can be used to queue incoming messages under certain
6144 conditions. This option overrides all of them and also <option>-odqs</option>. It always
6145 forces queueing.
6146 </para>
6147 </listitem></varlistentry>
6148 <varlistentry>
6149 <term><option>-odqs</option></term>
6150 <listitem>
6151 <para>
6152 <indexterm role="option">
6153 <primary><option>-odqs</option></primary>
6154 </indexterm>
6155 <indexterm role="concept">
6156 <primary>SMTP</primary>
6157 <secondary>delaying delivery</secondary>
6158 </indexterm>
6159 This option is a hybrid between <option>-odb</option>/<option>-odi</option> and <option>-odq</option>.
6160 However, like <option>-odb</option> and <option>-odi</option>, this option has no effect if
6161 <option>queue_only_override</option> is false and one of the queueing options in the
6162 configuration file is in effect.
6163 </para>
6164 <para>
6165 When <option>-odqs</option> does operate, a delivery process is started for each incoming
6166 message, in the background by default, but in the foreground if <option>-odi</option> is
6167 also present. The recipient addresses are routed, and local deliveries are done
6168 in the normal way. However, if any SMTP deliveries are required, they are not
6169 done at this time, so the message remains on the queue until a subsequent queue
6170 runner process encounters it. Because routing was done, Exim knows which
6171 messages are waiting for which hosts, and so a number of messages for the same
6172 host can be sent in a single SMTP connection. The <option>queue_smtp_domains</option>
6173 configuration option has the same effect for specific domains. See also the
6174 <option>-qq</option> option.
6175 </para>
6176 </listitem></varlistentry>
6177 <varlistentry>
6178 <term><option>-oee</option></term>
6179 <listitem>
6180 <para>
6181 <indexterm role="option">
6182 <primary><option>-oee</option></primary>
6183 </indexterm>
6184 <indexterm role="concept">
6185 <primary>error</primary>
6186 <secondary>reporting</secondary>
6187 </indexterm>
6188 If an error is detected while a non-SMTP message is being received (for
6189 example, a malformed address), the error is reported to the sender in a mail
6190 message.
6191 </para>
6192 <para>
6193 <indexterm role="concept">
6194 <primary>return code</primary>
6195 <secondary>for <option>-oee</option></secondary>
6196 </indexterm>
6197 Provided
6198 this error message is successfully sent, the Exim receiving process
6199 exits with a return code of zero. If not, the return code is 2 if the problem
6200 is that the original message has no recipients, or 1 for any other error.
6201 This is the default <option>-oe</option><emphasis>x</emphasis> option if Exim is called as <emphasis>rmail</emphasis>.
6202 </para>
6203 </listitem></varlistentry>
6204 <varlistentry>
6205 <term><option>-oem</option></term>
6206 <listitem>
6207 <para>
6208 <indexterm role="option">
6209 <primary><option>-oem</option></primary>
6210 </indexterm>
6211 <indexterm role="concept">
6212 <primary>error</primary>
6213 <secondary>reporting</secondary>
6214 </indexterm>
6215 <indexterm role="concept">
6216 <primary>return code</primary>
6217 <secondary>for <option>-oem</option></secondary>
6218 </indexterm>
6219 This is the same as <option>-oee</option>, except that Exim always exits with a non-zero
6220 return code, whether or not the error message was successfully sent.
6221 This is the default <option>-oe</option><emphasis>x</emphasis> option, unless Exim is called as <emphasis>rmail</emphasis>.
6222 </para>
6223 </listitem></varlistentry>
6224 <varlistentry>
6225 <term><option>-oep</option></term>
6226 <listitem>
6227 <para>
6228 <indexterm role="option">
6229 <primary><option>-oep</option></primary>
6230 </indexterm>
6231 <indexterm role="concept">
6232 <primary>error</primary>
6233 <secondary>reporting</secondary>
6234 </indexterm>
6235 If an error is detected while a non-SMTP message is being received, the
6236 error is reported by writing a message to the standard error file (stderr).
6237 <indexterm role="concept">
6238 <primary>return code</primary>
6239 <secondary>for <option>-oep</option></secondary>
6240 </indexterm>
6241 The return code is 1 for all errors.
6242 </para>
6243 </listitem></varlistentry>
6244 <varlistentry>
6245 <term><option>-oeq</option></term>
6246 <listitem>
6247 <para>
6248 <indexterm role="option">
6249 <primary><option>-oeq</option></primary>
6250 </indexterm>
6251 <indexterm role="concept">
6252 <primary>error</primary>
6253 <secondary>reporting</secondary>
6254 </indexterm>
6255 This option is supported for compatibility with Sendmail, but has the same
6256 effect as <option>-oep</option>.
6257 </para>
6258 </listitem></varlistentry>
6259 <varlistentry>
6260 <term><option>-oew</option></term>
6261 <listitem>
6262 <para>
6263 <indexterm role="option">
6264 <primary><option>-oew</option></primary>
6265 </indexterm>
6266 <indexterm role="concept">
6267 <primary>error</primary>
6268 <secondary>reporting</secondary>
6269 </indexterm>
6270 This option is supported for compatibility with Sendmail, but has the same
6271 effect as <option>-oem</option>.
6272 </para>
6273 </listitem></varlistentry>
6274 <varlistentry>
6275 <term><option>-oi</option></term>
6276 <listitem>
6277 <para>
6278 <indexterm role="option">
6279 <primary><option>-oi</option></primary>
6280 </indexterm>
6281 <indexterm role="concept">
6282 <primary>dot</primary>
6283 <secondary>in incoming non-SMTP message</secondary>
6284 </indexterm>
6285 This option, which has the same effect as <option>-i</option>, specifies that a dot on a
6286 line by itself should not terminate an incoming, non-SMTP message. Otherwise, a
6287 single dot does terminate, though Exim does no special processing for other
6288 lines that start with a dot. This option is set by default if Exim is called as
6289 <emphasis>rmail</emphasis>. See also <option>-ti</option>.
6290 </para>
6291 </listitem></varlistentry>
6292 <varlistentry>
6293 <term><option>-oitrue</option></term>
6294 <listitem>
6295 <para>
6296 <indexterm role="option">
6297 <primary><option>-oitrue</option></primary>
6298 </indexterm>
6299 This option is treated as synonymous with <option>-oi</option>.
6300 </para>
6301 </listitem></varlistentry>
6302 <varlistentry>
6303 <term><option>-oMa</option>&nbsp;&lt;<emphasis>host&nbsp;address</emphasis>&gt;</term>
6304 <listitem>
6305 <para>
6306 <indexterm role="option">
6307 <primary><option>-oMa</option></primary>
6308 </indexterm>
6309 <indexterm role="concept">
6310 <primary>sender</primary>
6311 <secondary>host address, specifying for local message</secondary>
6312 </indexterm>
6313 A number of options starting with <option>-oM</option> can be used to set values associated
6314 with remote hosts on locally-submitted messages (that is, messages not received
6315 over TCP/IP). These options can be used by any caller in conjunction with the
6316 <option>-bh</option>, <option>-be</option>, <option>-bf</option>, <option>-bF</option>, <option>-bt</option>, or <option>-bv</option> testing options. In
6317 other circumstances, they are ignored unless the caller is trusted.
6318 </para>
6319 <para>
6320 The <option>-oMa</option> option sets the sender host address. This may include a port
6321 number at the end, after a full stop (period). For example:
6322 </para>
6323 <literallayout class="monospaced">
6324 exim -bs -oMa 10.9.8.7.1234
6325 </literallayout>
6326 <para>
6327 An alternative syntax is to enclose the IP address in square brackets,
6328 followed by a colon and the port number:
6329 </para>
6330 <literallayout class="monospaced">
6331 exim -bs -oMa [10.9.8.7]:1234
6332 </literallayout>
6333 <para>
6334 The IP address is placed in the <varname>$sender_host_address</varname> variable, and the
6335 port, if present, in <varname>$sender_host_port</varname>. If both <option>-oMa</option> and <option>-bh</option>
6336 are present on the command line, the sender host IP address is taken from
6337 whichever one is last.
6338 </para>
6339 </listitem></varlistentry>
6340 <varlistentry>
6341 <term><option>-oMaa</option>&nbsp;&lt;<emphasis>name</emphasis>&gt;</term>
6342 <listitem>
6343 <para>
6344 <indexterm role="option">
6345 <primary><option>-oMaa</option></primary>
6346 </indexterm>
6347 <indexterm role="concept">
6348 <primary>authentication</primary>
6349 <secondary>name, specifying for local message</secondary>
6350 </indexterm>
6351 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMaa</option>
6352 option sets the value of <varname>$sender_host_authenticated</varname> (the authenticator
6353 name). See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of SMTP authentication.
6354 This option can be used with <option>-bh</option> and <option>-bs</option> to set up an
6355 authenticated SMTP session without actually using the SMTP AUTH command.
6356 </para>
6357 </listitem></varlistentry>
6358 <varlistentry>
6359 <term><option>-oMai</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6360 <listitem>
6361 <para>
6362 <indexterm role="option">
6363 <primary><option>-oMai</option></primary>
6364 </indexterm>
6365 <indexterm role="concept">
6366 <primary>authentication</primary>
6367 <secondary>id, specifying for local message</secondary>
6368 </indexterm>
6369 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMai</option>
6370 option sets the value of <varname>$authenticated_id</varname> (the id that was authenticated).
6371 This overrides the default value (the caller&#x2019;s login id, except with <option>-bh</option>,
6372 where there is no default) for messages from local sources. See chapter
6373 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated ids.
6374 </para>
6375 </listitem></varlistentry>
6376 <varlistentry>
6377 <term><option>-oMas</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
6378 <listitem>
6379 <para>
6380 <indexterm role="option">
6381 <primary><option>-oMas</option></primary>
6382 </indexterm>
6383 <indexterm role="concept">
6384 <primary>authentication</primary>
6385 <secondary>sender, specifying for local message</secondary>
6386 </indexterm>
6387 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMas</option>
6388 option sets the authenticated sender value in <varname>$authenticated_sender</varname>. It
6389 overrides the sender address that is created from the caller&#x2019;s login id for
6390 messages from local sources, except when <option>-bh</option> is used, when there is no
6391 default. For both <option>-bh</option> and <option>-bs</option>, an authenticated sender that is
6392 specified on a MAIL command overrides this value. See chapter
6393 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated senders.
6394 </para>
6395 </listitem></varlistentry>
6396 <varlistentry>
6397 <term><option>-oMi</option>&nbsp;&lt;<emphasis>interface&nbsp;address</emphasis>&gt;</term>
6398 <listitem>
6399 <para>
6400 <indexterm role="option">
6401 <primary><option>-oMi</option></primary>
6402 </indexterm>
6403 <indexterm role="concept">
6404 <primary>interface</primary>
6405 <secondary>address, specifying for local message</secondary>
6406 </indexterm>
6407 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMi</option>
6408 option sets the IP interface address value. A port number may be included,
6409 using the same syntax as for <option>-oMa</option>. The interface address is placed in
6410 <varname>$received_ip_address</varname> and the port number, if present, in <varname>$received_port</varname>.
6411 </para>
6412 </listitem></varlistentry>
6413 <varlistentry>
6414 <term><option>-oMm</option>&nbsp;&lt;<emphasis>message&nbsp;reference</emphasis>&gt;</term>
6415 <listitem>
6416 <para>
6417 <indexterm role="option">
6418 <primary><option>-oMm</option></primary>
6419 </indexterm>
6420 <indexterm role="concept">
6421 <primary>message reference</primary>
6422 <secondary>message reference, specifying for local message</secondary>
6423 </indexterm>
6424 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMm</option>
6425 option sets the message reference, e.g. message-id, and is logged during
6426 delivery. This is useful when some kind of audit trail is required to tie
6427 messages together. The format of the message reference is checked and will
6428 abort if the format is invalid. The option will only be accepted if exim is
6429 running in trusted mode, not as any regular user.
6430 </para>
6431 <para>
6432 The best example of a message reference is when Exim sends a bounce message.
6433 The message reference is the message-id of the original message for which Exim
6434 is sending the bounce.
6435 </para>
6436 </listitem></varlistentry>
6437 <varlistentry>
6438 <term><option>-oMr</option>&nbsp;&lt;<emphasis>protocol&nbsp;name</emphasis>&gt;</term>
6439 <listitem>
6440 <para>
6441 <indexterm role="option">
6442 <primary><option>-oMr</option></primary>
6443 </indexterm>
6444 <indexterm role="concept">
6445 <primary>protocol, specifying for local message</primary>
6446 </indexterm>
6447 <indexterm role="variable">
6448 <primary><varname>$received_protocol</varname></primary>
6449 </indexterm>
6450 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMr</option>
6451 option sets the received protocol value that is stored in
6452 <varname>$received_protocol</varname>. However, it does not apply (and is ignored) when <option>-bh</option>
6453 or <option>-bs</option> is used. For <option>-bh</option>, the protocol is forced to one of the standard
6454 SMTP protocol names (see the description of <varname>$received_protocol</varname> in section
6455 <xref linkend="SECTexpvar"/>). For <option>-bs</option>, the protocol is always <quote>local-</quote> followed by
6456 one of those same names. For <option>-bS</option> (batched SMTP) however, the protocol can
6457 be set by <option>-oMr</option>.
6458 </para>
6459 </listitem></varlistentry>
6460 <varlistentry>
6461 <term><option>-oMs</option>&nbsp;&lt;<emphasis>host&nbsp;name</emphasis>&gt;</term>
6462 <listitem>
6463 <para>
6464 <indexterm role="option">
6465 <primary><option>-oMs</option></primary>
6466 </indexterm>
6467 <indexterm role="concept">
6468 <primary>sender</primary>
6469 <secondary>host name, specifying for local message</secondary>
6470 </indexterm>
6471 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMs</option>
6472 option sets the sender host name in <varname>$sender_host_name</varname>. When this option is
6473 present, Exim does not attempt to look up a host name from an IP address; it
6474 uses the name it is given.
6475 </para>
6476 </listitem></varlistentry>
6477 <varlistentry>
6478 <term><option>-oMt</option>&nbsp;&lt;<emphasis>ident&nbsp;string</emphasis>&gt;</term>
6479 <listitem>
6480 <para>
6481 <indexterm role="option">
6482 <primary><option>-oMt</option></primary>
6483 </indexterm>
6484 <indexterm role="concept">
6485 <primary>sender</primary>
6486 <secondary>ident string, specifying for local message</secondary>
6487 </indexterm>
6488 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMt</option>
6489 option sets the sender ident value in <varname>$sender_ident</varname>. The default setting for
6490 local callers is the login id of the calling process, except when <option>-bh</option> is
6491 used, when there is no default.
6492 </para>
6493 </listitem></varlistentry>
6494 <varlistentry>
6495 <term><option>-om</option></term>
6496 <listitem>
6497 <para>
6498 <indexterm role="option">
6499 <primary><option>-om</option></primary>
6500 </indexterm>
6501 <indexterm role="concept">
6502 <primary>Sendmail compatibility</primary>
6503 <secondary><option>-om</option> option ignored</secondary>
6504 </indexterm>
6505 In Sendmail, this option means <quote>me too</quote>, indicating that the sender of a
6506 message should receive a copy of the message if the sender appears in an alias
6507 expansion. Exim always does this, so the option does nothing.
6508 </para>
6509 </listitem></varlistentry>
6510 <varlistentry>
6511 <term><option>-oo</option></term>
6512 <listitem>
6513 <para>
6514 <indexterm role="option">
6515 <primary><option>-oo</option></primary>
6516 </indexterm>
6517 <indexterm role="concept">
6518 <primary>Sendmail compatibility</primary>
6519 <secondary><option>-oo</option> option ignored</secondary>
6520 </indexterm>
6521 This option is ignored. In Sendmail it specifies <quote>old style headers</quote>,
6522 whatever that means.
6523 </para>
6524 </listitem></varlistentry>
6525 <varlistentry>
6526 <term><option>-oP</option>&nbsp;&lt;<emphasis>path</emphasis>&gt;</term>
6527 <listitem>
6528 <para>
6529 <indexterm role="option">
6530 <primary><option>-oP</option></primary>
6531 </indexterm>
6532 <indexterm role="concept">
6533 <primary>pid (process id)</primary>
6534 <secondary>of daemon</secondary>
6535 </indexterm>
6536 <indexterm role="concept">
6537 <primary>daemon</primary>
6538 <secondary>process id (pid)</secondary>
6539 </indexterm>
6540 This option is useful only in conjunction with <option>-bd</option> or <option>-q</option> with a time
6541 value. The option specifies the file to which the process id of the daemon is
6542 written. When <option>-oX</option> is used with <option>-bd</option>, or when <option>-q</option> with a time is used
6543 without <option>-bd</option>, this is the only way of causing Exim to write a pid file,
6544 because in those cases, the normal pid file is not used.
6545 </para>
6546 </listitem></varlistentry>
6547 <varlistentry>
6548 <term><option>-or</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6549 <listitem>
6550 <para>
6551 <indexterm role="option">
6552 <primary><option>-or</option></primary>
6553 </indexterm>
6554 <indexterm role="concept">
6555 <primary>timeout</primary>
6556 <secondary>for non-SMTP input</secondary>
6557 </indexterm>
6558 This option sets a timeout value for incoming non-SMTP messages. If it is not
6559 set, Exim will wait forever for the standard input. The value can also be set
6560 by the <option>receive_timeout</option> option. The format used for specifying times is
6561 described in section <xref linkend="SECTtimeformat"/>.
6562 </para>
6563 </listitem></varlistentry>
6564 <varlistentry>
6565 <term><option>-os</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6566 <listitem>
6567 <para>
6568 <indexterm role="option">
6569 <primary><option>-os</option></primary>
6570 </indexterm>
6571 <indexterm role="concept">
6572 <primary>timeout</primary>
6573 <secondary>for SMTP input</secondary>
6574 </indexterm>
6575 <indexterm role="concept">
6576 <primary>SMTP</primary>
6577 <secondary>input timeout</secondary>
6578 </indexterm>
6579 This option sets a timeout value for incoming SMTP messages. The timeout
6580 applies to each SMTP command and block of data. The value can also be set by
6581 the <option>smtp_receive_timeout</option> option; it defaults to 5 minutes. The format used
6582 for specifying times is described in section <xref linkend="SECTtimeformat"/>.
6583 </para>
6584 </listitem></varlistentry>
6585 <varlistentry>
6586 <term><option>-ov</option></term>
6587 <listitem>
6588 <para>
6589 <indexterm role="option">
6590 <primary><option>-ov</option></primary>
6591 </indexterm>
6592 This option has exactly the same effect as <option>-v</option>.
6593 </para>
6594 </listitem></varlistentry>
6595 <varlistentry>
6596 <term><option>-oX</option>&nbsp;&lt;<emphasis>number&nbsp;or&nbsp;string</emphasis>&gt;</term>
6597 <listitem>
6598 <para>
6599 <indexterm role="option">
6600 <primary><option>-oX</option></primary>
6601 </indexterm>
6602 <indexterm role="concept">
6603 <primary>TCP/IP</primary>
6604 <secondary>setting listening ports</secondary>
6605 </indexterm>
6606 <indexterm role="concept">
6607 <primary>TCP/IP</primary>
6608 <secondary>setting listening interfaces</secondary>
6609 </indexterm>
6610 <indexterm role="concept">
6611 <primary>port</primary>
6612 <secondary>receiving TCP/IP</secondary>
6613 </indexterm>
6614 This option is relevant only when the <option>-bd</option> (start listening daemon) option
6615 is also given. It controls which ports and interfaces the daemon uses. Details
6616 of the syntax, and how it interacts with configuration file options, are given
6617 in chapter <xref linkend="CHAPinterfaces"/>. When <option>-oX</option> is used to start a daemon, no pid
6618 file is written unless <option>-oP</option> is also present to specify a pid file name.
6619 </para>
6620 </listitem></varlistentry>
6621 <varlistentry>
6622 <term><option>-pd</option></term>
6623 <listitem>
6624 <para>
6625 <indexterm role="option">
6626 <primary><option>-pd</option></primary>
6627 </indexterm>
6628 <indexterm role="concept">
6629 <primary>Perl</primary>
6630 <secondary>starting the interpreter</secondary>
6631 </indexterm>
6632 This option applies when an embedded Perl interpreter is linked with Exim (see
6633 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6634 option, forcing the starting of the interpreter to be delayed until it is
6635 needed.
6636 </para>
6637 </listitem></varlistentry>
6638 <varlistentry>
6639 <term><option>-ps</option></term>
6640 <listitem>
6641 <para>
6642 <indexterm role="option">
6643 <primary><option>-ps</option></primary>
6644 </indexterm>
6645 <indexterm role="concept">
6646 <primary>Perl</primary>
6647 <secondary>starting the interpreter</secondary>
6648 </indexterm>
6649 This option applies when an embedded Perl interpreter is linked with Exim (see
6650 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6651 option, forcing the starting of the interpreter to occur as soon as Exim is
6652 started.
6653 </para>
6654 </listitem></varlistentry>
6655 <varlistentry>
6656 <term><option>-p</option>&lt;<emphasis>rval</emphasis>&gt;:&lt;<emphasis>sval</emphasis>&gt;</term>
6657 <listitem>
6658 <para>
6659 <indexterm role="option">
6660 <primary><option>-p</option></primary>
6661 </indexterm>
6662 For compatibility with Sendmail, this option is equivalent to
6663 </para>
6664 <literallayout>
6665 <literal>-oMr</literal> &lt;<emphasis>rval</emphasis>&gt; <literal>-oMs</literal> &lt;<emphasis>sval</emphasis>&gt;
6666 </literallayout>
6667 <para>
6668 It sets the incoming protocol and host name (for trusted callers). The
6669 host name and its colon can be omitted when only the protocol is to be set.
6670 Note the Exim already has two private options, <option>-pd</option> and <option>-ps</option>, that refer
6671 to embedded Perl. It is therefore impossible to set a protocol value of <literal>d</literal>
6672 or <literal>s</literal> using this option (but that does not seem a real limitation).
6673 </para>
6674 </listitem></varlistentry>
6675 <varlistentry>
6676 <term><option>-q</option></term>
6677 <listitem>
6678 <para>
6679 <indexterm role="option">
6680 <primary><option>-q</option></primary>
6681 </indexterm>
6682 <indexterm role="concept">
6683 <primary>queue runner</primary>
6684 <secondary>starting manually</secondary>
6685 </indexterm>
6686 This option is normally restricted to admin users. However, there is a
6687 configuration option called <option>prod_requires_admin</option> which can be set false to
6688 relax this restriction (and also the same requirement for the <option>-M</option>, <option>-R</option>,
6689 and <option>-S</option> options).
6690 </para>
6691 <para>
6692 <indexterm role="concept">
6693 <primary>queue runner</primary>
6694 <secondary>description of operation</secondary>
6695 </indexterm>
6696 The <option>-q</option> option starts one queue runner process. This scans the queue of
6697 waiting messages, and runs a delivery process for each one in turn. It waits
6698 for each delivery process to finish before starting the next one. A delivery
6699 process may not actually do any deliveries if the retry times for the addresses
6700 have not been reached. Use <option>-qf</option> (see below) if you want to override this.
6701 </para>
6702 <para>
6703 If
6704 <indexterm role="concept">
6705 <primary>SMTP</primary>
6706 <secondary>passed connection</secondary>
6707 </indexterm>
6708 <indexterm role="concept">
6709 <primary>SMTP</primary>
6710 <secondary>multiple deliveries</secondary>
6711 </indexterm>
6712 <indexterm role="concept">
6713 <primary>multiple SMTP deliveries</primary>
6714 </indexterm>
6715 the delivery process spawns other processes to deliver other messages down
6716 passed SMTP connections, the queue runner waits for these to finish before
6717 proceeding.
6718 </para>
6719 <para>
6720 When all the queued messages have been considered, the original queue runner
6721 process terminates. In other words, a single pass is made over the waiting
6722 mail, one message at a time. Use <option>-q</option> with a time (see below) if you want
6723 this to be repeated periodically.
6724 </para>
6725 <para>
6726 Exim processes the waiting messages in an unpredictable order. It isn&#x2019;t very
6727 random, but it is likely to be different each time, which is all that matters.
6728 If one particular message screws up a remote MTA, other messages to the same
6729 MTA have a chance of getting through if they get tried first.
6730 </para>
6731 <para>
6732 It is possible to cause the messages to be processed in lexical message id
6733 order, which is essentially the order in which they arrived, by setting the
6734 <option>queue_run_in_order</option> option, but this is not recommended for normal use.
6735 </para>
6736 </listitem></varlistentry>
6737 <varlistentry>
6738 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;</term>
6739 <listitem>
6740 <para>
6741 The <option>-q</option> option may be followed by one or more flag letters that change its
6742 behaviour. They are all optional, but if more than one is present, they must
6743 appear in the correct order. Each flag is described in a separate item below.
6744 </para>
6745 </listitem></varlistentry>
6746 <varlistentry>
6747 <term><option>-qq...</option></term>
6748 <listitem>
6749 <para>
6750 <indexterm role="option">
6751 <primary><option>-qq</option></primary>
6752 </indexterm>
6753 <indexterm role="concept">
6754 <primary>queue</primary>
6755 <secondary>double scanning</secondary>
6756 </indexterm>
6757 <indexterm role="concept">
6758 <primary>queue</primary>
6759 <secondary>routing</secondary>
6760 </indexterm>
6761 <indexterm role="concept">
6762 <primary>routing</primary>
6763 <secondary>whole queue before delivery</secondary>
6764 </indexterm>
6765 An option starting with <option>-qq</option> requests a two-stage queue run. In the first
6766 stage, the queue is scanned as if the <option>queue_smtp_domains</option> option matched
6767 every domain. Addresses are routed, local deliveries happen, but no remote
6768 transports are run.
6769 </para>
6770 <para>
6771 <indexterm role="concept">
6772 <primary>hints database</primary>
6773 <secondary>remembering routing</secondary>
6774 </indexterm>
6775 The hints database that remembers which messages are waiting for specific hosts
6776 is updated, as if delivery to those hosts had been deferred. After this is
6777 complete, a second, normal queue scan happens, with routing and delivery taking
6778 place as normal. Messages that are routed to the same host should mostly be
6779 delivered down a single SMTP
6780 <indexterm role="concept">
6781 <primary>SMTP</primary>
6782 <secondary>passed connection</secondary>
6783 </indexterm>
6784 <indexterm role="concept">
6785 <primary>SMTP</primary>
6786 <secondary>multiple deliveries</secondary>
6787 </indexterm>
6788 <indexterm role="concept">
6789 <primary>multiple SMTP deliveries</primary>
6790 </indexterm>
6791 connection because of the hints that were set up during the first queue scan.
6792 This option may be useful for hosts that are connected to the Internet
6793 intermittently.
6794 </para>
6795 </listitem></varlistentry>
6796 <varlistentry>
6797 <term><option>-q[q]i...</option></term>
6798 <listitem>
6799 <para>
6800 <indexterm role="option">
6801 <primary><option>-qi</option></primary>
6802 </indexterm>
6803 <indexterm role="concept">
6804 <primary>queue</primary>
6805 <secondary>initial delivery</secondary>
6806 </indexterm>
6807 If the <emphasis>i</emphasis> flag is present, the queue runner runs delivery processes only for
6808 those messages that haven&#x2019;t previously been tried. (<emphasis>i</emphasis> stands for <quote>initial
6809 delivery</quote>.) This can be helpful if you are putting messages on the queue using
6810 <option>-odq</option> and want a queue runner just to process the new messages.
6811 </para>
6812 </listitem></varlistentry>
6813 <varlistentry>
6814 <term><option>-q[q][i]f...</option></term>
6815 <listitem>
6816 <para>
6817 <indexterm role="option">
6818 <primary><option>-qf</option></primary>
6819 </indexterm>
6820 <indexterm role="concept">
6821 <primary>queue</primary>
6822 <secondary>forcing delivery</secondary>
6823 </indexterm>
6824 <indexterm role="concept">
6825 <primary>delivery</primary>
6826 <secondary>forcing in queue run</secondary>
6827 </indexterm>
6828 If one <emphasis>f</emphasis> flag is present, a delivery attempt is forced for each non-frozen
6829 message, whereas without <emphasis>f</emphasis> only those non-frozen addresses that have passed
6830 their retry times are tried.
6831 </para>
6832 </listitem></varlistentry>
6833 <varlistentry>
6834 <term><option>-q[q][i]ff...</option></term>
6835 <listitem>
6836 <para>
6837 <indexterm role="option">
6838 <primary><option>-qff</option></primary>
6839 </indexterm>
6840 <indexterm role="concept">
6841 <primary>frozen messages</primary>
6842 <secondary>forcing delivery</secondary>
6843 </indexterm>
6844 If <emphasis>ff</emphasis> is present, a delivery attempt is forced for every message, whether
6845 frozen or not.
6846 </para>
6847 </listitem></varlistentry>
6848 <varlistentry>
6849 <term><option>-q[q][i][f[f]]l</option></term>
6850 <listitem>
6851 <para>
6852 <indexterm role="option">
6853 <primary><option>-ql</option></primary>
6854 </indexterm>
6855 <indexterm role="concept">
6856 <primary>queue</primary>
6857 <secondary>local deliveries only</secondary>
6858 </indexterm>
6859 The <emphasis>l</emphasis> (the letter <quote>ell</quote>) flag specifies that only local deliveries are to
6860 be done. If a message requires any remote deliveries, it remains on the queue
6861 for later delivery.
6862 </para>
6863 </listitem></varlistentry>
6864 <varlistentry>
6865 <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>
6866 <listitem>
6867 <para>
6868 <indexterm role="concept">
6869 <primary>queue</primary>
6870 <secondary>delivering specific messages</secondary>
6871 </indexterm>
6872 When scanning the queue, Exim can be made to skip over messages whose ids are
6873 lexically less than a given value by following the <option>-q</option> option with a
6874 starting message id. For example:
6875 </para>
6876 <literallayout class="monospaced">
6877 exim -q 0t5C6f-0000c8-00
6878 </literallayout>
6879 <para>
6880 Messages that arrived earlier than <literal>0t5C6f-0000c8-00</literal> are not inspected. If a
6881 second message id is given, messages whose ids are lexically greater than it
6882 are also skipped. If the same id is given twice, for example,
6883 </para>
6884 <literallayout class="monospaced">
6885 exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00
6886 </literallayout>
6887 <para>
6888 just one delivery process is started, for that message. This differs from
6889 <option>-M</option> in that retry data is respected, and it also differs from <option>-Mc</option> in
6890 that it counts as a delivery from a queue run. Note that the selection
6891 mechanism does not affect the order in which the messages are scanned. There
6892 are also other ways of selecting specific sets of messages for delivery in a
6893 queue run &ndash; see <option>-R</option> and <option>-S</option>.
6894 </para>
6895 </listitem></varlistentry>
6896 <varlistentry>
6897 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;&lt;<emphasis>time</emphasis>&gt;</term>
6898 <listitem>
6899 <para>
6900 <indexterm role="concept">
6901 <primary>queue runner</primary>
6902 <secondary>starting periodically</secondary>
6903 </indexterm>
6904 <indexterm role="concept">
6905 <primary>periodic queue running</primary>
6906 </indexterm>
6907 When a time value is present, the <option>-q</option> option causes Exim to run as a daemon,
6908 starting a queue runner process at intervals specified by the given time value
6909 (whose format is described in section <xref linkend="SECTtimeformat"/>). This form of the
6910 <option>-q</option> option is commonly combined with the <option>-bd</option> option, in which case a
6911 single daemon process handles both functions. A common way of starting up a
6912 combined daemon at system boot time is to use a command such as
6913 </para>
6914 <literallayout class="monospaced">
6915 /usr/exim/bin/exim -bd -q30m
6916 </literallayout>
6917 <para>
6918 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
6919 process every 30 minutes.
6920 </para>
6921 <para>
6922 When a daemon is started by <option>-q</option> with a time value, but without <option>-bd</option>, no
6923 pid file is written unless one is explicitly requested by the <option>-oP</option> option.
6924 </para>
6925 </listitem></varlistentry>
6926 <varlistentry>
6927 <term><option>-qR</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6928 <listitem>
6929 <para>
6930 <indexterm role="option">
6931 <primary><option>-qR</option></primary>
6932 </indexterm>
6933 This option is synonymous with <option>-R</option>. It is provided for Sendmail
6934 compatibility.
6935 </para>
6936 </listitem></varlistentry>
6937 <varlistentry>
6938 <term><option>-qS</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6939 <listitem>
6940 <para>
6941 <indexterm role="option">
6942 <primary><option>-qS</option></primary>
6943 </indexterm>
6944 This option is synonymous with <option>-S</option>.
6945 </para>
6946 </listitem></varlistentry>
6947 <varlistentry>
6948 <term><option>-R</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6949 <listitem>
6950 <para>
6951 <indexterm role="option">
6952 <primary><option>-R</option></primary>
6953 </indexterm>
6954 <indexterm role="concept">
6955 <primary>queue runner</primary>
6956 <secondary>for specific recipients</secondary>
6957 </indexterm>
6958 <indexterm role="concept">
6959 <primary>delivery</primary>
6960 <secondary>to given domain</secondary>
6961 </indexterm>
6962 <indexterm role="concept">
6963 <primary>domain</primary>
6964 <secondary>delivery to</secondary>
6965 </indexterm>
6966 The &lt;<emphasis>rsflags</emphasis>&gt; may be empty, in which case the white space before the string
6967 is optional, unless the string is <emphasis>f</emphasis>, <emphasis>ff</emphasis>, <emphasis>r</emphasis>, <emphasis>rf</emphasis>, or <emphasis>rff</emphasis>,
6968 which are the possible values for &lt;<emphasis>rsflags</emphasis>&gt;. White space is required if
6969 &lt;<emphasis>rsflags</emphasis>&gt; is not empty.
6970 </para>
6971 <para>
6972 This option is similar to <option>-q</option> with no time value, that is, it causes Exim to
6973 perform a single queue run, except that, when scanning the messages on the
6974 queue, Exim processes only those that have at least one undelivered recipient
6975 address containing the given string, which is checked in a case-independent
6976 way. If the &lt;<emphasis>rsflags</emphasis>&gt; start with <emphasis>r</emphasis>, &lt;<emphasis>string</emphasis>&gt; is interpreted as a
6977 regular expression; otherwise it is a literal string.
6978 </para>
6979 <para>
6980 If you want to do periodic queue runs for messages with specific recipients,
6981 you can combine <option>-R</option> with <option>-q</option> and a time value. For example:
6982 </para>
6983 <literallayout class="monospaced">
6984 exim -q25m -R @special.domain.example
6985 </literallayout>
6986 <para>
6987 This example does a queue run for messages with recipients in the given domain
6988 every 25 minutes. Any additional flags that are specified with <option>-q</option> are
6989 applied to each queue run.
6990 </para>
6991 <para>
6992 Once a message is selected for delivery by this mechanism, all its addresses
6993 are processed. For the first selected message, Exim overrides any retry
6994 information and forces a delivery attempt for each undelivered address. This
6995 means that if delivery of any address in the first message is successful, any
6996 existing retry information is deleted, and so delivery attempts for that
6997 address in subsequently selected messages (which are processed without forcing)
6998 will run. However, if delivery of any address does not succeed, the retry
6999 information is updated, and in subsequently selected messages, the failing
7000 address will be skipped.
7001 </para>
7002 <para>
7003 <indexterm role="concept">
7004 <primary>frozen messages</primary>
7005 <secondary>forcing delivery</secondary>
7006 </indexterm>
7007 If the &lt;<emphasis>rsflags</emphasis>&gt; contain <emphasis>f</emphasis> or <emphasis>ff</emphasis>, the delivery forcing applies to
7008 all selected messages, not just the first; frozen messages are included when
7009 <emphasis>ff</emphasis> is present.
7010 </para>
7011 <para>
7012 The <option>-R</option> option makes it straightforward to initiate delivery of all messages
7013 to a given domain after a host has been down for some time. When the SMTP
7014 command ETRN is accepted by its ACL (see chapter <xref linkend="CHAPACL"/>), its default
7015 effect is to run Exim with the <option>-R</option> option, but it can be configured to run
7016 an arbitrary command instead.
7017 </para>
7018 </listitem></varlistentry>
7019 <varlistentry>
7020 <term><option>-r</option></term>
7021 <listitem>
7022 <para>
7023 <indexterm role="option">
7024 <primary><option>-r</option></primary>
7025 </indexterm>
7026 This is a documented (for Sendmail) obsolete alternative name for <option>-f</option>.
7027 </para>
7028 </listitem></varlistentry>
7029 <varlistentry>
7030 <term><option>-S</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7031 <listitem>
7032 <para>
7033 <indexterm role="option">
7034 <primary><option>-S</option></primary>
7035 </indexterm>
7036 <indexterm role="concept">
7037 <primary>delivery</primary>
7038 <secondary>from given sender</secondary>
7039 </indexterm>
7040 <indexterm role="concept">
7041 <primary>queue runner</primary>
7042 <secondary>for specific senders</secondary>
7043 </indexterm>
7044 This option acts like <option>-R</option> except that it checks the string against each
7045 message&#x2019;s sender instead of against the recipients. If <option>-R</option> is also set, both
7046 conditions must be met for a message to be selected. If either of the options
7047 has <emphasis>f</emphasis> or <emphasis>ff</emphasis> in its flags, the associated action is taken.
7048 </para>
7049 </listitem></varlistentry>
7050 <varlistentry>
7051 <term><option>-Tqt</option>&nbsp;&lt;<emphasis>times</emphasis>&gt;</term>
7052 <listitem>
7053 <para>
7054 <indexterm role="option">
7055 <primary><option>-Tqt</option></primary>
7056 </indexterm>
7057 This is an option that is exclusively for use by the Exim testing suite. It is not
7058 recognized when Exim is run normally. It allows for the setting up of explicit
7059 <quote>queue times</quote> so that various warning/retry features can be tested.
7060 </para>
7061 </listitem></varlistentry>
7062 <varlistentry>
7063 <term><option>-t</option></term>
7064 <listitem>
7065 <para>
7066 <indexterm role="option">
7067 <primary><option>-t</option></primary>
7068 </indexterm>
7069 <indexterm role="concept">
7070 <primary>recipient</primary>
7071 <secondary>extracting from header lines</secondary>
7072 </indexterm>
7073 <indexterm role="concept">
7074 <primary><emphasis>Bcc:</emphasis> header line</primary>
7075 </indexterm>
7076 <indexterm role="concept">
7077 <primary><emphasis>Cc:</emphasis> header line</primary>
7078 </indexterm>
7079 <indexterm role="concept">
7080 <primary><emphasis>To:</emphasis> header line</primary>
7081 </indexterm>
7082 When Exim is receiving a locally-generated, non-SMTP message on its standard
7083 input, the <option>-t</option> option causes the recipients of the message to be obtained
7084 from the <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis> header lines in the message instead of
7085 from the command arguments. The addresses are extracted before any rewriting
7086 takes place and the <emphasis>Bcc:</emphasis> header line, if present, is then removed.
7087 </para>
7088 <para>
7089 <indexterm role="concept">
7090 <primary>Sendmail compatibility</primary>
7091 <secondary><option>-t</option> option</secondary>
7092 </indexterm>
7093 If the command has any arguments, they specify addresses to which the message
7094 is <emphasis>not</emphasis> to be delivered. That is, the argument addresses are removed from
7095 the recipients list obtained from the headers. This is compatible with Smail 3
7096 and in accordance with the documented behaviour of several versions of
7097 Sendmail, as described in man pages on a number of operating systems (e.g.
7098 Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail <emphasis>add</emphasis>
7099 argument addresses to those obtained from the headers, and the O&#x2019;Reilly
7100 Sendmail book documents it that way. Exim can be made to add argument addresses
7101 instead of subtracting them by setting the option
7102 <option>extract_addresses_remove_arguments</option> false.
7103 </para>
7104 <para>
7105 <indexterm role="concept">
7106 <primary><option>Resent-</option> header lines</primary>
7107 <secondary>with <option>-t</option></secondary>
7108 </indexterm>
7109 If there are any <option>Resent-</option> header lines in the message, Exim extracts
7110 recipients from all <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>, and <emphasis>Resent-Bcc:</emphasis> header
7111 lines instead of from <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis>. This is for compatibility
7112 with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if
7113 <option>-t</option> was used in conjunction with <option>Resent-</option> header lines.)
7114 </para>
7115 <para>
7116 RFC 2822 talks about different sets of <option>Resent-</option> header lines (for when a
7117 message is resent several times). The RFC also specifies that they should be
7118 added at the front of the message, and separated by <emphasis>Received:</emphasis> lines. It is
7119 not at all clear how <option>-t</option> should operate in the present of multiple sets,
7120 nor indeed exactly what constitutes a <quote>set</quote>.
7121 In practice, it seems that MUAs do not follow the RFC. The <option>Resent-</option> lines
7122 are often added at the end of the header, and if a message is resent more than
7123 once, it is common for the original set of <option>Resent-</option> headers to be renamed as
7124 <option>X-Resent-</option> when a new set is added. This removes any possible ambiguity.
7125 </para>
7126 </listitem></varlistentry>
7127 <varlistentry>
7128 <term><option>-ti</option></term>
7129 <listitem>
7130 <para>
7131 <indexterm role="option">
7132 <primary><option>-ti</option></primary>
7133 </indexterm>
7134 This option is exactly equivalent to <option>-t</option> <option>-i</option>. It is provided for
7135 compatibility with Sendmail.
7136 </para>
7137 </listitem></varlistentry>
7138 <varlistentry>
7139 <term><option>-tls-on-connect</option></term>
7140 <listitem>
7141 <para>
7142 <indexterm role="option">
7143 <primary><option>-tls-on-connect</option></primary>
7144 </indexterm>
7145 <indexterm role="concept">
7146 <primary>TLS</primary>
7147 <secondary>use without STARTTLS</secondary>
7148 </indexterm>
7149 <indexterm role="concept">
7150 <primary>TLS</primary>
7151 <secondary>automatic start</secondary>
7152 </indexterm>
7153 This option is available when Exim is compiled with TLS support. It forces all
7154 incoming SMTP connections to behave as if the incoming port is listed in the
7155 <option>tls_on_connect_ports</option> option. See section <xref linkend="SECTsupobssmt"/> and chapter
7156 <xref linkend="CHAPTLS"/> for further details.
7157 </para>
7158 </listitem></varlistentry>
7159 <varlistentry>
7160 <term><option>-U</option></term>
7161 <listitem>
7162 <para>
7163 <indexterm role="option">
7164 <primary><option>-U</option></primary>
7165 </indexterm>
7166 <indexterm role="concept">
7167 <primary>Sendmail compatibility</primary>
7168 <secondary><option>-U</option> option ignored</secondary>
7169 </indexterm>
7170 Sendmail uses this option for <quote>initial message submission</quote>, and its
7171 documentation states that in future releases, it may complain about
7172 syntactically invalid messages rather than fixing them when this flag is not
7173 set. Exim ignores this option.
7174 </para>
7175 </listitem></varlistentry>
7176 <varlistentry>
7177 <term><option>-v</option></term>
7178 <listitem>
7179 <para>
7180 <indexterm role="option">
7181 <primary><option>-v</option></primary>
7182 </indexterm>
7183 This option causes Exim to write information to the standard error stream,
7184 describing what it is doing. In particular, it shows the log lines for
7185 receiving and delivering a message, and if an SMTP connection is made, the SMTP
7186 dialogue is shown. Some of the log lines shown may not actually be written to
7187 the log if the setting of <option>log_selector</option> discards them. Any relevant
7188 selectors are shown with each log line. If none are shown, the logging is
7189 unconditional.
7190 </para>
7191 </listitem></varlistentry>
7192 <varlistentry>
7193 <term><option>-x</option></term>
7194 <listitem>
7195 <para>
7196 <indexterm role="option">
7197 <primary><option>-x</option></primary>
7198 </indexterm>
7199 AIX uses <option>-x</option> for a private purpose (<quote>mail from a local mail program has
7200 National Language Support extended characters in the body of the mail item</quote>).
7201 It sets <option>-x</option> when calling the MTA from its <option>mail</option> command. Exim ignores
7202 this option.
7203 </para>
7204 </listitem></varlistentry>
7205 <varlistentry>
7206 <term><option>-X</option>&nbsp;&lt;<emphasis>logfile</emphasis>&gt;</term>
7207 <listitem>
7208 <para>
7209 <indexterm role="option">
7210 <primary><option>-X</option></primary>
7211 </indexterm>
7212 This option is interpreted by Sendmail to cause debug information to be sent
7213 to the named file.  It is ignored by Exim.
7214 </para>
7215 </listitem></varlistentry>
7216 <varlistentry>
7217 <term><option>-z</option>&nbsp;&lt;<emphasis>log-line</emphasis>&gt;</term>
7218 <listitem>
7219 <para>
7220 <indexterm role="option">
7221 <primary><option>-z</option></primary>
7222 </indexterm>
7223 This option writes its argument to Exim&#x2019;s logfile.
7224 Use is restricted to administrators; the intent is for operational notes.
7225 Quotes should be used to maintain a multi-word item as a single argument,
7226 under most shells.
7227 </para>
7228 </listitem></varlistentry>
7229 </variablelist>
7230 <para>
7231 <indexterm role="concept" startref="IIDclo1" class="endofrange"/>
7232 <indexterm role="concept" startref="IIDclo2" class="endofrange"/>
7233 </para>
7234 <!-- === End of command line options === -->
7235 </section>
7236 </chapter>
7237
7238 <chapter id="CHAPconf">
7239 <title>The Exim run time configuration file</title>
7240 <titleabbrev>The runtime configuration file</titleabbrev>
7241 <para>
7242 <indexterm role="concept">
7243 <primary>run time configuration</primary>
7244 </indexterm>
7245 <indexterm role="concept">
7246 <primary>configuration file</primary>
7247 <secondary>general description</secondary>
7248 </indexterm>
7249 <indexterm role="concept">
7250 <primary>CONFIGURE_FILE</primary>
7251 </indexterm>
7252 <indexterm role="concept">
7253 <primary>configuration file</primary>
7254 <secondary>errors in</secondary>
7255 </indexterm>
7256 <indexterm role="concept">
7257 <primary>error</primary>
7258 <secondary>in configuration file</secondary>
7259 </indexterm>
7260 <indexterm role="concept">
7261 <primary>return code</primary>
7262 <secondary>for bad configuration</secondary>
7263 </indexterm>
7264 Exim uses a single run time configuration file that is read whenever an Exim
7265 binary is executed. Note that in normal operation, this happens frequently,
7266 because Exim is designed to operate in a distributed manner, without central
7267 control.
7268 </para>
7269 <para>
7270 If a syntax error is detected while reading the configuration file, Exim
7271 writes a message on the standard error, and exits with a non-zero return code.
7272 The message is also written to the panic log. <emphasis role="bold">Note</emphasis>: Only simple syntax
7273 errors can be detected at this time. The values of any expanded options are
7274 not checked until the expansion happens, even when the expansion does not
7275 actually alter the string.
7276 </para>
7277 <para>
7278 The name of the configuration file is compiled into the binary for security
7279 reasons, and is specified by the CONFIGURE_FILE compilation option. In
7280 most configurations, this specifies a single file. However, it is permitted to
7281 give a colon-separated list of file names, in which case Exim uses the first
7282 existing file in the list.
7283 </para>
7284 <para>
7285 <indexterm role="concept">
7286 <primary>EXIM_USER</primary>
7287 </indexterm>
7288 <indexterm role="concept">
7289 <primary>EXIM_GROUP</primary>
7290 </indexterm>
7291 <indexterm role="concept">
7292 <primary>CONFIGURE_OWNER</primary>
7293 </indexterm>
7294 <indexterm role="concept">
7295 <primary>CONFIGURE_GROUP</primary>
7296 </indexterm>
7297 <indexterm role="concept">
7298 <primary>configuration file</primary>
7299 <secondary>ownership</secondary>
7300 </indexterm>
7301 <indexterm role="concept">
7302 <primary>ownership</primary>
7303 <secondary>configuration file</secondary>
7304 </indexterm>
7305 The run time configuration file must be owned by root or by the user that is
7306 specified at compile time by the CONFIGURE_OWNER option (if set). The
7307 configuration file must not be world-writeable, or group-writeable unless its
7308 group is the root group or the one specified at compile time by the
7309 CONFIGURE_GROUP option.
7310 </para>
7311 <para>
7312 <emphasis role="bold">Warning</emphasis>: In a conventional configuration, where the Exim binary is setuid
7313 to root, anybody who is able to edit the run time configuration file has an
7314 easy way to run commands as root. If you specify a user or group in the
7315 CONFIGURE_OWNER or CONFIGURE_GROUP options, then that user and/or any users
7316 who are members of that group will trivially be able to obtain root privileges.
7317 </para>
7318 <para>
7319 Up to Exim version 4.72, the run time configuration file was also permitted to
7320 be writeable by the Exim user and/or group. That has been changed in Exim 4.73
7321 since it offered a simple privilege escalation for any attacker who managed to
7322 compromise the Exim user account.
7323 </para>
7324 <para>
7325 A default configuration file, which will work correctly in simple situations,
7326 is provided in the file <filename>src/configure.default</filename>. If CONFIGURE_FILE
7327 defines just one file name, the installation process copies the default
7328 configuration to a new file of that name if it did not previously exist. If
7329 CONFIGURE_FILE is a list, no default is automatically installed. Chapter
7330 <xref linkend="CHAPdefconfil"/> is a <quote>walk-through</quote> discussion of the default
7331 configuration.
7332 </para>
7333 <section id="SECID40">
7334 <title>Using a different configuration file</title>
7335 <para>
7336 <indexterm role="concept">
7337 <primary>configuration file</primary>
7338 <secondary>alternate</secondary>
7339 </indexterm>
7340 A one-off alternate configuration can be specified by the <option>-C</option> command line
7341 option, which may specify a single file or a list of files. However, when
7342 <option>-C</option> is used, Exim gives up its root privilege, unless called by root (or
7343 unless the argument for <option>-C</option> is identical to the built-in value from
7344 CONFIGURE_FILE), or is listed in the TRUSTED_CONFIG_LIST file and the caller
7345 is the Exim user or the user specified in the CONFIGURE_OWNER setting. <option>-C</option>
7346 is useful mainly for checking the syntax of configuration files before
7347 installing them. No owner or group checks are done on a configuration file
7348 specified by <option>-C</option>, if root privilege has been dropped.
7349 </para>
7350 <para>
7351 Even the Exim user is not trusted to specify an arbitrary configuration file
7352 with the <option>-C</option> option to be used with root privileges, unless that file is
7353 listed in the TRUSTED_CONFIG_LIST file. This locks out the possibility of
7354 testing a configuration using <option>-C</option> right through message reception and
7355 delivery, even if the caller is root. The reception works, but by that time,
7356 Exim is running as the Exim user, so when it re-execs to regain privilege for
7357 the delivery, the use of <option>-C</option> causes privilege to be lost. However, root
7358 can test reception and delivery using two separate commands (one to put a
7359 message on the queue, using <option>-odq</option>, and another to do the delivery, using
7360 <option>-M</option>).
7361 </para>
7362 <para>
7363 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
7364 prefix string with which any file named in a <option>-C</option> command line option must
7365 start. In addition, the file name must not contain the sequence <quote><literal>/../</literal></quote>.
7366 There is no default setting for ALT_CONFIG_PREFIX; when it is unset, any file
7367 name can be used with <option>-C</option>.
7368 </para>
7369 <para>
7370 One-off changes to a configuration can be specified by the <option>-D</option> command line
7371 option, which defines and overrides values for macros used inside the
7372 configuration file. However, like <option>-C</option>, the use of this option by a
7373 non-privileged user causes Exim to discard its root privilege.
7374 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
7375 completely disabled, and its use causes an immediate error exit.
7376 </para>
7377 <para>
7378 The WHITELIST_D_MACROS option in <filename>Local/Makefile</filename> permits the binary builder
7379 to declare certain macro names trusted, such that root privilege will not
7380 necessarily be discarded.
7381 WHITELIST_D_MACROS defines a colon-separated list of macros which are
7382 considered safe and, if <option>-D</option> only supplies macros from this list, and the
7383 values are acceptable, then Exim will not give up root privilege if the caller
7384 is root, the Exim run-time user, or the CONFIGURE_OWNER, if set.  This is a
7385 transition mechanism and is expected to be removed in the future.  Acceptable
7386 values for the macros satisfy the regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
7387 </para>
7388 <para>
7389 Some sites may wish to use the same Exim binary on different machines that
7390 share a file system, but to use different configuration files on each machine.
7391 If CONFIGURE_FILE_USE_NODE is defined in <filename>Local/Makefile</filename>, Exim first
7392 looks for a file whose name is the configuration file name followed by a dot
7393 and the machine&#x2019;s node name, as obtained from the <function>uname()</function> function. If this
7394 file does not exist, the standard name is tried. This processing occurs for
7395 each file name in the list given by CONFIGURE_FILE or <option>-C</option>.
7396 </para>
7397 <para>
7398 In some esoteric situations different versions of Exim may be run under
7399 different effective uids and the CONFIGURE_FILE_USE_EUID is defined to
7400 help with this. See the comments in <filename>src/EDITME</filename> for details.
7401 </para>
7402 </section>
7403 <section id="SECTconffilfor">
7404 <title>Configuration file format</title>
7405 <para>
7406 <indexterm role="concept">
7407 <primary>configuration file</primary>
7408 <secondary>format of</secondary>
7409 </indexterm>
7410 <indexterm role="concept">
7411 <primary>format</primary>
7412 <secondary>configuration file</secondary>
7413 </indexterm>
7414 Exim&#x2019;s configuration file is divided into a number of different parts. General
7415 option settings must always appear at the start of the file. The other parts
7416 are all optional, and may appear in any order. Each part other than the first
7417 is introduced by the word <quote>begin</quote> followed by at least one literal
7418 space, and the name of the part. The optional parts are:
7419 </para>
7420 <itemizedlist>
7421 <listitem>
7422 <para>
7423 <emphasis>ACL</emphasis>: Access control lists for controlling incoming SMTP mail (see chapter
7424 <xref linkend="CHAPACL"/>).
7425 </para>
7426 </listitem>
7427 <listitem>
7428 <para>
7429 <indexterm role="concept">
7430 <primary>AUTH</primary>
7431 <secondary>configuration</secondary>
7432 </indexterm>
7433 <emphasis>authenticators</emphasis>: Configuration settings for the authenticator drivers. These
7434 are concerned with the SMTP AUTH command (see chapter <xref linkend="CHAPSMTPAUTH"/>).
7435 </para>
7436 </listitem>
7437 <listitem>
7438 <para>
7439 <emphasis>routers</emphasis>: Configuration settings for the router drivers. Routers process
7440 addresses and determine how the message is to be delivered (see chapters
7441 <xref linkend="CHAProutergeneric"/>&ndash;<xref linkend="CHAPredirect"/>).
7442 </para>
7443 </listitem>
7444 <listitem>
7445 <para>
7446 <emphasis>transports</emphasis>: Configuration settings for the transport drivers. Transports
7447 define mechanisms for copying messages to destinations (see chapters
7448 <xref linkend="CHAPtransportgeneric"/>&ndash;<xref linkend="CHAPsmtptrans"/>).
7449 </para>
7450 </listitem>
7451 <listitem>
7452 <para>
7453 <emphasis>retry</emphasis>: Retry rules, for use when a message cannot be delivered immediately.
7454 If there is no retry section, or if it is empty (that is, no retry rules are
7455 defined), Exim will not retry deliveries. In this situation, temporary errors
7456 are treated the same as permanent errors. Retry rules are discussed in chapter
7457 <xref linkend="CHAPretry"/>.
7458 </para>
7459 </listitem>
7460 <listitem>
7461 <para>
7462 <emphasis>rewrite</emphasis>: Global address rewriting rules, for use when a message arrives and
7463 when new addresses are generated during delivery. Rewriting is discussed in
7464 chapter <xref linkend="CHAPrewrite"/>.
7465 </para>
7466 </listitem>
7467 <listitem>
7468 <para>
7469 <emphasis>local_scan</emphasis>: Private options for the <function>local_scan()</function> function. If you
7470 want to use this feature, you must set
7471 </para>
7472 <literallayout class="monospaced">
7473 LOCAL_SCAN_HAS_OPTIONS=yes
7474 </literallayout>
7475 <para>
7476 in <filename>Local/Makefile</filename> before building Exim. Details of the <function>local_scan()</function>
7477 facility are given in chapter <xref linkend="CHAPlocalscan"/>.
7478 </para>
7479 </listitem>
7480 </itemizedlist>
7481 <para>
7482 <indexterm role="concept">
7483 <primary>configuration file</primary>
7484 <secondary>leading white space in</secondary>
7485 </indexterm>
7486 <indexterm role="concept">
7487 <primary>configuration file</primary>
7488 <secondary>trailing white space in</secondary>
7489 </indexterm>
7490 <indexterm role="concept">
7491 <primary>white space</primary>
7492 <secondary>in configuration file</secondary>
7493 </indexterm>
7494 Leading and trailing white space in configuration lines is always ignored.
7495 </para>
7496 <para>
7497 Blank lines in the file, and lines starting with a # character (ignoring
7498 leading white space) are treated as comments and are ignored. <emphasis role="bold">Note</emphasis>: A
7499 # character other than at the beginning of a line is not treated specially,
7500 and does not introduce a comment.
7501 </para>
7502 <para>
7503 Any non-comment line can be continued by ending it with a backslash. Note that
7504 the general rule for white space means that trailing white space after the
7505 backslash and leading white space at the start of continuation
7506 lines is ignored. Comment lines beginning with # (but not empty lines) may
7507 appear in the middle of a sequence of continuation lines.
7508 </para>
7509 <para>
7510 A convenient way to create a configuration file is to start from the
7511 default, which is supplied in <filename>src/configure.default</filename>, and add, delete, or
7512 change settings as required.
7513 </para>
7514 <para>
7515 The ACLs, retry rules, and rewriting rules have their own syntax which is
7516 described in chapters <xref linkend="CHAPACL"/>, <xref linkend="CHAPretry"/>, and <xref linkend="CHAPrewrite"/>,
7517 respectively. The other parts of the configuration file have some syntactic
7518 items in common, and these are described below, from section <xref linkend="SECTcos"/>
7519 onwards. Before that, the inclusion, macro, and conditional facilities are
7520 described.
7521 </para>
7522 </section>
7523 <section id="SECID41">
7524 <title>File inclusions in the configuration file</title>
7525 <para>
7526 <indexterm role="concept">
7527 <primary>inclusions in configuration file</primary>
7528 </indexterm>
7529 <indexterm role="concept">
7530 <primary>configuration file</primary>
7531 <secondary>including other files</secondary>
7532 </indexterm>
7533 <indexterm role="concept">
7534 <primary><literal>.include</literal> in configuration file</primary>
7535 </indexterm>
7536 <indexterm role="concept">
7537 <primary><literal>.include_if_exists</literal> in configuration file</primary>
7538 </indexterm>
7539 You can include other files inside Exim&#x2019;s run time configuration file by
7540 using this syntax:
7541 </para>
7542 <literallayout>
7543 <literal>.include</literal> &lt;<emphasis>file name</emphasis>&gt;
7544 <literal>.include_if_exists</literal> &lt;<emphasis>file name</emphasis>&gt;
7545 </literallayout>
7546 <para>
7547 on a line by itself. Double quotes round the file name are optional. If you use
7548 the first form, a configuration error occurs if the file does not exist; the
7549 second form does nothing for non-existent files. In all cases, an absolute file
7550 name is required.
7551 </para>
7552 <para>
7553 Includes may be nested to any depth, but remember that Exim reads its
7554 configuration file often, so it is a good idea to keep them to a minimum.
7555 If you change the contents of an included file, you must HUP the daemon,
7556 because an included file is read only when the configuration itself is read.
7557 </para>
7558 <para>
7559 The processing of inclusions happens early, at a physical line level, so, like
7560 comment lines, an inclusion can be used in the middle of an option setting,
7561 for example:
7562 </para>
7563 <literallayout class="monospaced">
7564 hosts_lookup = a.b.c \
7565                .include /some/file
7566 </literallayout>
7567 <para>
7568 Include processing happens after macro processing (see below). Its effect is to
7569 process the lines of the included file as if they occurred inline where the
7570 inclusion appears.
7571 </para>
7572 </section>
7573 <section id="SECTmacrodefs">
7574 <title>Macros in the configuration file</title>
7575 <para>
7576 <indexterm role="concept">
7577 <primary>macro</primary>
7578 <secondary>description of</secondary>
7579 </indexterm>
7580 <indexterm role="concept">
7581 <primary>configuration file</primary>
7582 <secondary>macros</secondary>
7583 </indexterm>
7584 If a line in the main part of the configuration (that is, before the first
7585 <quote>begin</quote> line) begins with an upper case letter, it is taken as a macro
7586 definition, and must be of the form
7587 </para>
7588 <literallayout>
7589 &lt;<emphasis>name</emphasis>&gt; = &lt;<emphasis>rest of line</emphasis>&gt;
7590 </literallayout>
7591 <para>
7592 The name must consist of letters, digits, and underscores, and need not all be
7593 in upper case, though that is recommended. The rest of the line, including any
7594 continuations, is the replacement text, and has leading and trailing white
7595 space removed. Quotes are not removed. The replacement text can never end with
7596 a backslash character, but this doesn&#x2019;t seem to be a serious limitation.
7597 </para>
7598 <para>
7599 Macros may also be defined between router, transport, authenticator, or ACL
7600 definitions. They may not, however, be defined within an individual driver or
7601 ACL, or in the <option>local_scan</option>, retry, or rewrite sections of the configuration.
7602 </para>
7603 </section>
7604 <section id="SECID42">
7605 <title>Macro substitution</title>
7606 <para>
7607 Once a macro is defined, all subsequent lines in the file (and any included
7608 files) are scanned for the macro name; if there are several macros, the line is
7609 scanned for each in turn, in the order in which the macros are defined. The
7610 replacement text is not re-scanned for the current macro, though it is scanned
7611 for subsequently defined macros. For this reason, a macro name may not contain
7612 the name of a previously defined macro as a substring. You could, for example,
7613 define
7614 </para>
7615 <literallayout>
7616 <literal>ABCD_XYZ = </literal>&lt;<emphasis>something</emphasis>&gt;
7617 <literal>ABCD = </literal>&lt;<emphasis>something else</emphasis>&gt;
7618 </literallayout>
7619 <para>
7620 but putting the definitions in the opposite order would provoke a configuration
7621 error. Macro expansion is applied to individual physical lines from the file,
7622 before checking for line continuation or file inclusion (see above). If a line
7623 consists solely of a macro name, and the expansion of the macro is empty, the
7624 line is ignored. A macro at the start of a line may turn the line into a
7625 comment line or a <literal>.include</literal> line.
7626 </para>
7627 </section>
7628 <section id="SECID43">
7629 <title>Redefining macros</title>
7630 <para>
7631 Once defined, the value of a macro can be redefined later in the configuration
7632 (or in an included file). Redefinition is specified by using <emphasis>==</emphasis> instead of
7633 <emphasis>=</emphasis>. For example:
7634 </para>
7635 <literallayout class="monospaced">
7636 MAC =  initial value
7637 ...
7638 MAC == updated value
7639 </literallayout>
7640 <para>
7641 Redefinition does not alter the order in which the macros are applied to the
7642 subsequent lines of the configuration file. It is still the same order in which
7643 the macros were originally defined. All that changes is the macro&#x2019;s value.
7644 Redefinition makes it possible to accumulate values. For example:
7645 </para>
7646 <literallayout class="monospaced">
7647 MAC =  initial value
7648 ...
7649 MAC == MAC and something added
7650 </literallayout>
7651 <para>
7652 This can be helpful in situations where the configuration file is built
7653 from a number of other files.
7654 </para>
7655 </section>
7656 <section id="SECID44">
7657 <title>Overriding macro values</title>
7658 <para>
7659 The values set for macros in the configuration file can be overridden by the
7660 <option>-D</option> command line option, but Exim gives up its root privilege when <option>-D</option> is
7661 used, unless called by root or the Exim user. A definition on the command line
7662 using the <option>-D</option> option causes all definitions and redefinitions within the
7663 file to be ignored.
7664 </para>
7665 </section>
7666 <section id="SECID45">
7667 <title>Example of macro usage</title>
7668 <para>
7669 As an example of macro usage, consider a configuration where aliases are looked
7670 up in a MySQL database. It helps to keep the file less cluttered if long
7671 strings such as SQL statements are defined separately as macros, for example:
7672 </para>
7673 <literallayout class="monospaced">
7674 ALIAS_QUERY = select mailbox from user where \
7675               login='${quote_mysql:$local_part}';
7676 </literallayout>
7677 <para>
7678 This can then be used in a <command>redirect</command> router setting like this:
7679 </para>
7680 <literallayout class="monospaced">
7681 data = ${lookup mysql{ALIAS_QUERY}}
7682 </literallayout>
7683 <para>
7684 In earlier versions of Exim macros were sometimes used for domain, host, or
7685 address lists. In Exim 4 these are handled better by named lists &ndash; see
7686 section <xref linkend="SECTnamedlists"/>.
7687 </para>
7688 </section>
7689 <section id="SECID46">
7690 <title>Conditional skips in the configuration file</title>
7691 <para>
7692 <indexterm role="concept">
7693 <primary>configuration file</primary>
7694 <secondary>conditional skips</secondary>
7695 </indexterm>
7696 <indexterm role="concept">
7697 <primary><literal>.ifdef</literal></primary>
7698 </indexterm>
7699 You can use the directives <literal>.ifdef</literal>, <literal>.ifndef</literal>, <literal>.elifdef</literal>,
7700 <literal>.elifndef</literal>, <literal>.else</literal>, and <literal>.endif</literal> to dynamically include or exclude
7701 portions of the configuration file. The processing happens whenever the file is
7702 read (that is, when an Exim binary starts to run).
7703 </para>
7704 <para>
7705 The implementation is very simple. Instances of the first four directives must
7706 be followed by text that includes the names of one or macros. The condition
7707 that is tested is whether or not any macro substitution has taken place in the
7708 line. Thus:
7709 </para>
7710 <literallayout class="monospaced">
7711 .ifdef AAA
7712 message_size_limit = 50M
7713 .else
7714 message_size_limit = 100M
7715 .endif
7716 </literallayout>
7717 <para>
7718 sets a message size limit of 50M if the macro <literal>AAA</literal> is defined
7719 (or <literal>A</literal> or <literal>AA</literal>), and 100M
7720 otherwise. If there is more than one macro named on the line, the condition
7721 is true if any of them are defined. That is, it is an <quote>or</quote> condition. To
7722 obtain an <quote>and</quote> condition, you need to use nested <literal>.ifdef</literal>s.
7723 </para>
7724 <para>
7725 Although you can use a macro expansion to generate one of these directives,
7726 it is not very useful, because the condition <quote>there was a macro substitution
7727 in this line</quote> will always be true.
7728 </para>
7729 <para>
7730 Text following <literal>.else</literal> and <literal>.endif</literal> is ignored, and can be used as comment
7731 to clarify complicated nestings.
7732 </para>
7733 </section>
7734 <section id="SECTcos">
7735 <title>Common option syntax</title>
7736 <para>
7737 <indexterm role="concept">
7738 <primary>common option syntax</primary>
7739 </indexterm>
7740 <indexterm role="concept">
7741 <primary>syntax of common options</primary>
7742 </indexterm>
7743 <indexterm role="concept">
7744 <primary>configuration file</primary>
7745 <secondary>common option syntax</secondary>
7746 </indexterm>
7747 For the main set of options, driver options, and <function>local_scan()</function> options,
7748 each setting is on a line by itself, and starts with a name consisting of
7749 lower-case letters and underscores. Many options require a data value, and in
7750 these cases the name must be followed by an equals sign (with optional white
7751 space) and then the value. For example:
7752 </para>
7753 <literallayout class="monospaced">
7754 qualify_domain = mydomain.example.com
7755 </literallayout>
7756 <para>
7757 <indexterm role="concept">
7758 <primary>hiding configuration option values</primary>
7759 </indexterm>
7760 <indexterm role="concept">
7761 <primary>configuration options</primary>
7762 <secondary>hiding value of</secondary>
7763 </indexterm>
7764 <indexterm role="concept">
7765 <primary>options</primary>
7766 <secondary>hiding value of</secondary>
7767 </indexterm>
7768 Some option settings may contain sensitive data, for example, passwords for
7769 accessing databases. To stop non-admin users from using the <option>-bP</option> command
7770 line option to read these values, you can precede the option settings with the
7771 word <quote>hide</quote>. For example:
7772 </para>
7773 <literallayout class="monospaced">
7774 hide mysql_servers = localhost/users/admin/secret-password
7775 </literallayout>
7776 <para>
7777 For non-admin users, such options are displayed like this:
7778 </para>
7779 <literallayout class="monospaced">
7780 mysql_servers = &lt;value not displayable&gt;
7781 </literallayout>
7782 <para>
7783 If <quote>hide</quote> is used on a driver option, it hides the value of that option on
7784 all instances of the same driver.
7785 </para>
7786 <para>
7787 The following sections describe the syntax used for the different data types
7788 that are found in option settings.
7789 </para>
7790 </section>
7791 <section id="SECID47">
7792 <title>Boolean options</title>
7793 <para>
7794 <indexterm role="concept">
7795 <primary>format</primary>
7796 <secondary>boolean</secondary>
7797 </indexterm>
7798 <indexterm role="concept">
7799 <primary>boolean configuration values</primary>
7800 </indexterm>
7801 <indexterm role="option">
7802 <primary><option>no_</option><emphasis>xxx</emphasis></primary>
7803 </indexterm>
7804 <indexterm role="option">
7805 <primary><option>not_</option><emphasis>xxx</emphasis></primary>
7806 </indexterm>
7807 Options whose type is given as boolean are on/off switches. There are two
7808 different ways of specifying such options: with and without a data value. If
7809 the option name is specified on its own without data, the switch is turned on;
7810 if it is preceded by <quote>no_</quote> or <quote>not_</quote> the switch is turned off. However,
7811 boolean options may be followed by an equals sign and one of the words
7812 <quote>true</quote>, <quote>false</quote>, <quote>yes</quote>, or <quote>no</quote>, as an alternative syntax. For example,
7813 the following two settings have exactly the same effect:
7814 </para>
7815 <literallayout class="monospaced">
7816 queue_only
7817 queue_only = true
7818 </literallayout>
7819 <para>
7820 The following two lines also have the same (opposite) effect:
7821 </para>
7822 <literallayout class="monospaced">
7823 no_queue_only
7824 queue_only = false
7825 </literallayout>
7826 <para>
7827 You can use whichever syntax you prefer.
7828 </para>
7829 </section>
7830 <section id="SECID48">
7831 <title>Integer values</title>
7832 <para>
7833 <indexterm role="concept">
7834 <primary>integer configuration values</primary>
7835 </indexterm>
7836 <indexterm role="concept">
7837 <primary>format</primary>
7838 <secondary>integer</secondary>
7839 </indexterm>
7840 If an option&#x2019;s type is given as <quote>integer</quote>, the value can be given in decimal,
7841 hexadecimal, or octal. If it starts with a digit greater than zero, a decimal
7842 number is assumed. Otherwise, it is treated as an octal number unless it starts
7843 with the characters <quote>0x</quote>, in which case the remainder is interpreted as a
7844 hexadecimal number.
7845 </para>
7846 <para>
7847 If an integer value is followed by the letter K, it is multiplied by 1024; if
7848 it is followed by the letter M, it is multiplied by 1024x1024. When the values
7849 of integer option settings are output, values which are an exact multiple of
7850 1024 or 1024x1024 are sometimes, but not always, printed using the letters K
7851 and M. The printing style is independent of the actual input format that was
7852 used.
7853 </para>
7854 </section>
7855 <section id="SECID49">
7856 <title>Octal integer values</title>
7857 <para>
7858 <indexterm role="concept">
7859 <primary>integer format</primary>
7860 </indexterm>
7861 <indexterm role="concept">
7862 <primary>format</primary>
7863 <secondary>octal integer</secondary>
7864 </indexterm>
7865 If an option&#x2019;s type is given as <quote>octal integer</quote>, its value is always
7866 interpreted as an octal number, whether or not it starts with the digit zero.
7867 Such options are always output in octal.
7868 </para>
7869 </section>
7870 <section id="SECID50">
7871 <title>Fixed point numbers</title>
7872 <para>
7873 <indexterm role="concept">
7874 <primary>fixed point configuration values</primary>
7875 </indexterm>
7876 <indexterm role="concept">
7877 <primary>format</primary>
7878 <secondary>fixed point</secondary>
7879 </indexterm>
7880 If an option&#x2019;s type is given as <quote>fixed-point</quote>, its value must be a decimal
7881 integer, optionally followed by a decimal point and up to three further digits.
7882 </para>
7883 </section>
7884 <section id="SECTtimeformat">
7885 <title>Time intervals</title>
7886 <para>
7887 <indexterm role="concept">
7888 <primary>time interval</primary>
7889 <secondary>specifying in configuration</secondary>
7890 </indexterm>
7891 <indexterm role="concept">
7892 <primary>format</primary>
7893 <secondary>time interval</secondary>
7894 </indexterm>
7895 A time interval is specified as a sequence of numbers, each followed by one of
7896 the following letters, with no intervening white space:
7897 </para>
7898 <informaltable frame="none">
7899 <tgroup cols="2" colsep="0" rowsep="0">
7900 <colspec colwidth="30pt" align="left"/>
7901 <colspec colwidth="254pt" align="left"/>
7902 <tbody>
7903 <row>
7904 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>s</option></entry>
7905 <entry>seconds</entry>
7906 </row>
7907 <row>
7908 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>m</option></entry>
7909 <entry>minutes</entry>
7910 </row>
7911 <row>
7912 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>h</option></entry>
7913 <entry>hours</entry>
7914 </row>
7915 <row>
7916 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>d</option></entry>
7917 <entry>days</entry>
7918 </row>
7919 <row>
7920 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>w</option></entry>
7921 <entry>weeks</entry>
7922 </row>
7923 </tbody>
7924 </tgroup>
7925 </informaltable>
7926 <para>
7927 For example, <quote>3h50m</quote> specifies 3 hours and 50 minutes. The values of time
7928 intervals are output in the same format. Exim does not restrict the values; it
7929 is perfectly acceptable, for example, to specify <quote>90m</quote> instead of <quote>1h30m</quote>.
7930 </para>
7931 </section>
7932 <section id="SECTstrings">
7933 <title>String values</title>
7934 <para>
7935 <indexterm role="concept">
7936 <primary>string</primary>
7937 <secondary>format of configuration values</secondary>
7938 </indexterm>
7939 <indexterm role="concept">
7940 <primary>format</primary>
7941 <secondary>string</secondary>
7942 </indexterm>
7943 If an option&#x2019;s type is specified as <quote>string</quote>, the value can be specified with
7944 or without double-quotes. If it does not start with a double-quote, the value
7945 consists of the remainder of the line plus any continuation lines, starting at
7946 the first character after any leading white space, with trailing white space
7947 removed, and with no interpretation of the characters in the string. Because
7948 Exim removes comment lines (those beginning with #) at an early stage, they can
7949 appear in the middle of a multi-line string. The following two settings are
7950 therefore equivalent:
7951 </para>
7952 <literallayout class="monospaced">
7953 trusted_users = uucp:mail
7954 trusted_users = uucp:\
7955                 # This comment line is ignored
7956                 mail
7957 </literallayout>
7958 <para>
7959 <indexterm role="concept">
7960 <primary>string</primary>
7961 <secondary>quoted</secondary>
7962 </indexterm>
7963 <indexterm role="concept">
7964 <primary>escape characters in quoted strings</primary>
7965 </indexterm>
7966 If a string does start with a double-quote, it must end with a closing
7967 double-quote, and any backslash characters other than those used for line
7968 continuation are interpreted as escape characters, as follows:
7969 </para>
7970 <informaltable frame="none">
7971 <tgroup cols="2" colsep="0" rowsep="0">
7972 <colspec colwidth="100pt" align="left"/>
7973 <colspec colwidth="254pt" align="left"/>
7974 <tbody>
7975 <row>
7976 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\\</literal></entry>
7977 <entry>single backslash</entry>
7978 </row>
7979 <row>
7980 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\n</literal></entry>
7981 <entry>newline</entry>
7982 </row>
7983 <row>
7984 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\r</literal></entry>
7985 <entry>carriage return</entry>
7986 </row>
7987 <row>
7988 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\t</literal></entry>
7989 <entry>tab</entry>
7990 </row>
7991 <row>
7992 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\</literal>&lt;<emphasis>octal digits</emphasis>&gt;</entry>
7993 <entry>up to 3 octal digits specify one character</entry>
7994 </row>
7995 <row>
7996 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\x</literal>&lt;<emphasis>hex digits</emphasis>&gt;</entry>
7997 <entry>up to 2 hexadecimal digits specify one character</entry>
7998 </row>
7999 </tbody>
8000 </tgroup>
8001 </informaltable>
8002 <para>
8003 If a backslash is followed by some other character, including a double-quote
8004 character, that character replaces the pair.
8005 </para>
8006 <para>
8007 Quoting is necessary only if you want to make use of the backslash escapes to
8008 insert special characters, or if you need to specify a value with leading or
8009 trailing spaces. These cases are rare, so quoting is almost never needed in
8010 current versions of Exim. In versions of Exim before 3.14, quoting was required
8011 in order to continue lines, so you may come across older configuration files
8012 and examples that apparently quote unnecessarily.
8013 </para>
8014 </section>
8015 <section id="SECID51">
8016 <title>Expanded strings</title>
8017 <para>
8018 <indexterm role="concept">
8019 <primary>expansion</primary>
8020 <secondary>definition of</secondary>
8021 </indexterm>
8022 Some strings in the configuration file are subjected to <emphasis>string expansion</emphasis>,
8023 by which means various parts of the string may be changed according to the
8024 circumstances (see chapter <xref linkend="CHAPexpand"/>). The input syntax for such strings
8025 is as just described; in particular, the handling of backslashes in quoted
8026 strings is done as part of the input process, before expansion takes place.
8027 However, backslash is also an escape character for the expander, so any
8028 backslashes that are required for that reason must be doubled if they are
8029 within a quoted configuration string.
8030 </para>
8031 </section>
8032 <section id="SECID52">
8033 <title>User and group names</title>
8034 <para>
8035 <indexterm role="concept">
8036 <primary>user name</primary>
8037 <secondary>format of</secondary>
8038 </indexterm>
8039 <indexterm role="concept">
8040 <primary>format</primary>
8041 <secondary>user name</secondary>
8042 </indexterm>
8043 <indexterm role="concept">
8044 <primary>groups</primary>
8045 <secondary>name format</secondary>
8046 </indexterm>
8047 <indexterm role="concept">
8048 <primary>format</primary>
8049 <secondary>group name</secondary>
8050 </indexterm>
8051 User and group names are specified as strings, using the syntax described
8052 above, but the strings are interpreted specially. A user or group name must
8053 either consist entirely of digits, or be a name that can be looked up using the
8054 <function>getpwnam()</function> or <function>getgrnam()</function> function, as appropriate.
8055 </para>
8056 </section>
8057 <section id="SECTlistconstruct">
8058 <title>List construction</title>
8059 <para>
8060 <indexterm role="concept">
8061 <primary>list</primary>
8062 <secondary>syntax of in configuration</secondary>
8063 </indexterm>
8064 <indexterm role="concept">
8065 <primary>format</primary>
8066 <secondary>list item in configuration</secondary>
8067 </indexterm>
8068 <indexterm role="concept">
8069 <primary>string</primary>
8070 <secondary>list, definition of</secondary>
8071 </indexterm>
8072 The data for some configuration options is a list of items, with colon as the
8073 default separator. Many of these options are shown with type <quote>string list</quote> in
8074 the descriptions later in this document. Others are listed as <quote>domain list</quote>,
8075 <quote>host list</quote>, <quote>address list</quote>, or <quote>local part list</quote>. Syntactically, they
8076 are all the same; however, those other than <quote>string list</quote> are subject to
8077 particular kinds of interpretation, as described in chapter
8078 <xref linkend="CHAPdomhosaddlists"/>.
8079 </para>
8080 <para>
8081 In all these cases, the entire list is treated as a single string as far as the
8082 input syntax is concerned. The <option>trusted_users</option> setting in section
8083 <xref linkend="SECTstrings"/> above is an example. If a colon is actually needed in an item
8084 in a list, it must be entered as two colons. Leading and trailing white space
8085 on each item in a list is ignored. This makes it possible to include items that
8086 start with a colon, and in particular, certain forms of IPv6 address. For
8087 example, the list
8088 </para>
8089 <literallayout class="monospaced">
8090 local_interfaces = 127.0.0.1 : ::::1
8091 </literallayout>
8092 <para>
8093 contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1.
8094 </para>
8095 <para>
8096 <emphasis role="bold">Note</emphasis>: Although leading and trailing white space is ignored in individual
8097 list items, it is not ignored when parsing the list. The space after the first
8098 colon in the example above is necessary. If it were not there, the list would
8099 be interpreted as the two items 127.0.0.1:: and 1.
8100 </para>
8101 </section>
8102 <section id="SECTlistsepchange">
8103 <title>Changing list separators</title>
8104 <para>
8105 <indexterm role="concept">
8106 <primary>list separator</primary>
8107 <secondary>changing</secondary>
8108 </indexterm>
8109 <indexterm role="concept">
8110 <primary>IPv6</primary>
8111 <secondary>addresses in lists</secondary>
8112 </indexterm>
8113 Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was
8114 introduced to allow the separator character to be changed. If a list begins
8115 with a left angle bracket, followed by any punctuation character, that
8116 character is used instead of colon as the list separator. For example, the list
8117 above can be rewritten to use a semicolon separator like this:
8118 </para>
8119 <literallayout class="monospaced">
8120 local_interfaces = &lt;; 127.0.0.1 ; ::1
8121 </literallayout>
8122 <para>
8123 This facility applies to all lists, with the exception of the list in
8124 <option>log_file_path</option>. It is recommended that the use of non-colon separators be
8125 confined to circumstances where they really are needed.
8126 </para>
8127 <para>
8128 <indexterm role="concept">
8129 <primary>list separator</primary>
8130 <secondary>newline as</secondary>
8131 </indexterm>
8132 <indexterm role="concept">
8133 <primary>newline</primary>
8134 <secondary>as list separator</secondary>
8135 </indexterm>
8136 It is also possible to use newline and other control characters (those with
8137 code values less than 32, plus DEL) as separators in lists. Such separators
8138 must be provided literally at the time the list is processed. For options that
8139 are string-expanded, you can write the separator using a normal escape
8140 sequence. This will be processed by the expander before the string is
8141 interpreted as a list. For example, if a newline-separated list of domains is
8142 generated by a lookup, you can process it directly by a line such as this:
8143 </para>
8144 <literallayout class="monospaced">
8145 domains = &lt;\n ${lookup mysql{.....}}
8146 </literallayout>
8147 <para>
8148 This avoids having to change the list separator in such data. You are unlikely
8149 to want to use a control character as a separator in an option that is not
8150 expanded, because the value is literal text. However, it can be done by giving
8151 the value in quotes. For example:
8152 </para>
8153 <literallayout class="monospaced">
8154 local_interfaces = "&lt;\n 127.0.0.1 \n ::1"
8155 </literallayout>
8156 <para>
8157 Unlike printing character separators, which can be included in list items by
8158 doubling, it is not possible to include a control character as data when it is
8159 set as the separator. Two such characters in succession are interpreted as
8160 enclosing an empty list item.
8161 </para>
8162 </section>
8163 <section id="SECTempitelis">
8164 <title>Empty items in lists</title>
8165 <para>
8166 <indexterm role="concept">
8167 <primary>list</primary>
8168 <secondary>empty item in</secondary>
8169 </indexterm>
8170 An empty item at the end of a list is always ignored. In other words, trailing
8171 separator characters are ignored. Thus, the list in
8172 </para>
8173 <literallayout class="monospaced">
8174 senders = user@domain :
8175 </literallayout>
8176 <para>
8177 contains only a single item. If you want to include an empty string as one item
8178 in a list, it must not be the last item. For example, this list contains three
8179 items, the second of which is empty:
8180 </para>
8181 <literallayout class="monospaced">
8182 senders = user1@domain : : user2@domain
8183 </literallayout>
8184 <para>
8185 <emphasis role="bold">Note</emphasis>: There must be white space between the two colons, as otherwise they
8186 are interpreted as representing a single colon data character (and the list
8187 would then contain just one item). If you want to specify a list that contains
8188 just one, empty item, you can do it as in this example:
8189 </para>
8190 <literallayout class="monospaced">
8191 senders = :
8192 </literallayout>
8193 <para>
8194 In this case, the first item is empty, and the second is discarded because it
8195 is at the end of the list.
8196 </para>
8197 </section>
8198 <section id="SECTfordricon">
8199 <title>Format of driver configurations</title>
8200 <para>
8201 <indexterm role="concept">
8202 <primary>drivers</primary>
8203 <secondary>configuration format</secondary>
8204 </indexterm>
8205 There are separate parts in the configuration for defining routers, transports,
8206 and authenticators. In each part, you are defining a number of driver
8207 instances, each with its own set of options. Each driver instance is defined by
8208 a sequence of lines like this:
8209 </para>
8210 <literallayout>
8211 &lt;<emphasis>instance name</emphasis>&gt;:
8212   &lt;<emphasis>option</emphasis>&gt;
8213   ...
8214   &lt;<emphasis>option</emphasis>&gt;
8215 </literallayout>
8216 <para>
8217 In the following example, the instance name is <command>localuser</command>, and it is
8218 followed by three options settings:
8219 </para>
8220 <literallayout class="monospaced">
8221 localuser:
8222   driver = accept
8223   check_local_user
8224   transport = local_delivery
8225 </literallayout>
8226 <para>
8227 For each driver instance, you specify which Exim code module it uses &ndash; by the
8228 setting of the <option>driver</option> option &ndash; and (optionally) some configuration
8229 settings. For example, in the case of transports, if you want a transport to
8230 deliver with SMTP you would use the <command>smtp</command> driver; if you want to deliver to
8231 a local file you would use the <command>appendfile</command> driver. Each of the drivers is
8232 described in detail in its own separate chapter later in this manual.
8233 </para>
8234 <para>
8235 You can have several routers, transports, or authenticators that are based on
8236 the same underlying driver (each must have a different instance name).
8237 </para>
8238 <para>
8239 The order in which routers are defined is important, because addresses are
8240 passed to individual routers one by one, in order. The order in which
8241 transports are defined does not matter at all. The order in which
8242 authenticators are defined is used only when Exim, as a client, is searching
8243 them to find one that matches an authentication mechanism offered by the
8244 server.
8245 </para>
8246 <para>
8247 <indexterm role="concept">
8248 <primary>generic options</primary>
8249 </indexterm>
8250 <indexterm role="concept">
8251 <primary>options</primary>
8252 <secondary>generic &ndash; definition of</secondary>
8253 </indexterm>
8254 Within a driver instance definition, there are two kinds of option: <emphasis>generic</emphasis>
8255 and <emphasis>private</emphasis>. The generic options are those that apply to all drivers of the
8256 same type (that is, all routers, all transports or all authenticators). The
8257 <option>driver</option> option is a generic option that must appear in every definition.
8258 <indexterm role="concept">
8259 <primary>private options</primary>
8260 </indexterm>
8261 The private options are special for each driver, and none need appear, because
8262 they all have default values.
8263 </para>
8264 <para>
8265 The options may appear in any order, except that the <option>driver</option> option must
8266 precede any private options, since these depend on the particular driver. For
8267 this reason, it is recommended that <option>driver</option> always be the first option.
8268 </para>
8269 <para>
8270 Driver instance names, which are used for reference in log entries and
8271 elsewhere, can be any sequence of letters, digits, and underscores (starting
8272 with a letter) and must be unique among drivers of the same type. A router and
8273 a transport (for example) can each have the same name, but no two router
8274 instances can have the same name. The name of a driver instance should not be
8275 confused with the name of the underlying driver module. For example, the
8276 configuration lines:
8277 </para>
8278 <literallayout class="monospaced">
8279 remote_smtp:
8280   driver = smtp
8281 </literallayout>
8282 <para>
8283 create an instance of the <command>smtp</command> transport driver whose name is
8284 <command>remote_smtp</command>. The same driver code can be used more than once, with
8285 different instance names and different option settings each time. A second
8286 instance of the <command>smtp</command> transport, with different options, might be defined
8287 thus:
8288 </para>
8289 <literallayout class="monospaced">
8290 special_smtp:
8291   driver = smtp
8292   port = 1234
8293   command_timeout = 10s
8294 </literallayout>
8295 <para>
8296 The names <command>remote_smtp</command> and <command>special_smtp</command> would be used to reference
8297 these transport instances from routers, and these names would appear in log
8298 lines.
8299 </para>
8300 <para>
8301 Comment lines may be present in the middle of driver specifications. The full
8302 list of option settings for any particular driver instance, including all the
8303 defaulted values, can be extracted by making use of the <option>-bP</option> command line
8304 option.
8305 </para>
8306 </section>
8307 </chapter>
8308
8309 <chapter id="CHAPdefconfil">
8310 <title>The default configuration file</title>
8311 <para>
8312 <indexterm role="concept" id="IIDconfiwal" class="startofrange">
8313 <primary>configuration file</primary>
8314 <secondary>default <quote>walk through</quote></secondary>
8315 </indexterm>
8316 <indexterm role="concept">
8317 <primary>default</primary>
8318 <secondary>configuration file <quote>walk through</quote></secondary>
8319 </indexterm>
8320 The default configuration file supplied with Exim as <filename>src/configure.default</filename>
8321 is sufficient for a host with simple mail requirements. As an introduction to
8322 the way Exim is configured, this chapter <quote>walks through</quote> the default
8323 configuration, giving brief explanations of the settings. Detailed descriptions
8324 of the options are given in subsequent chapters. The default configuration file
8325 itself contains extensive comments about ways you might want to modify the
8326 initial settings. However, note that there are many options that are not
8327 mentioned at all in the default configuration.
8328 </para>
8329 <section id="SECTdefconfmain">
8330 <title>Main configuration settings</title>
8331 <para>
8332 The main (global) configuration option settings must always come first in the
8333 file. The first thing you&#x2019;ll see in the file, after some initial comments, is
8334 the line
8335 </para>
8336 <literallayout class="monospaced">
8337 # primary_hostname =
8338 </literallayout>
8339 <para>
8340 This is a commented-out setting of the <option>primary_hostname</option> option. Exim needs
8341 to know the official, fully qualified name of your host, and this is where you
8342 can specify it. However, in most cases you do not need to set this option. When
8343 it is unset, Exim uses the <function>uname()</function> system function to obtain the host name.
8344 </para>
8345 <para>
8346 The first three non-comment configuration lines are as follows:
8347 </para>
8348 <literallayout class="monospaced">
8349 domainlist local_domains    = @
8350 domainlist relay_to_domains =
8351 hostlist   relay_from_hosts = 127.0.0.1
8352 </literallayout>
8353 <para>
8354 These are not, in fact, option settings. They are definitions of two named
8355 domain lists and one named host list. Exim allows you to give names to lists of
8356 domains, hosts, and email addresses, in order to make it easier to manage the
8357 configuration file (see section <xref linkend="SECTnamedlists"/>).
8358 </para>
8359 <para>
8360 The first line defines a domain list called <emphasis>local_domains</emphasis>; this is used
8361 later in the configuration to identify domains that are to be delivered
8362 on the local host.
8363 </para>
8364 <para>
8365 <indexterm role="concept">
8366 <primary>@ in a domain list</primary>
8367 </indexterm>
8368 There is just one item in this list, the string <quote>@</quote>. This is a special form
8369 of entry which means <quote>the name of the local host</quote>. Thus, if the local host is
8370 called <emphasis>a.host.example</emphasis>, mail to <emphasis>any.user@a.host.example</emphasis> is expected to
8371 be delivered locally. Because the local host&#x2019;s name is referenced indirectly,
8372 the same configuration file can be used on different hosts.
8373 </para>
8374 <para>
8375 The second line defines a domain list called <emphasis>relay_to_domains</emphasis>, but the
8376 list itself is empty. Later in the configuration we will come to the part that
8377 controls mail relaying through the local host; it allows relaying to any
8378 domains in this list. By default, therefore, no relaying on the basis of a mail
8379 domain is permitted.
8380 </para>
8381 <para>
8382 The third line defines a host list called <emphasis>relay_from_hosts</emphasis>. This list is
8383 used later in the configuration to permit relaying from any host or IP address
8384 that matches the list. The default contains just the IP address of the IPv4
8385 loopback interface, which means that processes on the local host are able to
8386 submit mail for relaying by sending it over TCP/IP to that interface. No other
8387 hosts are permitted to submit messages for relaying.
8388 </para>
8389 <para>
8390 Just to be sure there&#x2019;s no misunderstanding: at this point in the configuration
8391 we aren&#x2019;t actually setting up any controls. We are just defining some domains
8392 and hosts that will be used in the controls that are specified later.
8393 </para>
8394 <para>
8395 The next two configuration lines are genuine option settings:
8396 </para>
8397 <literallayout class="monospaced">
8398 acl_smtp_rcpt = acl_check_rcpt
8399 acl_smtp_data = acl_check_data
8400 </literallayout>
8401 <para>
8402 These options specify <emphasis>Access Control Lists</emphasis> (ACLs) that are to be used
8403 during an incoming SMTP session for every recipient of a message (every RCPT
8404 command), and after the contents of the message have been received,
8405 respectively. The names of the lists are <emphasis>acl_check_rcpt</emphasis> and
8406 <emphasis>acl_check_data</emphasis>, and we will come to their definitions below, in the ACL
8407 section of the configuration. The RCPT ACL controls which recipients are
8408 accepted for an incoming message &ndash; if a configuration does not provide an ACL
8409 to check recipients, no SMTP mail can be accepted. The DATA ACL allows the
8410 contents of a message to be checked.
8411 </para>
8412 <para>
8413 Two commented-out option settings are next:
8414 </para>
8415 <literallayout class="monospaced">
8416 # av_scanner = clamd:/tmp/clamd
8417 # spamd_address = 127.0.0.1 783
8418 </literallayout>
8419 <para>
8420 These are example settings that can be used when Exim is compiled with the
8421 content-scanning extension. The first specifies the interface to the virus
8422 scanner, and the second specifies the interface to SpamAssassin. Further
8423 details are given in chapter <xref linkend="CHAPexiscan"/>.
8424 </para>
8425 <para>
8426 Three more commented-out option settings follow:
8427 </para>
8428 <literallayout class="monospaced">
8429 # tls_advertise_hosts = *
8430 # tls_certificate = /etc/ssl/exim.crt
8431 # tls_privatekey = /etc/ssl/exim.pem
8432 </literallayout>
8433 <para>
8434 These are example settings that can be used when Exim is compiled with
8435 support for TLS (aka SSL) as described in section <xref linkend="SECTinctlsssl"/>. The
8436 first one specifies the list of clients that are allowed to use TLS when
8437 connecting to this server; in this case the wildcard means all clients. The
8438 other options specify where Exim should find its TLS certificate and private
8439 key, which together prove the server&#x2019;s identity to any clients that connect.
8440 More details are given in chapter <xref linkend="CHAPTLS"/>.
8441 </para>
8442 <para>
8443 Another two commented-out option settings follow:
8444 </para>
8445 <literallayout class="monospaced">
8446 # daemon_smtp_ports = 25 : 465 : 587
8447 # tls_on_connect_ports = 465
8448 </literallayout>
8449 <para>
8450 <indexterm role="concept">
8451 <primary>port</primary>
8452 <secondary>465 and 587</secondary>
8453 </indexterm>
8454 <indexterm role="concept">
8455 <primary>port</primary>
8456 <secondary>for message submission</secondary>
8457 </indexterm>
8458 <indexterm role="concept">
8459 <primary>message</primary>
8460 <secondary>submission, ports for</secondary>
8461 </indexterm>
8462 <indexterm role="concept">
8463 <primary>ssmtp protocol</primary>
8464 </indexterm>
8465 <indexterm role="concept">
8466 <primary>smtps protocol</primary>
8467 </indexterm>
8468 <indexterm role="concept">
8469 <primary>SMTP</primary>
8470 <secondary>ssmtp protocol</secondary>
8471 </indexterm>
8472 <indexterm role="concept">
8473 <primary>SMTP</primary>
8474 <secondary>smtps protocol</secondary>
8475 </indexterm>
8476 These options provide better support for roaming users who wish to use this
8477 server for message submission. They are not much use unless you have turned on
8478 TLS (as described in the previous paragraph) and authentication (about which
8479 more in section <xref linkend="SECTdefconfauth"/>). The usual SMTP port 25 is often blocked
8480 on end-user networks, so RFC 4409 specifies that message submission should use
8481 port 587 instead. However some software (notably Microsoft Outlook) cannot be
8482 configured to use port 587 correctly, so these settings also enable the
8483 non-standard <quote>smtps</quote> (aka <quote>ssmtp</quote>) port 465 (see section
8484 <xref linkend="SECTsupobssmt"/>).
8485 </para>
8486 <para>
8487 Two more commented-out options settings follow:
8488 </para>
8489 <literallayout class="monospaced">
8490 # qualify_domain =
8491 # qualify_recipient =
8492 </literallayout>
8493 <para>
8494 The first of these specifies a domain that Exim uses when it constructs a
8495 complete email address from a local login name. This is often needed when Exim
8496 receives a message from a local process. If you do not set <option>qualify_domain</option>,
8497 the value of <option>primary_hostname</option> is used. If you set both of these options,
8498 you can have different qualification domains for sender and recipient
8499 addresses. If you set only the first one, its value is used in both cases.
8500 </para>
8501 <para>
8502 <indexterm role="concept">
8503 <primary>domain literal</primary>
8504 <secondary>recognizing format</secondary>
8505 </indexterm>
8506 The following line must be uncommented if you want Exim to recognize
8507 addresses of the form <emphasis>user@[10.11.12.13]</emphasis> that is, with a <quote>domain literal</quote>
8508 (an IP address within square brackets) instead of a named domain.
8509 </para>
8510 <literallayout class="monospaced">
8511 # allow_domain_literals
8512 </literallayout>
8513 <para>
8514 The RFCs still require this form, but many people think that in the modern
8515 Internet it makes little sense to permit mail to be sent to specific hosts by
8516 quoting their IP addresses. This ancient format has been used by people who
8517 try to abuse hosts by using them for unwanted relaying. However, some
8518 people believe there are circumstances (for example, messages addressed to
8519 <emphasis>postmaster</emphasis>) where domain literals are still useful.
8520 </para>
8521 <para>
8522 The next configuration line is a kind of trigger guard:
8523 </para>
8524 <literallayout class="monospaced">
8525 never_users = root
8526 </literallayout>
8527 <para>
8528 It specifies that no delivery must ever be run as the root user. The normal
8529 convention is to set up <emphasis>root</emphasis> as an alias for the system administrator. This
8530 setting is a guard against slips in the configuration.
8531 The list of users specified by <option>never_users</option> is not, however, the complete
8532 list; the build-time configuration in <filename>Local/Makefile</filename> has an option called
8533 FIXED_NEVER_USERS specifying a list that cannot be overridden. The
8534 contents of <option>never_users</option> are added to this list. By default
8535 FIXED_NEVER_USERS also specifies root.
8536 </para>
8537 <para>
8538 When a remote host connects to Exim in order to send mail, the only information
8539 Exim has about the host&#x2019;s identity is its IP address. The next configuration
8540 line,
8541 </para>
8542 <literallayout class="monospaced">
8543 host_lookup = *
8544 </literallayout>
8545 <para>
8546 specifies that Exim should do a reverse DNS lookup on all incoming connections,
8547 in order to get a host name. This improves the quality of the logging
8548 information, but if you feel it is too expensive, you can remove it entirely,
8549 or restrict the lookup to hosts on <quote>nearby</quote> networks.
8550 Note that it is not always possible to find a host name from an IP address,
8551 because not all DNS reverse zones are maintained, and sometimes DNS servers are
8552 unreachable.
8553 </para>
8554 <para>
8555 The next two lines are concerned with <emphasis>ident</emphasis> callbacks, as defined by RFC
8556 1413 (hence their names):
8557 </para>
8558 <literallayout class="monospaced">
8559 rfc1413_hosts = *
8560 rfc1413_query_timeout = 0s
8561 </literallayout>
8562 <para>
8563 These settings cause Exim to avoid ident callbacks for all incoming SMTP calls.
8564 Few hosts offer RFC1413 service these days; calls have to be
8565 terminated by a timeout and this needlessly delays the startup
8566 of an incoming SMTP connection.
8567 If you have hosts for which you trust RFC1413 and need this
8568 information, you can change this.
8569 </para>
8570 <para>
8571 This line enables an efficiency SMTP option.  It is negotiated by clients
8572 and not expected to cause problems but can be disabled if needed.
8573 </para>
8574 <literallayout class="monospaced">
8575 prdr_enable = true
8576 </literallayout>
8577 <para>
8578 When Exim receives messages over SMTP connections, it expects all addresses to
8579 be fully qualified with a domain, as required by the SMTP definition. However,
8580 if you are running a server to which simple clients submit messages, you may
8581 find that they send unqualified addresses. The two commented-out options:
8582 </para>
8583 <literallayout class="monospaced">
8584 # sender_unqualified_hosts =
8585 # recipient_unqualified_hosts =
8586 </literallayout>
8587 <para>
8588 show how you can specify hosts that are permitted to send unqualified sender
8589 and recipient addresses, respectively.
8590 </para>
8591 <para>
8592 The <option>log_selector</option> option is used to increase the detail of logging
8593 over the default:
8594 </para>
8595 <literallayout class="monospaced">
8596 log_selector = +smtp_protocol_error +smtp_syntax_error \
8597                +tls_certificate_verified
8598 </literallayout>
8599 <para>
8600 The <option>percent_hack_domains</option> option is also commented out:
8601 </para>
8602 <literallayout class="monospaced">
8603 # percent_hack_domains =
8604 </literallayout>
8605 <para>
8606 It provides a list of domains for which the <quote>percent hack</quote> is to operate.
8607 This is an almost obsolete form of explicit email routing. If you do not know
8608 anything about it, you can safely ignore this topic.
8609 </para>
8610 <para>
8611 The next two settings in the main part of the default configuration are
8612 concerned with messages that have been <quote>frozen</quote> on Exim&#x2019;s queue. When a
8613 message is frozen, Exim no longer continues to try to deliver it. Freezing
8614 occurs when a bounce message encounters a permanent failure because the sender
8615 address of the original message that caused the bounce is invalid, so the
8616 bounce cannot be delivered. This is probably the most common case, but there
8617 are also other conditions that cause freezing, and frozen messages are not
8618 always bounce messages.
8619 </para>
8620 <literallayout class="monospaced">
8621 ignore_bounce_errors_after = 2d
8622 timeout_frozen_after = 7d
8623 </literallayout>
8624 <para>
8625 The first of these options specifies that failing bounce messages are to be
8626 discarded after 2 days on the queue. The second specifies that any frozen
8627 message (whether a bounce message or not) is to be timed out (and discarded)
8628 after a week. In this configuration, the first setting ensures that no failing
8629 bounce message ever lasts a week.
8630 </para>
8631 <para>
8632 Exim queues it&#x2019;s messages in a spool directory. If you expect to have
8633 large queues, you may consider using this option. It splits the spool
8634 directory into subdirectories to avoid file system degradation from
8635 many files in a single directory, resulting in better performance.
8636 Manual manipulation of queued messages becomes more complex (though fortunately
8637 not often needed).
8638 </para>
8639 <literallayout class="monospaced">
8640 # split_spool_directory = true
8641 </literallayout>
8642 <para>
8643 In an ideal world everybody follows the standards. For non-ASCII
8644 messages RFC 2047 is a standard, allowing a maximum line length of 76
8645 characters. Exim adheres that standard and won&#x2019;t process messages which
8646 violate this standard. (Even ${rfc2047:...} expansions will fail.)
8647 In particular, the Exim maintainers have had multiple reports of
8648 problems from Russian administrators of issues until they disable this
8649 check, because of some popular, yet buggy, mail composition software.
8650 </para>
8651 <literallayout class="monospaced">
8652 # check_rfc2047_length = false
8653 </literallayout>
8654 <para>
8655 If you need to be strictly RFC compliant you may wish to disable the
8656 8BITMIME advertisement. Use this, if you exchange mails with systems
8657 that are not 8-bit clean.
8658 </para>
8659 <literallayout class="monospaced">
8660 # accept_8bitmime = false
8661 </literallayout>
8662 <para>
8663 Libraries you use may depend on specific environment settings.  This
8664 imposes a security risk (e.g. PATH). There are two lists:
8665 <option>keep_environment</option> for the variables to import as they are, and
8666 <option>add_environment</option> for variables we want to set to a fixed value.
8667 Note that TZ is handled separately, by the $%timezone%$ runtime
8668 option and by the TIMEZONE_DEFAULT buildtime option.
8669 </para>
8670 <literallayout class="monospaced">
8671 # keep_environment = ^LDAP
8672 # add_environment = PATH=/usr/bin::/bin
8673 </literallayout>
8674 </section>
8675 <section id="SECID54">
8676 <title>ACL configuration</title>
8677 <para>
8678 <indexterm role="concept">
8679 <primary>default</primary>
8680 <secondary>ACLs</secondary>
8681 </indexterm>
8682 <indexterm role="concept">
8683 <primary>access control lists (ACLs)</primary>
8684 <secondary>default configuration</secondary>
8685 </indexterm>
8686 In the default configuration, the ACL section follows the main configuration.
8687 It starts with the line
8688 </para>
8689 <literallayout class="monospaced">
8690 begin acl
8691 </literallayout>
8692 <para>
8693 and it contains the definitions of two ACLs, called <emphasis>acl_check_rcpt</emphasis> and
8694 <emphasis>acl_check_data</emphasis>, that were referenced in the settings of <option>acl_smtp_rcpt</option>
8695 and <option>acl_smtp_data</option> above.
8696 </para>
8697 <para>
8698 <indexterm role="concept">
8699 <primary>RCPT</primary>
8700 <secondary>ACL for</secondary>
8701 </indexterm>
8702 The first ACL is used for every RCPT command in an incoming SMTP message. Each
8703 RCPT command specifies one of the message&#x2019;s recipients. The ACL statements
8704 are considered in order, until the recipient address is either accepted or
8705 rejected. The RCPT command is then accepted or rejected, according to the
8706 result of the ACL processing.
8707 </para>
8708 <literallayout class="monospaced">
8709 acl_check_rcpt:
8710 </literallayout>
8711 <para>
8712 This line, consisting of a name terminated by a colon, marks the start of the
8713 ACL, and names it.
8714 </para>
8715 <literallayout class="monospaced">
8716 accept  hosts = :
8717 </literallayout>
8718 <para>
8719 This ACL statement accepts the recipient if the sending host matches the list.
8720 But what does that strange list mean? It doesn&#x2019;t actually contain any host
8721 names or IP addresses. The presence of the colon puts an empty item in the
8722 list; Exim matches this only if the incoming message did not come from a remote
8723 host, because in that case, the remote hostname is empty. The colon is
8724 important. Without it, the list itself is empty, and can never match anything.
8725 </para>
8726 <para>
8727 What this statement is doing is to accept unconditionally all recipients in
8728 messages that are submitted by SMTP from local processes using the standard
8729 input and output (that is, not using TCP/IP). A number of MUAs operate in this
8730 manner.
8731 </para>
8732 <literallayout class="monospaced">
8733 deny    message       = Restricted characters in address
8734         domains       = +local_domains
8735         local_parts   = ^[.] : ^.*[@%!/|]
8736
8737 deny    message       = Restricted characters in address
8738         domains       = !+local_domains
8739         local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
8740 </literallayout>
8741 <para>
8742 These statements are concerned with local parts that contain any of the
8743 characters <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>, <quote>|</quote>, or dots in unusual places.
8744 Although these characters are entirely legal in local parts (in the case of
8745 <quote>@</quote> and leading dots, only if correctly quoted), they do not commonly occur
8746 in Internet mail addresses.
8747 </para>
8748 <para>
8749 The first three have in the past been associated with explicitly routed
8750 addresses (percent is still sometimes used &ndash; see the <option>percent_hack_domains</option>
8751 option). Addresses containing these characters are regularly tried by spammers
8752 in an attempt to bypass relaying restrictions, and also by open relay testing
8753 programs. Unless you really need them it is safest to reject these characters
8754 at this early stage. This configuration is heavy-handed in rejecting these
8755 characters for all messages it accepts from remote hosts. This is a deliberate
8756 policy of being as safe as possible.
8757 </para>
8758 <para>
8759 The first rule above is stricter, and is applied to messages that are addressed
8760 to one of the local domains handled by this host. This is implemented by the
8761 first condition, which restricts it to domains that are listed in the
8762 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8763 reference to a named list. In this configuration, there is just one domain in
8764 <emphasis>local_domains</emphasis>, but in general there may be many.
8765 </para>
8766 <para>
8767 The second condition on the first statement uses two regular expressions to
8768 block local parts that begin with a dot or contain <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>,
8769 or <quote>|</quote>. If you have local accounts that include these characters, you will
8770 have to modify this rule.
8771 </para>
8772 <para>
8773 Empty components (two dots in a row) are not valid in RFC 2822, but Exim
8774 allows them because they have been encountered in practice. (Consider the
8775 common convention of local parts constructed as
8776 <quote><emphasis>first-initial.second-initial.family-name</emphasis></quote> when applied to someone like
8777 the author of Exim, who has no second initial.) However, a local part starting
8778 with a dot or containing <quote>/../</quote> can cause trouble if it is used as part of a
8779 file name (for example, for a mailing list). This is also true for local parts
8780 that contain slashes. A pipe symbol can also be troublesome if the local part
8781 is incorporated unthinkingly into a shell command line.
8782 </para>
8783 <para>
8784 The second rule above applies to all other domains, and is less strict. This
8785 allows your own users to send outgoing messages to sites that use slashes
8786 and vertical bars in their local parts. It blocks local parts that begin
8787 with a dot, slash, or vertical bar, but allows these characters within the
8788 local part. However, the sequence <quote>/../</quote> is barred. The use of <quote>@</quote>, <quote>%</quote>,
8789 and <quote>!</quote> is blocked, as before. The motivation here is to prevent your users
8790 (or your users&#x2019; viruses) from mounting certain kinds of attack on remote sites.
8791 </para>
8792 <literallayout class="monospaced">
8793 accept  local_parts   = postmaster
8794         domains       = +local_domains
8795 </literallayout>
8796 <para>
8797 This statement, which has two conditions, accepts an incoming address if the
8798 local part is <emphasis>postmaster</emphasis> and the domain is one of those listed in the
8799 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8800 reference to a named list. In this configuration, there is just one domain in
8801 <emphasis>local_domains</emphasis>, but in general there may be many.
8802 </para>
8803 <para>
8804 The presence of this statement means that mail to postmaster is never blocked
8805 by any of the subsequent tests. This can be helpful while sorting out problems
8806 in cases where the subsequent tests are incorrectly denying access.
8807 </para>
8808 <literallayout class="monospaced">
8809 require verify        = sender
8810 </literallayout>
8811 <para>
8812 This statement requires the sender address to be verified before any subsequent
8813 ACL statement can be used. If verification fails, the incoming recipient
8814 address is refused. Verification consists of trying to route the address, to
8815 see if a bounce message could be delivered to it. In the case of remote
8816 addresses, basic verification checks only the domain, but <emphasis>callouts</emphasis> can be
8817 used for more verification if required. Section <xref linkend="SECTaddressverification"/>
8818 discusses the details of address verification.
8819 </para>
8820 <literallayout class="monospaced">
8821 accept  hosts         = +relay_from_hosts
8822         control       = submission
8823 </literallayout>
8824 <para>
8825 This statement accepts the address if the message is coming from one of the
8826 hosts that are defined as being allowed to relay through this host. Recipient
8827 verification is omitted here, because in many cases the clients are dumb MUAs
8828 that do not cope well with SMTP error responses. For the same reason, the
8829 second line specifies <quote>submission mode</quote> for messages that are accepted. This
8830 is described in detail in section <xref linkend="SECTsubmodnon"/>; it causes Exim to fix
8831 messages that are deficient in some way, for example, because they lack a
8832 <emphasis>Date:</emphasis> header line. If you are actually relaying out from MTAs, you should
8833 probably add recipient verification here, and disable submission mode.
8834 </para>
8835 <literallayout class="monospaced">
8836 accept  authenticated = *
8837         control       = submission
8838 </literallayout>
8839 <para>
8840 This statement accepts the address if the client host has authenticated itself.
8841 Submission mode is again specified, on the grounds that such messages are most
8842 likely to come from MUAs. The default configuration does not define any
8843 authenticators, though it does include some nearly complete commented-out
8844 examples described in <xref linkend="SECTdefconfauth"/>. This means that no client can in
8845 fact authenticate until you complete the authenticator definitions.
8846 </para>
8847 <literallayout class="monospaced">
8848 require message = relay not permitted
8849         domains = +local_domains : +relay_to_domains
8850 </literallayout>
8851 <para>
8852 This statement rejects the address if its domain is neither a local domain nor
8853 one of the domains for which this host is a relay.
8854 </para>
8855 <literallayout class="monospaced">
8856 require verify = recipient
8857 </literallayout>
8858 <para>
8859 This statement requires the recipient address to be verified; if verification
8860 fails, the address is rejected.
8861 </para>
8862 <literallayout class="monospaced">
8863 # deny    message     = rejected because $sender_host_address \
8864 #                       is in a black list at $dnslist_domain\n\
8865 #                       $dnslist_text
8866 #         dnslists    = black.list.example
8867 #
8868 # warn    dnslists    = black.list.example
8869 #         add_header  = X-Warning: $sender_host_address is in \
8870 #                       a black list at $dnslist_domain
8871 #         log_message = found in $dnslist_domain
8872 </literallayout>
8873 <para>
8874 These commented-out lines are examples of how you could configure Exim to check
8875 sending hosts against a DNS black list. The first statement rejects messages
8876 from blacklisted hosts, whereas the second just inserts a warning header
8877 line.
8878 </para>
8879 <literallayout class="monospaced">
8880 # require verify = csa
8881 </literallayout>
8882 <para>
8883 This commented-out line is an example of how you could turn on client SMTP
8884 authorization (CSA) checking. Such checks do DNS lookups for special SRV
8885 records.
8886 </para>
8887 <literallayout class="monospaced">
8888 accept
8889 </literallayout>
8890 <para>
8891 The final statement in the first ACL unconditionally accepts any recipient
8892 address that has successfully passed all the previous tests.
8893 </para>
8894 <literallayout class="monospaced">
8895 acl_check_data:
8896 </literallayout>
8897 <para>
8898 This line marks the start of the second ACL, and names it. Most of the contents
8899 of this ACL are commented out:
8900 </para>
8901 <literallayout class="monospaced">
8902 # deny    malware   = *
8903 #         message   = This message contains a virus \
8904 #                     ($malware_name).
8905 </literallayout>
8906 <para>
8907 These lines are examples of how to arrange for messages to be scanned for
8908 viruses when Exim has been compiled with the content-scanning extension, and a
8909 suitable virus scanner is installed. If the message is found to contain a
8910 virus, it is rejected with the given custom error message.
8911 </para>
8912 <literallayout class="monospaced">
8913 # warn    spam      = nobody
8914 #         message   = X-Spam_score: $spam_score\n\
8915 #                     X-Spam_score_int: $spam_score_int\n\
8916 #                     X-Spam_bar: $spam_bar\n\
8917 #                     X-Spam_report: $spam_report
8918 </literallayout>
8919 <para>
8920 These lines are an example of how to arrange for messages to be scanned by
8921 SpamAssassin when Exim has been compiled with the content-scanning extension,
8922 and SpamAssassin has been installed. The SpamAssassin check is run with
8923 <literal>nobody</literal> as its user parameter, and the results are added to the message as a
8924 series of extra header line. In this case, the message is not rejected,
8925 whatever the spam score.
8926 </para>
8927 <literallayout class="monospaced">
8928 accept
8929 </literallayout>
8930 <para>
8931 This final line in the DATA ACL accepts the message unconditionally.
8932 </para>
8933 </section>
8934 <section id="SECID55">
8935 <title>Router configuration</title>
8936 <para>
8937 <indexterm role="concept">
8938 <primary>default</primary>
8939 <secondary>routers</secondary>
8940 </indexterm>
8941 <indexterm role="concept">
8942 <primary>routers</primary>
8943 <secondary>default</secondary>
8944 </indexterm>
8945 The router configuration comes next in the default configuration, introduced
8946 by the line
8947 </para>
8948 <literallayout class="monospaced">
8949 begin routers
8950 </literallayout>
8951 <para>
8952 Routers are the modules in Exim that make decisions about where to send
8953 messages. An address is passed to each router in turn, until it is either
8954 accepted, or failed. This means that the order in which you define the routers
8955 matters. Each router is fully described in its own chapter later in this
8956 manual. Here we give only brief overviews.
8957 </para>
8958 <literallayout class="monospaced">
8959 # domain_literal:
8960 #   driver = ipliteral
8961 #   domains = !+local_domains
8962 #   transport = remote_smtp
8963 </literallayout>
8964 <para>
8965 <indexterm role="concept">
8966 <primary>domain literal</primary>
8967 <secondary>default router</secondary>
8968 </indexterm>
8969 This router is commented out because the majority of sites do not want to
8970 support domain literal addresses (those of the form <emphasis>user@[10.9.8.7]</emphasis>). If
8971 you uncomment this router, you also need to uncomment the setting of
8972 <option>allow_domain_literals</option> in the main part of the configuration.
8973 </para>
8974 <literallayout class="monospaced">
8975 dnslookup:
8976   driver = dnslookup
8977   domains = ! +local_domains
8978   transport = remote_smtp
8979   ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
8980   no_more
8981 </literallayout>
8982 <para>
8983 The first uncommented router handles addresses that do not involve any local
8984 domains. This is specified by the line
8985 </para>
8986 <literallayout class="monospaced">
8987 domains = ! +local_domains
8988 </literallayout>
8989 <para>
8990 The <option>domains</option> option lists the domains to which this router applies, but the
8991 exclamation mark is a negation sign, so the router is used only for domains
8992 that are not in the domain list called <emphasis>local_domains</emphasis> (which was defined at
8993 the start of the configuration). The plus sign before <emphasis>local_domains</emphasis>
8994 indicates that it is referring to a named list. Addresses in other domains are
8995 passed on to the following routers.
8996 </para>
8997 <para>
8998 The name of the router driver is <command>dnslookup</command>,
8999 and is specified by the <option>driver</option> option. Do not be confused by the fact that
9000 the name of this router instance is the same as the name of the driver. The
9001 instance name is arbitrary, but the name set in the <option>driver</option> option must be
9002 one of the driver modules that is in the Exim binary.
9003 </para>
9004 <para>
9005 The <command>dnslookup</command> router routes addresses by looking up their domains in the
9006 DNS in order to obtain a list of hosts to which the address is routed. If the
9007 router succeeds, the address is queued for the <command>remote_smtp</command> transport, as
9008 specified by the <option>transport</option> option. If the router does not find the domain
9009 in the DNS, no further routers are tried because of the <option>no_more</option> setting, so
9010 the address fails and is bounced.
9011 </para>
9012 <para>
9013 The <option>ignore_target_hosts</option> option specifies a list of IP addresses that are to
9014 be entirely ignored. This option is present because a number of cases have been
9015 encountered where MX records in the DNS point to host names
9016 whose IP addresses are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1).
9017 Completely ignoring these IP addresses causes Exim to fail to route the
9018 email address, so it bounces. Otherwise, Exim would log a routing problem, and
9019 continue to try to deliver the message periodically until the address timed
9020 out.
9021 </para>
9022 <literallayout class="monospaced">
9023 system_aliases:
9024   driver = redirect
9025   allow_fail
9026   allow_defer
9027   data = ${lookup{$local_part}lsearch{/etc/aliases}}
9028 # user = exim
9029   file_transport = address_file
9030   pipe_transport = address_pipe
9031 </literallayout>
9032 <para>
9033 Control reaches this and subsequent routers only for addresses in the local
9034 domains. This router checks to see whether the local part is defined as an
9035 alias in the <filename>/etc/aliases</filename> file, and if so, redirects it according to the
9036 data that it looks up from that file. If no data is found for the local part,
9037 the value of the <option>data</option> option is empty, causing the address to be passed to
9038 the next router.
9039 </para>
9040 <para>
9041 <filename>/etc/aliases</filename> is a conventional name for the system aliases file that is
9042 often used. That is why it is referenced by from the default configuration
9043 file. However, you can change this by setting SYSTEM_ALIASES_FILE in
9044 <filename>Local/Makefile</filename> before building Exim.
9045 </para>
9046 <literallayout class="monospaced">
9047 userforward:
9048   driver = redirect
9049   check_local_user
9050 # local_part_suffix = +* : -*
9051 # local_part_suffix_optional
9052   file = $home/.forward
9053 # allow_filter
9054   no_verify
9055   no_expn
9056   check_ancestor
9057   file_transport = address_file
9058   pipe_transport = address_pipe
9059   reply_transport = address_reply
9060 </literallayout>
9061 <para>
9062 This is the most complicated router in the default configuration. It is another
9063 redirection router, but this time it is looking for forwarding data set up by
9064 individual users. The <option>check_local_user</option> setting specifies a check that the
9065 local part of the address is the login name of a local user. If it is not, the
9066 router is skipped. The two commented options that follow <option>check_local_user</option>,
9067 namely:
9068 </para>
9069 <literallayout class="monospaced">
9070 # local_part_suffix = +* : -*
9071 # local_part_suffix_optional
9072 </literallayout>
9073 <para>
9074 <indexterm role="variable">
9075 <primary><varname>$local_part_suffix</varname></primary>
9076 </indexterm>
9077 show how you can specify the recognition of local part suffixes. If the first
9078 is uncommented, a suffix beginning with either a plus or a minus sign, followed
9079 by any sequence of characters, is removed from the local part and placed in the
9080 variable <varname>$local_part_suffix</varname>. The second suffix option specifies that the
9081 presence of a suffix in the local part is optional. When a suffix is present,
9082 the check for a local login uses the local part with the suffix removed.
9083 </para>
9084 <para>
9085 When a local user account is found, the file called <filename>.forward</filename> in the user&#x2019;s
9086 home directory is consulted. If it does not exist, or is empty, the router
9087 declines. Otherwise, the contents of <filename>.forward</filename> are interpreted as
9088 redirection data (see chapter <xref linkend="CHAPredirect"/> for more details).
9089 </para>
9090 <para>
9091 <indexterm role="concept">
9092 <primary>Sieve filter</primary>
9093 <secondary>enabling in default router</secondary>
9094 </indexterm>
9095 Traditional <filename>.forward</filename> files contain just a list of addresses, pipes, or
9096 files. Exim supports this by default. However, if <option>allow_filter</option> is set (it
9097 is commented out by default), the contents of the file are interpreted as a set
9098 of Exim or Sieve filtering instructions, provided the file begins with <quote>#Exim
9099 filter</quote> or <quote>#Sieve filter</quote>, respectively. User filtering is discussed in the
9100 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
9101 </para>
9102 <para>
9103 The <option>no_verify</option> and <option>no_expn</option> options mean that this router is skipped when
9104 verifying addresses, or when running as a consequence of an SMTP EXPN command.
9105 There are two reasons for doing this:
9106 </para>
9107 <orderedlist numeration="arabic">
9108 <listitem>
9109 <para>
9110 Whether or not a local user has a <filename>.forward</filename> file is not really relevant when
9111 checking an address for validity; it makes sense not to waste resources doing
9112 unnecessary work.
9113 </para>
9114 </listitem>
9115 <listitem>
9116 <para>
9117 More importantly, when Exim is verifying addresses or handling an EXPN
9118 command during an SMTP session, it is running as the Exim user, not as root.
9119 The group is the Exim group, and no additional groups are set up.
9120 It may therefore not be possible for Exim to read users&#x2019; <filename>.forward</filename> files at
9121 this time.
9122 </para>
9123 </listitem>
9124 </orderedlist>
9125 <para>
9126 The setting of <option>check_ancestor</option> prevents the router from generating a new
9127 address that is the same as any previous address that was redirected. (This
9128 works round a problem concerning a bad interaction between aliasing and
9129 forwarding &ndash; see section <xref linkend="SECTredlocmai"/>).
9130 </para>
9131 <para>
9132 The final three option settings specify the transports that are to be used when
9133 forwarding generates a direct delivery to a file, or to a pipe, or sets up an
9134 auto-reply, respectively. For example, if a <filename>.forward</filename> file contains
9135 </para>
9136 <literallayout class="monospaced">
9137 a.nother@elsewhere.example, /home/spqr/archive
9138 </literallayout>
9139 <para>
9140 the delivery to <filename>/home/spqr/archive</filename> is done by running the <option>address_file</option>
9141 transport.
9142 </para>
9143 <literallayout class="monospaced">
9144 localuser:
9145   driver = accept
9146   check_local_user
9147 # local_part_suffix = +* : -*
9148 # local_part_suffix_optional
9149   transport = local_delivery
9150 </literallayout>
9151 <para>
9152 The final router sets up delivery into local mailboxes, provided that the local
9153 part is the name of a local login, by accepting the address and assigning it to
9154 the <command>local_delivery</command> transport. Otherwise, we have reached the end of the
9155 routers, so the address is bounced. The commented suffix settings fulfil the
9156 same purpose as they do for the <command>userforward</command> router.
9157 </para>
9158 </section>
9159 <section id="SECID56">
9160 <title>Transport configuration</title>
9161 <para>
9162 <indexterm role="concept">
9163 <primary>default</primary>
9164 <secondary>transports</secondary>
9165 </indexterm>
9166 <indexterm role="concept">
9167 <primary>transports</primary>
9168 <secondary>default</secondary>
9169 </indexterm>
9170 Transports define mechanisms for actually delivering messages. They operate
9171 only when referenced from routers, so the order in which they are defined does
9172 not matter. The transports section of the configuration starts with
9173 </para>
9174 <literallayout class="monospaced">
9175 begin transports
9176 </literallayout>
9177 <para>
9178 One remote transport and four local transports are defined.
9179 </para>
9180 <literallayout class="monospaced">
9181 remote_smtp:
9182   driver = smtp
9183   hosts_try_prdr = *
9184 </literallayout>
9185 <para>
9186 This transport is used for delivering messages over SMTP connections.
9187 The list of remote hosts comes from the router.
9188 The <option>hosts_try_prdr</option> option enables an efficiency SMTP option.
9189 It is negotiated between client and server
9190 and not expected to cause problems but can be disabled if needed.
9191 All other options are defaulted.
9192 </para>
9193 <literallayout class="monospaced">
9194 local_delivery:
9195   driver = appendfile
9196   file = /var/mail/$local_part
9197   delivery_date_add
9198   envelope_to_add
9199   return_path_add
9200 # group = mail
9201 # mode = 0660
9202 </literallayout>
9203 <para>
9204 This <command>appendfile</command> transport is used for local delivery to user mailboxes in
9205 traditional BSD mailbox format. By default it runs under the uid and gid of the
9206 local user, which requires the sticky bit to be set on the <filename>/var/mail</filename>
9207 directory. Some systems use the alternative approach of running mail deliveries
9208 under a particular group instead of using the sticky bit. The commented options
9209 show how this can be done.
9210 </para>
9211 <para>
9212 Exim adds three headers to the message as it delivers it: <emphasis>Delivery-date:</emphasis>,
9213 <emphasis>Envelope-to:</emphasis> and <emphasis>Return-path:</emphasis>. This action is requested by the three
9214 similarly-named options above.
9215 </para>
9216 <literallayout class="monospaced">
9217 address_pipe:
9218   driver = pipe
9219   return_output
9220 </literallayout>
9221 <para>
9222 This transport is used for handling deliveries to pipes that are generated by
9223 redirection (aliasing or users&#x2019; <filename>.forward</filename> files). The <option>return_output</option>
9224 option specifies that any output on stdout or stderr generated by the pipe is to
9225 be returned to the sender.
9226 </para>
9227 <literallayout class="monospaced">
9228 address_file:
9229   driver = appendfile
9230   delivery_date_add
9231   envelope_to_add
9232   return_path_add
9233 </literallayout>
9234 <para>
9235 This transport is used for handling deliveries to files that are generated by
9236 redirection. The name of the file is not specified in this instance of
9237 <command>appendfile</command>, because it comes from the <command>redirect</command> router.
9238 </para>
9239 <literallayout class="monospaced">
9240 address_reply:
9241   driver = autoreply
9242 </literallayout>
9243 <para>
9244 This transport is used for handling automatic replies generated by users&#x2019;
9245 filter files.
9246 </para>
9247 </section>
9248 <section id="SECID57">
9249 <title>Default retry rule</title>
9250 <para>
9251 <indexterm role="concept">
9252 <primary>retry</primary>
9253 <secondary>default rule</secondary>
9254 </indexterm>
9255 <indexterm role="concept">
9256 <primary>default</primary>
9257 <secondary>retry rule</secondary>
9258 </indexterm>
9259 The retry section of the configuration file contains rules which affect the way
9260 Exim retries deliveries that cannot be completed at the first attempt. It is
9261 introduced by the line
9262 </para>
9263 <literallayout class="monospaced">
9264 begin retry
9265 </literallayout>
9266 <para>
9267 In the default configuration, there is just one rule, which applies to all
9268 errors:
9269 </para>
9270 <literallayout class="monospaced">
9271 *   *   F,2h,15m; G,16h,1h,1.5; F,4d,6h
9272 </literallayout>
9273 <para>
9274 This causes any temporarily failing address to be retried every 15 minutes for
9275 2 hours, then at intervals starting at one hour and increasing by a factor of
9276 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address
9277 is not delivered after 4 days of temporary failure, it is bounced.
9278 </para>
9279 <para>
9280 If the retry section is removed from the configuration, or is empty (that is,
9281 if no retry rules are defined), Exim will not retry deliveries. This turns
9282 temporary errors into permanent errors.
9283 </para>
9284 </section>
9285 <section id="SECID58">
9286 <title>Rewriting configuration</title>
9287 <para>
9288 The rewriting section of the configuration, introduced by
9289 </para>
9290 <literallayout class="monospaced">
9291 begin rewrite
9292 </literallayout>
9293 <para>
9294 contains rules for rewriting addresses in messages as they arrive. There are no
9295 rewriting rules in the default configuration file.
9296 </para>
9297 </section>
9298 <section id="SECTdefconfauth">
9299 <title>Authenticators configuration</title>
9300 <para>
9301 <indexterm role="concept">
9302 <primary>AUTH</primary>
9303 <secondary>configuration</secondary>
9304 </indexterm>
9305 The authenticators section of the configuration, introduced by
9306 </para>
9307 <literallayout class="monospaced">
9308 begin authenticators
9309 </literallayout>
9310 <para>
9311 defines mechanisms for the use of the SMTP AUTH command. The default
9312 configuration file contains two commented-out example authenticators
9313 which support plaintext username/password authentication using the
9314 standard PLAIN mechanism and the traditional but non-standard LOGIN
9315 mechanism, with Exim acting as the server. PLAIN and LOGIN are enough
9316 to support most MUA software.
9317 </para>
9318 <para>
9319 The example PLAIN authenticator looks like this:
9320 </para>
9321 <literallayout class="monospaced">
9322 #PLAIN:
9323 #  driver                  = plaintext
9324 #  server_set_id           = $auth2
9325 #  server_prompts          = :
9326 #  server_condition        = Authentication is not yet configured
9327 #  server_advertise_condition = ${if def:tls_in_cipher }
9328 </literallayout>
9329 <para>
9330 And the example LOGIN authenticator looks like this:
9331 </para>
9332 <literallayout class="monospaced">
9333 #LOGIN:
9334 #  driver                  = plaintext
9335 #  server_set_id           = $auth1
9336 #  server_prompts          = &lt;| Username: | Password:
9337 #  server_condition        = Authentication is not yet configured
9338 #  server_advertise_condition = ${if def:tls_in_cipher }
9339 </literallayout>
9340 <para>
9341 The <option>server_set_id</option> option makes Exim remember the authenticated username
9342 in <varname>$authenticated_id</varname>, which can be used later in ACLs or routers. The
9343 <option>server_prompts</option> option configures the <command>plaintext</command> authenticator so
9344 that it implements the details of the specific authentication mechanism,
9345 i.e. PLAIN or LOGIN. The <option>server_advertise_condition</option> setting controls
9346 when Exim offers authentication to clients; in the examples, this is only
9347 when TLS or SSL has been started, so to enable the authenticators you also
9348 need to add support for TLS as described in section <xref linkend="SECTdefconfmain"/>.
9349 </para>
9350 <para>
9351 The <option>server_condition</option> setting defines how to verify that the username and
9352 password are correct. In the examples it just produces an error message.
9353 To make the authenticators work, you can use a string expansion
9354 expression like one of the examples in chapter <xref linkend="CHAPplaintext"/>.
9355 </para>
9356 <para>
9357 Beware that the sequence of the parameters to PLAIN and LOGIN differ; the
9358 usercode and password are in different positions.
9359 Chapter <xref linkend="CHAPplaintext"/> covers both.
9360 </para>
9361 <para>
9362 <indexterm role="concept" startref="IIDconfiwal" class="endofrange"/>
9363 </para>
9364 </section>
9365 </chapter>
9366
9367 <chapter id="CHAPregexp">
9368 <title>Regular expressions</title>
9369 <para>
9370 <indexterm role="concept">
9371 <primary>regular expressions</primary>
9372 <secondary>library</secondary>
9373 </indexterm>
9374 <indexterm role="concept">
9375 <primary>PCRE</primary>
9376 </indexterm>
9377 Exim supports the use of regular expressions in many of its options. It
9378 uses the PCRE regular expression library; this provides regular expression
9379 matching that is compatible with Perl 5. The syntax and semantics of
9380 regular expressions is discussed in many Perl reference books, and also in
9381 Jeffrey Friedl&#x2019;s <emphasis>Mastering Regular Expressions</emphasis>, which is published by
9382 O&#x2019;Reilly (see <emphasis role="bold"><ulink url="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</ulink></emphasis>).
9383 </para>
9384 <para>
9385 The documentation for the syntax and semantics of the regular expressions that
9386 are supported by PCRE is included in the PCRE distribution, and no further
9387 description is included here. The PCRE functions are called from Exim using
9388 the default option settings (that is, with no PCRE options set), except that
9389 the PCRE_CASELESS option is set when the matching is required to be
9390 case-insensitive.
9391 </para>
9392 <para>
9393 In most cases, when a regular expression is required in an Exim configuration,
9394 it has to start with a circumflex, in order to distinguish it from plain text
9395 or an <quote>ends with</quote> wildcard. In this example of a configuration setting, the
9396 second item in the colon-separated list is a regular expression.
9397 </para>
9398 <literallayout class="monospaced">
9399 domains = a.b.c : ^\\d{3} : *.y.z : ...
9400 </literallayout>
9401 <para>
9402 The doubling of the backslash is required because of string expansion that
9403 precedes interpretation &ndash; see section <xref linkend="SECTlittext"/> for more discussion
9404 of this issue, and a way of avoiding the need for doubling backslashes. The
9405 regular expression that is eventually used in this example contains just one
9406 backslash. The circumflex is included in the regular expression, and has the
9407 normal effect of <quote>anchoring</quote> it to the start of the string that is being
9408 matched.
9409 </para>
9410 <para>
9411 There are, however, two cases where a circumflex is not required for the
9412 recognition of a regular expression: these are the <option>match</option> condition in a
9413 string expansion, and the <option>matches</option> condition in an Exim filter file. In
9414 these cases, the relevant string is always treated as a regular expression; if
9415 it does not start with a circumflex, the expression is not anchored, and can
9416 match anywhere in the subject string.
9417 </para>
9418 <para>
9419 In all cases, if you want a regular expression to match at the end of a string,
9420 you must code the $ metacharacter to indicate this. For example:
9421 </para>
9422 <literallayout class="monospaced">
9423 domains = ^\\d{3}\\.example
9424 </literallayout>
9425 <para>
9426 matches the domain <emphasis>123.example</emphasis>, but it also matches <emphasis>123.example.com</emphasis>.
9427 You need to use:
9428 </para>
9429 <literallayout class="monospaced">
9430 domains = ^\\d{3}\\.example\$
9431 </literallayout>
9432 <para>
9433 if you want <emphasis>example</emphasis> to be the top-level domain. The backslash before the
9434 $ is needed because string expansion also interprets dollar characters.
9435 </para>
9436 </chapter>
9437
9438 <chapter id="CHAPfdlookup">
9439 <title>File and database lookups</title>
9440 <para>
9441 <indexterm role="concept" id="IIDfidalo1" class="startofrange">
9442 <primary>file</primary>
9443 <secondary>lookups</secondary>
9444 </indexterm>
9445 <indexterm role="concept" id="IIDfidalo2" class="startofrange">
9446 <primary>database</primary>
9447 <secondary>lookups</secondary>
9448 </indexterm>
9449 <indexterm role="concept">
9450 <primary>lookup</primary>
9451 <secondary>description of</secondary>
9452 </indexterm>
9453 Exim can be configured to look up data in files or databases as it processes
9454 messages. Two different kinds of syntax are used:
9455 </para>
9456 <orderedlist numeration="arabic">
9457 <listitem>
9458 <para>
9459 A string that is to be expanded may contain explicit lookup requests. These
9460 cause parts of the string to be replaced by data that is obtained from the
9461 lookup. Lookups of this type are conditional expansion items. Different results
9462 can be defined for the cases of lookup success and failure. See chapter
9463 <xref linkend="CHAPexpand"/>, where string expansions are described in detail.
9464 The key for the lookup is specified as part of the string expansion.
9465 </para>
9466 </listitem>
9467 <listitem>
9468 <para>
9469 Lists of domains, hosts, and email addresses can contain lookup requests as a
9470 way of avoiding excessively long linear lists. In this case, the data that is
9471 returned by the lookup is often (but not always) discarded; whether the lookup
9472 succeeds or fails is what really counts. These kinds of list are described in
9473 chapter <xref linkend="CHAPdomhosaddlists"/>.
9474 The key for the lookup is given by the context in which the list is expanded.
9475 </para>
9476 </listitem>
9477 </orderedlist>
9478 <para>
9479 String expansions, lists, and lookups interact with each other in such a way
9480 that there is no order in which to describe any one of them that does not
9481 involve references to the others. Each of these three chapters makes more sense
9482 if you have read the other two first. If you are reading this for the first
9483 time, be aware that some of it will make a lot more sense after you have read
9484 chapters <xref linkend="CHAPdomhosaddlists"/> and <xref linkend="CHAPexpand"/>.
9485 </para>
9486 <section id="SECID60">
9487 <title>Examples of different lookup syntax</title>
9488 <para>
9489 It is easy to confuse the two different kinds of lookup, especially as the
9490 lists that may contain the second kind are always expanded before being
9491 processed as lists. Therefore, they may also contain lookups of the first kind.
9492 Be careful to distinguish between the following two examples:
9493 </para>
9494 <literallayout class="monospaced">
9495 domains = ${lookup{$sender_host_address}lsearch{/some/file}}
9496 domains = lsearch;/some/file
9497 </literallayout>
9498 <para>
9499 The first uses a string expansion, the result of which must be a domain list.
9500 No strings have been specified for a successful or a failing lookup; the
9501 defaults in this case are the looked-up data and an empty string, respectively.
9502 The expansion takes place before the string is processed as a list, and the
9503 file that is searched could contain lines like this:
9504 </para>
9505 <literallayout class="monospaced">
9506 192.168.3.4: domain1:domain2:...
9507 192.168.1.9: domain3:domain4:...
9508 </literallayout>
9509 <para>
9510 When the lookup succeeds, the result of the expansion is a list of domains (and
9511 possibly other types of item that are allowed in domain lists).
9512 </para>
9513 <para>
9514 In the second example, the lookup is a single item in a domain list. It causes
9515 Exim to use a lookup to see if the domain that is being processed can be found
9516 in the file. The file could contains lines like this:
9517 </para>
9518 <literallayout class="monospaced">
9519 domain1:
9520 domain2:
9521 </literallayout>
9522 <para>
9523 Any data that follows the keys is not relevant when checking that the domain
9524 matches the list item.
9525 </para>
9526 <para>
9527 It is possible, though no doubt confusing, to use both kinds of lookup at once.
9528 Consider a file containing lines like this:
9529 </para>
9530 <literallayout class="monospaced">
9531 192.168.5.6: lsearch;/another/file
9532 </literallayout>
9533 <para>
9534 If the value of <varname>$sender_host_address</varname> is 192.168.5.6, expansion of the
9535 first <option>domains</option> setting above generates the second setting, which therefore
9536 causes a second lookup to occur.
9537 </para>
9538 <para>
9539 The rest of this chapter describes the different lookup types that are
9540 available. Any of them can be used in any part of the configuration where a
9541 lookup is permitted.
9542 </para>
9543 </section>
9544 <section id="SECID61">
9545 <title>Lookup types</title>
9546 <para>
9547 <indexterm role="concept">
9548 <primary>lookup</primary>
9549 <secondary>types of</secondary>
9550 </indexterm>
9551 <indexterm role="concept">
9552 <primary>single-key lookup</primary>
9553 <secondary>definition of</secondary>
9554 </indexterm>
9555 Two different types of data lookup are implemented:
9556 </para>
9557 <itemizedlist>
9558 <listitem>
9559 <para>
9560 The <emphasis>single-key</emphasis> type requires the specification of a file in which to look,
9561 and a single key to search for. The key must be a non-empty string for the
9562 lookup to succeed. The lookup type determines how the file is searched.
9563 </para>
9564 </listitem>
9565 <listitem>
9566 <para>
9567 <indexterm role="concept">
9568 <primary>query-style lookup</primary>
9569 <secondary>definition of</secondary>
9570 </indexterm>
9571 The <emphasis>query-style</emphasis> type accepts a generalized database query. No particular
9572 key value is assumed by Exim for query-style lookups. You can use whichever
9573 Exim variables you need to construct the database query.
9574 </para>
9575 </listitem>
9576 </itemizedlist>
9577 <para>
9578 The code for each lookup type is in a separate source file that is included in
9579 the binary of Exim only if the corresponding compile-time option is set. The
9580 default settings in <filename>src/EDITME</filename> are:
9581 </para>
9582 <literallayout class="monospaced">
9583 LOOKUP_DBM=yes
9584 LOOKUP_LSEARCH=yes
9585 </literallayout>
9586 <para>
9587 which means that only linear searching and DBM lookups are included by default.
9588 For some types of lookup (e.g. SQL databases), you need to install appropriate
9589 libraries and header files before building Exim.
9590 </para>
9591 </section>
9592 <section id="SECTsinglekeylookups">
9593 <title>Single-key lookup types</title>
9594 <para>
9595 <indexterm role="concept">
9596 <primary>lookup</primary>
9597 <secondary>single-key types</secondary>
9598 </indexterm>
9599 <indexterm role="concept">
9600 <primary>single-key lookup</primary>
9601 <secondary>list of types</secondary>
9602 </indexterm>
9603 The following single-key lookup types are implemented:
9604 </para>
9605 <itemizedlist>
9606 <listitem>
9607 <para>
9608 <indexterm role="concept">
9609 <primary>cdb</primary>
9610 <secondary>description of</secondary>
9611 </indexterm>
9612 <indexterm role="concept">
9613 <primary>lookup</primary>
9614 <secondary>cdb</secondary>
9615 </indexterm>
9616 <indexterm role="concept">
9617 <primary>binary zero</primary>
9618 <secondary>in lookup key</secondary>
9619 </indexterm>
9620 <command>cdb</command>: The given file is searched as a Constant DataBase file, using the key
9621 string without a terminating binary zero. The cdb format is designed for
9622 indexed files that are read frequently and never updated, except by total
9623 re-creation. As such, it is particularly suitable for large files containing
9624 aliases or other indexed data referenced by an MTA. Information about cdb can
9625 be found in several places:
9626 </para>
9627 <literallayout>
9628 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>
9629 <emphasis role="bold"><ulink url="ftp://ftp.corpit.ru/pub/tinycdb/">ftp://ftp.corpit.ru/pub/tinycdb/</ulink></emphasis>
9630 <emphasis role="bold"><ulink url="http://packages.debian.org/stable/utils/freecdb.html">http://packages.debian.org/stable/utils/freecdb.html</ulink></emphasis>
9631 </literallayout>
9632 <para>
9633 A cdb distribution is not needed in order to build Exim with cdb support,
9634 because the code for reading cdb files is included directly in Exim itself.
9635 However, no means of building or testing cdb files is provided with Exim, so
9636 you need to obtain a cdb distribution in order to do this.
9637 </para>
9638 </listitem>
9639 <listitem>
9640 <para>
9641 <indexterm role="concept">
9642 <primary>DBM</primary>
9643 <secondary>lookup type</secondary>
9644 </indexterm>
9645 <indexterm role="concept">
9646 <primary>lookup</primary>
9647 <secondary>dbm</secondary>
9648 </indexterm>
9649 <indexterm role="concept">
9650 <primary>binary zero</primary>
9651 <secondary>in lookup key</secondary>
9652 </indexterm>
9653 <command>dbm</command>: Calls to DBM library functions are used to extract data from the given
9654 DBM file by looking up the record with the given key. A terminating binary
9655 zero is included in the key that is passed to the DBM library. See section
9656 <xref linkend="SECTdb"/> for a discussion of DBM libraries.
9657 </para>
9658 <para>
9659 <indexterm role="concept">
9660 <primary>Berkeley DB library</primary>
9661 <secondary>file format</secondary>
9662 </indexterm>
9663 For all versions of Berkeley DB, Exim uses the DB_HASH style of database
9664 when building DBM files using the <option>exim_dbmbuild</option> utility. However, when
9665 using Berkeley DB versions 3 or 4, it opens existing databases for reading with
9666 the DB_UNKNOWN option. This enables it to handle any of the types of database
9667 that the library supports, and can be useful for accessing DBM files created by
9668 other applications. (For earlier DB versions, DB_HASH is always used.)
9669 </para>
9670 </listitem>
9671 <listitem>
9672 <para>
9673 <indexterm role="concept">
9674 <primary>lookup</primary>
9675 <secondary>dbmjz</secondary>
9676 </indexterm>
9677 <indexterm role="concept">
9678 <primary>lookup</primary>
9679 <secondary>dbm &ndash; embedded NULs</secondary>
9680 </indexterm>
9681 <indexterm role="concept">
9682 <primary>sasldb2</primary>
9683 </indexterm>
9684 <indexterm role="concept">
9685 <primary>dbmjz lookup type</primary>
9686 </indexterm>
9687 <command>dbmjz</command>: This is the same as <command>dbm</command>, except that the lookup key is
9688 interpreted as an Exim list; the elements of the list are joined together with
9689 ASCII NUL characters to form the lookup key.  An example usage would be to
9690 authenticate incoming SMTP calls using the passwords from Cyrus SASL&#x2019;s
9691 <filename>/etc/sasldb2</filename> file with the <command>gsasl</command> authenticator or Exim&#x2019;s own
9692 <command>cram_md5</command> authenticator.
9693 </para>
9694 </listitem>
9695 <listitem>
9696 <para>
9697 <indexterm role="concept">
9698 <primary>lookup</primary>
9699 <secondary>dbmnz</secondary>
9700 </indexterm>
9701 <indexterm role="concept">
9702 <primary>lookup</primary>
9703 <secondary>dbm &ndash; terminating zero</secondary>
9704 </indexterm>
9705 <indexterm role="concept">
9706 <primary>binary zero</primary>
9707 <secondary>in lookup key</secondary>
9708 </indexterm>
9709 <indexterm role="concept">
9710 <primary>Courier</primary>
9711 </indexterm>
9712 <indexterm role="concept">
9713 <primary><filename>/etc/userdbshadow.dat</filename></primary>
9714 </indexterm>
9715 <indexterm role="concept">
9716 <primary>dbmnz lookup type</primary>
9717 </indexterm>
9718 <command>dbmnz</command>: This is the same as <command>dbm</command>, except that a terminating binary zero
9719 is not included in the key that is passed to the DBM library. You may need this
9720 if you want to look up data in files that are created by or shared with some
9721 other application that does not use terminating zeros. For example, you need to
9722 use <command>dbmnz</command> rather than <command>dbm</command> if you want to authenticate incoming SMTP
9723 calls using the passwords from Courier&#x2019;s <filename>/etc/userdbshadow.dat</filename> file. Exim&#x2019;s
9724 utility program for creating DBM files (<emphasis>exim_dbmbuild</emphasis>) includes the zeros
9725 by default, but has an option to omit them (see section <xref linkend="SECTdbmbuild"/>).
9726 </para>
9727 </listitem>
9728 <listitem>
9729 <para>
9730 <indexterm role="concept">
9731 <primary>lookup</primary>
9732 <secondary>dsearch</secondary>
9733 </indexterm>
9734 <indexterm role="concept">
9735 <primary>dsearch lookup type</primary>
9736 </indexterm>
9737 <command>dsearch</command>: The given file must be a directory; this is searched for an entry
9738 whose name is the key by calling the <function>lstat()</function> function. The key may not
9739 contain any forward slash characters. If <function>lstat()</function> succeeds, the result of
9740 the lookup is the name of the entry, which may be a file, directory,
9741 symbolic link, or any other kind of directory entry. An example of how this
9742 lookup can be used to support virtual domains is given in section
9743 <xref linkend="SECTvirtualdomains"/>.
9744 </para>
9745 </listitem>
9746 <listitem>
9747 <para>
9748 <indexterm role="concept">
9749 <primary>lookup</primary>
9750 <secondary>iplsearch</secondary>
9751 </indexterm>
9752 <indexterm role="concept">
9753 <primary>iplsearch lookup type</primary>
9754 </indexterm>
9755 <command>iplsearch</command>: The given file is a text file containing keys and data. A key is
9756 terminated by a colon or white space or the end of the line. The keys in the
9757 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
9758 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
9759 being interpreted as a key terminator. For example:
9760 </para>
9761 <literallayout class="monospaced">
9762 1.2.3.4:           data for 1.2.3.4
9763 192.168.0.0/16:    data for 192.168.0.0/16
9764 "abcd::cdab":      data for abcd::cdab
9765 "abcd:abcd::/32"   data for abcd:abcd::/32
9766 </literallayout>
9767 <para>
9768 The key for an <command>iplsearch</command> lookup must be an IP address (without a mask). The
9769 file is searched linearly, using the CIDR masks where present, until a matching
9770 key is found. The first key that matches is used; there is no attempt to find a
9771 <quote>best</quote> match. Apart from the way the keys are matched, the processing for
9772 <command>iplsearch</command> is the same as for <command>lsearch</command>.
9773 </para>
9774 <para>
9775 <emphasis role="bold">Warning 1</emphasis>: Unlike most other single-key lookup types, a file of data for
9776 <command>iplsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9777 lookup types support only literal keys.
9778 </para>
9779 <para>
9780 <emphasis role="bold">Warning 2</emphasis>: In a host list, you must always use <command>net-iplsearch</command> so that
9781 the implicit key is the host&#x2019;s IP address rather than its name (see section
9782 <xref linkend="SECThoslispatsikey"/>).
9783 </para>
9784 </listitem>
9785 <listitem>
9786 <para>
9787 <indexterm role="concept">
9788 <primary>linear search</primary>
9789 </indexterm>
9790 <indexterm role="concept">
9791 <primary>lookup</primary>
9792 <secondary>lsearch</secondary>
9793 </indexterm>
9794 <indexterm role="concept">
9795 <primary>lsearch lookup type</primary>
9796 </indexterm>
9797 <indexterm role="concept">
9798 <primary>case sensitivity</primary>
9799 <secondary>in lsearch lookup</secondary>
9800 </indexterm>
9801 <command>lsearch</command>: The given file is a text file that is searched linearly for a
9802 line beginning with the search key, terminated by a colon or white space or the
9803 end of the line. The search is case-insensitive; that is, upper and lower case
9804 letters are treated as the same. The first occurrence of the key that is found
9805 in the file is used.
9806 </para>
9807 <para>
9808 White space between the key and the colon is permitted. The remainder of the
9809 line, with leading and trailing white space removed, is the data. This can be
9810 continued onto subsequent lines by starting them with any amount of white
9811 space, but only a single space character is included in the data at such a
9812 junction. If the data begins with a colon, the key must be terminated by a
9813 colon, for example:
9814 </para>
9815 <literallayout class="monospaced">
9816 baduser:  :fail:
9817 </literallayout>
9818 <para>
9819 Empty lines and lines beginning with # are ignored, even if they occur in the
9820 middle of an item. This is the traditional textual format of alias files. Note
9821 that the keys in an <command>lsearch</command> file are literal strings. There is no
9822 wildcarding of any kind.
9823 </para>
9824 <para>
9825 <indexterm role="concept">
9826 <primary>lookup</primary>
9827 <secondary>lsearch &ndash; colons in keys</secondary>
9828 </indexterm>
9829 <indexterm role="concept">
9830 <primary>white space</primary>
9831 <secondary>in lsearch key</secondary>
9832 </indexterm>
9833 In most <command>lsearch</command> files, keys are not required to contain colons or #
9834 characters, or white space. However, if you need this feature, it is available.
9835 If a key begins with a doublequote character, it is terminated only by a
9836 matching quote (or end of line), and the normal escaping rules apply to its
9837 contents (see section <xref linkend="SECTstrings"/>). An optional colon is permitted after
9838 quoted keys (exactly as for unquoted keys). There is no special handling of
9839 quotes for the data part of an <command>lsearch</command> line.
9840 </para>
9841 </listitem>
9842 <listitem>
9843 <para>
9844 <indexterm role="concept">
9845 <primary>NIS lookup type</primary>
9846 </indexterm>
9847 <indexterm role="concept">
9848 <primary>lookup</primary>
9849 <secondary>NIS</secondary>
9850 </indexterm>
9851 <indexterm role="concept">
9852 <primary>binary zero</primary>
9853 <secondary>in lookup key</secondary>
9854 </indexterm>
9855 <command>nis</command>: The given file is the name of a NIS map, and a NIS lookup is done with
9856 the given key, without a terminating binary zero. There is a variant called
9857 <command>nis0</command> which does include the terminating binary zero in the key. This is
9858 reportedly needed for Sun-style alias files. Exim does not recognize NIS
9859 aliases; the full map names must be used.
9860 </para>
9861 </listitem>
9862 <listitem>
9863 <para>
9864 <indexterm role="concept">
9865 <primary>wildlsearch lookup type</primary>
9866 </indexterm>
9867 <indexterm role="concept">
9868 <primary>lookup</primary>
9869 <secondary>wildlsearch</secondary>
9870 </indexterm>
9871 <indexterm role="concept">
9872 <primary>nwildlsearch lookup type</primary>
9873 </indexterm>
9874 <indexterm role="concept">
9875 <primary>lookup</primary>
9876 <secondary>nwildlsearch</secondary>
9877 </indexterm>
9878 <command>wildlsearch</command> or <command>nwildlsearch</command>: These search a file linearly, like
9879 <command>lsearch</command>, but instead of being interpreted as a literal string, each key in
9880 the file may be wildcarded. The difference between these two lookup types is
9881 that for <command>wildlsearch</command>, each key in the file is string-expanded before being
9882 used, whereas for <command>nwildlsearch</command>, no expansion takes place.
9883 </para>
9884 <para>
9885 <indexterm role="concept">
9886 <primary>case sensitivity</primary>
9887 <secondary>in (n)wildlsearch lookup</secondary>
9888 </indexterm>
9889 Like <command>lsearch</command>, the testing is done case-insensitively. However, keys in the
9890 file that are regular expressions can be made case-sensitive by the use of
9891 <literal>(-i)</literal> within the pattern. The following forms of wildcard are recognized:
9892 </para>
9893 <orderedlist numeration="arabic">
9894 <listitem>
9895 <para>
9896 The string may begin with an asterisk to mean <quote>ends with</quote>. For example:
9897 </para>
9898 <literallayout class="monospaced">
9899     *.a.b.c       data for anything.a.b.c
9900     *fish         data for anythingfish
9901 </literallayout>
9902 </listitem>
9903 <listitem>
9904 <para>
9905 The string may begin with a circumflex to indicate a regular expression. For
9906 example, for <command>wildlsearch</command>:
9907 </para>
9908 <literallayout class="monospaced">
9909     ^\N\d+\.a\.b\N    data for &lt;digits&gt;.a.b
9910 </literallayout>
9911 <para>
9912 Note the use of <literal>\N</literal> to disable expansion of the contents of the regular
9913 expression. If you are using <command>nwildlsearch</command>, where the keys are not
9914 string-expanded, the equivalent entry is:
9915 </para>
9916 <literallayout class="monospaced">
9917     ^\d+\.a\.b        data for &lt;digits&gt;.a.b
9918 </literallayout>
9919 <para>
9920 The case-insensitive flag is set at the start of compiling the regular
9921 expression, but it can be turned off by using <literal>(-i)</literal> at an appropriate point.
9922 For example, to make the entire pattern case-sensitive:
9923 </para>
9924 <literallayout class="monospaced">
9925     ^(?-i)\d+\.a\.b        data for &lt;digits&gt;.a.b
9926 </literallayout>
9927 <para>
9928 If the regular expression contains white space or colon characters, you must
9929 either quote it (see <command>lsearch</command> above), or represent these characters in other
9930 ways. For example, <literal>\s</literal> can be used for white space and <literal>\x3A</literal> for a
9931 colon. This may be easier than quoting, because if you quote, you have to
9932 escape all the backslashes inside the quotes.
9933 </para>
9934 <para>
9935 <emphasis role="bold">Note</emphasis>: It is not possible to capture substrings in a regular expression
9936 match for later use, because the results of all lookups are cached. If a lookup
9937 is repeated, the result is taken from the cache, and no actual pattern matching
9938 takes place. The values of all the numeric variables are unset after a
9939 <command>(n)wildlsearch</command> match.
9940 </para>
9941 </listitem>
9942 <listitem>
9943 <para>
9944 Although I cannot see it being of much use, the general matching function that
9945 is used to implement <command>(n)wildlsearch</command> means that the string may begin with a
9946 lookup name terminated by a semicolon, and followed by lookup data. For
9947 example:
9948 </para>
9949 <literallayout class="monospaced">
9950     cdb;/some/file  data for keys that match the file
9951 </literallayout>
9952 <para>
9953 The data that is obtained from the nested lookup is discarded.
9954 </para>
9955 </listitem>
9956 </orderedlist>
9957 <para>
9958 Keys that do not match any of these patterns are interpreted literally. The
9959 continuation rules for the data are the same as for <command>lsearch</command>, and keys may
9960 be followed by optional colons.
9961 </para>
9962 <para>
9963 <emphasis role="bold">Warning</emphasis>: Unlike most other single-key lookup types, a file of data for
9964 <command>(n)wildlsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9965 lookup types support only literal keys.
9966 </para>
9967 </listitem>
9968 </itemizedlist>
9969 </section>
9970 <section id="SECID62">
9971 <title>Query-style lookup types</title>
9972 <para>
9973 <indexterm role="concept">
9974 <primary>lookup</primary>
9975 <secondary>query-style types</secondary>
9976 </indexterm>
9977 <indexterm role="concept">
9978 <primary>query-style lookup</primary>
9979 <secondary>list of types</secondary>
9980 </indexterm>
9981 The supported query-style lookup types are listed below. Further details about
9982 many of them are given in later sections.
9983 </para>
9984 <itemizedlist>
9985 <listitem>
9986 <para>
9987 <indexterm role="concept">
9988 <primary>DNS</primary>
9989 <secondary>as a lookup type</secondary>
9990 </indexterm>
9991 <indexterm role="concept">
9992 <primary>lookup</primary>
9993 <secondary>DNS</secondary>
9994 </indexterm>
9995 <command>dnsdb</command>: This does a DNS search for one or more records whose domain names
9996 are given in the supplied query. The resulting data is the contents of the
9997 records. See section <xref linkend="SECTdnsdb"/>.
9998 </para>
9999 </listitem>
10000 <listitem>
10001 <para>
10002 <indexterm role="concept">
10003 <primary>InterBase lookup type</primary>
10004 </indexterm>
10005 <indexterm role="concept">
10006 <primary>lookup</primary>
10007 <secondary>InterBase</secondary>
10008 </indexterm>
10009 <command>ibase</command>: This does a lookup in an InterBase database.
10010 </para>
10011 </listitem>
10012 <listitem>
10013 <para>
10014 <indexterm role="concept">
10015 <primary>LDAP</primary>
10016 <secondary>lookup type</secondary>
10017 </indexterm>
10018 <indexterm role="concept">
10019 <primary>lookup</primary>
10020 <secondary>LDAP</secondary>
10021 </indexterm>
10022 <command>ldap</command>: This does an LDAP lookup using a query in the form of a URL, and
10023 returns attributes from a single entry. There is a variant called <command>ldapm</command>
10024 that permits values from multiple entries to be returned. A third variant
10025 called <command>ldapdn</command> returns the Distinguished Name of a single entry instead of
10026 any attribute values. See section <xref linkend="SECTldap"/>.
10027 </para>
10028 </listitem>
10029 <listitem>
10030 <para>
10031 <indexterm role="concept">
10032 <primary>MySQL</primary>
10033 <secondary>lookup type</secondary>
10034 </indexterm>
10035 <indexterm role="concept">
10036 <primary>lookup</primary>
10037 <secondary>MySQL</secondary>
10038 </indexterm>
10039 <command>mysql</command>: The format of the query is an SQL statement that is passed to a
10040 MySQL database. See section <xref linkend="SECTsql"/>.
10041 </para>
10042 </listitem>
10043 <listitem>
10044 <para>
10045 <indexterm role="concept">
10046 <primary>NIS+ lookup type</primary>
10047 </indexterm>
10048 <indexterm role="concept">
10049 <primary>lookup</primary>
10050 <secondary>NIS+</secondary>
10051 </indexterm>
10052 <command>nisplus</command>: This does a NIS+ lookup using a query that can specify the name of
10053 the field to be returned. See section <xref linkend="SECTnisplus"/>.
10054 </para>
10055 </listitem>
10056 <listitem>
10057 <para>
10058 <indexterm role="concept">
10059 <primary>Oracle</primary>
10060 <secondary>lookup type</secondary>
10061 </indexterm>
10062 <indexterm role="concept">
10063 <primary>lookup</primary>
10064 <secondary>Oracle</secondary>
10065 </indexterm>
10066 <command>oracle</command>: The format of the query is an SQL statement that is passed to an
10067 Oracle database. See section <xref linkend="SECTsql"/>.
10068 </para>
10069 </listitem>
10070 <listitem>
10071 <para>
10072 <indexterm role="concept">
10073 <primary>lookup</primary>
10074 <secondary>passwd</secondary>
10075 </indexterm>
10076 <indexterm role="concept">
10077 <primary>passwd lookup type</primary>
10078 </indexterm>
10079 <indexterm role="concept">
10080 <primary><filename>/etc/passwd</filename></primary>
10081 </indexterm>
10082 <command>passwd</command> is a query-style lookup with queries that are just user names. The
10083 lookup calls <function>getpwnam()</function> to interrogate the system password data, and on
10084 success, the result string is the same as you would get from an <command>lsearch</command>
10085 lookup on a traditional <filename>/etc/passwd file</filename>, though with <literal>*</literal> for the
10086 password value. For example:
10087 </para>
10088 <literallayout class="monospaced">
10089 *:42:42:King Rat:/home/kr:/bin/bash
10090 </literallayout>
10091 </listitem>
10092 <listitem>
10093 <para>
10094 <indexterm role="concept">
10095 <primary>PostgreSQL lookup type</primary>
10096 </indexterm>
10097 <indexterm role="concept">
10098 <primary>lookup</primary>
10099 <secondary>PostgreSQL</secondary>
10100 </indexterm>
10101 <command>pgsql</command>: The format of the query is an SQL statement that is passed to a
10102 PostgreSQL database. See section <xref linkend="SECTsql"/>.
10103 </para>
10104 </listitem>
10105 <listitem>
10106 <para revisionflag="changed">
10107 <indexterm role="concept">
10108 <primary>Redis lookup type</primary>
10109 </indexterm>
10110 <indexterm role="concept">
10111 <primary>lookup</primary>
10112 <secondary>Redis</secondary>
10113 </indexterm>
10114 <command>redis</command>: The format of the query is an SQL statement that is passed to a
10115 Redis database. See section <xref linkend="SECTsql"/>.
10116 </para>
10117 </listitem>
10118 <listitem>
10119 <para>
10120 <indexterm role="concept">
10121 <primary>sqlite lookup type</primary>
10122 </indexterm>
10123 <indexterm role="concept">
10124 <primary>lookup</primary>
10125 <secondary>sqlite</secondary>
10126 </indexterm>
10127 <command>sqlite</command>: The format of the query is a file name followed by an SQL statement
10128 that is passed to an SQLite database. See section <xref linkend="SECTsqlite"/>.
10129 </para>
10130 </listitem>
10131 <listitem>
10132 <para>
10133 <command>testdb</command>: This is a lookup type that is used for testing Exim. It is
10134 not likely to be useful in normal operation.
10135 </para>
10136 </listitem>
10137 <listitem>
10138 <para>
10139 <indexterm role="concept">
10140 <primary>whoson lookup type</primary>
10141 </indexterm>
10142 <indexterm role="concept">
10143 <primary>lookup</primary>
10144 <secondary>whoson</secondary>
10145 </indexterm>
10146 <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
10147 allows a server to check whether a particular (dynamically allocated) IP
10148 address is currently allocated to a known (trusted) user and, optionally, to
10149 obtain the identity of the said user. For SMTP servers, <emphasis>Whoson</emphasis> was popular
10150 at one time for <quote>POP before SMTP</quote> authentication, but that approach has been
10151 superseded by SMTP authentication. In Exim, <emphasis>Whoson</emphasis> can be used to implement
10152 <quote>POP before SMTP</quote> checking using ACL statements such as
10153 </para>
10154 <literallayout class="monospaced">
10155 require condition = \
10156   ${lookup whoson {$sender_host_address}{yes}{no}}
10157 </literallayout>
10158 <para>
10159 The query consists of a single IP address. The value returned is the name of
10160 the authenticated user, which is stored in the variable <varname>$value</varname>. However, in
10161 this example, the data in <varname>$value</varname> is not used; the result of the lookup is
10162 one of the fixed strings <quote>yes</quote> or <quote>no</quote>.
10163 </para>
10164 </listitem>
10165 </itemizedlist>
10166 </section>
10167 <section id="SECID63">
10168 <title>Temporary errors in lookups</title>
10169 <para>
10170 <indexterm role="concept">
10171 <primary>lookup</primary>
10172 <secondary>temporary error in</secondary>
10173 </indexterm>
10174 Lookup functions can return temporary error codes if the lookup cannot be
10175 completed. For example, an SQL or LDAP database might be unavailable. For this
10176 reason, it is not advisable to use a lookup that might do this for critical
10177 options such as a list of local domains.
10178 </para>
10179 <para>
10180 When a lookup cannot be completed in a router or transport, delivery
10181 of the message (to the relevant address) is deferred, as for any other
10182 temporary error. In other circumstances Exim may assume the lookup has failed,
10183 or may give up altogether.
10184 </para>
10185 </section>
10186 <section id="SECTdefaultvaluelookups">
10187 <title>Default values in single-key lookups</title>
10188 <para>
10189 <indexterm role="concept">
10190 <primary>wildcard lookups</primary>
10191 </indexterm>
10192 <indexterm role="concept">
10193 <primary>lookup</primary>
10194 <secondary>default values</secondary>
10195 </indexterm>
10196 <indexterm role="concept">
10197 <primary>lookup</primary>
10198 <secondary>wildcard</secondary>
10199 </indexterm>
10200 <indexterm role="concept">
10201 <primary>lookup</primary>
10202 <secondary>* added to type</secondary>
10203 </indexterm>
10204 <indexterm role="concept">
10205 <primary>default</primary>
10206 <secondary>in single-key lookups</secondary>
10207 </indexterm>
10208 In this context, a <quote>default value</quote> is a value specified by the administrator
10209 that is to be used if a lookup fails.
10210 </para>
10211 <para>
10212 <emphasis role="bold">Note:</emphasis> This section applies only to single-key lookups. For query-style
10213 lookups, the facilities of the query language must be used. An attempt to
10214 specify a default for a query-style lookup provokes an error.
10215 </para>
10216 <para>
10217 If <quote>*</quote> is added to a single-key lookup type (for example, <option>lsearch*</option>)
10218 and the initial lookup fails, the key <quote>*</quote> is looked up in the file to
10219 provide a default value. See also the section on partial matching below.
10220 </para>
10221 <para>
10222 <indexterm role="concept">
10223 <primary>*@ with single-key lookup</primary>
10224 </indexterm>
10225 <indexterm role="concept">
10226 <primary>lookup</primary>
10227 <secondary>*@ added to type</secondary>
10228 </indexterm>
10229 <indexterm role="concept">
10230 <primary>alias file</primary>
10231 <secondary>per-domain default</secondary>
10232 </indexterm>
10233 Alternatively, if <quote>*@</quote> is added to a single-key lookup type (for example
10234 <option>dbm*@</option>) then, if the initial lookup fails and the key contains an @
10235 character, a second lookup is done with everything before the last @ replaced
10236 by *. This makes it possible to provide per-domain defaults in alias files
10237 that include the domains in the keys. If the second lookup fails (or doesn&#x2019;t
10238 take place because there is no @ in the key), <quote>*</quote> is looked up.
10239 For example, a <command>redirect</command> router might contain:
10240 </para>
10241 <literallayout class="monospaced">
10242 data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}}
10243 </literallayout>
10244 <para>
10245 Suppose the address that is being processed is <emphasis>jane@eyre.example</emphasis>. Exim
10246 looks up these keys, in this order:
10247 </para>
10248 <literallayout class="monospaced">
10249 jane@eyre.example
10250 *@eyre.example
10251 *
10252 </literallayout>
10253 <para>
10254 The data is taken from whichever key it finds first. <emphasis role="bold">Note</emphasis>: In an
10255 <command>lsearch</command> file, this does not mean the first of these keys in the file. A
10256 complete scan is done for each key, and only if it is not found at all does
10257 Exim move on to try the next key.
10258 </para>
10259 </section>
10260 <section id="SECTpartiallookup">
10261 <title>Partial matching in single-key lookups</title>
10262 <para>
10263 <indexterm role="concept">
10264 <primary>partial matching</primary>
10265 </indexterm>
10266 <indexterm role="concept">
10267 <primary>wildcard lookups</primary>
10268 </indexterm>
10269 <indexterm role="concept">
10270 <primary>lookup</primary>
10271 <secondary>partial matching</secondary>
10272 </indexterm>
10273 <indexterm role="concept">
10274 <primary>lookup</primary>
10275 <secondary>wildcard</secondary>
10276 </indexterm>
10277 <indexterm role="concept">
10278 <primary>asterisk</primary>
10279 <secondary>in search type</secondary>
10280 </indexterm>
10281 The normal operation of a single-key lookup is to search the file for an exact
10282 match with the given key. However, in a number of situations where domains are
10283 being looked up, it is useful to be able to do partial matching. In this case,
10284 information in the file that has a key starting with <quote>*.</quote> is matched by any
10285 domain that ends with the components that follow the full stop. For example, if
10286 a key in a DBM file is
10287 </para>
10288 <literallayout class="monospaced">
10289 *.dates.fict.example
10290 </literallayout>
10291 <para>
10292 then when partial matching is enabled this is matched by (amongst others)
10293 <emphasis>2001.dates.fict.example</emphasis> and <emphasis>1984.dates.fict.example</emphasis>. It is also matched
10294 by <emphasis>dates.fict.example</emphasis>, if that does not appear as a separate key in the
10295 file.
10296 </para>
10297 <para>
10298 <emphasis role="bold">Note</emphasis>: Partial matching is not available for query-style lookups. It is
10299 also not available for any lookup items in address lists (see section
10300 <xref linkend="SECTaddresslist"/>).
10301 </para>
10302 <para>
10303 Partial matching is implemented by doing a series of separate lookups using
10304 keys constructed by modifying the original subject key. This means that it can
10305 be used with any of the single-key lookup types, provided that
10306 partial matching keys
10307 beginning with a special prefix (default <quote>*.</quote>) are included in the data file.
10308 Keys in the file that do not begin with the prefix are matched only by
10309 unmodified subject keys when partial matching is in use.
10310 </para>
10311 <para>
10312 Partial matching is requested by adding the string <quote>partial-</quote> to the front of
10313 the name of a single-key lookup type, for example, <option>partial-dbm</option>. When this
10314 is done, the subject key is first looked up unmodified; if that fails, <quote>*.</quote>
10315 is added at the start of the subject key, and it is looked up again. If that
10316 fails, further lookups are tried with dot-separated components removed from the
10317 start of the subject key, one-by-one, and <quote>*.</quote> added on the front of what
10318 remains.
10319 </para>
10320 <para>
10321 A minimum number of two non-* components are required. This can be adjusted
10322 by including a number before the hyphen in the search type. For example,
10323 <option>partial3-lsearch</option> specifies a minimum of three non-* components in the
10324 modified keys. Omitting the number is equivalent to <quote>partial2-</quote>. If the
10325 subject key is <emphasis>2250.dates.fict.example</emphasis> then the following keys are looked
10326 up when the minimum number of non-* components is two:
10327 </para>
10328 <literallayout class="monospaced">
10329 2250.dates.fict.example
10330 *.2250.dates.fict.example
10331 *.dates.fict.example
10332 *.fict.example
10333 </literallayout>
10334 <para>
10335 As soon as one key in the sequence is successfully looked up, the lookup
10336 finishes.
10337 </para>
10338 <para>
10339 <indexterm role="concept">
10340 <primary>lookup</primary>
10341 <secondary>partial matching &ndash; changing prefix</secondary>
10342 </indexterm>
10343 <indexterm role="concept">
10344 <primary>prefix</primary>
10345 <secondary>for partial matching</secondary>
10346 </indexterm>
10347 The use of <quote>*.</quote> as the partial matching prefix is a default that can be
10348 changed. The motivation for this feature is to allow Exim to operate with file
10349 formats that are used by other MTAs. A different prefix can be supplied in
10350 parentheses instead of the hyphen after <quote>partial</quote>. For example:
10351 </para>
10352 <literallayout class="monospaced">
10353 domains = partial(.)lsearch;/some/file
10354 </literallayout>
10355 <para>
10356 In this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
10357 <literal>a.b.c</literal>, <literal>.a.b.c</literal>, and <literal>.b.c</literal> (the default minimum of 2 non-wild
10358 components is unchanged). The prefix may consist of any punctuation characters
10359 other than a closing parenthesis. It may be empty, for example:
10360 </para>
10361 <literallayout class="monospaced">
10362 domains = partial1()cdb;/some/file
10363 </literallayout>
10364 <para>
10365 For this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
10366 <literal>a.b.c</literal>, <literal>b.c</literal>, and <literal>c</literal>.
10367 </para>
10368 <para>
10369 If <quote>partial0</quote> is specified, what happens at the end (when the lookup with
10370 just one non-wild component has failed, and the original key is shortened right
10371 down to the null string) depends on the prefix:
10372 </para>
10373 <itemizedlist>
10374 <listitem>
10375 <para>
10376 If the prefix has zero length, the whole lookup fails.
10377 </para>
10378 </listitem>
10379 <listitem>
10380 <para>
10381 If the prefix has length 1, a lookup for just the prefix is done. For
10382 example, the final lookup for <quote>partial0(.)</quote> is for <literal>.</literal> alone.
10383 </para>
10384 </listitem>
10385 <listitem>
10386 <para>
10387 Otherwise, if the prefix ends in a dot, the dot is removed, and the
10388 remainder is looked up. With the default prefix, therefore, the final lookup is
10389 for <quote>*</quote> on its own.
10390 </para>
10391 </listitem>
10392 <listitem>
10393 <para>
10394 Otherwise, the whole prefix is looked up.
10395 </para>
10396 </listitem>
10397 </itemizedlist>
10398 <para>
10399 If the search type ends in <quote>*</quote> or <quote>*@</quote> (see section
10400 <xref linkend="SECTdefaultvaluelookups"/> above), the search for an ultimate default that
10401 this implies happens after all partial lookups have failed. If <quote>partial0</quote> is
10402 specified, adding <quote>*</quote> to the search type has no effect with the default
10403 prefix, because the <quote>*</quote> key is already included in the sequence of partial
10404 lookups. However, there might be a use for lookup types such as
10405 <quote>partial0(.)lsearch*</quote>.
10406 </para>
10407 <para>
10408 The use of <quote>*</quote> in lookup partial matching differs from its use as a wildcard
10409 in domain lists and the like. Partial matching works only in terms of
10410 dot-separated components; a key such as <literal>*fict.example</literal>
10411 in a database file is useless, because the asterisk in a partial matching
10412 subject key is always followed by a dot.
10413 </para>
10414 </section>
10415 <section id="SECID64">
10416 <title>Lookup caching</title>
10417 <para>
10418 <indexterm role="concept">
10419 <primary>lookup</primary>
10420 <secondary>caching</secondary>
10421 </indexterm>
10422 <indexterm role="concept">
10423 <primary>caching</primary>
10424 <secondary>lookup data</secondary>
10425 </indexterm>
10426 Exim caches all lookup results in order to avoid needless repetition of
10427 lookups. However, because (apart from the daemon) Exim operates as a collection
10428 of independent, short-lived processes, this caching applies only within a
10429 single Exim process. There is no inter-process lookup caching facility.
10430 </para>
10431 <para>
10432 For single-key lookups, Exim keeps the relevant files open in case there is
10433 another lookup that needs them. In some types of configuration this can lead to
10434 many files being kept open for messages with many recipients. To avoid hitting
10435 the operating system limit on the number of simultaneously open files, Exim
10436 closes the least recently used file when it needs to open more files than its
10437 own internal limit, which can be changed via the <option>lookup_open_max</option> option.
10438 </para>
10439 <para>
10440 The single-key lookup files are closed and the lookup caches are flushed at
10441 strategic points during delivery &ndash; for example, after all routing is
10442 complete.
10443 </para>
10444 </section>
10445 <section id="SECID65">
10446 <title>Quoting lookup data</title>
10447 <para>
10448 <indexterm role="concept">
10449 <primary>lookup</primary>
10450 <secondary>quoting</secondary>
10451 </indexterm>
10452 <indexterm role="concept">
10453 <primary>quoting</primary>
10454 <secondary>in lookups</secondary>
10455 </indexterm>
10456 When data from an incoming message is included in a query-style lookup, there
10457 is the possibility of special characters in the data messing up the syntax of
10458 the query. For example, a NIS+ query that contains
10459 </para>
10460 <literallayout class="monospaced">
10461 [name=$local_part]
10462 </literallayout>
10463 <para>
10464 will be broken if the local part happens to contain a closing square bracket.
10465 For NIS+, data can be enclosed in double quotes like this:
10466 </para>
10467 <literallayout class="monospaced">
10468 [name="$local_part"]
10469 </literallayout>
10470 <para>
10471 but this still leaves the problem of a double quote in the data. The rule for
10472 NIS+ is that double quotes must be doubled. Other lookup types have different
10473 rules, and to cope with the differing requirements, an expansion operator
10474 of the following form is provided:
10475 </para>
10476 <literallayout class="monospaced">
10477 ${quote_&lt;lookup-type&gt;:&lt;string&gt;}
10478 </literallayout>
10479 <para>
10480 For example, the safest way to write the NIS+ query is
10481 </para>
10482 <literallayout class="monospaced">
10483 [name="${quote_nisplus:$local_part}"]
10484 </literallayout>
10485 <para>
10486 See chapter <xref linkend="CHAPexpand"/> for full coverage of string expansions. The quote
10487 operator can be used for all lookup types, but has no effect for single-key
10488 lookups, since no quoting is ever needed in their key strings.
10489 </para>
10490 </section>
10491 <section id="SECTdnsdb">
10492 <title>More about dnsdb</title>
10493 <para>
10494 <indexterm role="concept">
10495 <primary>dnsdb lookup</primary>
10496 </indexterm>
10497 <indexterm role="concept">
10498 <primary>lookup</primary>
10499 <secondary>dnsdb</secondary>
10500 </indexterm>
10501 <indexterm role="concept">
10502 <primary>DNS</primary>
10503 <secondary>as a lookup type</secondary>
10504 </indexterm>
10505 The <command>dnsdb</command> lookup type uses the DNS as its database. A simple query consists
10506 of a record type and a domain name, separated by an equals sign. For example,
10507 an expansion string could contain:
10508 </para>
10509 <literallayout class="monospaced">
10510 ${lookup dnsdb{mx=a.b.example}{$value}fail}
10511 </literallayout>
10512 <para>
10513 If the lookup succeeds, the result is placed in <varname>$value</varname>, which in this case
10514 is used on its own as the result. If the lookup does not succeed, the
10515 <literal>fail</literal> keyword causes a <emphasis>forced expansion failure</emphasis> &ndash; see section
10516 <xref linkend="SECTforexpfai"/> for an explanation of what this means.
10517 </para>
10518 <para>
10519 The supported DNS record types are A, CNAME, MX, NS, PTR, SOA, SPF, SRV, TLSA
10520 and TXT, and, when Exim is compiled with IPv6 support, AAAA.
10521 If no type is given, TXT is assumed.
10522 </para>
10523 <para>
10524 For any record type, if multiple records are found, the data is returned as a
10525 concatenation, with newline as the default separator. The order, of course,
10526 depends on the DNS resolver. You can specify a different separator character
10527 between multiple records by putting a right angle-bracket followed immediately
10528 by the new separator at the start of the query. For example:
10529 </para>
10530 <literallayout class="monospaced">
10531 ${lookup dnsdb{&gt;: a=host1.example}}
10532 </literallayout>
10533 <para>
10534 It is permitted to specify a space as the separator character. Further
10535 white space is ignored.
10536 For lookup types that return multiple fields per record,
10537 an alternate field separator can be specified using a comma after the main
10538 separator character, followed immediately by the field separator.
10539 </para>
10540 <para>
10541 <indexterm role="concept">
10542 <primary>PTR record</primary>
10543 <secondary>in <command>dnsdb</command> lookup</secondary>
10544 </indexterm>
10545 When the type is PTR,
10546 the data can be an IP address, written as normal; inversion and the addition of
10547 <option>in-addr.arpa</option> or <option>ip6.arpa</option> happens automatically. For example:
10548 </para>
10549 <literallayout class="monospaced">
10550 ${lookup dnsdb{ptr=192.168.4.5}{$value}fail}
10551 </literallayout>
10552 <para>
10553 If the data for a PTR record is not a syntactically valid IP address, it is not
10554 altered and nothing is added.
10555 </para>
10556 <para>
10557 <indexterm role="concept">
10558 <primary>MX record</primary>
10559 <secondary>in <command>dnsdb</command> lookup</secondary>
10560 </indexterm>
10561 <indexterm role="concept">
10562 <primary>SRV record</primary>
10563 <secondary>in <command>dnsdb</command> lookup</secondary>
10564 </indexterm>
10565 For an MX lookup, both the preference value and the host name are returned for
10566 each record, separated by a space. For an SRV lookup, the priority, weight,
10567 port, and host name are returned for each record, separated by spaces.
10568 The field separator can be modified as above.
10569 </para>
10570 <para>
10571 <indexterm role="concept">
10572 <primary>TXT record</primary>
10573 <secondary>in <command>dnsdb</command> lookup</secondary>
10574 </indexterm>
10575 <indexterm role="concept">
10576 <primary>SPF record</primary>
10577 <secondary>in <command>dnsdb</command> lookup</secondary>
10578 </indexterm>
10579 For TXT records with multiple items of data, only the first item is returned,
10580 unless a field separator is specified.
10581 To concatenate items without a separator, use a semicolon instead.
10582 For SPF records the
10583 default behaviour is to concatenate multiple items without using a separator.
10584 </para>
10585 <literallayout class="monospaced">
10586 ${lookup dnsdb{&gt;\n,: txt=a.b.example}}
10587 ${lookup dnsdb{&gt;\n; txt=a.b.example}}
10588 ${lookup dnsdb{spf=example.org}}
10589 </literallayout>
10590 <para>
10591 It is permitted to specify a space as the separator character. Further
10592 white space is ignored.
10593 </para>
10594 <para>
10595 <indexterm role="concept">
10596 <primary>SOA record</primary>
10597 <secondary>in <command>dnsdb</command> lookup</secondary>
10598 </indexterm>
10599 For an SOA lookup, while no result is obtained the lookup is redone with
10600 successively more leading components dropped from the given domain.
10601 Only the primary-nameserver field is returned unless a field separator is
10602 specified.
10603 </para>
10604 <literallayout class="monospaced">
10605 ${lookup dnsdb{&gt;:,; soa=a.b.example.com}}
10606 </literallayout>
10607 </section>
10608 <section id="SECTdnsdb_mod">
10609 <title>Dnsdb lookup modifiers</title>
10610 <para>
10611 <indexterm role="concept">
10612 <primary>dnsdb modifiers</primary>
10613 </indexterm>
10614 <indexterm role="concept">
10615 <primary>modifiers</primary>
10616 <secondary>dnsdb</secondary>
10617 </indexterm>
10618 <indexterm role="concept">
10619 <primary>options</primary>
10620 <secondary>dnsdb</secondary>
10621 </indexterm>
10622 Modifiers for <command>dnsdb</command> lookups are given by optional keywords,
10623 each followed by a comma,
10624 that may appear before the record type.
10625 </para>
10626 <para>
10627 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
10628 temporary DNS error for any of them, the behaviour is controlled by
10629 a defer-option modifier.
10630 The possible keywords are
10631 <quote>defer_strict</quote>, <quote>defer_never</quote>, and <quote>defer_lax</quote>.
10632 With <quote>strict</quote> behaviour, any temporary DNS error causes the
10633 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
10634 ignored, and the behaviour is as if the DNS lookup failed to find anything.
10635 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
10636 error causes the whole lookup to defer only if none of the other lookups
10637 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
10638 </para>
10639 <literallayout class="monospaced">
10640 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
10641 ${lookup dnsdb{a=one.host.com:two.host.com}}
10642 </literallayout>
10643 <para>
10644 Thus, in the default case, as long as at least one of the DNS lookups
10645 yields some data, the lookup succeeds.
10646 </para>
10647 <para>
10648 <indexterm role="concept">
10649 <primary>DNSSEC</primary>
10650 <secondary>dns lookup</secondary>
10651 </indexterm>
10652 Use of <command>DNSSEC</command> is controlled by a dnssec modifier.
10653 The possible keywords are
10654 <quote>dnssec_strict</quote>, <quote>dnssec_lax</quote>, and <quote>dnssec_never</quote>.
10655 With <quote>strict</quote> or <quote>lax</quote> DNSSEC information is requested
10656 with the lookup.
10657 With <quote>strict</quote> a response from the DNS resolver that
10658 is not labelled as authenticated data
10659 is treated as equivalent to a temporary DNS error.
10660 The default is <quote>never</quote>.
10661 </para>
10662 <para>
10663 See also the <varname>$lookup_dnssec_authenticated</varname> variable.
10664 </para>
10665 <para>
10666 <indexterm role="concept">
10667 <primary>timeout</primary>
10668 <secondary>dns lookup</secondary>
10669 </indexterm>
10670 <indexterm role="concept">
10671 <primary>DNS</primary>
10672 <secondary>timeout</secondary>
10673 </indexterm>
10674 Timeout for the dnsdb lookup can be controlled by a retrans modifier.
10675 The form is <quote>retrans_VAL</quote> where VAL is an Exim time specification
10676 (e.g. <quote>5s</quote>).
10677 The default value is set by the main configuration option <option>dns_retrans</option>.
10678 </para>
10679 <para>
10680 Retries for the dnsdb lookup can be controlled by a retry modifier.
10681 The form if <quote>retry_VAL</quote> where VAL is an integer.
10682 The default count is set by the main configuration option <option>dns_retry</option>.
10683 </para>
10684 <para revisionflag="changed">
10685 <indexterm role="concept">
10686 <primary>cacheing</primary>
10687 <secondary>of dns lookup</secondary>
10688 </indexterm>
10689 <indexterm role="concept">
10690 <primary>TTL</primary>
10691 <secondary>of dns lookup</secondary>
10692 </indexterm>
10693 <indexterm role="concept">
10694 <primary>DNS</primary>
10695 <secondary>TTL</secondary>
10696 </indexterm>
10697 Dnsdb lookup results are cached within a single process (and its children).
10698 The cache entry lifetime is limited to the smallest time-to-live (TTL)
10699 value of the set of returned DNS records.
10700 </para>
10701 </section>
10702 <section id="SECID66">
10703 <title>Pseudo dnsdb record types</title>
10704 <para>
10705 <indexterm role="concept">
10706 <primary>MX record</primary>
10707 <secondary>in <command>dnsdb</command> lookup</secondary>
10708 </indexterm>
10709 By default, both the preference value and the host name are returned for
10710 each MX record, separated by a space. If you want only host names, you can use
10711 the pseudo-type MXH:
10712 </para>
10713 <literallayout class="monospaced">
10714 ${lookup dnsdb{mxh=a.b.example}}
10715 </literallayout>
10716 <para>
10717 In this case, the preference values are omitted, and just the host names are
10718 returned.
10719 </para>
10720 <para>
10721 <indexterm role="concept">
10722 <primary>name server for enclosing domain</primary>
10723 </indexterm>
10724 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
10725 records on the given domain, but if none are found, it removes the first
10726 component of the domain name, and tries again. This process continues until NS
10727 records are found or there are no more components left (or there is a DNS
10728 error). In other words, it may return the name servers for a top-level domain,
10729 but it never returns the root name servers. If there are no NS records for the
10730 top-level domain, the lookup fails. Consider these examples:
10731 </para>
10732 <literallayout class="monospaced">
10733 ${lookup dnsdb{zns=xxx.quercite.com}}
10734 ${lookup dnsdb{zns=xxx.edu}}
10735 </literallayout>
10736 <para>
10737 Assuming that in each case there are no NS records for the full domain name,
10738 the first returns the name servers for <option>quercite.com</option>, and the second returns
10739 the name servers for <option>edu</option>.
10740 </para>
10741 <para>
10742 You should be careful about how you use this lookup because, unless the
10743 top-level domain does not exist, the lookup always returns some host names. The
10744 sort of use to which this might be put is for seeing if the name servers for a
10745 given domain are on a blacklist. You can probably assume that the name servers
10746 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
10747 such a list.
10748 </para>
10749 <para>
10750 <indexterm role="concept">
10751 <primary>CSA</primary>
10752 <secondary>in <command>dnsdb</command> lookup</secondary>
10753 </indexterm>
10754 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
10755 records according to the CSA rules, which are described in section
10756 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
10757 not sufficient because of the extra parent domain search behaviour of CSA. The
10758 result of a successful lookup such as:
10759 </para>
10760 <literallayout class="monospaced">
10761 ${lookup dnsdb {csa=$sender_helo_name}}
10762 </literallayout>
10763 <para>
10764 has two space-separated fields: an authorization code and a target host name.
10765 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
10766 authorization required but absent, or <quote>?</quote> for unknown.
10767 </para>
10768 <para>
10769 <indexterm role="concept">
10770 <primary>A+</primary>
10771 <secondary>in <command>dnsdb</command> lookup</secondary>
10772 </indexterm>
10773 The pseudo-type A+ performs an AAAA
10774 and then an A lookup.  All results are returned; defer processing
10775 (see below) is handled separately for each lookup.  Example:
10776 </para>
10777 <literallayout class="monospaced">
10778 ${lookup dnsdb {&gt;; a+=$sender_helo_name}}
10779 </literallayout>
10780 </section>
10781 <section id="SECID67">
10782 <title>Multiple dnsdb lookups</title>
10783 <para>
10784 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
10785 However, you can specify a list of domains or IP addresses in a single
10786 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
10787 the default separator, but with the ability to change this. For example:
10788 </para>
10789 <literallayout class="monospaced">
10790 ${lookup dnsdb{one.domain.com:two.domain.com}}
10791 ${lookup dnsdb{a=one.host.com:two.host.com}}
10792 ${lookup dnsdb{ptr = &lt;; 1.2.3.4 ; 4.5.6.8}}
10793 </literallayout>
10794 <para>
10795 In order to retain backwards compatibility, there is one special case: if
10796 the lookup type is PTR and no change of separator is specified, Exim looks
10797 to see if the rest of the string is precisely one IPv6 address. In this
10798 case, it does not treat it as a list.
10799 </para>
10800 <para>
10801 The data from each lookup is concatenated, with newline separators by default,
10802 in the same way that multiple DNS records for a single item are handled. A
10803 different separator can be specified, as described above.
10804 </para>
10805 </section>
10806 <section id="SECTldap">
10807 <title>More about LDAP</title>
10808 <para>
10809 <indexterm role="concept">
10810 <primary>LDAP</primary>
10811 <secondary>lookup, more about</secondary>
10812 </indexterm>
10813 <indexterm role="concept">
10814 <primary>lookup</primary>
10815 <secondary>LDAP</secondary>
10816 </indexterm>
10817 <indexterm role="concept">
10818 <primary>Solaris</primary>
10819 <secondary>LDAP</secondary>
10820 </indexterm>
10821 The original LDAP implementation came from the University of Michigan; this has
10822 become <quote>Open LDAP</quote>, and there are now two different releases. Another
10823 implementation comes from Netscape, and Solaris 7 and subsequent releases
10824 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
10825 the lookup function level, their error handling is different. For this reason
10826 it is necessary to set a compile-time variable when building Exim with LDAP, to
10827 indicate which LDAP library is in use. One of the following should appear in
10828 your <filename>Local/Makefile</filename>:
10829 </para>
10830 <literallayout class="monospaced">
10831 LDAP_LIB_TYPE=UMICHIGAN
10832 LDAP_LIB_TYPE=OPENLDAP1
10833 LDAP_LIB_TYPE=OPENLDAP2
10834 LDAP_LIB_TYPE=NETSCAPE
10835 LDAP_LIB_TYPE=SOLARIS
10836 </literallayout>
10837 <para>
10838 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
10839 same interface as the University of Michigan version.
10840 </para>
10841 <para>
10842 There are three LDAP lookup types in Exim. These behave slightly differently in
10843 the way they handle the results of a query:
10844 </para>
10845 <itemizedlist>
10846 <listitem>
10847 <para>
10848 <command>ldap</command> requires the result to contain just one entry; if there are more, it
10849 gives an error.
10850 </para>
10851 </listitem>
10852 <listitem>
10853 <para>
10854 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
10855 Distinguished Name that is returned rather than any attribute values.
10856 </para>
10857 </listitem>
10858 <listitem>
10859 <para>
10860 <command>ldapm</command> permits the result to contain more than one entry; the attributes
10861 from all of them are returned.
10862 </para>
10863 </listitem>
10864 </itemizedlist>
10865 <para>
10866 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
10867 Exim behaves as if the entry did not exist, and the lookup fails. The format of
10868 the data returned by a successful lookup is described in the next section.
10869 First we explain how LDAP queries are coded.
10870 </para>
10871 </section>
10872 <section id="SECTforldaque">
10873 <title>Format of LDAP queries</title>
10874 <para>
10875 <indexterm role="concept">
10876 <primary>LDAP</primary>
10877 <secondary>query format</secondary>
10878 </indexterm>
10879 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
10880 the configuration of a <command>redirect</command> router one might have this setting:
10881 </para>
10882 <literallayout class="monospaced">
10883 data = ${lookup ldap \
10884   {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
10885   c=UK?mailbox?base?}}
10886 </literallayout>
10887 <para>
10888 <indexterm role="concept">
10889 <primary>LDAP</primary>
10890 <secondary>with TLS</secondary>
10891 </indexterm>
10892 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
10893 secure (encrypted) LDAP connections. The second of these ensures that an
10894 encrypted TLS connection is used.
10895 </para>
10896 <para>
10897 With sufficiently modern LDAP libraries, Exim supports forcing TLS over regular
10898 LDAP connections, rather than the SSL-on-connect <literal>ldaps</literal>.
10899 See the <option>ldap_start_tls</option> option.
10900 </para>
10901 <para>
10902 Starting with Exim 4.83, the initialization of LDAP with TLS is more tightly
10903 controlled. Every part of the TLS configuration can be configured by settings in
10904 <filename>exim.conf</filename>. Depending on the version of the client libraries installed on
10905 your system, some of the initialization may have required setting options in
10906 <filename>/etc/ldap.conf</filename> or <filename>~/.ldaprc</filename> to get TLS working with self-signed
10907 certificates. This revealed a nuance where the current UID that exim was
10908 running as could affect which config files it read. With Exim 4.83, these
10909 methods become optional, only taking effect if not specifically set in
10910 <filename>exim.conf</filename>.
10911 </para>
10912 </section>
10913 <section id="SECID68">
10914 <title>LDAP quoting</title>
10915 <para>
10916 <indexterm role="concept">
10917 <primary>LDAP</primary>
10918 <secondary>quoting</secondary>
10919 </indexterm>
10920 Two levels of quoting are required in LDAP queries, the first for LDAP itself
10921 and the second because the LDAP query is represented as a URL. Furthermore,
10922 within an LDAP query, two different kinds of quoting are required. For this
10923 reason, there are two different LDAP-specific quoting operators.
10924 </para>
10925 <para>
10926 The <option>quote_ldap</option> operator is designed for use on strings that are part of
10927 filter specifications. Conceptually, it first does the following conversions on
10928 the string:
10929 </para>
10930 <literallayout class="monospaced">
10931 *   =&gt;   \2A
10932 (   =&gt;   \28
10933 )   =&gt;   \29
10934 \   =&gt;   \5C
10935 </literallayout>
10936 <para>
10937 in accordance with RFC 2254. The resulting string is then quoted according
10938 to the rules for URLs, that is, all non-alphanumeric characters except
10939 </para>
10940 <literallayout class="monospaced">
10941 ! $ ' - . _ ( ) * +
10942 </literallayout>
10943 <para>
10944 are converted to their hex values, preceded by a percent sign. For example:
10945 </para>
10946 <literallayout class="monospaced">
10947 ${quote_ldap: a(bc)*, a&lt;yz&gt;; }
10948 </literallayout>
10949 <para>
10950 yields
10951 </para>
10952 <literallayout class="monospaced">
10953 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
10954 </literallayout>
10955 <para>
10956 Removing the URL quoting, this is (with a leading and a trailing space):
10957 </para>
10958 <literallayout class="monospaced">
10959 a\28bc\29\2A, a&lt;yz&gt;;
10960 </literallayout>
10961 <para>
10962 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
10963 base DN specifications in queries. Conceptually, it first converts the string
10964 by inserting a backslash in front of any of the following characters:
10965 </para>
10966 <literallayout class="monospaced">
10967 , + " \ &lt; &gt; ;
10968 </literallayout>
10969 <para>
10970 It also inserts a backslash before any leading spaces or # characters, and
10971 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
10972 is then quoted according to the rules for URLs. For example:
10973 </para>
10974 <literallayout class="monospaced">
10975 ${quote_ldap_dn: a(bc)*, a&lt;yz&gt;; }
10976 </literallayout>
10977 <para>
10978 yields
10979 </para>
10980 <literallayout class="monospaced">
10981 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
10982 </literallayout>
10983 <para>
10984 Removing the URL quoting, this is (with a trailing space):
10985 </para>
10986 <literallayout class="monospaced">
10987 \ a(bc)*\, a\&lt;yz\&gt;\;\
10988 </literallayout>
10989 <para>
10990 There are some further comments about quoting in the section on LDAP
10991 authentication below.
10992 </para>
10993 </section>
10994 <section id="SECID69">
10995 <title>LDAP connections</title>
10996 <para>
10997 <indexterm role="concept">
10998 <primary>LDAP</primary>
10999 <secondary>connections</secondary>
11000 </indexterm>
11001 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
11002 is in use, via a Unix domain socket. The example given above does not specify
11003 an LDAP server. A server that is reached by TCP/IP can be specified in a query
11004 by starting it with
11005 </para>
11006 <literallayout class="monospaced">
11007 ldap://&lt;hostname&gt;:&lt;port&gt;/...
11008 </literallayout>
11009 <para>
11010 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
11011 used. When no server is specified in a query, a list of default servers is
11012 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
11013 colon-separated list of servers which are tried in turn until one successfully
11014 handles a query, or there is a serious error. Successful handling either
11015 returns the requested data, or indicates that it does not exist. Serious errors
11016 are syntactical, or multiple values when only a single value is expected.
11017 Errors which cause the next server to be tried are connection failures, bind
11018 failures, and timeouts.
11019 </para>
11020 <para>
11021 For each server name in the list, a port number can be given. The standard way
11022 of specifying a host and port is to use a colon separator (RFC 1738). Because
11023 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
11024 doubled. For example
11025 </para>
11026 <literallayout class="monospaced">
11027 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
11028 </literallayout>
11029 <para>
11030 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
11031 to the LDAP library with no server name, and the library&#x2019;s default (normally
11032 the local host) is used.
11033 </para>
11034 <para>
11035 If you are using the OpenLDAP library, you can connect to an LDAP server using
11036 a Unix domain socket instead of a TCP/IP connection. This is specified by using
11037 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
11038 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
11039 not available.
11040 </para>
11041 <para>
11042 For this type of connection, instead of a host name for the server, a pathname
11043 for the socket is required, and the port number is not relevant. The pathname
11044 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
11045 the query. In the former case, you can have settings such as
11046 </para>
11047 <literallayout class="monospaced">
11048 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
11049 </literallayout>
11050 <para>
11051 When the pathname is given in the query, you have to escape the slashes as
11052 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
11053 </para>
11054 <literallayout class="monospaced">
11055 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
11056 </literallayout>
11057 <para>
11058 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
11059 a pathname, it uses the Unix domain socket code, even if the query actually
11060 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
11061 socket connection. This behaviour means that you can use a setting of
11062 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
11063 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
11064 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
11065 backup host.
11066 </para>
11067 <para>
11068 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
11069 specified, an error is diagnosed. However, if there are more items in
11070 <option>ldap_default_servers</option>, they are tried. In other words:
11071 </para>
11072 <itemizedlist>
11073 <listitem>
11074 <para>
11075 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
11076 interface.
11077 </para>
11078 </listitem>
11079 <listitem>
11080 <para>
11081 Using <literal>ldapi</literal> with a host name causes an error.
11082 </para>
11083 </listitem>
11084 </itemizedlist>
11085 <para>
11086 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
11087 <option>ldap_default_servers</option>, does whatever the library does by default.
11088 </para>
11089 </section>
11090 <section id="SECID70">
11091 <title>LDAP authentication and control information</title>
11092 <para>
11093 <indexterm role="concept">
11094 <primary>LDAP</primary>
11095 <secondary>authentication</secondary>
11096 </indexterm>
11097 The LDAP URL syntax provides no way of passing authentication and other control
11098 information to the server. To make this possible, the URL in an LDAP query may
11099 be preceded by any number of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; settings, separated by
11100 spaces. If a value contains spaces it must be enclosed in double quotes, and
11101 when double quotes are used, backslash is interpreted in the usual way inside
11102 them. The following names are recognized:
11103 </para>
11104 <literallayout>
11105 <literal>DEREFERENCE</literal>  set the dereferencing parameter
11106 <literal>NETTIME    </literal>  set a timeout for a network operation
11107 <literal>USER       </literal>  set the DN, for authenticating the LDAP bind
11108 <literal>PASS       </literal>  set the password, likewise
11109 <literal>REFERRALS  </literal>  set the referrals parameter
11110 <literal>SERVERS    </literal>  set alternate server list for this query only
11111 <literal>SIZE       </literal>  set the limit for the number of entries returned
11112 <literal>TIME       </literal>  set the maximum waiting time for a query
11113 </literallayout>
11114 <para>
11115 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
11116 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>. The value of the REFERRALS parameter
11117 must be <quote>follow</quote> (the default) or <quote>nofollow</quote>. The latter stops the LDAP
11118 library from trying to follow referrals issued by the LDAP server.
11119 </para>
11120 <para>
11121 <indexterm role="concept">
11122 <primary>LDAP</primary>
11123 <secondary>timeout</secondary>
11124 </indexterm>
11125 <indexterm role="concept">
11126 <primary>timeout</primary>
11127 <secondary>LDAP lookup</secondary>
11128 </indexterm>
11129 The name CONNECT is an obsolete name for NETTIME, retained for
11130 backwards compatibility. This timeout (specified as a number of seconds) is
11131 enforced from the client end for operations that can be carried out over a
11132 network. Specifically, it applies to network connections and calls to the
11133 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
11134 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
11135 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
11136 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
11137 Netscape SDK; for OpenLDAP no action is taken.
11138 </para>
11139 <para>
11140 The TIME parameter (also a number of seconds) is passed to the server to
11141 set a server-side limit on the time taken to complete a search.
11142 </para>
11143 <para>
11144 The SERVERS parameter allows you to specify an alternate list of ldap servers
11145 to use for an individual lookup.  The global <option>ldap_default_servers</option> option provides a
11146 default list of ldap servers, and a single lookup can specify a single ldap
11147 server to use.  But when you need to do a lookup with a list of servers that is
11148 different than the default list (maybe different order, maybe a completely
11149 different set of servers), the SERVERS parameter allows you to specify this
11150 alternate list (colon-separated).
11151 </para>
11152 <para>
11153 Here is an example of an LDAP query in an Exim lookup that uses some of these
11154 values. This is a single line, folded to fit on the page:
11155 </para>
11156 <literallayout class="monospaced">
11157 ${lookup ldap
11158   {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
11159   ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
11160   {$value}fail}
11161 </literallayout>
11162 <para>
11163 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
11164 any of the auxiliary data. Exim configuration settings that include lookups
11165 which contain password information should be preceded by <quote>hide</quote> to prevent
11166 non-admin users from using the <option>-bP</option> option to see their values.
11167 </para>
11168 <para>
11169 The auxiliary data items may be given in any order. The default is no
11170 connection timeout (the system timeout is used), no user or password, no limit
11171 on the number of entries returned, and no time limit on queries.
11172 </para>
11173 <para>
11174 When a DN is quoted in the USER= setting for LDAP authentication, Exim
11175 removes any URL quoting that it may contain before passing it LDAP. Apparently
11176 some libraries do this for themselves, but some do not. Removing the URL
11177 quoting has two advantages:
11178 </para>
11179 <itemizedlist>
11180 <listitem>
11181 <para>
11182 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
11183 DNs as with DNs inside actual queries.
11184 </para>
11185 </listitem>
11186 <listitem>
11187 <para>
11188 It permits spaces inside USER= DNs.
11189 </para>
11190 </listitem>
11191 </itemizedlist>
11192 <para>
11193 For example, a setting such as
11194 </para>
11195 <literallayout class="monospaced">
11196 USER=cn=${quote_ldap_dn:$1}
11197 </literallayout>
11198 <para>
11199 should work even if <varname>$1</varname> contains spaces.
11200 </para>
11201 <para>
11202 Expanded data for the PASS= value should be quoted using the <option>quote</option>
11203 expansion operator, rather than the LDAP quote operators. The only reason this
11204 field needs quoting is to ensure that it conforms to the Exim syntax, which
11205 does not allow unquoted spaces. For example:
11206 </para>
11207 <literallayout class="monospaced">
11208 PASS=${quote:$3}
11209 </literallayout>
11210 <para>
11211 The LDAP authentication mechanism can be used to check passwords as part of
11212 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
11213 <xref linkend="CHAPexpand"/>.
11214 </para>
11215 </section>
11216 <section id="SECID71">
11217 <title>Format of data returned by LDAP</title>
11218 <para>
11219 <indexterm role="concept">
11220 <primary>LDAP</primary>
11221 <secondary>returned data formats</secondary>
11222 </indexterm>
11223 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
11224 as a sequence of values, for example
11225 </para>
11226 <literallayout class="monospaced">
11227 cn=manager,o=University of Cambridge,c=UK
11228 </literallayout>
11229 <para>
11230 The <command>ldap</command> lookup type generates an error if more than one entry matches the
11231 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
11232 the result between the data from different entries. It is possible for multiple
11233 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
11234 you know that whatever values are returned all came from a single entry in the
11235 directory.
11236 </para>
11237 <para>
11238 In the common case where you specify a single attribute in your LDAP query, the
11239 result is not quoted, and does not contain the attribute name. If the attribute
11240 has multiple values, they are separated by commas. Any comma that is
11241 part of an attribute&#x2019;s value is doubled.
11242 </para>
11243 <para>
11244 If you specify multiple attributes, the result contains space-separated, quoted
11245 strings, each preceded by the attribute name and an equals sign. Within the
11246 quotes, the quote character, backslash, and newline are escaped with
11247 backslashes, and commas are used to separate multiple values for the attribute.
11248 Any commas in attribute values are doubled
11249 (permitting treatment of the values as a comma-separated list).
11250 Apart from the escaping, the string within quotes takes the same form as the
11251 output when a single attribute is requested. Specifying no attributes is the
11252 same as specifying all of an entry&#x2019;s attributes.
11253 </para>
11254 <para>
11255 Here are some examples of the output format. The first line of each pair is an
11256 LDAP query, and the second is the data that is returned. The attribute called
11257 <option>attr1</option> has two values, one of them with an embedded comma, whereas
11258 <option>attr2</option> has only one value. Both attributes are derived from <option>attr</option>
11259 (they have SUP <option>attr</option> in their schema definitions).
11260 </para>
11261 <literallayout class="monospaced">
11262 ldap:///o=base?attr1?sub?(uid=fred)
11263 value1.1,value1,,2
11264
11265 ldap:///o=base?attr2?sub?(uid=fred)
11266 value two
11267
11268 ldap:///o=base?attr?sub?(uid=fred)
11269 value1.1,value1,,2,value two
11270
11271 ldap:///o=base?attr1,attr2?sub?(uid=fred)
11272 attr1="value1.1,value1,,2" attr2="value two"
11273
11274 ldap:///o=base??sub?(uid=fred)
11275 objectClass="top" attr1="value1.1,value1,,2" attr2="value two"
11276 </literallayout>
11277 <para>
11278 You can
11279 make use of Exim&#x2019;s <option>-be</option> option to run expansion tests and thereby check the
11280 results of LDAP lookups.
11281 The <option>extract</option> operator in string expansions can be used to pick out
11282 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs.
11283 The <option>listextract</option> operator should be used to pick out individual values
11284 of attributes, even when only a single value is expected.
11285 The doubling of embedded commas allows you to use the returned data as a
11286 comma separated list (using the "&lt;," syntax for changing the input list separator).
11287 </para>
11288 </section>
11289 <section id="SECTnisplus">
11290 <title>More about NIS+</title>
11291 <para>
11292 <indexterm role="concept">
11293 <primary>NIS+ lookup type</primary>
11294 </indexterm>
11295 <indexterm role="concept">
11296 <primary>lookup</primary>
11297 <secondary>NIS+</secondary>
11298 </indexterm>
11299 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
11300 and field name. If this is given, the result of a successful query is the
11301 contents of the named field; otherwise the result consists of a concatenation
11302 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
11303 values containing spaces are quoted. For example, the query
11304 </para>
11305 <literallayout class="monospaced">
11306 [name=mg1456],passwd.org_dir
11307 </literallayout>
11308 <para>
11309 might return the string
11310 </para>
11311 <literallayout class="monospaced">
11312 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
11313 home=/home/mg1456 shell=/bin/bash shadow=""
11314 </literallayout>
11315 <para>
11316 (split over two lines here to fit on the page), whereas
11317 </para>
11318 <literallayout class="monospaced">
11319 [name=mg1456],passwd.org_dir:gcos
11320 </literallayout>
11321 <para>
11322 would just return
11323 </para>
11324 <literallayout class="monospaced">
11325 Martin Guerre
11326 </literallayout>
11327 <para>
11328 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
11329 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
11330 operator is to double any quote characters within the text.
11331 </para>
11332 </section>
11333 <section id="SECTsql">
11334 <title>SQL lookups</title>
11335 <para>
11336 <indexterm role="concept">
11337 <primary>SQL lookup types</primary>
11338 </indexterm>
11339 <indexterm role="concept">
11340 <primary>MySQL</primary>
11341 <secondary>lookup type</secondary>
11342 </indexterm>
11343 <indexterm role="concept">
11344 <primary>PostgreSQL lookup type</primary>
11345 </indexterm>
11346 <indexterm role="concept">
11347 <primary>lookup</primary>
11348 <secondary>MySQL</secondary>
11349 </indexterm>
11350 <indexterm role="concept">
11351 <primary>lookup</primary>
11352 <secondary>PostgreSQL</secondary>
11353 </indexterm>
11354 <indexterm role="concept">
11355 <primary>Oracle</primary>
11356 <secondary>lookup type</secondary>
11357 </indexterm>
11358 <indexterm role="concept">
11359 <primary>lookup</primary>
11360 <secondary>Oracle</secondary>
11361 </indexterm>
11362 <indexterm role="concept">
11363 <primary>InterBase lookup type</primary>
11364 </indexterm>
11365 <indexterm role="concept">
11366 <primary>lookup</primary>
11367 <secondary>InterBase</secondary>
11368 </indexterm>
11369 <indexterm role="concept">
11370 <primary>Redis lookup type</primary>
11371 </indexterm>
11372 <indexterm role="concept">
11373 <primary>lookup</primary>
11374 <secondary>Redis</secondary>
11375 </indexterm>
11376 Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, Redis,
11377 and SQLite
11378 databases. Queries for these databases contain SQL statements, so an example
11379 might be
11380 </para>
11381 <literallayout class="monospaced">
11382 ${lookup mysql{select mailbox from users where id='userx'}\
11383   {$value}fail}
11384 </literallayout>
11385 <para>
11386 If the result of the query contains more than one field, the data for each
11387 field in the row is returned, preceded by its name, so the result of
11388 </para>
11389 <literallayout class="monospaced">
11390 ${lookup pgsql{select home,name from users where id='userx'}\
11391   {$value}}
11392 </literallayout>
11393 <para>
11394 might be
11395 </para>
11396 <literallayout class="monospaced">
11397 home=/home/userx name="Mister X"
11398 </literallayout>
11399 <para>
11400 Empty values and values containing spaces are double quoted, with embedded
11401 quotes escaped by a backslash. If the result of the query contains just one
11402 field, the value is passed back verbatim, without a field name, for example:
11403 </para>
11404 <literallayout class="monospaced">
11405 Mister X
11406 </literallayout>
11407 <para>
11408 If the result of the query yields more than one row, it is all concatenated,
11409 with a newline between the data for each row.
11410 </para>
11411 </section>
11412 <section id="SECID72">
11413 <title>More about MySQL, PostgreSQL, Oracle, InterBase, and Redis</title>
11414 <para>
11415 <indexterm role="concept">
11416 <primary>MySQL</primary>
11417 <secondary>lookup type</secondary>
11418 </indexterm>
11419 <indexterm role="concept">
11420 <primary>PostgreSQL lookup type</primary>
11421 </indexterm>
11422 <indexterm role="concept">
11423 <primary>lookup</primary>
11424 <secondary>MySQL</secondary>
11425 </indexterm>
11426 <indexterm role="concept">
11427 <primary>lookup</primary>
11428 <secondary>PostgreSQL</secondary>
11429 </indexterm>
11430 <indexterm role="concept">
11431 <primary>Oracle</primary>
11432 <secondary>lookup type</secondary>
11433 </indexterm>
11434 <indexterm role="concept">
11435 <primary>lookup</primary>
11436 <secondary>Oracle</secondary>
11437 </indexterm>
11438 <indexterm role="concept">
11439 <primary>InterBase lookup type</primary>
11440 </indexterm>
11441 <indexterm role="concept">
11442 <primary>lookup</primary>
11443 <secondary>InterBase</secondary>
11444 </indexterm>
11445 <indexterm role="concept">
11446 <primary>Redis lookup type</primary>
11447 </indexterm>
11448 <indexterm role="concept">
11449 <primary>lookup</primary>
11450 <secondary>Redis</secondary>
11451 </indexterm>
11452 If any MySQL, PostgreSQL, Oracle, InterBase or Redis lookups are used, the
11453 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, <option>ibase_servers</option>,
11454 or <option>redis_servers</option>
11455 option (as appropriate) must be set to a colon-separated list of server
11456 information.
11457 (For MySQL and PostgreSQL, the global option need not be set if all
11458 queries contain their own server information &ndash; see section
11459 <xref linkend="SECTspeserque"/>.)
11460 For all but Redis
11461 each item in the list is a slash-separated list of four
11462 items: host name, database name, user name, and password. In the case of
11463 Oracle, the host name field is used for the <quote>service name</quote>, and the database
11464 name field is not used and should be empty. For example:
11465 </para>
11466 <literallayout class="monospaced">
11467 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
11468 </literallayout>
11469 <para>
11470 Because password data is sensitive, you should always precede the setting with
11471 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
11472 option. Here is an example where two MySQL servers are listed:
11473 </para>
11474 <literallayout class="monospaced">
11475 hide mysql_servers = localhost/users/root/secret:\
11476                      otherhost/users/root/othersecret
11477 </literallayout>
11478 <para>
11479 For MySQL and PostgreSQL, a host may be specified as &lt;<emphasis>name</emphasis>&gt;:&lt;<emphasis>port</emphasis>&gt; but
11480 because this is a colon-separated list, the colon has to be doubled. For each
11481 query, these parameter groups are tried in order until a connection is made and
11482 a query is successfully processed. The result of a query may be that no data is
11483 found, but that is still a successful query. In other words, the list of
11484 servers provides a backup facility, not a list of different places to look.
11485 </para>
11486 <para revisionflag="changed">
11487 For Redis the global option need not be specified if all queries contain their
11488 own server information &ndash; see section <xref linkend="SECTspeserque"/>.
11489 If specified, the option must be set to a colon-separated list of server
11490 information.
11491 Each item in the list is a slash-separated list of three items:
11492 host, database number, and password.
11493 </para>
11494 <orderedlist numeration="arabic" revisionflag="changed">
11495 <listitem>
11496 <para revisionflag="changed">
11497 The host is required and may be either an IPv4 address and optional
11498 port number (separated by a colon, which needs doubling due to the
11499 higher-level list), or a Unix socket pathname enclosed in parentheses
11500 </para>
11501 </listitem>
11502 <listitem>
11503 <para revisionflag="changed">
11504 The database number is optional; if present that number is selected in the backend
11505 </para>
11506 </listitem>
11507 <listitem>
11508 <para revisionflag="changed">
11509 The password is optional; if present it is used to authenticate to the backend
11510 </para>
11511 </listitem>
11512 </orderedlist>
11513 <para revisionflag="changed">
11514 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
11515 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
11516 respectively, and the characters single-quote, double-quote, and backslash
11517 itself are escaped with backslashes.
11518 </para>
11519 <para revisionflag="changed">
11520 The <option>quote_redis</option> expansion operator
11521 escapes whitespace and backslash characters with a backslash.
11522 </para>
11523 </section>
11524 <section id="SECTspeserque">
11525 <title>Specifying the server in the query</title>
11526 <para>
11527 For MySQL, PostgreSQL and Redis lookups (but not currently for Oracle and InterBase),
11528 it is possible to specify a list of servers with an individual query. This is
11529 done by starting the query with
11530 </para>
11531 <literallayout>
11532 <literal>servers=</literal><emphasis>server1:server2:server3:...</emphasis><literal>;</literal>
11533 </literallayout>
11534 <para>
11535 Each item in the list may take one of two forms:
11536 </para>
11537 <orderedlist numeration="arabic">
11538 <listitem>
11539 <para>
11540 If it contains no slashes it is assumed to be just a host name. The appropriate
11541 global option (<option>mysql_servers</option> or <option>pgsql_servers</option>) is searched for a host
11542 of the same name, and the remaining parameters (database, user, password) are
11543 taken from there.
11544 </para>
11545 </listitem>
11546 <listitem>
11547 <para>
11548 If it contains any slashes, it is taken as a complete parameter set.
11549 </para>
11550 </listitem>
11551 </orderedlist>
11552 <para>
11553 The list of servers is used in exactly the same way as the global list.
11554 Once a connection to a server has happened and a query has been
11555 successfully executed, processing of the lookup ceases.
11556 </para>
11557 <para>
11558 This feature is intended for use in master/slave situations where updates
11559 are occurring and you want to update the master rather than a slave. If the
11560 master is in the list as a backup for reading, you might have a global setting
11561 like this:
11562 </para>
11563 <literallayout class="monospaced">
11564 mysql_servers = slave1/db/name/pw:\
11565                 slave2/db/name/pw:\
11566                 master/db/name/pw
11567 </literallayout>
11568 <para>
11569 In an updating lookup, you could then write:
11570 </para>
11571 <literallayout class="monospaced">
11572 ${lookup mysql{servers=master; UPDATE ...} }
11573 </literallayout>
11574 <para>
11575 That query would then be sent only to the master server. If, on the other hand,
11576 the master is not to be used for reading, and so is not present in the global
11577 option, you can still update it by a query of this form:
11578 </para>
11579 <literallayout class="monospaced">
11580 ${lookup pgsql{servers=master/db/name/pw; UPDATE ...} }
11581 </literallayout>
11582 </section>
11583 <section id="SECID73">
11584 <title>Special MySQL features</title>
11585 <para>
11586 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
11587 causes a connection to the server on the local host by means of a Unix domain
11588 socket. An alternate socket can be specified in parentheses.
11589 </para>
11590 <para revisionflag="changed">
11591 An option group name for MySQL option files can be specified in square brackets;
11592 the default value is <quote>exim</quote>.
11593 </para>
11594 <para>
11595 The full syntax of each item in <option>mysql_servers</option> is:
11596 </para>
11597 <literallayout>
11598 &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;
11599 </literallayout>
11600 <para>
11601 Any of the four sub-parts of the first field can be omitted. For normal use on
11602 the local host it can be left blank or set to just <quote>localhost</quote>.
11603 </para>
11604 <para>
11605 No database need be supplied &ndash; but if it is absent here, it must be given in
11606 the queries.
11607 </para>
11608 <para>
11609 If a MySQL query is issued that does not request any data (an insert, update,
11610 or delete command), the result of the lookup is the number of rows affected.
11611 </para>
11612 <para>
11613 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
11614 anything (for example, setting a field to the value it already has), the result
11615 is zero because no rows are affected.
11616 </para>
11617 </section>
11618 <section id="SECID74">
11619 <title>Special PostgreSQL features</title>
11620 <para>
11621 PostgreSQL lookups can also use Unix domain socket connections to the database.
11622 This is usually faster and costs less CPU time than a TCP/IP connection.
11623 However it can be used only if the mail server runs on the same machine as the
11624 database server. A configuration line for PostgreSQL via Unix domain sockets
11625 looks like this:
11626 </para>
11627 <literallayout class="monospaced">
11628 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
11629 </literallayout>
11630 <para>
11631 In other words, instead of supplying a host name, a path to the socket is
11632 given. The path name is enclosed in parentheses so that its slashes aren&#x2019;t
11633 visually confused with the delimiters for the other server parameters.
11634 </para>
11635 <para>
11636 If a PostgreSQL query is issued that does not request any data (an insert,
11637 update, or delete command), the result of the lookup is the number of rows
11638 affected.
11639 </para>
11640 </section>
11641 <section id="SECTsqlite">
11642 <title>More about SQLite</title>
11643 <para>
11644 <indexterm role="concept">
11645 <primary>lookup</primary>
11646 <secondary>SQLite</secondary>
11647 </indexterm>
11648 <indexterm role="concept">
11649 <primary>sqlite lookup type</primary>
11650 </indexterm>
11651 SQLite is different to the other SQL lookups because a file name is required in
11652 addition to the SQL query. An SQLite database is a single file, and there is no
11653 daemon as in the other SQL databases. The interface to Exim requires the name
11654 of the file, as an absolute path, to be given at the start of the query. It is
11655 separated from the query by white space. This means that the path name cannot
11656 contain white space. Here is a lookup expansion example:
11657 </para>
11658 <literallayout class="monospaced">
11659 ${lookup sqlite {/some/thing/sqlitedb \
11660   select name from aliases where id='userx';}}
11661 </literallayout>
11662 <para>
11663 In a list, the syntax is similar. For example:
11664 </para>
11665 <literallayout class="monospaced">
11666 domainlist relay_to_domains = sqlite;/some/thing/sqlitedb \
11667    select * from relays where ip='$sender_host_address';
11668 </literallayout>
11669 <para>
11670 The only character affected by the <option>quote_sqlite</option> operator is a single
11671 quote, which it doubles.
11672 </para>
11673 <para>
11674 <indexterm role="concept">
11675 <primary>timeout</primary>
11676 <secondary>SQLite</secondary>
11677 </indexterm>
11678 <indexterm role="concept">
11679 <primary>sqlite</primary>
11680 <secondary>lookup timeout</secondary>
11681 </indexterm>
11682 The SQLite library handles multiple simultaneous accesses to the database
11683 internally. Multiple readers are permitted, but only one process can
11684 update at once. Attempts to access the database while it is being updated
11685 are rejected after a timeout period, during which the SQLite library
11686 waits for the lock to be released. In Exim, the default timeout is set
11687 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
11688 option.
11689 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
11690 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
11691 </para>
11692 </section>
11693 </chapter>
11694
11695 <chapter id="CHAPdomhosaddlists">
11696 <title>Domain, host, address, and local part lists</title>
11697 <titleabbrev>Domain, host, and address lists</titleabbrev>
11698 <para>
11699 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
11700 <primary>lists of domains; hosts; etc.</primary>
11701 </indexterm>
11702 A number of Exim configuration options contain lists of domains, hosts,
11703 email addresses, or local parts. For example, the <option>hold_domains</option> option
11704 contains a list of domains whose delivery is currently suspended. These lists
11705 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
11706 arguments to expansion conditions such as <option>match_domain</option>.
11707 </para>
11708 <para>
11709 Each item in one of these lists is a pattern to be matched against a domain,
11710 host, email address, or local part, respectively. In the sections below, the
11711 different types of pattern for each case are described, but first we cover some
11712 general facilities that apply to all four kinds of list.
11713 </para>
11714 <para>
11715 Note that other parts of Exim use a <emphasis>string list</emphasis> which does not
11716 support all the complexity available in
11717 domain, host, address and local part lists.
11718 </para>
11719 <section id="SECTlistexpand">
11720 <title>Expansion of lists</title>
11721 <para>
11722 <indexterm role="concept">
11723 <primary>expansion</primary>
11724 <secondary>of lists</secondary>
11725 </indexterm>
11726 Each list is expanded as a single string before it is used. The result of
11727 expansion must be a list, possibly containing empty items, which is split up
11728 into separate items for matching. By default, colon is the separator character,
11729 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
11730 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
11731 discusses the way to specify empty list items.
11732 </para>
11733 <para>
11734 If the string expansion is forced to fail, Exim behaves as if the item it is
11735 testing (domain, host, address, or local part) is not in the list. Other
11736 expansion failures cause temporary errors.
11737 </para>
11738 <para>
11739 If an item in a list is a regular expression, backslashes, dollars and possibly
11740 other special characters in the expression must be protected against
11741 misinterpretation by the string expander. The easiest way to do this is to use
11742 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
11743 expression should not be expanded. For example, in an ACL you might have:
11744 </para>
11745 <literallayout class="monospaced">
11746 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
11747                ${lookup{$domain}lsearch{/badsenders/bydomain}}
11748 </literallayout>
11749 <para>
11750 The first item is a regular expression that is protected from expansion by
11751 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
11752 senders based on the receiving domain.
11753 </para>
11754 </section>
11755 <section id="SECID76">
11756 <title>Negated items in lists</title>
11757 <para>
11758 <indexterm role="concept">
11759 <primary>list</primary>
11760 <secondary>negation</secondary>
11761 </indexterm>
11762 <indexterm role="concept">
11763 <primary>negation</primary>
11764 <secondary>in lists</secondary>
11765 </indexterm>
11766 Items in a list may be positive or negative. Negative items are indicated by a
11767 leading exclamation mark, which may be followed by optional white space. A list
11768 defines a set of items (domains, etc). When Exim processes one of these lists,
11769 it is trying to find out whether a domain, host, address, or local part
11770 (respectively) is in the set that is defined by the list. It works like this:
11771 </para>
11772 <para>
11773 The list is scanned from left to right. If a positive item is matched, the
11774 subject that is being checked is in the set; if a negative item is matched, the
11775 subject is not in the set. If the end of the list is reached without the
11776 subject having matched any of the patterns, it is in the set if the last item
11777 was a negative one, but not if it was a positive one. For example, the list in
11778 </para>
11779 <literallayout class="monospaced">
11780 domainlist relay_to_domains = !a.b.c : *.b.c
11781 </literallayout>
11782 <para>
11783 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
11784 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
11785 list is positive. However, if the setting were
11786 </para>
11787 <literallayout class="monospaced">
11788 domainlist relay_to_domains = !a.b.c
11789 </literallayout>
11790 <para>
11791 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
11792 list is negative. In other words, a list that ends with a negative item behaves
11793 as if it had an extra item <literal>:*</literal> on the end.
11794 </para>
11795 <para>
11796 Another way of thinking about positive and negative items in lists is to read
11797 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
11798 item.
11799 </para>
11800 </section>
11801 <section id="SECTfilnamlis">
11802 <title>File names in lists</title>
11803 <para>
11804 <indexterm role="concept">
11805 <primary>list</primary>
11806 <secondary>file name in</secondary>
11807 </indexterm>
11808 If an item in a domain, host, address, or local part list is an absolute file
11809 name (beginning with a slash character), each line of the file is read and
11810 processed as if it were an independent item in the list, except that further
11811 file names are not allowed,
11812 and no expansion of the data from the file takes place.
11813 Empty lines in the file are ignored, and the file may also contain comment
11814 lines:
11815 </para>
11816 <itemizedlist>
11817 <listitem>
11818 <para>
11819 For domain and host lists, if a # character appears anywhere in a line of the
11820 file, it and all following characters are ignored.
11821 </para>
11822 </listitem>
11823 <listitem>
11824 <para>
11825 Because local parts may legitimately contain # characters, a comment in an
11826 address list or local part list file is recognized only if # is preceded by
11827 white space or the start of the line. For example:
11828 </para>
11829 <literallayout class="monospaced">
11830 not#comment@x.y.z   # but this is a comment
11831 </literallayout>
11832 </listitem>
11833 </itemizedlist>
11834 <para>
11835 Putting a file name in a list has the same effect as inserting each line of the
11836 file as an item in the list (blank lines and comments excepted). However, there
11837 is one important difference: the file is read each time the list is processed,
11838 so if its contents vary over time, Exim&#x2019;s behaviour changes.
11839 </para>
11840 <para>
11841 If a file name is preceded by an exclamation mark, the sense of any match
11842 within the file is inverted. For example, if
11843 </para>
11844 <literallayout class="monospaced">
11845 hold_domains = !/etc/nohold-domains
11846 </literallayout>
11847 <para>
11848 and the file contains the lines
11849 </para>
11850 <literallayout class="monospaced">
11851 !a.b.c
11852 *.b.c
11853 </literallayout>
11854 <para>
11855 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
11856 any domain matching <literal>*.b.c</literal> is not.
11857 </para>
11858 </section>
11859 <section id="SECID77">
11860 <title>An lsearch file is not an out-of-line list</title>
11861 <para>
11862 As will be described in the sections that follow, lookups can be used in lists
11863 to provide indexed methods of checking list membership. There has been some
11864 confusion about the way <command>lsearch</command> lookups work in lists. Because
11865 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
11866 sometimes thought that it is allowed to contain wild cards and other kinds of
11867 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
11868 always fixed strings, just as for any other single-key lookup type.
11869 </para>
11870 <para>
11871 If you want to use a file to contain wild-card patterns that form part of a
11872 list, just give the file name on its own, without a search type, as described
11873 in the previous section. You could also use the <command>wildlsearch</command> or
11874 <command>nwildlsearch</command>, but there is no advantage in doing this.
11875 </para>
11876 </section>
11877 <section id="SECTnamedlists">
11878 <title>Named lists</title>
11879 <para>
11880 <indexterm role="concept">
11881 <primary>named lists</primary>
11882 </indexterm>
11883 <indexterm role="concept">
11884 <primary>list</primary>
11885 <secondary>named</secondary>
11886 </indexterm>
11887 A list of domains, hosts, email addresses, or local parts can be given a name
11888 which is then used to refer to the list elsewhere in the configuration. This is
11889 particularly convenient if the same list is required in several different
11890 places. It also allows lists to be given meaningful names, which can improve
11891 the readability of the configuration. For example, it is conventional to define
11892 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
11893 locally on a host, using a configuration line such as
11894 </para>
11895 <literallayout class="monospaced">
11896 domainlist local_domains = localhost:my.dom.example
11897 </literallayout>
11898 <para>
11899 Named lists are referenced by giving their name preceded by a plus sign, so,
11900 for example, a router that is intended to handle local domains would be
11901 configured with the line
11902 </para>
11903 <literallayout class="monospaced">
11904 domains = +local_domains
11905 </literallayout>
11906 <para>
11907 The first router in a configuration is often one that handles all domains
11908 except the local ones, using a configuration with a negated item like this:
11909 </para>
11910 <literallayout class="monospaced">
11911 dnslookup:
11912   driver = dnslookup
11913   domains = ! +local_domains
11914   transport = remote_smtp
11915   no_more
11916 </literallayout>
11917 <para>
11918 The four kinds of named list are created by configuration lines starting with
11919 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
11920 respectively. Then there follows the name that you are defining, followed by an
11921 equals sign and the list itself. For example:
11922 </para>
11923 <literallayout class="monospaced">
11924 hostlist    relay_from_hosts = 192.168.23.0/24 : my.friend.example
11925 addresslist bad_senders = cdb;/etc/badsenders
11926 </literallayout>
11927 <para>
11928 A named list may refer to other named lists:
11929 </para>
11930 <literallayout class="monospaced">
11931 domainlist  dom1 = first.example : second.example
11932 domainlist  dom2 = +dom1 : third.example
11933 domainlist  dom3 = fourth.example : +dom2 : fifth.example
11934 </literallayout>
11935 <para>
11936 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
11937 effect may not be what you intended, because the negation does not propagate
11938 out to the higher level. For example, consider:
11939 </para>
11940 <literallayout class="monospaced">
11941 domainlist  dom1 = !a.b
11942 domainlist  dom2 = +dom1 : *.b
11943 </literallayout>
11944 <para>
11945 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
11946 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
11947 means it matches the second list as well. The effect is not the same as
11948 </para>
11949 <literallayout class="monospaced">
11950 domainlist  dom2 = !a.b : *.b
11951 </literallayout>
11952 <para>
11953 where <emphasis>x.y</emphasis> does not match. It&#x2019;s best to avoid negation altogether in
11954 referenced lists if you can.
11955 </para>
11956 <para>
11957 Named lists may have a performance advantage. When Exim is routing an
11958 address or checking an incoming message, it caches the result of tests on named
11959 lists. So, if you have a setting such as
11960 </para>
11961 <literallayout class="monospaced">
11962 domains = +local_domains
11963 </literallayout>
11964 <para>
11965 on several of your routers
11966 or in several ACL statements,
11967 the actual test is done only for the first one. However, the caching works only
11968 if there are no expansions within the list itself or any sublists that it
11969 references. In other words, caching happens only for lists that are known to be
11970 the same each time they are referenced.
11971 </para>
11972 <para>
11973 By default, there may be up to 16 named lists of each type. This limit can be
11974 extended by changing a compile-time variable. The use of domain and host lists
11975 is recommended for concepts such as local domains, relay domains, and relay
11976 hosts. The default configuration is set up like this.
11977 </para>
11978 </section>
11979 <section id="SECID78">
11980 <title>Named lists compared with macros</title>
11981 <para>
11982 <indexterm role="concept">
11983 <primary>list</primary>
11984 <secondary>named compared with macro</secondary>
11985 </indexterm>
11986 <indexterm role="concept">
11987 <primary>macro</primary>
11988 <secondary>compared with named list</secondary>
11989 </indexterm>
11990 At first sight, named lists might seem to be no different from macros in the
11991 configuration file. However, macros are just textual substitutions. If you
11992 write
11993 </para>
11994 <literallayout class="monospaced">
11995 ALIST = host1 : host2
11996 auth_advertise_hosts = !ALIST
11997 </literallayout>
11998 <para>
11999 it probably won&#x2019;t do what you want, because that is exactly the same as
12000 </para>
12001 <literallayout class="monospaced">
12002 auth_advertise_hosts = !host1 : host2
12003 </literallayout>
12004 <para>
12005 Notice that the second host name is not negated. However, if you use a host
12006 list, and write
12007 </para>
12008 <literallayout class="monospaced">
12009 hostlist alist = host1 : host2
12010 auth_advertise_hosts = ! +alist
12011 </literallayout>
12012 <para>
12013 the negation applies to the whole list, and so that is equivalent to
12014 </para>
12015 <literallayout class="monospaced">
12016 auth_advertise_hosts = !host1 : !host2
12017 </literallayout>
12018 </section>
12019 <section id="SECID79">
12020 <title>Named list caching</title>
12021 <para>
12022 <indexterm role="concept">
12023 <primary>list</primary>
12024 <secondary>caching of named</secondary>
12025 </indexterm>
12026 <indexterm role="concept">
12027 <primary>caching</primary>
12028 <secondary>named lists</secondary>
12029 </indexterm>
12030 While processing a message, Exim caches the result of checking a named list if
12031 it is sure that the list is the same each time. In practice, this means that
12032 the cache operates only if the list contains no $ characters, which guarantees
12033 that it will not change when it is expanded. Sometimes, however, you may have
12034 an expanded list that you know will be the same each time within a given
12035 message. For example:
12036 </para>
12037 <literallayout class="monospaced">
12038 domainlist special_domains = \
12039            ${lookup{$sender_host_address}cdb{/some/file}}
12040 </literallayout>
12041 <para>
12042 This provides a list of domains that depends only on the sending host&#x2019;s IP
12043 address. If this domain list is referenced a number of times (for example,
12044 in several ACL lines, or in several routers) the result of the check is not
12045 cached by default, because Exim does not know that it is going to be the
12046 same list each time.
12047 </para>
12048 <para>
12049 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
12050 cache the result anyway. For example:
12051 </para>
12052 <literallayout class="monospaced">
12053 domainlist_cache special_domains = ${lookup{...
12054 </literallayout>
12055 <para>
12056 If you do this, you should be absolutely sure that caching is going to do
12057 the right thing in all cases. When in doubt, leave it out.
12058 </para>
12059 </section>
12060 <section id="SECTdomainlist">
12061 <title>Domain lists</title>
12062 <para>
12063 <indexterm role="concept">
12064 <primary>domain list</primary>
12065 <secondary>patterns for</secondary>
12066 </indexterm>
12067 <indexterm role="concept">
12068 <primary>list</primary>
12069 <secondary>domain list</secondary>
12070 </indexterm>
12071 Domain lists contain patterns that are to be matched against a mail domain.
12072 The following types of item may appear in domain lists:
12073 </para>
12074 <itemizedlist>
12075 <listitem>
12076 <para>
12077 <indexterm role="concept">
12078 <primary>primary host name</primary>
12079 </indexterm>
12080 <indexterm role="concept">
12081 <primary>host name</primary>
12082 <secondary>matched in domain list</secondary>
12083 </indexterm>
12084 <indexterm role="option">
12085 <primary><option>primary_hostname</option></primary>
12086 </indexterm>
12087 <indexterm role="concept">
12088 <primary>domain list</primary>
12089 <secondary>matching primary host name</secondary>
12090 </indexterm>
12091 <indexterm role="concept">
12092 <primary>@ in a domain list</primary>
12093 </indexterm>
12094 If a pattern consists of a single @ character, it matches the local host name,
12095 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
12096 possible to use the same configuration file on several different hosts that
12097 differ only in their names.
12098 </para>
12099 </listitem>
12100 <listitem>
12101 <para>
12102 <indexterm role="concept">
12103 <primary>@[] in a domain list</primary>
12104 </indexterm>
12105 <indexterm role="concept">
12106 <primary>domain list</primary>
12107 <secondary>matching local IP interfaces</secondary>
12108 </indexterm>
12109 <indexterm role="concept">
12110 <primary>domain literal</primary>
12111 </indexterm>
12112 If a pattern consists of the string <literal>@[]</literal> it matches an IP address enclosed
12113 in square brackets (as in an email address that contains a domain literal), but
12114 only if that IP address is recognized as local for email routing purposes. The
12115 <option>local_interfaces</option> and <option>extra_local_interfaces</option> options can be used to
12116 control which of a host&#x2019;s several IP addresses are treated as local.
12117 In today&#x2019;s Internet, the use of domain literals is controversial.
12118 </para>
12119 </listitem>
12120 <listitem>
12121 <para>
12122 <indexterm role="concept">
12123 <primary>@mx_any</primary>
12124 </indexterm>
12125 <indexterm role="concept">
12126 <primary>@mx_primary</primary>
12127 </indexterm>
12128 <indexterm role="concept">
12129 <primary>@mx_secondary</primary>
12130 </indexterm>
12131 <indexterm role="concept">
12132 <primary>domain list</primary>
12133 <secondary>matching MX pointers to local host</secondary>
12134 </indexterm>
12135 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
12136 has an MX record pointing to the local host or to any host that is listed in
12137 <indexterm role="option">
12138 <primary><option>hosts_treat_as_local</option></primary>
12139 </indexterm>
12140 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
12141 are similar, except that the first matches only when a primary MX target is the
12142 local host, and the second only when no primary MX target is the local host,
12143 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
12144 preference value &ndash; there may of course be more than one of them.
12145 </para>
12146 <para>
12147 The MX lookup that takes place when matching a pattern of this type is
12148 performed with the resolver options for widening names turned off. Thus, for
12149 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
12150 resolver&#x2019;s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
12151 options of the <command>dnslookup</command> router for a discussion of domain widening.
12152 </para>
12153 <para>
12154 Sometimes you may want to ignore certain IP addresses when using one of these
12155 patterns. You can specify this by following the pattern with <literal>/ignore=</literal>&lt;<emphasis>ip
12156 list</emphasis>&gt;, where &lt;<emphasis>ip list</emphasis>&gt; is a list of IP addresses. These addresses are
12157 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
12158 on a router). For example:
12159 </para>
12160 <literallayout class="monospaced">
12161 domains = @mx_any/ignore=127.0.0.1
12162 </literallayout>
12163 <para>
12164 This example matches any domain that has an MX record pointing to one of
12165 the local host&#x2019;s IP addresses other than 127.0.0.1.
12166 </para>
12167 <para>
12168 The list of IP addresses is in fact processed by the same code that processes
12169 host lists, so it may contain CIDR-coded network specifications and it may also
12170 contain negative items.
12171 </para>
12172 <para>
12173 Because the list of IP addresses is a sublist within a domain list, you have to
12174 be careful about delimiters if there is more than one address. Like any other
12175 list, the default delimiter can be changed. Thus, you might have:
12176 </para>
12177 <literallayout class="monospaced">
12178 domains = @mx_any/ignore=&lt;;127.0.0.1;0.0.0.0 : \
12179           an.other.domain : ...
12180 </literallayout>
12181 <para>
12182 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
12183 involved, it is easiest to change the delimiter for the main list as well:
12184 </para>
12185 <literallayout class="monospaced">
12186 domains = &lt;? @mx_any/ignore=&lt;;127.0.0.1;::1 ? \
12187           an.other.domain ? ...
12188 </literallayout>
12189 </listitem>
12190 <listitem>
12191 <para>
12192 <indexterm role="concept">
12193 <primary>asterisk</primary>
12194 <secondary>in domain list</secondary>
12195 </indexterm>
12196 <indexterm role="concept">
12197 <primary>domain list</primary>
12198 <secondary>asterisk in</secondary>
12199 </indexterm>
12200 <indexterm role="concept">
12201 <primary>domain list</primary>
12202 <secondary>matching <quote>ends with</quote></secondary>
12203 </indexterm>
12204 If a pattern starts with an asterisk, the remaining characters of the pattern
12205 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
12206 domain lists differs from its use in partial matching lookups. In a domain
12207 list, the character following the asterisk need not be a dot, whereas partial
12208 matching works only in terms of dot-separated components. For example, a domain
12209 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
12210 <emphasis>cipher.key.ex</emphasis>.
12211 </para>
12212 </listitem>
12213 <listitem>
12214 <para>
12215 <indexterm role="concept">
12216 <primary>regular expressions</primary>
12217 <secondary>in domain list</secondary>
12218 </indexterm>
12219 <indexterm role="concept">
12220 <primary>domain list</primary>
12221 <secondary>matching regular expression</secondary>
12222 </indexterm>
12223 If a pattern starts with a circumflex character, it is treated as a regular
12224 expression, and matched against the domain using a regular expression matching
12225 function. The circumflex is treated as part of the regular expression.
12226 Email domains are case-independent, so this regular expression match is by
12227 default case-independent, but you can make it case-dependent by starting it
12228 with <literal>(?-i)</literal>. References to descriptions of the syntax of regular expressions
12229 are given in chapter <xref linkend="CHAPregexp"/>.
12230 </para>
12231 <para>
12232 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
12233 must escape any backslash and dollar characters in the regular expression, or
12234 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
12235 it is not to be expanded (unless you really do want to build a regular
12236 expression by expansion, of course).
12237 </para>
12238 </listitem>
12239 <listitem>
12240 <para>
12241 <indexterm role="concept">
12242 <primary>lookup</primary>
12243 <secondary>in domain list</secondary>
12244 </indexterm>
12245 <indexterm role="concept">
12246 <primary>domain list</primary>
12247 <secondary>matching by lookup</secondary>
12248 </indexterm>
12249 If a pattern starts with the name of a single-key lookup type followed by a
12250 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
12251 must be a file name in a suitable format for the lookup type. For example, for
12252 <quote>cdb;</quote> it must be an absolute path:
12253 </para>
12254 <literallayout class="monospaced">
12255 domains = cdb;/etc/mail/local_domains.cdb
12256 </literallayout>
12257 <para>
12258 The appropriate type of lookup is done on the file using the domain name as the
12259 key. In most cases, the data that is looked up is not used; Exim is interested
12260 only in whether or not the key is present in the file. However, when a lookup
12261 is used for the <option>domains</option> option on a router
12262 or a <option>domains</option> condition in an ACL statement, the data is preserved in the
12263 <varname>$domain_data</varname> variable and can be referred to in other router options or
12264 other statements in the same ACL.
12265 </para>
12266 </listitem>
12267 <listitem>
12268 <para>
12269 Any of the single-key lookup type names may be preceded by
12270 <literal>partial</literal>&lt;<emphasis>n</emphasis>&gt;<literal>-</literal>, where the &lt;<emphasis>n</emphasis>&gt; is optional, for example,
12271 </para>
12272 <literallayout class="monospaced">
12273 domains = partial-dbm;/partial/domains
12274 </literallayout>
12275 <para>
12276 This causes partial matching logic to be invoked; a description of how this
12277 works is given in section <xref linkend="SECTpartiallookup"/>.
12278 </para>
12279 </listitem>
12280 <listitem>
12281 <para>
12282 <indexterm role="concept">
12283 <primary>asterisk</primary>
12284 <secondary>in lookup type</secondary>
12285 </indexterm>
12286 Any of the single-key lookup types may be followed by an asterisk. This causes
12287 a default lookup for a key consisting of a single asterisk to be done if the
12288 original lookup fails. This is not a useful feature when using a domain list to
12289 select particular domains (because any domain would match), but it might have
12290 value if the result of the lookup is being used via the <varname>$domain_data</varname>
12291 expansion variable.
12292 </para>
12293 </listitem>
12294 <listitem>
12295 <para>
12296 If the pattern starts with the name of a query-style lookup type followed by a
12297 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
12298 pattern must be an appropriate query for the lookup type, as described in
12299 chapter <xref linkend="CHAPfdlookup"/>. For example:
12300 </para>
12301 <literallayout class="monospaced">
12302 hold_domains = mysql;select domain from holdlist \
12303   where domain = '${quote_mysql:$domain}';
12304 </literallayout>
12305 <para>
12306 In most cases, the data that is looked up is not used (so for an SQL query, for
12307 example, it doesn&#x2019;t matter what field you select). Exim is interested only in
12308 whether or not the query succeeds. However, when a lookup is used for the
12309 <option>domains</option> option on a router, the data is preserved in the <varname>$domain_data</varname>
12310 variable and can be referred to in other options.
12311 </para>
12312 </listitem>
12313 <listitem>
12314 <para>
12315 <indexterm role="concept">
12316 <primary>domain list</primary>
12317 <secondary>matching literal domain name</secondary>
12318 </indexterm>
12319 If none of the above cases apply, a caseless textual comparison is made
12320 between the pattern and the domain.
12321 </para>
12322 </listitem>
12323 </itemizedlist>
12324 <para>
12325 Here is an example that uses several different kinds of pattern:
12326 </para>
12327 <literallayout class="monospaced">
12328 domainlist funny_domains = \
12329   @ : \
12330   lib.unseen.edu : \
12331   *.foundation.fict.example : \
12332   \N^[1-2]\d{3}\.fict\.example$\N : \
12333   partial-dbm;/opt/data/penguin/book : \
12334   nis;domains.byname : \
12335   nisplus;[name=$domain,status=local],domains.org_dir
12336 </literallayout>
12337 <para>
12338 There are obvious processing trade-offs among the various matching modes. Using
12339 an asterisk is faster than a regular expression, and listing a few names
12340 explicitly probably is too. The use of a file or database lookup is expensive,
12341 but may be the only option if hundreds of names are required. Because the
12342 patterns are tested in order, it makes sense to put the most commonly matched
12343 patterns earlier.
12344 </para>
12345 </section>
12346 <section id="SECThostlist">
12347 <title>Host lists</title>
12348 <para>
12349 <indexterm role="concept">
12350 <primary>host list</primary>
12351 <secondary>patterns in</secondary>
12352 </indexterm>
12353 <indexterm role="concept">
12354 <primary>list</primary>
12355 <secondary>host list</secondary>
12356 </indexterm>
12357 Host lists are used to control what remote hosts are allowed to do. For
12358 example, some hosts may be allowed to use the local host as a relay, and some
12359 may be permitted to use the SMTP ETRN command. Hosts can be identified in
12360 two different ways, by name or by IP address. In a host list, some types of
12361 pattern are matched to a host name, and some are matched to an IP address.
12362 You need to be particularly careful with this when single-key lookups are
12363 involved, to ensure that the right value is being used as the key.
12364 </para>
12365 </section>
12366 <section id="SECID80">
12367 <title>Special host list patterns</title>
12368 <para>
12369 <indexterm role="concept">
12370 <primary>empty item in hosts list</primary>
12371 </indexterm>
12372 <indexterm role="concept">
12373 <primary>host list</primary>
12374 <secondary>empty string in</secondary>
12375 </indexterm>
12376 If a host list item is the empty string, it matches only when no remote host is
12377 involved. This is the case when a message is being received from a local
12378 process using SMTP on the standard input, that is, when a TCP/IP connection is
12379 not used.
12380 </para>
12381 <para>
12382 <indexterm role="concept">
12383 <primary>asterisk</primary>
12384 <secondary>in host list</secondary>
12385 </indexterm>
12386 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
12387 the IP address nor the name is actually inspected.
12388 </para>
12389 </section>
12390 <section id="SECThoslispatip">
12391 <title>Host list patterns that match by IP address</title>
12392 <para>
12393 <indexterm role="concept">
12394 <primary>host list</primary>
12395 <secondary>matching IP addresses</secondary>
12396 </indexterm>
12397 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
12398 the incoming address actually appears in the IPv6 host as
12399 <literal>::ffff:</literal>&lt;<emphasis>v4address</emphasis>&gt;. When such an address is tested against a host
12400 list, it is converted into a traditional IPv4 address first. (Not all operating
12401 systems accept IPv4 calls on IPv6 sockets, as there have been some security
12402 concerns.)
12403 </para>
12404 <para>
12405 The following types of pattern in a host list check the remote host by
12406 inspecting its IP address:
12407 </para>
12408 <itemizedlist>
12409 <listitem>
12410 <para>
12411 If the pattern is a plain domain name (not a regular expression, not starting
12412 with *, not a lookup of any kind), Exim calls the operating system function
12413 to find the associated IP address(es). Exim uses the newer
12414 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
12415 This typically causes a forward DNS lookup of the name. The result is compared
12416 with the IP address of the subject host.
12417 </para>
12418 <para>
12419 If there is a temporary problem (such as a DNS timeout) with the host name
12420 lookup, a temporary error occurs. For example, if the list is being used in an
12421 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
12422 temporary SMTP error code. If no IP address can be found for the host name,
12423 what happens is described in section <xref linkend="SECTbehipnot"/> below.
12424 </para>
12425 </listitem>
12426 <listitem>
12427 <para>
12428 <indexterm role="concept">
12429 <primary>@ in a host list</primary>
12430 </indexterm>
12431 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
12432 domain name, as just described.
12433 </para>
12434 </listitem>
12435 <listitem>
12436 <para>
12437 If the pattern is an IP address, it is matched against the IP address of the
12438 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
12439 IPv6 addresses can be given in colon-separated format, but the colons have to
12440 be doubled so as not to be taken as item separators when the default list
12441 separator is used. IPv6 addresses are recognized even when Exim is compiled
12442 without IPv6 support. This means that if they appear in a host list on an
12443 IPv4-only host, Exim will not treat them as host names. They are just addresses
12444 that can never match a client host.
12445 </para>
12446 </listitem>
12447 <listitem>
12448 <para>
12449 <indexterm role="concept">
12450 <primary>@[] in a host list</primary>
12451 </indexterm>
12452 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
12453 the local host. For example, if the local host is an IPv4 host with one
12454 interface address 10.45.23.56, these two ACL statements have the same effect:
12455 </para>
12456 <literallayout class="monospaced">
12457 accept hosts = 127.0.0.1 : 10.45.23.56
12458 accept hosts = @[]
12459 </literallayout>
12460 </listitem>
12461 <listitem>
12462 <para>
12463 <indexterm role="concept">
12464 <primary>CIDR notation</primary>
12465 </indexterm>
12466 If the pattern is an IP address followed by a slash and a mask length (for
12467 example 10.11.42.0/24), it is matched against the IP address of the subject
12468 host under the given mask. This allows, an entire network of hosts to be
12469 included (or excluded) by a single item. The mask uses CIDR notation; it
12470 specifies the number of address bits that must match, starting from the most
12471 significant end of the address.
12472 </para>
12473 <para>
12474 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
12475 of a range of addresses. It is the number of bits in the network portion of the
12476 address. The above example specifies a 24-bit netmask, so it matches all 256
12477 addresses in the 10.11.42.0 network. An item such as
12478 </para>
12479 <literallayout class="monospaced">
12480 192.168.23.236/31
12481 </literallayout>
12482 <para>
12483 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
12484 32 for an IPv4 address is the same as no mask at all; just a single address
12485 matches.
12486 </para>
12487 <para>
12488 Here is another example which shows an IPv4 and an IPv6 network:
12489 </para>
12490 <literallayout class="monospaced">
12491 recipient_unqualified_hosts = 192.168.0.0/16: \
12492                               3ffe::ffff::836f::::/48
12493 </literallayout>
12494 <para>
12495 The doubling of list separator characters applies only when these items
12496 appear inline in a host list. It is not required when indirecting via a file.
12497 For example:
12498 </para>
12499 <literallayout class="monospaced">
12500 recipient_unqualified_hosts = /opt/exim/unqualnets
12501 </literallayout>
12502 <para>
12503 could make use of a file containing
12504 </para>
12505 <literallayout class="monospaced">
12506 172.16.0.0/12
12507 3ffe:ffff:836f::/48
12508 </literallayout>
12509 <para>
12510 to have exactly the same effect as the previous example. When listing IPv6
12511 addresses inline, it is usually more convenient to use the facility for
12512 changing separator characters. This list contains the same two networks:
12513 </para>
12514 <literallayout class="monospaced">
12515 recipient_unqualified_hosts = &lt;; 172.16.0.0/12; \
12516                                  3ffe:ffff:836f::/48
12517 </literallayout>
12518 <para>
12519 The separator is changed to semicolon by the leading <quote>&lt;;</quote> at the start of the
12520 list.
12521 </para>
12522 </listitem>
12523 </itemizedlist>
12524 </section>
12525 <section id="SECThoslispatsikey">
12526 <title>Host list patterns for single-key lookups by host address</title>
12527 <para>
12528 <indexterm role="concept">
12529 <primary>host list</primary>
12530 <secondary>lookup of IP address</secondary>
12531 </indexterm>
12532 When a host is to be identified by a single-key lookup of its complete IP
12533 address, the pattern takes this form:
12534 </para>
12535 <literallayout>
12536 <literal>net-&lt;</literal><emphasis>single-key-search-type</emphasis><literal>&gt;;&lt;</literal><emphasis>search-data</emphasis><literal>&gt;</literal>
12537 </literallayout>
12538 <para>
12539 For example:
12540 </para>
12541 <literallayout class="monospaced">
12542 hosts_lookup = net-cdb;/hosts-by-ip.db
12543 </literallayout>
12544 <para>
12545 The text form of the IP address of the subject host is used as the lookup key.
12546 IPv6 addresses are converted to an unabbreviated form, using lower case
12547 letters, with dots as separators because colon is the key terminator in
12548 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
12549 quoting the keys, but this is a facility that was added later.] The data
12550 returned by the lookup is not used.
12551 </para>
12552 <para>
12553 <indexterm role="concept">
12554 <primary>IP address</primary>
12555 <secondary>masking</secondary>
12556 </indexterm>
12557 <indexterm role="concept">
12558 <primary>host list</primary>
12559 <secondary>masked IP address</secondary>
12560 </indexterm>
12561 Single-key lookups can also be performed using masked IP addresses, using
12562 patterns of this form:
12563 </para>
12564 <literallayout>
12565 <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>
12566 </literallayout>
12567 <para>
12568 For example:
12569 </para>
12570 <literallayout class="monospaced">
12571 net24-dbm;/networks.db
12572 </literallayout>
12573 <para>
12574 The IP address of the subject host is masked using &lt;<emphasis>number</emphasis>&gt; as the mask
12575 length. A textual string is constructed from the masked value, followed by the
12576 mask, and this is used as the lookup key. For example, if the host&#x2019;s IP address
12577 is 192.168.34.6, the key that is looked up for the above example is
12578 <quote>192.168.34.0/24</quote>.
12579 </para>
12580 <para>
12581 When an IPv6 address is converted to a string, dots are normally used instead
12582 of colons, so that keys in <command>lsearch</command> files need not contain colons (which
12583 terminate <command>lsearch</command> keys). This was implemented some time before the ability
12584 to quote keys was made available in <command>lsearch</command> files. However, the more
12585 recently implemented <command>iplsearch</command> files do require colons in IPv6 keys
12586 (notated using the quoting facility) so as to distinguish them from IPv4 keys.
12587 For this reason, when the lookup type is <command>iplsearch</command>, IPv6 addresses are
12588 converted using colons and not dots. In all cases, full, unabbreviated IPv6
12589 addresses are always used.
12590 </para>
12591 <para>
12592 Ideally, it would be nice to tidy up this anomalous situation by changing to
12593 colons in all cases, given that quoting is now available for <command>lsearch</command>.
12594 However, this would be an incompatible change that might break some existing
12595 configurations.
12596 </para>
12597 <para>
12598 <emphasis role="bold">Warning</emphasis>: Specifying <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
12599 IPv6 address) is not the same as specifying just <option>net-</option> without a number. In
12600 the former case the key strings include the mask value, whereas in the latter
12601 case the IP address is used on its own.
12602 </para>
12603 </section>
12604 <section id="SECThoslispatnam">
12605 <title>Host list patterns that match by host name</title>
12606 <para>
12607 <indexterm role="concept">
12608 <primary>host</primary>
12609 <secondary>lookup failures</secondary>
12610 </indexterm>
12611 <indexterm role="concept">
12612 <primary>unknown host name</primary>
12613 </indexterm>
12614 <indexterm role="concept">
12615 <primary>host list</primary>
12616 <secondary>matching host name</secondary>
12617 </indexterm>
12618 There are several types of pattern that require Exim to know the name of the
12619 remote host. These are either wildcard patterns or lookups by name. (If a
12620 complete hostname is given without any wildcarding, it is used to find an IP
12621 address to match against, as described in section <xref linkend="SECThoslispatip"/>
12622 above.)
12623 </para>
12624 <para>
12625 If the remote host name is not already known when Exim encounters one of these
12626 patterns, it has to be found from the IP address.
12627 Although many sites on the Internet are conscientious about maintaining reverse
12628 DNS data for their hosts, there are also many that do not do this.
12629 Consequently, a name cannot always be found, and this may lead to unwanted
12630 effects. Take care when configuring host lists with wildcarded name patterns.
12631 Consider what will happen if a name cannot be found.
12632 </para>
12633 <para>
12634 Because of the problems of determining host names from IP addresses, matching
12635 against host names is not as common as matching against IP addresses.
12636 </para>
12637 <para>
12638 By default, in order to find a host name, Exim first does a reverse DNS lookup;
12639 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
12640 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
12641 are done can be changed by setting the <option>host_lookup_order</option> option. For
12642 security, once Exim has found one or more names, it looks up the IP addresses
12643 for these names and compares them with the IP address that it started with.
12644 Only those names whose IP addresses match are accepted. Any other names are
12645 discarded. If no names are left, Exim behaves as if the host name cannot be
12646 found. In the most common case there is only one name and one IP address.
12647 </para>
12648 <para>
12649 There are some options that control what happens if a host name cannot be
12650 found. These are described in section <xref linkend="SECTbehipnot"/> below.
12651 </para>
12652 <para>
12653 <indexterm role="concept">
12654 <primary>host</primary>
12655 <secondary>alias for</secondary>
12656 </indexterm>
12657 <indexterm role="concept">
12658 <primary>alias for host</primary>
12659 </indexterm>
12660 As a result of aliasing, hosts may have more than one name. When processing any
12661 of the following types of pattern, all the host&#x2019;s names are checked:
12662 </para>
12663 <itemizedlist>
12664 <listitem>
12665 <para>
12666 <indexterm role="concept">
12667 <primary>asterisk</primary>
12668 <secondary>in host list</secondary>
12669 </indexterm>
12670 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
12671 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
12672 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
12673 requirement. Other kinds of wildcarding require the use of a regular
12674 expression.
12675 </para>
12676 </listitem>
12677 <listitem>
12678 <para>
12679 <indexterm role="concept">
12680 <primary>regular expressions</primary>
12681 <secondary>in host list</secondary>
12682 </indexterm>
12683 <indexterm role="concept">
12684 <primary>host list</primary>
12685 <secondary>regular expression in</secondary>
12686 </indexterm>
12687 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
12688 matched against the host name. Host names are case-independent, so this regular
12689 expression match is by default case-independent, but you can make it
12690 case-dependent by starting it with <literal>(?-i)</literal>. References to descriptions of the
12691 syntax of regular expressions are given in chapter <xref linkend="CHAPregexp"/>. For
12692 example,
12693 </para>
12694 <literallayout class="monospaced">
12695 ^(a|b)\.c\.d$
12696 </literallayout>
12697 <para>
12698 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
12699 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
12700 that backslash and dollar characters are not misinterpreted as part of the
12701 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
12702 part of the string as non-expandable. For example:
12703 </para>
12704 <literallayout class="monospaced">
12705 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
12706 </literallayout>
12707 <para>
12708 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
12709 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
12710 example. Without it, a match at the start of the host name is all that is
12711 required.
12712 </para>
12713 </listitem>
12714 </itemizedlist>
12715 </section>
12716 <section id="SECTbehipnot">
12717 <title>Behaviour when an IP address or name cannot be found</title>
12718 <para>
12719 <indexterm role="concept">
12720 <primary>host</primary>
12721 <secondary>lookup failures, permanent</secondary>
12722 </indexterm>
12723 While processing a host list, Exim may need to look up an IP address from a
12724 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
12725 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
12726 behaviour when it fails to find the information it is seeking is the same.
12727 </para>
12728 <para>
12729 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
12730 apply to temporary DNS errors, whose handling is described in the next section.
12731 </para>
12732 <para>
12733 <indexterm role="concept">
12734 <primary><literal>+include_unknown</literal></primary>
12735 </indexterm>
12736 <indexterm role="concept">
12737 <primary><literal>+ignore_unknown</literal></primary>
12738 </indexterm>
12739 Exim parses a host list from left to right. If it encounters a permanent
12740 lookup failure in any item in the host list before it has found a match,
12741 Exim treats it as a failure and the default behavior is as if the host
12742 does not match the list. This may not always be what you want to happen.
12743 To change Exim&#x2019;s behaviour, the special items <literal>+include_unknown</literal> or
12744 <literal>+ignore_unknown</literal> may appear in the list (at top level &ndash; they are
12745 not recognized in an indirected file).
12746 </para>
12747 <itemizedlist>
12748 <listitem>
12749 <para>
12750 If any item that follows <literal>+include_unknown</literal> requires information that
12751 cannot found, Exim behaves as if the host does match the list. For example,
12752 </para>
12753 <literallayout class="monospaced">
12754 host_reject_connection = +include_unknown:*.enemy.ex
12755 </literallayout>
12756 <para>
12757 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
12758 any hosts whose name it cannot find.
12759 </para>
12760 </listitem>
12761 <listitem>
12762 <para>
12763 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
12764 be found, Exim ignores that item and proceeds to the rest of the list. For
12765 example:
12766 </para>
12767 <literallayout class="monospaced">
12768 accept hosts = +ignore_unknown : friend.example : \
12769                192.168.4.5
12770 </literallayout>
12771 <para>
12772 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
12773 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
12774 name can be found for 192.168.4.5, it is rejected.
12775 </para>
12776 </listitem>
12777 </itemizedlist>
12778 <para>
12779 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
12780 list. The effect of each one lasts until the next, or until the end of the
12781 list.
12782 </para>
12783 </section>
12784 <section id="SECTmixwilhos">
12785 <title>Mixing wildcarded host names and addresses in host lists</title>
12786 <para>
12787 <indexterm role="concept">
12788 <primary>host list</primary>
12789 <secondary>mixing names and addresses in</secondary>
12790 </indexterm>
12791 </para>
12792 <para>
12793 This section explains the host/ip processing logic with the same concepts
12794 as the previous section, but specifically addresses what happens when a
12795 wildcarded hostname is one of the items in the hostlist.
12796 </para>
12797 <itemizedlist>
12798 <listitem>
12799 <para>
12800 If you have name lookups or wildcarded host names and
12801 IP addresses in the same host list, you should normally put the IP
12802 addresses first. For example, in an ACL you could have:
12803 </para>
12804 <literallayout class="monospaced">
12805 accept hosts = 10.9.8.7 : *.friend.example
12806 </literallayout>
12807 <para>
12808 The reason you normally would order it this way lies in the
12809 left-to-right way that Exim processes lists.  It can test IP addresses
12810 without doing any DNS lookups, but when it reaches an item that requires
12811 a host name, it fails if it cannot find a host name to compare with the
12812 pattern. If the above list is given in the opposite order, the
12813 <option>accept</option> statement fails for a host whose name cannot be found, even
12814 if its IP address is 10.9.8.7.
12815 </para>
12816 </listitem>
12817 <listitem>
12818 <para>
12819 If you really do want to do the name check first, and still recognize the IP
12820 address, you can rewrite the ACL like this:
12821 </para>
12822 <literallayout class="monospaced">
12823 accept hosts = *.friend.example
12824 accept hosts = 10.9.8.7
12825 </literallayout>
12826 <para>
12827 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
12828 <xref linkend="CHAPACL"/> for details of ACLs. Alternatively, you can use
12829 <literal>+ignore_unknown</literal>, which was discussed in depth in the first example in
12830 this section.
12831 </para>
12832 </listitem>
12833 </itemizedlist>
12834 </section>
12835 <section id="SECTtemdnserr">
12836 <title>Temporary DNS errors when looking up host information</title>
12837 <para>
12838 <indexterm role="concept">
12839 <primary>host</primary>
12840 <secondary>lookup failures, temporary</secondary>
12841 </indexterm>
12842 <indexterm role="concept">
12843 <primary><literal>+include_defer</literal></primary>
12844 </indexterm>
12845 <indexterm role="concept">
12846 <primary><literal>+ignore_defer</literal></primary>
12847 </indexterm>
12848 A temporary DNS lookup failure normally causes a defer action (except when
12849 <option>dns_again_means_nonexist</option> converts it into a permanent error). However,
12850 host lists can include <literal>+ignore_defer</literal> and <literal>+include_defer</literal>, analogous to
12851 <literal>+ignore_unknown</literal> and <literal>+include_unknown</literal>, as described in the previous
12852 section. These options should be used with care, probably only in non-critical
12853 host lists such as whitelists.
12854 </para>
12855 </section>
12856 <section id="SECThoslispatnamsk">
12857 <title>Host list patterns for single-key lookups by host name</title>
12858 <para>
12859 <indexterm role="concept">
12860 <primary>unknown host name</primary>
12861 </indexterm>
12862 <indexterm role="concept">
12863 <primary>host list</primary>
12864 <secondary>matching host name</secondary>
12865 </indexterm>
12866 If a pattern is of the form
12867 </para>
12868 <literallayout>
12869 &lt;<emphasis>single-key-search-type</emphasis>&gt;;&lt;<emphasis>search-data</emphasis>&gt;
12870 </literallayout>
12871 <para>
12872 for example
12873 </para>
12874 <literallayout class="monospaced">
12875 dbm;/host/accept/list
12876 </literallayout>
12877 <para>
12878 a single-key lookup is performed, using the host name as its key. If the
12879 lookup succeeds, the host matches the item. The actual data that is looked up
12880 is not used.
12881 </para>
12882 <para>
12883 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
12884 keys in the file, not IP addresses. If you want to do lookups based on IP
12885 addresses, you must precede the search type with <quote>net-</quote> (see section
12886 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
12887 two items in the same list, one doing an address lookup and one doing a name
12888 lookup, both using the same file.
12889 </para>
12890 </section>
12891 <section id="SECID81">
12892 <title>Host list patterns for query-style lookups</title>
12893 <para>
12894 If a pattern is of the form
12895 </para>
12896 <literallayout>
12897 &lt;<emphasis>query-style-search-type</emphasis>&gt;;&lt;<emphasis>query</emphasis>&gt;
12898 </literallayout>
12899 <para>
12900 the query is obeyed, and if it succeeds, the host matches the item. The actual
12901 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
12902 <varname>$sender_host_name</varname> can be used in the query. For example:
12903 </para>
12904 <literallayout class="monospaced">
12905 hosts_lookup = pgsql;\
12906   select ip from hostlist where ip='$sender_host_address'
12907 </literallayout>
12908 <para>
12909 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
12910 can use the <option>sg</option> expansion item to change this if you need to. If you want to
12911 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
12912 operator.
12913 </para>
12914 <para>
12915 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
12916 looks up the host name if it has not already done so. (See section
12917 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
12918 </para>
12919 <para>
12920 Historical note: prior to release 4.30, Exim would always attempt to find a
12921 host name before running the query, unless the search type was preceded by
12922 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
12923 still recognized for query-style lookups, but its presence or absence has no
12924 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
12925 See section <xref linkend="SECThoslispatsikey"/>.)
12926 </para>
12927 </section>
12928 <section id="SECTaddresslist">
12929 <title>Address lists</title>
12930 <para>
12931 <indexterm role="concept">
12932 <primary>list</primary>
12933 <secondary>address list</secondary>
12934 </indexterm>
12935 <indexterm role="concept">
12936 <primary>address list</primary>
12937 <secondary>empty item</secondary>
12938 </indexterm>
12939 <indexterm role="concept">
12940 <primary>address list</primary>
12941 <secondary>patterns</secondary>
12942 </indexterm>
12943 Address lists contain patterns that are matched against mail addresses. There
12944 is one special case to be considered: the sender address of a bounce message is
12945 always empty. You can test for this by providing an empty item in an address
12946 list. For example, you can set up a router to process bounce messages by
12947 using this option setting:
12948 </para>
12949 <literallayout class="monospaced">
12950 senders = :
12951 </literallayout>
12952 <para>
12953 The presence of the colon creates an empty item. If you do not provide any
12954 data, the list is empty and matches nothing. The empty sender can also be
12955 detected by a regular expression that matches an empty string,
12956 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
12957 </para>
12958 <para>
12959 Non-empty items in an address list can be straightforward email addresses. For
12960 example:
12961 </para>
12962 <literallayout class="monospaced">
12963 senders = jbc@askone.example : hs@anacreon.example
12964 </literallayout>
12965 <para>
12966 A certain amount of wildcarding is permitted. If a pattern contains an @
12967 character, but is not a regular expression and does not begin with a
12968 semicolon-terminated lookup type (described below), the local part of the
12969 subject address is compared with the local part of the pattern, which may start
12970 with an asterisk. If the local parts match, the domain is checked in exactly
12971 the same way as for a pattern in a domain list. For example, the domain can be
12972 wildcarded, refer to a named list, or be a lookup:
12973 </para>
12974 <literallayout class="monospaced">
12975 deny senders = *@*.spamming.site:\
12976                *@+hostile_domains:\
12977                bozo@partial-lsearch;/list/of/dodgy/sites:\
12978                *@dbm;/bad/domains.db
12979 </literallayout>
12980 <para>
12981 <indexterm role="concept">
12982 <primary>local part</primary>
12983 <secondary>starting with !</secondary>
12984 </indexterm>
12985 <indexterm role="concept">
12986 <primary>address list</primary>
12987 <secondary>local part starting with !</secondary>
12988 </indexterm>
12989 If a local part that begins with an exclamation mark is required, it has to be
12990 specified using a regular expression, because otherwise the exclamation mark is
12991 treated as a sign of negation, as is standard in lists.
12992 </para>
12993 <para>
12994 If a non-empty pattern that is not a regular expression or a lookup does not
12995 contain an @ character, it is matched against the domain part of the subject
12996 address. The only two formats that are recognized this way are a literal
12997 domain, or a domain pattern that starts with *. In both these cases, the effect
12998 is the same as if <literal>*@</literal> preceded the pattern. For example:
12999 </para>
13000 <literallayout class="monospaced">
13001 deny senders = enemy.domain : *.enemy.domain
13002 </literallayout>
13003 <para>
13004 The following kinds of more complicated address list pattern can match any
13005 address, including the empty address that is characteristic of bounce message
13006 senders:
13007 </para>
13008 <itemizedlist>
13009 <listitem>
13010 <para>
13011 <indexterm role="concept">
13012 <primary>regular expressions</primary>
13013 <secondary>in address list</secondary>
13014 </indexterm>
13015 <indexterm role="concept">
13016 <primary>address list</primary>
13017 <secondary>regular expression in</secondary>
13018 </indexterm>
13019 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
13020 done against the complete address, with the pattern as the regular expression.
13021 You must take care that backslash and dollar characters are not misinterpreted
13022 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
13023 to mark that part of the string as non-expandable. For example:
13024 </para>
13025 <literallayout class="monospaced">
13026 deny senders = \N^.*this.*@example\.com$\N : \
13027                \N^\d{8}.+@spamhaus.example$\N : ...
13028 </literallayout>
13029 <para>
13030 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
13031 start with <quote>^</quote> by the time they are being interpreted as address patterns.
13032 </para>
13033 </listitem>
13034 <listitem>
13035 <para>
13036 <indexterm role="concept">
13037 <primary>address list</primary>
13038 <secondary>lookup for complete address</secondary>
13039 </indexterm>
13040 Complete addresses can be looked up by using a pattern that starts with a
13041 lookup type terminated by a semicolon, followed by the data for the lookup. For
13042 example:
13043 </para>
13044 <literallayout class="monospaced">
13045 deny senders = cdb;/etc/blocked.senders : \
13046   mysql;select address from blocked where \
13047   address='${quote_mysql:$sender_address}'
13048 </literallayout>
13049 <para>
13050 Both query-style and single-key lookup types can be used. For a single-key
13051 lookup type, Exim uses the complete address as the key. However, empty keys are
13052 not supported for single-key lookups, so a match against the empty address
13053 always fails. This restriction does not apply to query-style lookups.
13054 </para>
13055 <para>
13056 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
13057 cannot be used, and is ignored if specified, with an entry being written to the
13058 panic log.
13059 <indexterm role="concept">
13060 <primary>*@ with single-key lookup</primary>
13061 </indexterm>
13062 However, you can configure lookup defaults, as described in section
13063 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
13064 default. For example, with this lookup:
13065 </para>
13066 <literallayout class="monospaced">
13067 accept senders = lsearch*@;/some/file
13068 </literallayout>
13069 <para>
13070 the file could contains lines like this:
13071 </para>
13072 <literallayout class="monospaced">
13073 user1@domain1.example
13074 *@domain2.example
13075 </literallayout>
13076 <para>
13077 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
13078 that are tried is:
13079 </para>
13080 <literallayout class="monospaced">
13081 nimrod@jaeger.example
13082 *@jaeger.example
13083 *
13084 </literallayout>
13085 <para>
13086 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
13087 would mean that every address matches, thus rendering the test useless.
13088 </para>
13089 <para>
13090 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
13091 </para>
13092 <literallayout class="monospaced">
13093 deny recipients = dbm*@;/some/file
13094 deny recipients = *@dbm;/some/file
13095 </literallayout>
13096 <para>
13097 The first does a whole address lookup, with defaulting, as just described,
13098 because it starts with a lookup type. The second matches the local part and
13099 domain independently, as described in a bullet point below.
13100 </para>
13101 </listitem>
13102 </itemizedlist>
13103 <para>
13104 The following kinds of address list pattern can match only non-empty addresses.
13105 If the subject address is empty, a match against any of these pattern types
13106 always fails.
13107 </para>
13108 <itemizedlist>
13109 <listitem>
13110 <para>
13111 <indexterm role="concept">
13112 <primary>@@ with single-key lookup</primary>
13113 </indexterm>
13114 <indexterm role="concept">
13115 <primary>address list</primary>
13116 <secondary>@@ lookup type</secondary>
13117 </indexterm>
13118 <indexterm role="concept">
13119 <primary>address list</primary>
13120 <secondary>split local part and domain</secondary>
13121 </indexterm>
13122 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
13123 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
13124 split into a local part and a domain. The domain is looked up in the file. If
13125 it is not found, there is no match. If it is found, the data that is looked up
13126 from the file is treated as a colon-separated list of local part patterns, each
13127 of which is matched against the subject local part in turn.
13128 </para>
13129 <para>
13130 <indexterm role="concept">
13131 <primary>asterisk</primary>
13132 <secondary>in address list</secondary>
13133 </indexterm>
13134 The lookup may be a partial one, and/or one involving a search for a default
13135 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
13136 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
13137 even be further lookups. They may also be independently negated. For example,
13138 with
13139 </para>
13140 <literallayout class="monospaced">
13141 deny senders = @@dbm;/etc/reject-by-domain
13142 </literallayout>
13143 <para>
13144 the data from which the DBM file is built could contain lines like
13145 </para>
13146 <literallayout class="monospaced">
13147 baddomain.com:  !postmaster : *
13148 </literallayout>
13149 <para>
13150 to reject all senders except <option>postmaster</option> from that domain.
13151 </para>
13152 <para>
13153 <indexterm role="concept">
13154 <primary>local part</primary>
13155 <secondary>starting with !</secondary>
13156 </indexterm>
13157 If a local part that actually begins with an exclamation mark is required, it
13158 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
13159 may be split over several lines by indenting the second and subsequent lines,
13160 but the separating colon must still be included at line breaks. White space
13161 surrounding the colons is ignored. For example:
13162 </para>
13163 <literallayout class="monospaced">
13164 aol.com:  spammer1 : spammer2 : ^[0-9]+$ :
13165   spammer3 : spammer4
13166 </literallayout>
13167 <para>
13168 As in all colon-separated lists in Exim, a colon can be included in an item by
13169 doubling.
13170 </para>
13171 <para>
13172 If the last item in the list starts with a right angle-bracket, the remainder
13173 of the item is taken as a new key to look up in order to obtain a continuation
13174 list of local parts. The new key can be any sequence of characters. Thus one
13175 might have entries like
13176 </para>
13177 <literallayout class="monospaced">
13178 aol.com: spammer1 : spammer 2 : &gt;*
13179 xyz.com: spammer3 : &gt;*
13180 *:       ^\d{8}$
13181 </literallayout>
13182 <para>
13183 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
13184 local parts for all domains, in addition to the specific local parts listed for
13185 each domain. Of course, using this feature costs another lookup each time a
13186 chain is followed, but the effort needed to maintain the data is reduced.
13187 </para>
13188 <para>
13189 <indexterm role="concept">
13190 <primary>loop</primary>
13191 <secondary>in lookups</secondary>
13192 </indexterm>
13193 It is possible to construct loops using this facility, and in order to catch
13194 them, the chains may be no more than fifty items long.
13195 </para>
13196 </listitem>
13197 <listitem>
13198 <para>
13199 The @@&lt;<emphasis>lookup</emphasis>&gt; style of item can also be used with a query-style
13200 lookup, but in this case, the chaining facility is not available. The lookup
13201 can only return a single list of local parts.
13202 </para>
13203 </listitem>
13204 </itemizedlist>
13205 <para>
13206 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
13207 in these two examples:
13208 </para>
13209 <literallayout class="monospaced">
13210 senders = +my_list
13211 senders = *@+my_list
13212 </literallayout>
13213 <para>
13214 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
13215 example it is a named domain list.
13216 </para>
13217 </section>
13218 <section id="SECTcasletadd">
13219 <title>Case of letters in address lists</title>
13220 <para>
13221 <indexterm role="concept">
13222 <primary>case of local parts</primary>
13223 </indexterm>
13224 <indexterm role="concept">
13225 <primary>address list</primary>
13226 <secondary>case forcing</secondary>
13227 </indexterm>
13228 <indexterm role="concept">
13229 <primary>case forcing in address lists</primary>
13230 </indexterm>
13231 Domains in email addresses are always handled caselessly, but for local parts
13232 case may be significant on some systems (see <option>caseful_local_part</option> for how
13233 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
13234 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
13235 blocking lists should be done in a case-independent manner. Since most address
13236 lists in Exim are used for this kind of control, Exim attempts to do this by
13237 default.
13238 </para>
13239 <para>
13240 The domain portion of an address is always lowercased before matching it to an
13241 address list. The local part is lowercased by default, and any string
13242 comparisons that take place are done caselessly. This means that the data in
13243 the address list itself, in files included as plain file names, and in any file
13244 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
13245 keys in files that are looked up by a search type other than <command>lsearch</command> (which
13246 works caselessly) must be in lower case, because these lookups are not
13247 case-independent.
13248 </para>
13249 <para>
13250 <indexterm role="concept">
13251 <primary><literal>+caseful</literal></primary>
13252 </indexterm>
13253 To allow for the possibility of caseful address list matching, if an item in
13254 an address list is the string <quote>+caseful</quote>, the original case of the local
13255 part is restored for any comparisons that follow, and string comparisons are no
13256 longer case-independent. This does not affect the domain, which remains in
13257 lower case. However, although independent matches on the domain alone are still
13258 performed caselessly, regular expressions that match against an entire address
13259 become case-sensitive after <quote>+caseful</quote> has been seen.
13260 </para>
13261 </section>
13262 <section id="SECTlocparlis">
13263 <title>Local part lists</title>
13264 <para>
13265 <indexterm role="concept">
13266 <primary>list</primary>
13267 <secondary>local part list</secondary>
13268 </indexterm>
13269 <indexterm role="concept">
13270 <primary>local part</primary>
13271 <secondary>list</secondary>
13272 </indexterm>
13273 Case-sensitivity in local part lists is handled in the same way as for address
13274 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
13275 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
13276 set false, the subject is lowercased and the matching is initially
13277 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
13278 matching in the local part list, but not elsewhere in the router. If
13279 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
13280 option is case-sensitive from the start.
13281 </para>
13282 <para>
13283 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
13284 comments are handled in the same way as address lists &ndash; they are recognized
13285 only if the # is preceded by white space or the start of the line.
13286 Otherwise, local part lists are matched in the same way as domain lists, except
13287 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
13288 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
13289 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
13290 types.
13291 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
13292 </para>
13293 </section>
13294 </chapter>
13295
13296 <chapter id="CHAPexpand">
13297 <title>String expansions</title>
13298 <para>
13299 <indexterm role="concept" id="IIDstrexp" class="startofrange">
13300 <primary>expansion</primary>
13301 <secondary>of strings</secondary>
13302 </indexterm>
13303 Many strings in Exim&#x2019;s run time configuration are expanded before use. Some of
13304 them are expanded every time they are used; others are expanded only once.
13305 </para>
13306 <para>
13307 When a string is being expanded it is copied verbatim from left to right except
13308 when a dollar or backslash character is encountered. A dollar specifies the
13309 start of a portion of the string that is interpreted and replaced as described
13310 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
13311 escape character, as described in the following section.
13312 </para>
13313 <para>
13314 Whether a string is expanded depends upon the context.  Usually this is solely
13315 dependent upon the option for which a value is sought; in this documentation,
13316 options for which string expansion is performed are marked with &dagger; after
13317 the data type.  ACL rules always expand strings.  A couple of expansion
13318 conditions do not expand some of the brace-delimited branches, for security
13319 reasons.
13320 </para>
13321 <section id="SECTlittext">
13322 <title>Literal text in expanded strings</title>
13323 <para>
13324 <indexterm role="concept">
13325 <primary>expansion</primary>
13326 <secondary>including literal text</secondary>
13327 </indexterm>
13328 An uninterpreted dollar can be included in an expanded string by putting a
13329 backslash in front of it. A backslash can be used to prevent any special
13330 character being treated specially in an expansion, including backslash itself.
13331 If the string appears in quotes in the configuration file, two backslashes are
13332 required because the quotes themselves cause interpretation of backslashes when
13333 the string is read in (see section <xref linkend="SECTstrings"/>).
13334 </para>
13335 <para>
13336 <indexterm role="concept">
13337 <primary>expansion</primary>
13338 <secondary>non-expandable substrings</secondary>
13339 </indexterm>
13340 A portion of the string can specified as non-expandable by placing it between
13341 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
13342 expressions, which often contain backslashes and dollar signs. For example:
13343 </para>
13344 <literallayout class="monospaced">
13345 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
13346 </literallayout>
13347 <para>
13348 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
13349 without interpretation until it reaches the next <literal>\N</literal> or the end of the
13350 string.
13351 </para>
13352 </section>
13353 <section id="SECID82">
13354 <title>Character escape sequences in expanded strings</title>
13355 <para>
13356 <indexterm role="concept">
13357 <primary>expansion</primary>
13358 <secondary>escape sequences</secondary>
13359 </indexterm>
13360 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
13361 expanded string is recognized as an escape sequence for the character newline,
13362 carriage return, or tab, respectively. A backslash followed by up to three
13363 octal digits is recognized as an octal encoding for a single character, and a
13364 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
13365 encoding.
13366 </para>
13367 <para>
13368 These escape sequences are also recognized in quoted strings when they are read
13369 in. Their interpretation in expansions as well is useful for unquoted strings,
13370 and for other cases such as looked-up strings that are then expanded.
13371 </para>
13372 </section>
13373 <section id="SECID83">
13374 <title>Testing string expansions</title>
13375 <para>
13376 <indexterm role="concept">
13377 <primary>expansion</primary>
13378 <secondary>testing</secondary>
13379 </indexterm>
13380 <indexterm role="concept">
13381 <primary>testing</primary>
13382 <secondary>string expansion</secondary>
13383 </indexterm>
13384 <indexterm role="option">
13385 <primary><option>-be</option></primary>
13386 </indexterm>
13387 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
13388 takes the command arguments, or lines from the standard input if there are no
13389 arguments, runs them through the string expansion code, and writes the results
13390 to the standard output. Variables based on configuration values are set up, but
13391 since no message is being processed, variables such as <varname>$local_part</varname> have no
13392 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
13393 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
13394 and <option>nhash</option>.
13395 </para>
13396 <para>
13397 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
13398 instead runs under the uid and gid it was called with, to prevent users from
13399 using <option>-be</option> for reading files to which they do not have access.
13400 </para>
13401 <para>
13402 <indexterm role="option">
13403 <primary><option>-bem</option></primary>
13404 </indexterm>
13405 If you want to test expansions that include variables whose values are taken
13406 from a message, there are two other options that can be used. The <option>-bem</option>
13407 option is like <option>-be</option> except that it is followed by a file name. The file is
13408 read as a message before doing the test expansions. For example:
13409 </para>
13410 <literallayout class="monospaced">
13411 exim -bem /tmp/test.message '$h_subject:'
13412 </literallayout>
13413 <para>
13414 The <option>-Mset</option> option is used in conjunction with <option>-be</option> and is followed by an
13415 Exim message identifier. For example:
13416 </para>
13417 <literallayout class="monospaced">
13418 exim -be -Mset 1GrA8W-0004WS-LQ '$recipients'
13419 </literallayout>
13420 <para>
13421 This loads the message from Exim&#x2019;s spool before doing the test expansions, and
13422 is therefore restricted to admin users.
13423 </para>
13424 </section>
13425 <section id="SECTforexpfai">
13426 <title>Forced expansion failure</title>
13427 <para>
13428 <indexterm role="concept">
13429 <primary>expansion</primary>
13430 <secondary>forced failure</secondary>
13431 </indexterm>
13432 A number of expansions that are described in the following section have
13433 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
13434 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
13435 used depends on some condition that is evaluated as part of the expansion. If,
13436 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
13437 the entire string expansion fails in a way that can be detected by the code
13438 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
13439 its consequences depend on the circumstances. In some cases it is no different
13440 from any other expansion failure, but in others a different action may be
13441 taken. Such variations are mentioned in the documentation of the option that is
13442 being expanded.
13443 </para>
13444 </section>
13445 <section id="SECTexpansionitems">
13446 <title>Expansion items</title>
13447 <para>
13448 The following items are recognized in expanded strings. White space may be used
13449 between sub-items that are keywords or substrings enclosed in braces inside an
13450 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
13451 white space is significant.
13452 </para>
13453 <variablelist>
13454 <varlistentry>
13455 <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>
13456 <listitem>
13457 <para>
13458 <indexterm role="concept">
13459 <primary>expansion</primary>
13460 <secondary>variables</secondary>
13461 </indexterm>
13462 Substitute the contents of the named variable, for example:
13463 </para>
13464 <literallayout class="monospaced">
13465 $local_part
13466 ${domain}
13467 </literallayout>
13468 <para>
13469 The second form can be used to separate the name from subsequent alphanumeric
13470 characters. This form (using braces) is available only for variables; it does
13471 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
13472 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
13473 given, the expansion fails.
13474 </para>
13475 </listitem></varlistentry>
13476 <varlistentry>
13477 <term><emphasis role="bold">${</emphasis>&lt;<emphasis>op</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13478 <listitem>
13479 <para>
13480 <indexterm role="concept">
13481 <primary>expansion</primary>
13482 <secondary>operators</secondary>
13483 </indexterm>
13484 The string is first itself expanded, and then the operation specified by
13485 &lt;<emphasis>op</emphasis>&gt; is applied to it. For example:
13486 </para>
13487 <literallayout class="monospaced">
13488 ${lc:$local_part}
13489 </literallayout>
13490 <para>
13491 The string starts with the first character after the colon, which may be
13492 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
13493 below. The operator notation is used for simple expansion items that have just
13494 one argument, because it reduces the number of braces and therefore makes the
13495 string easier to understand.
13496 </para>
13497 </listitem></varlistentry>
13498 <varlistentry>
13499 <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>
13500 <listitem>
13501 <para>
13502 This item inserts <quote>basic</quote> header lines. It is described with the <option>header</option>
13503 expansion item below.
13504 </para>
13505 </listitem></varlistentry>
13506 <varlistentry>
13507 <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>
13508 <listitem>
13509 <para>
13510 <indexterm role="concept">
13511 <primary>expansion</primary>
13512 <secondary>calling an acl</secondary>
13513 </indexterm>
13514 <indexterm role="concept">
13515 <primary><option>acl</option></primary>
13516 <secondary>call from expansion</secondary>
13517 </indexterm>
13518 The name and zero to nine argument strings are first expanded separately.  The expanded
13519 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
13520 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
13521 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
13522 and may use the variables; if another acl expansion is used the values
13523 are restored after it returns.  If the ACL sets
13524 a value using a "message =" modifier and returns accept or deny, the value becomes
13525 the result of the expansion.
13526 If no message is set and the ACL returns accept or deny
13527 the expansion result is an empty string.
13528 If the ACL returns defer the result is a forced-fail.  Otherwise the expansion fails.
13529 </para>
13530 </listitem></varlistentry>
13531 <varlistentry>
13532 <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>
13533 <listitem>
13534 <para>
13535 <indexterm role="concept">
13536 <primary>expansion</primary>
13537 <secondary>extracting cerificate fields</secondary>
13538 </indexterm>
13539 <indexterm role="concept">
13540 <primary><option>certextract</option></primary>
13541 <secondary>certificate fields</secondary>
13542 </indexterm>
13543 <indexterm role="concept">
13544 <primary>certificate</primary>
13545 <secondary>extracting fields</secondary>
13546 </indexterm>
13547 The &lt;<emphasis>certificate</emphasis>&gt; must be a variable of type certificate.
13548 The field name is expanded and used to retrieve the relevant field from
13549 the certificate.  Supported fields are:
13550 </para>
13551 <literallayout>
13552 <literal>version        </literal>
13553 <literal>serial_number  </literal>
13554 <literal>subject        </literal> RFC4514 DN
13555 <literal>issuer         </literal> RFC4514 DN
13556 <literal>notbefore      </literal> time
13557 <literal>notafter       </literal> time
13558 <literal>sig_algorithm  </literal>
13559 <literal>signature      </literal>
13560 <literal>subj_altname   </literal> tagged list
13561 <literal>ocsp_uri       </literal> list
13562 <literal>crl_uri        </literal> list
13563 </literallayout>
13564 <para>
13565 If the field is found,
13566 &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
13567 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
13568 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
13569 is restored to any previous value it might have had.
13570 </para>
13571 <para>
13572 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
13573 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
13574 extracted is used.
13575 </para>
13576 <para>
13577 Some field names take optional modifiers, appended and separated by commas.
13578 </para>
13579 <para>
13580 The field selectors marked as "RFC4514" above
13581 output a Distinguished Name string which is
13582 not quite
13583 parseable by Exim as a comma-separated tagged list
13584 (the exceptions being elements containing commas).
13585 RDN elements of a single type may be selected by
13586 a modifier of the type label; if so the expansion
13587 result is a list (newline-separated by default).
13588 The separator may be changed by another modifier of
13589 a right angle-bracket followed immediately by the new separator.
13590 Recognised RDN type labels include "CN", "O", "OU" and "DC".
13591 </para>
13592 <para>
13593 The field selectors marked as "time" above
13594 take an optional modifier of "int"
13595 for which the result is the number of seconds since epoch.
13596 Otherwise the result is a human-readable string
13597 in the timezone selected by the main "timezone" option.
13598 </para>
13599 <para>
13600 The field selectors marked as "list" above return a list,
13601 newline-separated by default,
13602 (embedded separator characters in elements are doubled).
13603 The separator may be changed by a modifier of
13604 a right angle-bracket followed immediately by the new separator.
13605 </para>
13606 <para>
13607 The field selectors marked as "tagged" above
13608 prefix each list element with a type string and an equals sign.
13609 Elements of only one type may be selected by a modifier
13610 which is one of "dns", "uri" or "mail";
13611 if so the element tags are omitted.
13612 </para>
13613 <para>
13614 If not otherwise noted field values are presented in human-readable form.
13615 </para>
13616 </listitem></varlistentry>
13617 <varlistentry>
13618 <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>
13619 <listitem>
13620 <para>
13621 <indexterm role="concept">
13622 <primary><option>dlfunc</option></primary>
13623 </indexterm>
13624 This expansion dynamically loads and then calls a locally-written C function.
13625 This functionality is available only if Exim is compiled with
13626 </para>
13627 <literallayout class="monospaced">
13628 EXPAND_DLFUNC=yes
13629 </literallayout>
13630 <para>
13631 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
13632 object so that it doesn&#x2019;t reload the same object file in the same Exim process
13633 (but of course Exim does start new processes frequently).
13634 </para>
13635 <para>
13636 There may be from zero to eight arguments to the function. When compiling
13637 a local function that is to be called in this way, <filename>local_scan.h</filename> should be
13638 included. The Exim variables and functions that are defined by that API
13639 are also available for dynamically loaded functions. The function itself
13640 must have the following type:
13641 </para>
13642 <literallayout class="monospaced">
13643 int dlfunction(uschar **yield, int argc, uschar *argv[])
13644 </literallayout>
13645 <para>
13646 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
13647 function should return one of the following values:
13648 </para>
13649 <para>
13650 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
13651 into the expanded string that is being built.
13652 </para>
13653 <para>
13654 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
13655 from <emphasis>yield</emphasis>, if it is set.
13656 </para>
13657 <para>
13658 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
13659 taken from <emphasis>yield</emphasis> if it is set.
13660 </para>
13661 <para>
13662 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
13663 </para>
13664 <para>
13665 When compiling a function that is to be used in this way with gcc,
13666 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
13667 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
13668 </para>
13669 </listitem></varlistentry>
13670 <varlistentry>
13671 <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>
13672 <listitem>
13673 <para>
13674 <indexterm role="concept">
13675 <primary>expansion</primary>
13676 <secondary>extracting value from environment</secondary>
13677 </indexterm>
13678 <indexterm role="concept">
13679 <primary>environment</primary>
13680 <secondary>values from</secondary>
13681 </indexterm>
13682 The key is first expanded separately, and leading and trailing white space
13683 removed.
13684 This is then searched for as a name in the environment.
13685 If a variable is found then its value is placed in <varname>$value</varname>
13686 and &lt;<emphasis>string1</emphasis>&gt; is expanded, otherwise &lt;<emphasis>string2</emphasis>&gt; is expanded.
13687 </para>
13688 <para>
13689 Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
13690 appear, for example:
13691 </para>
13692 <literallayout class="monospaced">
13693 ${env{USER}{$value} fail }
13694 </literallayout>
13695 <para>
13696 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
13697 {&lt;<emphasis>string1</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
13698 </para>
13699 <para>
13700 If {&lt;<emphasis>string2</emphasis>&gt;} is omitted an empty string is substituted on
13701 search failure.
13702 If {&lt;<emphasis>string1</emphasis>&gt;} is omitted the search result is substituted on
13703 search success.
13704 </para>
13705 <para>
13706 The environment is adjusted by the <option>keep_environment</option> and
13707 <option>add_environment</option> main section options.
13708 </para>
13709 </listitem></varlistentry>
13710 <varlistentry>
13711 <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>
13712 <listitem>
13713 <para>
13714 <indexterm role="concept">
13715 <primary>expansion</primary>
13716 <secondary>extracting substrings by key</secondary>
13717 </indexterm>
13718 <indexterm role="concept">
13719 <primary><option>extract</option></primary>
13720 <secondary>substrings by key</secondary>
13721 </indexterm>
13722 The key and &lt;<emphasis>string1</emphasis>&gt; are first expanded separately. Leading and trailing
13723 white space is removed from the key (but not from any of the strings). The key
13724 must not consist entirely of digits. The expanded &lt;<emphasis>string1</emphasis>&gt; must be of the
13725 form:
13726 </para>
13727 <literallayout>
13728 &lt;<emphasis>key1</emphasis>&gt; = &lt;<emphasis>value1</emphasis>&gt;  &lt;<emphasis>key2</emphasis>&gt; = &lt;<emphasis>value2</emphasis>&gt; ...
13729 </literallayout>
13730 <para>
13731 <indexterm role="variable">
13732 <primary><varname>$value</varname></primary>
13733 </indexterm>
13734 where the equals signs and spaces (but not both) are optional. If any of the
13735 values contain white space, they must be enclosed in double quotes, and any
13736 values that are enclosed in double quotes are subject to escape processing as
13737 described in section <xref linkend="SECTstrings"/>. The expanded &lt;<emphasis>string1</emphasis>&gt; is searched
13738 for the value that corresponds to the key. The search is case-insensitive. If
13739 the key is found, &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
13740 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
13741 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
13742 is restored to any previous value it might have had.
13743 </para>
13744 <para>
13745 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
13746 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
13747 extracted is used. Thus, for example, these two expansions are identical, and
13748 yield <quote>2001</quote>:
13749 </para>
13750 <literallayout class="monospaced">
13751 ${extract{gid}{uid=1984 gid=2001}}
13752 ${extract{gid}{uid=1984 gid=2001}{$value}}
13753 </literallayout>
13754 <para>
13755 Instead of {&lt;<emphasis>string3</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
13756 appear, for example:
13757 </para>
13758 <literallayout class="monospaced">
13759 ${extract{Z}{A=... B=...}{$value} fail }
13760 </literallayout>
13761 <para>
13762 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
13763 {&lt;<emphasis>string2</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
13764 </para>
13765 </listitem></varlistentry>
13766 <varlistentry>
13767 <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>
13768 <listitem>
13769 <para>
13770 <indexterm role="concept">
13771 <primary>expansion</primary>
13772 <secondary>extracting substrings by number</secondary>
13773 </indexterm>
13774 <indexterm role="concept">
13775 <primary><option>extract</option></primary>
13776 <secondary>substrings by number</secondary>
13777 </indexterm>
13778 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
13779 apart from leading and trailing white space, which is ignored.
13780 This is what distinguishes this form of <option>extract</option> from the previous kind. It
13781 behaves in the same way, except that, instead of extracting a named field, it
13782 extracts from &lt;<emphasis>string1</emphasis>&gt; the field whose number is given as the first
13783 argument. You can use <varname>$value</varname> in &lt;<emphasis>string2</emphasis>&gt; or <literal>fail</literal> instead of
13784 &lt;<emphasis>string3</emphasis>&gt; as before.
13785 </para>
13786 <para>
13787 The fields in the string are separated by any one of the characters in the
13788 separator string. These may include space or tab characters.
13789 The first field is numbered one. If the number is negative, the fields are
13790 counted from the end of the string, with the rightmost one numbered -1. If the
13791 number given is zero, the entire string is returned. If the modulus of the
13792 number is greater than the number of fields in the string, the result is the
13793 expansion of &lt;<emphasis>string3</emphasis>&gt;, or the empty string if &lt;<emphasis>string3</emphasis>&gt; is not
13794 provided. For example:
13795 </para>
13796 <literallayout class="monospaced">
13797 ${extract{2}{:}{x:42:99:&amp; Mailer::/bin/bash}}
13798 </literallayout>
13799 <para>
13800 yields <quote>42</quote>, and
13801 </para>
13802 <literallayout class="monospaced">
13803 ${extract{-4}{:}{x:42:99:&amp; Mailer::/bin/bash}}
13804 </literallayout>
13805 <para>
13806 yields <quote>99</quote>. Two successive separators mean that the field between them is
13807 empty (for example, the fifth field above).
13808 </para>
13809 </listitem></varlistentry>
13810 <varlistentry>
13811 <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>
13812 <listitem>
13813 <para>
13814 <indexterm role="concept">
13815 <primary>list</primary>
13816 <secondary>selecting by condition</secondary>
13817 </indexterm>
13818 <indexterm role="concept">
13819 <primary>expansion</primary>
13820 <secondary>selecting from list by condition</secondary>
13821 </indexterm>
13822 <indexterm role="variable">
13823 <primary><varname>$item</varname></primary>
13824 </indexterm>
13825 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
13826 default, but the separator can be changed in the usual way. For each item
13827 in this list, its value is place in <varname>$item</varname>, and then the condition is
13828 evaluated. If the condition is true, <varname>$item</varname> is added to the output as an
13829 item in a new list; if the condition is false, the item is discarded. The
13830 separator used for the output list is the same as the one used for the
13831 input, but a separator setting is not included in the output. For example:
13832 </para>
13833 <literallayout class="monospaced">
13834 ${filter{a:b:c}{!eq{$item}{b}}
13835 </literallayout>
13836 <para>
13837 yields <literal>a:c</literal>. At the end of the expansion, the value of <varname>$item</varname> is restored
13838 to what it was before. See also the <emphasis role="bold">map</emphasis> and <emphasis role="bold">reduce</emphasis> expansion items.
13839 </para>
13840 </listitem></varlistentry>
13841 <varlistentry>
13842 <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>
13843 <listitem>
13844 <para>
13845 <indexterm role="concept">
13846 <primary>hash function</primary>
13847 <secondary>textual</secondary>
13848 </indexterm>
13849 <indexterm role="concept">
13850 <primary>expansion</primary>
13851 <secondary>textual hash</secondary>
13852 </indexterm>
13853 This is a textual hashing function, and was the first to be implemented in
13854 early versions of Exim. In current releases, there are other hashing functions
13855 (numeric, MD5, and SHA-1), which are described below.
13856 </para>
13857 <para>
13858 The first two strings, after expansion, must be numbers. Call them &lt;<emphasis>m</emphasis>&gt; and
13859 &lt;<emphasis>n</emphasis>&gt;. If you are using fixed values for these numbers, that is, if
13860 &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you can
13861 use the simpler operator notation that avoids some of the braces:
13862 </para>
13863 <literallayout class="monospaced">
13864 ${hash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
13865 </literallayout>
13866 <para>
13867 The second number is optional (in both notations). If &lt;<emphasis>n</emphasis>&gt; is greater than
13868 or equal to the length of the string, the expansion item returns the string.
13869 Otherwise it computes a new string of length &lt;<emphasis>n</emphasis>&gt; by applying a hashing
13870 function to the string. The new string consists of characters taken from the
13871 first &lt;<emphasis>m</emphasis>&gt; characters of the string
13872 </para>
13873 <literallayout class="monospaced">
13874 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
13875 </literallayout>
13876 <para>
13877 If &lt;<emphasis>m</emphasis>&gt; is not present the value 26 is used, so that only lower case
13878 letters appear. For example:
13879 </para>
13880 <literallayout>
13881 <literal>$hash{3}{monty}}           </literal>   yields  <literal>jmg</literal>
13882 <literal>$hash{5}{monty}}           </literal>   yields  <literal>monty</literal>
13883 <literal>$hash{4}{62}{monty python}}</literal>   yields  <literal>fbWx</literal>
13884 </literallayout>
13885 </listitem></varlistentry>
13886 <varlistentry>
13887 <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>
13888 <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>
13889 <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>
13890 <listitem>
13891 <para>
13892 <indexterm role="concept">
13893 <primary>expansion</primary>
13894 <secondary>header insertion</secondary>
13895 </indexterm>
13896 <indexterm role="variable">
13897 <primary><varname>$header_</varname></primary>
13898 </indexterm>
13899 <indexterm role="variable">
13900 <primary><varname>$bheader_</varname></primary>
13901 </indexterm>
13902 <indexterm role="variable">
13903 <primary><varname>$rheader_</varname></primary>
13904 </indexterm>
13905 <indexterm role="concept">
13906 <primary>header lines</primary>
13907 <secondary>in expansion strings</secondary>
13908 </indexterm>
13909 <indexterm role="concept">
13910 <primary>header lines</primary>
13911 <secondary>character sets</secondary>
13912 </indexterm>
13913 <indexterm role="concept">
13914 <primary>header lines</primary>
13915 <secondary>decoding</secondary>
13916 </indexterm>
13917 Substitute the contents of the named message header line, for example
13918 </para>
13919 <literallayout class="monospaced">
13920 $header_reply-to:
13921 </literallayout>
13922 <para>
13923 The newline that terminates a header line is not included in the expansion, but
13924 internal newlines (caused by splitting the header line over several physical
13925 lines) may be present.
13926 </para>
13927 <para>
13928 The difference between <option>rheader</option>, <option>bheader</option>, and <option>header</option> is in the way
13929 the data in the header line is interpreted.
13930 </para>
13931 <itemizedlist>
13932 <listitem>
13933 <para>
13934 <indexterm role="concept">
13935 <primary>white space</primary>
13936 <secondary>in header lines</secondary>
13937 </indexterm>
13938 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
13939 processing at all, and without the removal of leading and trailing white space.
13940 </para>
13941 </listitem>
13942 <listitem>
13943 <para>
13944 <indexterm role="concept">
13945 <primary>base64 encoding</primary>
13946 <secondary>in header lines</secondary>
13947 </indexterm>
13948 <option>bheader</option> removes leading and trailing white space, and then decodes base64
13949 or quoted-printable MIME <quote>words</quote> within the header text, but does no
13950 character set translation. If decoding of what looks superficially like a MIME
13951 <quote>word</quote> fails, the raw string is returned. If decoding
13952 <indexterm role="concept">
13953 <primary>binary zero</primary>
13954 <secondary>in header line</secondary>
13955 </indexterm>
13956 produces a binary zero character, it is replaced by a question mark &ndash; this is
13957 what Exim does for binary zeros that are actually received in header lines.
13958 </para>
13959 </listitem>
13960 <listitem>
13961 <para>
13962 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
13963 standard character set. This is an attempt to produce the same string as would
13964 be displayed on a user&#x2019;s MUA. If translation fails, the <option>bheader</option> string is
13965 returned. Translation is attempted only on operating systems that support the
13966 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
13967 a system Makefile or in <filename>Local/Makefile</filename>.
13968 </para>
13969 </listitem>
13970 </itemizedlist>
13971 <para>
13972 In a filter file, the target character set for <option>header</option> can be specified by a
13973 command of the following form:
13974 </para>
13975 <literallayout class="monospaced">
13976 headers charset "UTF-8"
13977 </literallayout>
13978 <para>
13979 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
13980 subsequently obeyed filter commands. In the absence of this command, the target
13981 character set in a filter is taken from the setting of the <option>headers_charset</option>
13982 option in the runtime configuration. The value of this option defaults to the
13983 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
13984 ISO-8859-1.
13985 </para>
13986 <para>
13987 Header names follow the syntax of RFC 2822, which states that they may contain
13988 any printing characters except space and colon. Consequently, curly brackets
13989 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
13990 if they were variables. Attempting to do so causes a syntax error.
13991 </para>
13992 <para>
13993 Only header lines that are common to all copies of a message are visible to
13994 this mechanism. These are the original header lines that are received with the
13995 message, and any that are added by an ACL statement or by a system
13996 filter. Header lines that are added to a particular copy of a message by a
13997 router or transport are not accessible.
13998 </para>
13999 <para>
14000 For incoming SMTP messages, no header lines are visible in ACLs that are obeyed
14001 before the DATA ACL, because the header structure is not set up until the
14002 message is received. Header lines that are added in a RCPT ACL (for example)
14003 are saved until the message&#x2019;s incoming header lines are available, at which
14004 point they are added. When a DATA ACL is running, however, header lines added
14005 by earlier ACLs are visible.
14006 </para>
14007 <para>
14008 Upper case and lower case letters are synonymous in header names. If the
14009 following character is white space, the terminating colon may be omitted, but
14010 this is not recommended, because you may then forget it when it is needed. When
14011 white space terminates the header name, this white space is included in the
14012 expanded string.  If the message does not contain the given header, the
14013 expansion item is replaced by an empty string. (See the <option>def</option> condition in
14014 section <xref linkend="SECTexpcond"/> for a means of testing for the existence of a
14015 header.)
14016 </para>
14017 <para>
14018 If there is more than one header with the same name, they are all concatenated
14019 to form the substitution string, up to a maximum length of 64K. Unless
14020 <option>rheader</option> is being used, leading and trailing white space is removed from
14021 each header before concatenation, and a completely empty header is ignored. A
14022 newline character is then inserted between non-empty headers, but there is no
14023 newline at the very end. For the <option>header</option> and <option>bheader</option> expansion, for
14024 those headers that contain lists of addresses, a comma is also inserted at the
14025 junctions between headers. This does not happen for the <option>rheader</option> expansion.
14026 </para>
14027 </listitem></varlistentry>
14028 <varlistentry>
14029 <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>
14030 <listitem>
14031 <para>
14032 <indexterm role="concept">
14033 <primary>expansion</primary>
14034 <secondary>hmac hashing</secondary>
14035 </indexterm>
14036 <indexterm role="concept">
14037 <primary><option>hmac</option></primary>
14038 </indexterm>
14039 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
14040 shared secret and some text into a message authentication code, as specified in
14041 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
14042 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
14043 cryptographic hash, allowing for authentication that is not possible with MD5
14044 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
14045 present. For example:
14046 </para>
14047 <literallayout class="monospaced">
14048 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
14049 </literallayout>
14050 <para>
14051 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
14052 produces:
14053 </para>
14054 <literallayout class="monospaced">
14055 dd97e3ba5d1a61b5006108f8c8252953
14056 </literallayout>
14057 <para>
14058 As an example of how this might be used, you might put in the main part of
14059 an Exim configuration:
14060 </para>
14061 <literallayout class="monospaced">
14062 SPAMSCAN_SECRET=cohgheeLei2thahw
14063 </literallayout>
14064 <para>
14065 In a router or a transport you could then have:
14066 </para>
14067 <literallayout class="monospaced">
14068 headers_add = \
14069   X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
14070   ${hmac{md5}{SPAMSCAN_SECRET}\
14071   {${primary_hostname},${message_exim_id},$h_message-id:}}
14072 </literallayout>
14073 <para>
14074 Then given a message, you can check where it was scanned by looking at the
14075 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
14076 this header line is authentic by recomputing the authentication code from the
14077 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
14078 using Exim&#x2019;s <option>-be</option> option, or by other means, for example by using the
14079 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
14080 </para>
14081 </listitem></varlistentry>
14082 <varlistentry>
14083 <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>
14084 <listitem>
14085 <para>
14086 <indexterm role="concept">
14087 <primary>expansion</primary>
14088 <secondary>conditional</secondary>
14089 </indexterm>
14090 <indexterm role="concept">
14091 <primary><option>if</option>, expansion item</primary>
14092 </indexterm>
14093 If &lt;<emphasis>condition</emphasis>&gt; is true, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the whole
14094 item; otherwise &lt;<emphasis>string2</emphasis>&gt; is used. The available conditions are described
14095 in section <xref linkend="SECTexpcond"/> below. For example:
14096 </para>
14097 <literallayout class="monospaced">
14098 ${if eq {$local_part}{postmaster} {yes}{no} }
14099 </literallayout>
14100 <para>
14101 The second string need not be present; if it is not and the condition is not
14102 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
14103 be present instead of the second string (without any curly brackets). In this
14104 case, the expansion is forced to fail if the condition is not true (see section
14105 <xref linkend="SECTforexpfai"/>).
14106 </para>
14107 <para>
14108 If both strings are omitted, the result is the string <literal>true</literal> if the condition
14109 is true, and the empty string if the condition is false. This makes it less
14110 cumbersome to write custom ACL and router conditions. For example, instead of
14111 </para>
14112 <literallayout class="monospaced">
14113 condition = ${if &gt;{$acl_m4}{3}{true}{false}}
14114 </literallayout>
14115 <para>
14116 you can use
14117 </para>
14118 <literallayout class="monospaced">
14119 condition = ${if &gt;{$acl_m4}{3}}
14120 </literallayout>
14121 </listitem></varlistentry>
14122 <varlistentry revisionflag="changed">
14123 <term><emphasis role="bold">${imapfolder{</emphasis>&lt;<emphasis>foldername</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
14124 <listitem>
14125 <para revisionflag="changed">
14126 <indexterm role="concept">
14127 <primary>expansion</primary>
14128 <secondary>imap folder</secondary>
14129 </indexterm>
14130 <indexterm role="concept">
14131 <primary><option>imapfolder</option> expansion item</primary>
14132 </indexterm>
14133 This item converts a (possibly multilevel, or with non-ASCII characters)
14134 folder specification to a Maildir name for filesystem use.
14135 For information on internationalisation support see <xref linkend="SECTi18nMDA"/>.
14136 </para>
14137 </listitem></varlistentry>
14138 <varlistentry>
14139 <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>
14140 <listitem>
14141 <para>
14142 <indexterm role="concept">
14143 <primary>expansion</primary>
14144 <secondary>string truncation</secondary>
14145 </indexterm>
14146 <indexterm role="concept">
14147 <primary><option>length</option> expansion item</primary>
14148 </indexterm>
14149 The <option>length</option> item is used to extract the initial portion of a string. Both
14150 strings are expanded, and the first one must yield a number, &lt;<emphasis>n</emphasis>&gt;, say. If
14151 you are using a fixed value for the number, that is, if &lt;<emphasis>string1</emphasis>&gt; does not
14152 change when expanded, you can use the simpler operator notation that avoids
14153 some of the braces:
14154 </para>
14155 <literallayout class="monospaced">
14156 ${length_&lt;n&gt;:&lt;string&gt;}
14157 </literallayout>
14158 <para>
14159 The result of this item is either the first &lt;<emphasis>n</emphasis>&gt; characters or the whole
14160 of &lt;<emphasis>string2</emphasis>&gt;, whichever is the shorter. Do not confuse <option>length</option> with
14161 <option>strlen</option>, which gives the length of a string.
14162 </para>
14163 </listitem></varlistentry>
14164 <varlistentry>
14165 <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>
14166 <listitem>
14167 <para>
14168 <indexterm role="concept">
14169 <primary>expansion</primary>
14170 <secondary>extracting list elements by number</secondary>
14171 </indexterm>
14172 <indexterm role="concept">
14173 <primary><option>listextract</option></primary>
14174 <secondary>extract list elements by number</secondary>
14175 </indexterm>
14176 <indexterm role="concept">
14177 <primary>list</primary>
14178 <secondary>extracting elements by number</secondary>
14179 </indexterm>
14180 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
14181 apart from an optional leading minus,
14182 and leading and trailing white space (which is ignored).
14183 </para>
14184 <para>
14185 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
14186 default, but the separator can be changed in the usual way.
14187 </para>
14188 <para>
14189 The first field of the list is numbered one.
14190 If the number is negative, the fields are
14191 counted from the end of the list, with the rightmost one numbered -1.
14192 The numbered element of the list is extracted and placed in <varname>$value</varname>,
14193 then &lt;<emphasis>string2</emphasis>&gt; is expanded as the result.
14194 </para>
14195 <para>
14196 If the modulus of the
14197 number is zero or greater than the number of fields in the string,
14198 the result is the expansion of &lt;<emphasis>string3</emphasis>&gt;.
14199 </para>
14200 <para>
14201 For example:
14202 </para>
14203 <literallayout class="monospaced">
14204 ${listextract{2}{x:42:99}}
14205 </literallayout>
14206 <para>
14207 yields <quote>42</quote>, and
14208 </para>
14209 <literallayout class="monospaced">
14210 ${listextract{-3}{&lt;, x,42,99,&amp; Mailer,,/bin/bash}{result: $value}}
14211 </literallayout>
14212 <para>
14213 yields <quote>result: 42</quote>.
14214 </para>
14215 <para>
14216 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, an empty string is used for string3.
14217 If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
14218 extracted is used.
14219 You can use <literal>fail</literal> instead of {&lt;<emphasis>string3</emphasis>&gt;} as in a string extract.
14220 </para>
14221 </listitem></varlistentry>
14222 <varlistentry>
14223 <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>
14224 <listitem>
14225 <para>
14226 This is the first of one of two different types of lookup item, which are both
14227 described in the next item.
14228 </para>
14229 </listitem></varlistentry>
14230 <varlistentry>
14231 <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>
14232 <listitem>
14233 <para>
14234 <indexterm role="concept">
14235 <primary>expansion</primary>
14236 <secondary>lookup in</secondary>
14237 </indexterm>
14238 <indexterm role="concept">
14239 <primary>file</primary>
14240 <secondary>lookups</secondary>
14241 </indexterm>
14242 <indexterm role="concept">
14243 <primary>lookup</primary>
14244 <secondary>in expanded string</secondary>
14245 </indexterm>
14246 The two forms of lookup item specify data lookups in files and databases, as
14247 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
14248 lookups, and the second is used for query-style lookups. The &lt;<emphasis>key</emphasis>&gt;,
14249 &lt;<emphasis>file</emphasis>&gt;, and &lt;<emphasis>query</emphasis>&gt; strings are expanded before use.
14250 </para>
14251 <para>
14252 If there is any white space in a lookup item which is part of a filter command,
14253 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
14254 other place where white space is significant, the lookup item must be enclosed
14255 in double quotes. The use of data lookups in users&#x2019; filter files may be locked
14256 out by the system administrator.
14257 </para>
14258 <para>
14259 <indexterm role="variable">
14260 <primary><varname>$value</varname></primary>
14261 </indexterm>
14262 If the lookup succeeds, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the entire item.
14263 During its expansion, the variable <varname>$value</varname> contains the data returned by the
14264 lookup. Afterwards it reverts to the value it had previously (at the outer
14265 level it is empty). If the lookup fails, &lt;<emphasis>string2</emphasis>&gt; is expanded and replaces
14266 the entire item. If {&lt;<emphasis>string2</emphasis>&gt;} is omitted, the replacement is the empty
14267 string on failure. If &lt;<emphasis>string2</emphasis>&gt; is provided, it can itself be a nested
14268 lookup, thus providing a mechanism for looking up a default value when the
14269 original lookup fails.
14270 </para>
14271 <para>
14272 If a nested lookup is used as part of &lt;<emphasis>string1</emphasis>&gt;, <varname>$value</varname> contains the
14273 data for the outer lookup while the parameters of the second lookup are
14274 expanded, and also while &lt;<emphasis>string2</emphasis>&gt; of the second lookup is expanded, should
14275 the second lookup fail. Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> can
14276 appear, and in this case, if the lookup fails, the entire expansion is forced
14277 to fail (see section <xref linkend="SECTforexpfai"/>). If both {&lt;<emphasis>string1</emphasis>&gt;} and
14278 {&lt;<emphasis>string2</emphasis>&gt;} are omitted, the result is the looked up value in the case of a
14279 successful lookup, and nothing in the case of failure.
14280 </para>
14281 <para>
14282 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
14283 search type in order to do partial matching, and * or *@ may follow a search
14284 type to request default lookups if the key does not match (see sections
14285 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
14286 </para>
14287 <para>
14288 <indexterm role="concept">
14289 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
14290 <secondary>in lookup expansion</secondary>
14291 </indexterm>
14292 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
14293 and non-wild parts of the key during the expansion of the replacement text.
14294 They return to their previous values at the end of the lookup item.
14295 </para>
14296 <para>
14297 This example looks up the postmaster alias in the conventional alias file:
14298 </para>
14299 <literallayout class="monospaced">
14300 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
14301 </literallayout>
14302 <para>
14303 This example uses NIS+ to look up the full name of the user corresponding to
14304 the local part of an address, forcing the expansion to fail if it is not found:
14305 </para>
14306 <literallayout class="monospaced">
14307 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
14308   {$value}fail}
14309 </literallayout>
14310 </listitem></varlistentry>
14311 <varlistentry>
14312 <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>
14313 <listitem>
14314 <para>
14315 <indexterm role="concept">
14316 <primary>expansion</primary>
14317 <secondary>list creation</secondary>
14318 </indexterm>
14319 <indexterm role="variable">
14320 <primary><varname>$item</varname></primary>
14321 </indexterm>
14322 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
14323 default, but the separator can be changed in the usual way. For each item
14324 in this list, its value is place in <varname>$item</varname>, and then &lt;<emphasis>string2</emphasis>&gt; is
14325 expanded and added to the output as an item in a new list. The separator used
14326 for the output list is the same as the one used for the input, but a separator
14327 setting is not included in the output. For example:
14328 </para>
14329 <literallayout class="monospaced">
14330 ${map{a:b:c}{[$item]}} ${map{&lt;- x-y-z}{($item)}}
14331 </literallayout>
14332 <para>
14333 expands to <literal>[a]:[b]:[c] (x)-(y)-(z)</literal>. At the end of the expansion, the
14334 value of <varname>$item</varname> is restored to what it was before. See also the <emphasis role="bold">filter</emphasis>
14335 and <emphasis role="bold">reduce</emphasis> expansion items.
14336 </para>
14337 </listitem></varlistentry>
14338 <varlistentry>
14339 <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>
14340 <listitem>
14341 <para>
14342 <indexterm role="concept">
14343 <primary>expansion</primary>
14344 <secondary>numeric hash</secondary>
14345 </indexterm>
14346 <indexterm role="concept">
14347 <primary>hash function</primary>
14348 <secondary>numeric</secondary>
14349 </indexterm>
14350 The three strings are expanded; the first two must yield numbers. Call them
14351 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
14352 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
14353 can use the simpler operator notation that avoids some of the braces:
14354 </para>
14355 <literallayout class="monospaced">
14356 ${nhash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
14357 </literallayout>
14358 <para>
14359 The second number is optional (in both notations). If there is only one number,
14360 the result is a number in the range 0&ndash;&lt;<emphasis>n</emphasis>&gt;-1. Otherwise, the string is
14361 processed by a div/mod hash function that returns two numbers, separated by a
14362 slash, in the ranges 0 to &lt;<emphasis>n</emphasis>&gt;-1 and 0 to &lt;<emphasis>m</emphasis>&gt;-1, respectively. For
14363 example,
14364 </para>
14365 <literallayout class="monospaced">
14366 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
14367 </literallayout>
14368 <para>
14369 returns the string <quote>6/33</quote>.
14370 </para>
14371 </listitem></varlistentry>
14372 <varlistentry>
14373 <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>
14374 <listitem>
14375 <para>
14376 <indexterm role="concept">
14377 <primary>Perl</primary>
14378 <secondary>use in expanded string</secondary>
14379 </indexterm>
14380 <indexterm role="concept">
14381 <primary>expansion</primary>
14382 <secondary>calling Perl from</secondary>
14383 </indexterm>
14384 This item is available only if Exim has been built to include an embedded Perl
14385 interpreter. The subroutine name and the arguments are first separately
14386 expanded, and then the Perl subroutine is called with those arguments. No
14387 additional arguments need be given; the maximum number permitted, including the
14388 name of the subroutine, is nine.
14389 </para>
14390 <para>
14391 The return value of the subroutine is inserted into the expanded string, unless
14392 the return value is <option>undef</option>. In that case, the expansion fails in the same
14393 way as an explicit <quote>fail</quote> on a lookup item. The return value is a scalar.
14394 Whatever you return is evaluated in a scalar context. For example, if you
14395 return the name of a Perl vector, the return value is the size of the vector,
14396 not its contents.
14397 </para>
14398 <para>
14399 If the subroutine exits by calling Perl&#x2019;s <option>die</option> function, the expansion fails
14400 with the error message that was passed to <option>die</option>. More details of the embedded
14401 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
14402 </para>
14403 <para>
14404 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
14405 out the use of this expansion item in filter files.
14406 </para>
14407 </listitem></varlistentry>
14408 <varlistentry>
14409 <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>
14410 <listitem>
14411 <para>
14412 <indexterm role="concept">
14413 <primary><option>prvs</option> expansion item</primary>
14414 </indexterm>
14415 The first argument is a complete email address and the second is secret
14416 keystring. The third argument, specifying a key number, is optional. If absent,
14417 it defaults to 0. The result of the expansion is a prvs-signed email address,
14418 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
14419 as part of a bounce address tag validation (BATV) scheme. For more discussion
14420 and an example, see section <xref linkend="SECTverifyPRVS"/>.
14421 </para>
14422 </listitem></varlistentry>
14423 <varlistentry>
14424 <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>
14425 <listitem>
14426 <para>
14427 <indexterm role="concept">
14428 <primary><option>prvscheck</option> expansion item</primary>
14429 </indexterm>
14430 This expansion item is the complement of the <option>prvs</option> item. It is used for
14431 checking prvs-signed addresses. If the expansion of the first argument does not
14432 yield a syntactically valid prvs-signed address, the whole item expands to the
14433 empty string. When the first argument does expand to a syntactically valid
14434 prvs-signed address, the second argument is expanded, with the prvs-decoded
14435 version of the address and the key number extracted from the address in the
14436 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
14437 </para>
14438 <para>
14439 These two variables can be used in the expansion of the second argument to
14440 retrieve the secret. The validity of the prvs-signed address is then checked
14441 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
14442 which is empty for failure or <quote>1</quote> for success.
14443 </para>
14444 <para>
14445 The third argument is optional; if it is missing, it defaults to an empty
14446 string. This argument is now expanded. If the result is an empty string, the
14447 result of the expansion is the decoded version of the address. This is the case
14448 whether or not the signature was valid. Otherwise, the result of the expansion
14449 is the expansion of the third argument.
14450 </para>
14451 <para>
14452 All three variables can be used in the expansion of the third argument.
14453 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
14454 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
14455 </para>
14456 </listitem></varlistentry>
14457 <varlistentry>
14458 <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>
14459 <listitem>
14460 <para>
14461 <indexterm role="concept">
14462 <primary>expansion</primary>
14463 <secondary>inserting an entire file</secondary>
14464 </indexterm>
14465 <indexterm role="concept">
14466 <primary>file</primary>
14467 <secondary>inserting into expansion</secondary>
14468 </indexterm>
14469 <indexterm role="concept">
14470 <primary><option>readfile</option> expansion item</primary>
14471 </indexterm>
14472 The file name and end-of-line string are first expanded separately. The file is
14473 then read, and its contents replace the entire item. All newline characters in
14474 the file are replaced by the end-of-line string if it is present. Otherwise,
14475 newlines are left in the string.
14476 String expansion is not applied to the contents of the file. If you want this,
14477 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
14478 the string expansion fails.
14479 </para>
14480 <para>
14481 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
14482 locks out the use of this expansion item in filter files.
14483 </para>
14484 </listitem></varlistentry>
14485 <varlistentry>
14486 <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>timeout</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>
14487 <listitem>
14488 <para>
14489 <indexterm role="concept">
14490 <primary>expansion</primary>
14491 <secondary>inserting from a socket</secondary>
14492 </indexterm>
14493 <indexterm role="concept">
14494 <primary>socket, use of in expansion</primary>
14495 </indexterm>
14496 <indexterm role="concept">
14497 <primary><option>readsocket</option> expansion item</primary>
14498 </indexterm>
14499 This item inserts data from a Unix domain or TCP socket into the expanded
14500 string. The minimal way of using it uses just two arguments, as in these
14501 examples:
14502 </para>
14503 <literallayout class="monospaced">
14504 ${readsocket{/socket/name}{request string}}
14505 ${readsocket{inet:some.host:1234}{request string}}
14506 </literallayout>
14507 <para>
14508 For a Unix domain socket, the first substring must be the path to the socket.
14509 For an Internet socket, the first substring must contain <literal>inet:</literal> followed by
14510 a host name or IP address, followed by a colon and a port, which can be a
14511 number or the name of a TCP port in <filename>/etc/services</filename>. An IP address may
14512 optionally be enclosed in square brackets. This is best for IPv6 addresses. For
14513 example:
14514 </para>
14515 <literallayout class="monospaced">
14516 ${readsocket{inet:[::1]:1234}{request string}}
14517 </literallayout>
14518 <para>
14519 Only a single host name may be given, but if looking it up yields more than
14520 one IP address, they are each tried in turn until a connection is made. For
14521 both kinds of socket, Exim makes a connection, writes the request string
14522 unless it is an empty string; and no terminating NUL is ever sent)
14523 and reads from the socket until an end-of-file
14524 is read. A timeout of 5 seconds is applied. Additional, optional arguments
14525 extend what can be done. Firstly, you can vary the timeout. For example:
14526 </para>
14527 <literallayout class="monospaced">
14528 ${readsocket{/socket/name}{request string}{3s}}
14529 </literallayout>
14530 <para>
14531 A fourth argument allows you to change any newlines that are in the data
14532 that is read, in the same way as for <option>readfile</option> (see above). This example
14533 turns them into spaces:
14534 </para>
14535 <literallayout class="monospaced">
14536 ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }}
14537 </literallayout>
14538 <para>
14539 As with all expansions, the substrings are expanded before the processing
14540 happens. Errors in these sub-expansions cause the expansion to fail. In
14541 addition, the following errors can occur:
14542 </para>
14543 <itemizedlist>
14544 <listitem>
14545 <para>
14546 Failure to create a socket file descriptor;
14547 </para>
14548 </listitem>
14549 <listitem>
14550 <para>
14551 Failure to connect the socket;
14552 </para>
14553 </listitem>
14554 <listitem>
14555 <para>
14556 Failure to write the request string;
14557 </para>
14558 </listitem>
14559 <listitem>
14560 <para>
14561 Timeout on reading from the socket.
14562 </para>
14563 </listitem>
14564 </itemizedlist>
14565 <para>
14566 By default, any of these errors causes the expansion to fail. However, if
14567 you supply a fifth substring, it is expanded and used when any of the above
14568 errors occurs. For example:
14569 </para>
14570 <literallayout class="monospaced">
14571 ${readsocket{/socket/name}{request string}{3s}{\n}\
14572   {socket failure}}
14573 </literallayout>
14574 <para>
14575 You can test for the existence of a Unix domain socket by wrapping this
14576 expansion in <literal>${if exists</literal>, but there is a race condition between that test
14577 and the actual opening of the socket, so it is safer to use the fifth argument
14578 if you want to be absolutely sure of avoiding an expansion error for a
14579 non-existent Unix domain socket, or a failure to connect to an Internet socket.
14580 </para>
14581 <para>
14582 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
14583 locks out the use of this expansion item in filter files.
14584 </para>
14585 </listitem></varlistentry>
14586 <varlistentry>
14587 <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>
14588 <listitem>
14589 <para>
14590 <indexterm role="concept">
14591 <primary>expansion</primary>
14592 <secondary>reducing a list to a scalar</secondary>
14593 </indexterm>
14594 <indexterm role="concept">
14595 <primary>list</primary>
14596 <secondary>reducing to a scalar</secondary>
14597 </indexterm>
14598 <indexterm role="variable">
14599 <primary><varname>$value</varname></primary>
14600 </indexterm>
14601 <indexterm role="variable">
14602 <primary><varname>$item</varname></primary>
14603 </indexterm>
14604 This operation reduces a list to a single, scalar string. After expansion,
14605 &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by default, but the
14606 separator can be changed in the usual way. Then &lt;<emphasis>string2</emphasis>&gt; is expanded and
14607 assigned to the <varname>$value</varname> variable. After this, each item in the &lt;<emphasis>string1</emphasis>&gt;
14608 list is assigned to <varname>$item</varname> in turn, and &lt;<emphasis>string3</emphasis>&gt; is expanded for each of
14609 them. The result of that expansion is assigned to <varname>$value</varname> before the next
14610 iteration. When the end of the list is reached, the final value of <varname>$value</varname> is
14611 added to the expansion output. The <emphasis role="bold">reduce</emphasis> expansion item can be used in a
14612 number of ways. For example, to add up a list of numbers:
14613 </para>
14614 <literallayout class="monospaced">
14615 ${reduce {&lt;, 1,2,3}{0}{${eval:$value+$item}}}
14616 </literallayout>
14617 <para>
14618 The result of that expansion would be <literal>6</literal>. The maximum of a list of numbers
14619 can be found:
14620 </para>
14621 <literallayout class="monospaced">
14622 ${reduce {3:0:9:4:6}{0}{${if &gt;{$item}{$value}{$item}{$value}}}}
14623 </literallayout>
14624 <para>
14625 At the end of a <emphasis role="bold">reduce</emphasis> expansion, the values of <varname>$item</varname> and <varname>$value</varname> are
14626 restored to what they were before. See also the <emphasis role="bold">filter</emphasis> and <emphasis role="bold">map</emphasis>
14627 expansion items.
14628 </para>
14629 </listitem></varlistentry>
14630 <varlistentry>
14631 <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>
14632 <listitem>
14633 <para>
14634 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
14635 expansion item above.
14636 </para>
14637 </listitem></varlistentry>
14638 <varlistentry>
14639 <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>
14640 <listitem>
14641 <para>
14642 <indexterm role="concept">
14643 <primary>expansion</primary>
14644 <secondary>running a command</secondary>
14645 </indexterm>
14646 <indexterm role="concept">
14647 <primary><option>run</option> expansion item</primary>
14648 </indexterm>
14649 The command and its arguments are first expanded as one string. The string is
14650 split apart into individual arguments by spaces, and then the command is run
14651 in a separate process, but under the same uid and gid.  As in other command
14652 executions from Exim, a shell is not used by default. If the command requires
14653 a shell, you must explicitly code it.
14654 </para>
14655 <para>
14656 Since the arguments are split by spaces, when there is a variable expansion
14657 which has an empty result, it will cause the situation that the argument will
14658 simply be omitted when the program is actually executed by Exim. If the
14659 script/program requires a specific number of arguments and the expanded
14660 variable could possibly result in this empty expansion, the variable must be
14661 quoted. This is more difficult if the expanded variable itself could result
14662 in a string containing quotes, because it would interfere with the quotes
14663 around the command arguments. A possible guard against this is to wrap the
14664 variable in the <option>sg</option> operator to change any quote marks to some other
14665 character.
14666 </para>
14667 <para>
14668 The standard input for the command exists, but is empty. The standard output
14669 and standard error are set to the same file descriptor.
14670 <indexterm role="concept">
14671 <primary>return code</primary>
14672 <secondary>from <option>run</option> expansion</secondary>
14673 </indexterm>
14674 <indexterm role="variable">
14675 <primary><varname>$value</varname></primary>
14676 </indexterm>
14677 If the command succeeds (gives a zero return code) &lt;<emphasis>string1</emphasis>&gt; is expanded
14678 and replaces the entire item; during this expansion, the standard output/error
14679 from the command is in the variable <varname>$value</varname>. If the command fails,
14680 &lt;<emphasis>string2</emphasis>&gt;, if present, is expanded and used. Once again, during the
14681 expansion, the standard output/error from the command is in the variable
14682 <varname>$value</varname>.
14683 </para>
14684 <para>
14685 If &lt;<emphasis>string2</emphasis>&gt; is absent, the result is empty. Alternatively, &lt;<emphasis>string2</emphasis>&gt;
14686 can be the word <quote>fail</quote> (not in braces) to force expansion failure if the
14687 command does not succeed. If both strings are omitted, the result is contents
14688 of the standard output/error on success, and nothing on failure.
14689 </para>
14690 <para>
14691 <indexterm role="variable">
14692 <primary><varname>$run_in_acl</varname></primary>
14693 </indexterm>
14694 The standard output/error of the command is put in the variable <varname>$value</varname>.
14695 In this ACL example, the output of a command is logged for the admin to
14696 troubleshoot:
14697 </para>
14698 <literallayout class="monospaced">
14699 warn  condition    = ${run{/usr/bin/id}{yes}{no}}
14700       log_message  = Output of id: $value
14701 </literallayout>
14702 <para>
14703 If the command requires shell idioms, such as the &gt; redirect operator, the
14704 shell must be invoked directly, such as with:
14705 </para>
14706 <literallayout class="monospaced">
14707 ${run{/bin/bash -c "/usr/bin/id &gt;/tmp/id"}{yes}{yes}}
14708 </literallayout>
14709 <para>
14710 <indexterm role="variable">
14711 <primary><varname>$runrc</varname></primary>
14712 </indexterm>
14713 The return code from the command is put in the variable <varname>$runrc</varname>, and this
14714 remains set afterwards, so in a filter file you can do things like this:
14715 </para>
14716 <literallayout class="monospaced">
14717 if "${run{x y z}{}}$runrc" is 1 then ...
14718   elif $runrc is 2 then ...
14719   ...
14720 endif
14721 </literallayout>
14722 <para>
14723 If execution of the command fails (for example, the command does not exist),
14724 the return code is 127 &ndash; the same code that shells use for non-existent
14725 commands.
14726 </para>
14727 <para>
14728 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
14729 option values are expanded, except for those preconditions whose order of
14730 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
14731 by the expansion of one option, and use it in another.
14732 </para>
14733 <para>
14734 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
14735 out the use of this expansion item in filter files.
14736 </para>
14737 </listitem></varlistentry>
14738 <varlistentry>
14739 <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>
14740 <listitem>
14741 <para>
14742 <indexterm role="concept">
14743 <primary>expansion</primary>
14744 <secondary>string substitution</secondary>
14745 </indexterm>
14746 <indexterm role="concept">
14747 <primary><option>sg</option> expansion item</primary>
14748 </indexterm>
14749 This item works like Perl&#x2019;s substitution operator (s) with the global (/g)
14750 option; hence its name. However, unlike the Perl equivalent, Exim does not
14751 modify the subject string; instead it returns the modified string for insertion
14752 into the overall expansion. The item takes three arguments: the subject string,
14753 a regular expression, and a substitution string. For example:
14754 </para>
14755 <literallayout class="monospaced">
14756 ${sg{abcdefabcdef}{abc}{xyz}}
14757 </literallayout>
14758 <para>
14759 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
14760 if any $ or \ characters are required in the regular expression or in the
14761 substitution string, they have to be escaped. For example:
14762 </para>
14763 <literallayout class="monospaced">
14764 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
14765 </literallayout>
14766 <para>
14767 yields <quote>defabc</quote>, and
14768 </para>
14769 <literallayout class="monospaced">
14770 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
14771 </literallayout>
14772 <para>
14773 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
14774 the regular expression from string expansion.
14775 </para>
14776 </listitem></varlistentry>
14777 <varlistentry>
14778 <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>
14779 <listitem>
14780 <para>
14781 <indexterm role="concept">
14782 <primary>sorting</primary>
14783 <secondary>a list</secondary>
14784 </indexterm>
14785 <indexterm role="concept">
14786 <primary>list</primary>
14787 <secondary>sorting</secondary>
14788 </indexterm>
14789 <indexterm role="concept">
14790 <primary>expansion</primary>
14791 <secondary>list sorting</secondary>
14792 </indexterm>
14793 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
14794 default, but the separator can be changed in the usual way.
14795 The &lt;<emphasis>comparator</emphasis>&gt; argument is interpreted as the operator
14796 of a two-argument expansion condition.
14797 The numeric operators plus ge, gt, le, lt (and ~i variants) are supported.
14798 The comparison should return true when applied to two values
14799 if the first value should sort before the second value.
14800 The &lt;<emphasis>extractor</emphasis>&gt; expansion is applied repeatedly to elements of the list,
14801 the element being placed in <varname>$item</varname>,
14802 to give values for comparison.
14803 </para>
14804 <para>
14805 The item result is a sorted list,
14806 with the original list separator,
14807 of the list elements (in full) of the original.
14808 </para>
14809 <para>
14810 Examples:
14811 </para>
14812 <literallayout class="monospaced">
14813 ${sort{3:2:1:4}{&lt;}{$item}}
14814 </literallayout>
14815 <para>
14816 sorts a list of numbers, and
14817 </para>
14818 <literallayout class="monospaced">
14819 ${sort {${lookup dnsdb{&gt;:,,mx=example.com}}} {&lt;} {${listextract{1}{&lt;,$item}}}}
14820 </literallayout>
14821 <para>
14822 will sort an MX lookup into priority order.
14823 </para>
14824 </listitem></varlistentry>
14825 <varlistentry>
14826 <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>
14827 <listitem>
14828 <para>
14829 <indexterm role="concept">
14830 <primary><option>substr</option> expansion item</primary>
14831 </indexterm>
14832 <indexterm role="concept">
14833 <primary>substring extraction</primary>
14834 </indexterm>
14835 <indexterm role="concept">
14836 <primary>expansion</primary>
14837 <secondary>substring extraction</secondary>
14838 </indexterm>
14839 The three strings are expanded; the first two must yield numbers. Call them
14840 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
14841 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
14842 can use the simpler operator notation that avoids some of the braces:
14843 </para>
14844 <literallayout class="monospaced">
14845 ${substr_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
14846 </literallayout>
14847 <para>
14848 The second number is optional (in both notations).
14849 If it is absent in the simpler format, the preceding underscore must also be
14850 omitted.
14851 </para>
14852 <para>
14853 The <option>substr</option> item can be used to extract more general substrings than
14854 <option>length</option>. The first number, &lt;<emphasis>n</emphasis>&gt;, is a starting offset, and &lt;<emphasis>m</emphasis>&gt; is the
14855 length required. For example
14856 </para>
14857 <literallayout class="monospaced">
14858 ${substr{3}{2}{$local_part}}
14859 </literallayout>
14860 <para>
14861 If the starting offset is greater than the string length the result is the
14862 null string; if the length plus starting offset is greater than the string
14863 length, the result is the right-hand part of the string, starting from the
14864 given offset. The first character in the string has offset zero.
14865 </para>
14866 <para>
14867 The <option>substr</option> expansion item can take negative offset values to count
14868 from the right-hand end of its operand. The last character is offset -1, the
14869 second-last is offset -2, and so on. Thus, for example,
14870 </para>
14871 <literallayout class="monospaced">
14872 ${substr{-5}{2}{1234567}}
14873 </literallayout>
14874 <para>
14875 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
14876 length of the string, the substring starts at the beginning of the string, and
14877 the length is reduced by the amount of overshoot. Thus, for example,
14878 </para>
14879 <literallayout class="monospaced">
14880 ${substr{-5}{2}{12}}
14881 </literallayout>
14882 <para>
14883 yields an empty string, but
14884 </para>
14885 <literallayout class="monospaced">
14886 ${substr{-3}{2}{12}}
14887 </literallayout>
14888 <para>
14889 yields <quote>1</quote>.
14890 </para>
14891 <para>
14892 When the second number is omitted from <option>substr</option>, the remainder of the string
14893 is taken if the offset is positive. If it is negative, all characters in the
14894 string preceding the offset point are taken. For example, an offset of -1 and
14895 no length, as in these semantically identical examples:
14896 </para>
14897 <literallayout class="monospaced">
14898 ${substr_-1:abcde}
14899 ${substr{-1}{abcde}}
14900 </literallayout>
14901 <para>
14902 yields all but the last character of the string, that is, <quote>abcd</quote>.
14903 </para>
14904 </listitem></varlistentry>
14905 <varlistentry>
14906 <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>
14907 <listitem>
14908 <para>
14909 <indexterm role="concept">
14910 <primary>expansion</primary>
14911 <secondary>character translation</secondary>
14912 </indexterm>
14913 <indexterm role="concept">
14914 <primary><option>tr</option> expansion item</primary>
14915 </indexterm>
14916 This item does single-character translation on its subject string. The second
14917 argument is a list of characters to be translated in the subject string. Each
14918 matching character is replaced by the corresponding character from the
14919 replacement list. For example
14920 </para>
14921 <literallayout class="monospaced">
14922 ${tr{abcdea}{ac}{13}}
14923 </literallayout>
14924 <para>
14925 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
14926 last occurrence is used. If the third string is shorter than the second, its
14927 last character is replicated. However, if it is empty, no translation takes
14928 place.
14929 </para>
14930 </listitem></varlistentry>
14931 </variablelist>
14932 </section>
14933 <section id="SECTexpop">
14934 <title>Expansion operators</title>
14935 <para>
14936 <indexterm role="concept">
14937 <primary>expansion</primary>
14938 <secondary>operators</secondary>
14939 </indexterm>
14940 For expansion items that perform transformations on a single argument string,
14941 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
14942 The substring is first expanded before the operation is applied to it. The
14943 following operations can be performed:
14944 </para>
14945 <variablelist>
14946 <varlistentry>
14947 <term><emphasis role="bold">${address:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14948 <listitem>
14949 <para>
14950 <indexterm role="concept">
14951 <primary>expansion</primary>
14952 <secondary>RFC 2822 address handling</secondary>
14953 </indexterm>
14954 <indexterm role="concept">
14955 <primary><option>address</option> expansion item</primary>
14956 </indexterm>
14957 The string is interpreted as an RFC 2822 address, as it might appear in a
14958 header line, and the effective address is extracted from it. If the string does
14959 not parse successfully, the result is empty.
14960 </para>
14961 </listitem></varlistentry>
14962 <varlistentry>
14963 <term><emphasis role="bold">${addresses:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14964 <listitem>
14965 <para>
14966 <indexterm role="concept">
14967 <primary>expansion</primary>
14968 <secondary>RFC 2822 address handling</secondary>
14969 </indexterm>
14970 <indexterm role="concept">
14971 <primary><option>addresses</option> expansion item</primary>
14972 </indexterm>
14973 The string (after expansion) is interpreted as a list of addresses in RFC
14974 2822 format, such as can be found in a <emphasis>To:</emphasis> or <emphasis>Cc:</emphasis> header line. The
14975 operative address (<emphasis>local-part@domain</emphasis>) is extracted from each item, and the
14976 result of the expansion is a colon-separated list, with appropriate
14977 doubling of colons should any happen to be present in the email addresses.
14978 Syntactically invalid RFC2822 address items are omitted from the output.
14979 </para>
14980 <para>
14981 It is possible to specify a character other than colon for the output
14982 separator by starting the string with &gt; followed by the new separator
14983 character. For example:
14984 </para>
14985 <literallayout class="monospaced">
14986 ${addresses:&gt;&amp; Chief &lt;ceo@up.stairs&gt;, sec@base.ment (dogsbody)}
14987 </literallayout>
14988 <para>
14989 expands to <literal>ceo@up.stairs&amp;sec@base.ment</literal>. Compare the <emphasis role="bold">address</emphasis> (singular)
14990 expansion item, which extracts the working address from a single RFC2822
14991 address. See the <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and <emphasis role="bold">reduce</emphasis> items for ways of
14992 processing lists.
14993 </para>
14994 <para>
14995 To clarify "list of addresses in RFC 2822 format" mentioned above, Exim follows
14996 a strict interpretation of header line formatting.  Exim parses the bare,
14997 unquoted portion of an email address and if it finds a comma, treats it as an
14998 email address separator. For the example header line:
14999 </para>
15000 <literallayout class="monospaced">
15001 From: =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;
15002 </literallayout>
15003 <para>
15004 The first example below demonstrates that Q-encoded email addresses are parsed
15005 properly if it is given the raw header (in this example, <literal>$rheader_from:</literal>).
15006 It does not see the comma because it&#x2019;s still encoded as "=2C".  The second
15007 example below is passed the contents of <literal>$header_from:</literal>, meaning it gets
15008 de-mimed. Exim sees the decoded "," so it treats it as <emphasis role="bold">two</emphasis> email addresses.
15009 The third example shows that the presence of a comma is skipped when it is
15010 quoted.
15011 </para>
15012 <literallayout class="monospaced">
15013 # exim -be '${addresses:From: \
15014 =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;}'
15015 user@example.com
15016 # exim -be '${addresses:From: Last, First &lt;user@example.com&gt;}'
15017 Last:user@example.com
15018 # exim -be '${addresses:From: "Last, First" &lt;user@example.com&gt;}'
15019 user@example.com
15020 </literallayout>
15021 </listitem></varlistentry>
15022 <varlistentry>
15023 <term><emphasis role="bold">${base62:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15024 <listitem>
15025 <para>
15026 <indexterm role="concept">
15027 <primary><option>base62</option> expansion item</primary>
15028 </indexterm>
15029 <indexterm role="concept">
15030 <primary>expansion</primary>
15031 <secondary>conversion to base 62</secondary>
15032 </indexterm>
15033 The string must consist entirely of decimal digits. The number is converted to
15034 base 62 and output as a string of six characters, including leading zeros. In
15035 the few operating environments where Exim uses base 36 instead of base 62 for
15036 its message identifiers (because those systems do not have case-sensitive file
15037 names), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just to
15038 be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
15039 </para>
15040 </listitem></varlistentry>
15041 <varlistentry>
15042 <term><emphasis role="bold">${base62d:</emphasis>&lt;<emphasis>base-62&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15043 <listitem>
15044 <para>
15045 <indexterm role="concept">
15046 <primary><option>base62d</option> expansion item</primary>
15047 </indexterm>
15048 <indexterm role="concept">
15049 <primary>expansion</primary>
15050 <secondary>conversion to base 62</secondary>
15051 </indexterm>
15052 The string must consist entirely of base-62 digits, or, in operating
15053 environments where Exim uses base 36 instead of base 62 for its message
15054 identifiers, base-36 digits. The number is converted to decimal and output as a
15055 string.
15056 </para>
15057 </listitem></varlistentry>
15058 <varlistentry revisionflag="changed">
15059 <term><emphasis role="bold">${base64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15060 <listitem>
15061 <para revisionflag="changed">
15062 <indexterm role="concept">
15063 <primary>expansion</primary>
15064 <secondary>base64 encoding</secondary>
15065 </indexterm>
15066 <indexterm role="concept">
15067 <primary>base64 encoding</primary>
15068 <secondary>in string expansion</secondary>
15069 </indexterm>
15070 <indexterm role="concept">
15071 <primary><option>base64</option> expansion item</primary>
15072 </indexterm>
15073 <indexterm role="concept">
15074 <primary>certificate</primary>
15075 <secondary>base64 of DER</secondary>
15076 </indexterm>
15077 This operator converts a string into one that is base64 encoded.
15078 </para>
15079 <para revisionflag="changed">
15080 If the string is a single variable of type certificate,
15081 returns the base64 encoding of the DER form of the certificate.
15082 </para>
15083 </listitem></varlistentry>
15084 <varlistentry revisionflag="changed">
15085 <term><emphasis role="bold">${base64d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15086 <listitem>
15087 <para revisionflag="changed">
15088 <indexterm role="concept">
15089 <primary>expansion</primary>
15090 <secondary>base64 decoding</secondary>
15091 </indexterm>
15092 <indexterm role="concept">
15093 <primary>base64 decoding</primary>
15094 <secondary>in string expansion</secondary>
15095 </indexterm>
15096 <indexterm role="concept">
15097 <primary><option>base64d</option> expansion item</primary>
15098 </indexterm>
15099 This operator converts a base64-encoded string into the un-coded form.
15100 </para>
15101 </listitem></varlistentry>
15102 <varlistentry>
15103 <term><emphasis role="bold">${domain:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15104 <listitem>
15105 <para>
15106 <indexterm role="concept">
15107 <primary>domain</primary>
15108 <secondary>extraction</secondary>
15109 </indexterm>
15110 <indexterm role="concept">
15111 <primary>expansion</primary>
15112 <secondary>domain extraction</secondary>
15113 </indexterm>
15114 The string is interpreted as an RFC 2822 address and the domain is extracted
15115 from it. If the string does not parse successfully, the result is empty.
15116 </para>
15117 </listitem></varlistentry>
15118 <varlistentry>
15119 <term><emphasis role="bold">${escape:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15120 <listitem>
15121 <para>
15122 <indexterm role="concept">
15123 <primary>expansion</primary>
15124 <secondary>escaping non-printing characters</secondary>
15125 </indexterm>
15126 <indexterm role="concept">
15127 <primary><option>escape</option> expansion item</primary>
15128 </indexterm>
15129 If the string contains any non-printing characters, they are converted to
15130 escape sequences starting with a backslash. Whether characters with the most
15131 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
15132 is controlled by the <option>print_topbitchars</option> option.
15133 </para>
15134 </listitem></varlistentry>
15135 <varlistentry>
15136 <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>
15137 <listitem>
15138 <para>
15139 <indexterm role="concept">
15140 <primary>expansion</primary>
15141 <secondary>expression evaluation</secondary>
15142 </indexterm>
15143 <indexterm role="concept">
15144 <primary>expansion</primary>
15145 <secondary>arithmetic expression</secondary>
15146 </indexterm>
15147 <indexterm role="concept">
15148 <primary><option>eval</option> expansion item</primary>
15149 </indexterm>
15150 These items supports simple arithmetic and bitwise logical operations in
15151 expansion strings. The string (after expansion) must be a conventional
15152 arithmetic expression, but it is limited to basic arithmetic operators, bitwise
15153 logical operators, and parentheses. All operations are carried out using
15154 integer arithmetic. The operator priorities are as follows (the same as in the
15155 C programming language):
15156 </para>
15157 <informaltable frame="none">
15158 <tgroup cols="2" colsep="0" rowsep="0">
15159 <colspec colwidth="70pt" align="left"/>
15160 <colspec colwidth="300pt" align="left"/>
15161 <tbody>
15162 <row>
15163 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>highest:</emphasis></entry>
15164 <entry>not (~), negate (-)</entry>
15165 </row>
15166 <row>
15167 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
15168 <entry>multiply (*), divide (/), remainder (%)</entry>
15169 </row>
15170 <row>
15171 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
15172 <entry>plus (+), minus (-)</entry>
15173 </row>
15174 <row>
15175 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
15176 <entry>shift-left (&lt;&lt;), shift-right (&gt;&gt;)</entry>
15177 </row>
15178 <row>
15179 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
15180 <entry>and (&amp;)</entry>
15181 </row>
15182 <row>
15183 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
15184 <entry>xor (^)</entry>
15185 </row>
15186 <row>
15187 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>lowest:</emphasis></entry>
15188 <entry>or (|)</entry>
15189 </row>
15190 </tbody>
15191 </tgroup>
15192 </informaltable>
15193 <para>
15194 Binary operators with the same priority are evaluated from left to right. White
15195 space is permitted before or after operators.
15196 </para>
15197 <para>
15198 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
15199 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
15200 decimal, even if they start with a leading zero; hexadecimal numbers are not
15201 permitted. This can be useful when processing numbers extracted from dates or
15202 times, which often do have leading zeros.
15203 </para>
15204 <para>
15205 A number may be followed by <quote>K</quote>, <quote>M</quote> or <quote>G</quote> to multiply it by 1024, 1024*1024
15206 or 1024*1024*1024,
15207 respectively. Negative numbers are supported. The result of the computation is
15208 a decimal representation of the answer (without <quote>K</quote>, <quote>M</quote> or <quote>G</quote>). For example:
15209 </para>
15210 <literallayout>
15211 <literal>${eval:1+1}            </literal>  yields 2
15212 <literal>${eval:1+2*3}          </literal>  yields 7
15213 <literal>${eval:(1+2)*3}        </literal>  yields 9
15214 <literal>${eval:2+42%5}         </literal>  yields 4
15215 <literal>${eval:0xc&amp;5}          </literal>  yields 4
15216 <literal>${eval:0xc|5}          </literal>  yields 13
15217 <literal>${eval:0xc^5}          </literal>  yields 9
15218 <literal>${eval:0xc&gt;&gt;1}         </literal>  yields 6
15219 <literal>${eval:0xc&lt;&lt;1}         </literal>  yields 24
15220 <literal>${eval:~255&amp;0x1234}    </literal>  yields 4608
15221 <literal>${eval:-(~255&amp;0x1234)} </literal>  yields -4608
15222 </literallayout>
15223 <para>
15224 As a more realistic example, in an ACL you might have
15225 </para>
15226 <literallayout class="monospaced">
15227 deny   message = Too many bad recipients
15228        condition =                    \
15229          ${if and {                   \
15230            {&gt;{$rcpt_count}{10}}       \
15231            {                          \
15232            &lt;                          \
15233              {$recipients_count}      \
15234              {${eval:$rcpt_count/2}}  \
15235            }                          \
15236          }{yes}{no}}
15237 </literallayout>
15238 <para>
15239 The condition is true if there have been more than 10 RCPT commands and
15240 fewer than half of them have resulted in a valid recipient.
15241 </para>
15242 </listitem></varlistentry>
15243 <varlistentry>
15244 <term><emphasis role="bold">${expand:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15245 <listitem>
15246 <para>
15247 <indexterm role="concept">
15248 <primary>expansion</primary>
15249 <secondary>re-expansion of substring</secondary>
15250 </indexterm>
15251 The <option>expand</option> operator causes a string to be expanded for a second time. For
15252 example,
15253 </para>
15254 <literallayout class="monospaced">
15255 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
15256 </literallayout>
15257 <para>
15258 first looks up a string in a file while expanding the operand for <option>expand</option>,
15259 and then re-expands what it has found.
15260 </para>
15261 </listitem></varlistentry>
15262 <varlistentry>
15263 <term><emphasis role="bold">${from_utf8:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15264 <listitem>
15265 <para>
15266 <indexterm role="concept">
15267 <primary>Unicode</primary>
15268 </indexterm>
15269 <indexterm role="concept">
15270 <primary>UTF-8</primary>
15271 <secondary>conversion from</secondary>
15272 </indexterm>
15273 <indexterm role="concept">
15274 <primary>expansion</primary>
15275 <secondary>UTF-8 conversion</secondary>
15276 </indexterm>
15277 <indexterm role="concept">
15278 <primary><option>from_utf8</option> expansion item</primary>
15279 </indexterm>
15280 The world is slowly moving towards Unicode, although there are no standards for
15281 email yet. However, other applications (including some databases) are starting
15282 to store data in Unicode, using UTF-8 encoding. This operator converts from a
15283 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
15284 converted to underscores. The input must be a valid UTF-8 string. If it is not,
15285 the result is an undefined sequence of bytes.
15286 </para>
15287 <para>
15288 Unicode code points with values less than 256 are compatible with ASCII and
15289 ISO-8859-1 (also known as Latin-1).
15290 For example, character 169 is the copyright symbol in both cases, though the
15291 way it is encoded is different. In UTF-8, more than one byte is needed for
15292 characters with code values greater than 127, whereas ISO-8859-1 is a
15293 single-byte encoding (but thereby limited to 256 characters). This makes
15294 translation from UTF-8 to ISO-8859-1 straightforward.
15295 </para>
15296 </listitem></varlistentry>
15297 <varlistentry>
15298 <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>
15299 <listitem>
15300 <para>
15301 <indexterm role="concept">
15302 <primary>hash function</primary>
15303 <secondary>textual</secondary>
15304 </indexterm>
15305 <indexterm role="concept">
15306 <primary>expansion</primary>
15307 <secondary>textual hash</secondary>
15308 </indexterm>
15309 The <option>hash</option> operator is a simpler interface to the hashing function that can
15310 be used when the two parameters are fixed numbers (as opposed to strings that
15311 change when expanded). The effect is the same as
15312 </para>
15313 <literallayout class="monospaced">
15314 ${hash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
15315 </literallayout>
15316 <para>
15317 See the description of the general <option>hash</option> item above for details. The
15318 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
15319 </para>
15320 </listitem></varlistentry>
15321 <varlistentry>
15322 <term><emphasis role="bold">${hex2b64:</emphasis>&lt;<emphasis>hexstring</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15323 <listitem>
15324 <para>
15325 <indexterm role="concept">
15326 <primary>base64 encoding</primary>
15327 <secondary>conversion from hex</secondary>
15328 </indexterm>
15329 <indexterm role="concept">
15330 <primary>expansion</primary>
15331 <secondary>hex to base64</secondary>
15332 </indexterm>
15333 <indexterm role="concept">
15334 <primary><option>hex2b64</option> expansion item</primary>
15335 </indexterm>
15336 This operator converts a hex string into one that is base64 encoded. This can
15337 be useful for processing the output of the MD5 and SHA-1 hashing functions.
15338 </para>
15339 </listitem></varlistentry>
15340 <varlistentry>
15341 <term><emphasis role="bold">${hexquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15342 <listitem>
15343 <para>
15344 <indexterm role="concept">
15345 <primary>quoting</primary>
15346 <secondary>hex-encoded unprintable characters</secondary>
15347 </indexterm>
15348 <indexterm role="concept">
15349 <primary><option>hexquote</option> expansion item</primary>
15350 </indexterm>
15351 This operator converts non-printable characters in a string into a hex
15352 escape form. Byte values between 33 (!) and 126 (~) inclusive are left
15353 as is, and other byte values are converted to <literal>\xNN</literal>, for example a
15354 byte value 127 is converted to <literal>\x7f</literal>.
15355 </para>
15356 </listitem></varlistentry>
15357 <varlistentry revisionflag="changed">
15358 <term><emphasis role="bold">${ipv6denorm:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15359 <listitem>
15360 <para revisionflag="changed">
15361 <indexterm role="concept">
15362 <primary><option>ipv6denorm</option> expansion item</primary>
15363 </indexterm>
15364 <indexterm role="concept">
15365 <primary>IP address</primary>
15366 <secondary>normalisation</secondary>
15367 </indexterm>
15368 This expands an IPv6 address to a full eight-element colon-separated set
15369 of hex digits including leading zeroes.
15370 A trailing ipv4-style dotted-decimal set is converted to hex.
15371 Pure IPv4 addresses are converted to IPv4-mapped IPv6.
15372 </para>
15373 </listitem></varlistentry>
15374 <varlistentry revisionflag="changed">
15375 <term><emphasis role="bold">${ipv6norm:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15376 <listitem>
15377 <para revisionflag="changed">
15378 <indexterm role="concept">
15379 <primary><option>ipv6norm</option> expansion item</primary>
15380 </indexterm>
15381 <indexterm role="concept">
15382 <primary>IP address</primary>
15383 <secondary>normalisation</secondary>
15384 </indexterm>
15385 <indexterm role="concept">
15386 <primary>IP address</primary>
15387 <secondary>canonical form</secondary>
15388 </indexterm>
15389 This converts an IPv6 address to canonical form.
15390 Leading zeroes of groups are omitted, and the longest
15391 set of zero-valued groups is replaced with a double colon.
15392 A trailing ipv4-style dotted-decimal set is converted to hex.
15393 Pure IPv4 addresses are converted to IPv4-mapped IPv6.
15394 </para>
15395 </listitem></varlistentry>
15396 <varlistentry>
15397 <term><emphasis role="bold">${lc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15398 <listitem>
15399 <para>
15400 <indexterm role="concept">
15401 <primary>case forcing in strings</primary>
15402 </indexterm>
15403 <indexterm role="concept">
15404 <primary>string</primary>
15405 <secondary>case forcing</secondary>
15406 </indexterm>
15407 <indexterm role="concept">
15408 <primary>lower casing</primary>
15409 </indexterm>
15410 <indexterm role="concept">
15411 <primary>expansion</primary>
15412 <secondary>case forcing</secondary>
15413 </indexterm>
15414 <indexterm role="concept">
15415 <primary><option>lc</option> expansion item</primary>
15416 </indexterm>
15417 This forces the letters in the string into lower-case, for example:
15418 </para>
15419 <literallayout class="monospaced">
15420 ${lc:$local_part}
15421 </literallayout>
15422 </listitem></varlistentry>
15423 <varlistentry>
15424 <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>
15425 <listitem>
15426 <para>
15427 <indexterm role="concept">
15428 <primary>expansion</primary>
15429 <secondary>string truncation</secondary>
15430 </indexterm>
15431 <indexterm role="concept">
15432 <primary><option>length</option> expansion item</primary>
15433 </indexterm>
15434 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
15435 can be used when the parameter is a fixed number (as opposed to a string that
15436 changes when expanded). The effect is the same as
15437 </para>
15438 <literallayout class="monospaced">
15439 ${length{&lt;number&gt;}{&lt;string&gt;}}
15440 </literallayout>
15441 <para>
15442 See the description of the general <option>length</option> item above for details. Note that
15443 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
15444 when <option>length</option> is used as an operator.
15445 </para>
15446 </listitem></varlistentry>
15447 <varlistentry>
15448 <term><emphasis role="bold">${listcount:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15449 <listitem>
15450 <para>
15451 <indexterm role="concept">
15452 <primary>expansion</primary>
15453 <secondary>list item count</secondary>
15454 </indexterm>
15455 <indexterm role="concept">
15456 <primary>list</primary>
15457 <secondary>item count</secondary>
15458 </indexterm>
15459 <indexterm role="concept">
15460 <primary>list</primary>
15461 <secondary>count of items</secondary>
15462 </indexterm>
15463 <indexterm role="concept">
15464 <primary><option>listcount</option> expansion item</primary>
15465 </indexterm>
15466 The string is interpreted as a list and the number of items is returned.
15467 </para>
15468 </listitem></varlistentry>
15469 <varlistentry>
15470 <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>
15471 <listitem>
15472 <para>
15473 <indexterm role="concept">
15474 <primary>expansion</primary>
15475 <secondary>named list</secondary>
15476 </indexterm>
15477 <indexterm role="concept">
15478 <primary><option>listnamed</option> expansion item</primary>
15479 </indexterm>
15480 The name is interpreted as a named list and the content of the list is returned,
15481 expanding any referenced lists, re-quoting as needed for colon-separation.
15482 If the optional type is given it must be one of "a", "d", "h" or "l"
15483 and selects address-, domain-, host- or localpart- lists to search among respectively.
15484 Otherwise all types are searched in an undefined order and the first
15485 matching list is returned.
15486 </para>
15487 </listitem></varlistentry>
15488 <varlistentry>
15489 <term><emphasis role="bold">${local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15490 <listitem>
15491 <para>
15492 <indexterm role="concept">
15493 <primary>expansion</primary>
15494 <secondary>local part extraction</secondary>
15495 </indexterm>
15496 <indexterm role="concept">
15497 <primary><option>local_part</option> expansion item</primary>
15498 </indexterm>
15499 The string is interpreted as an RFC 2822 address and the local part is
15500 extracted from it. If the string does not parse successfully, the result is
15501 empty.
15502 </para>
15503 </listitem></varlistentry>
15504 <varlistentry>
15505 <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>
15506 <listitem>
15507 <para>
15508 <indexterm role="concept">
15509 <primary>masked IP address</primary>
15510 </indexterm>
15511 <indexterm role="concept">
15512 <primary>IP address</primary>
15513 <secondary>masking</secondary>
15514 </indexterm>
15515 <indexterm role="concept">
15516 <primary>CIDR notation</primary>
15517 </indexterm>
15518 <indexterm role="concept">
15519 <primary>expansion</primary>
15520 <secondary>IP address masking</secondary>
15521 </indexterm>
15522 <indexterm role="concept">
15523 <primary><option>mask</option> expansion item</primary>
15524 </indexterm>
15525 If the form of the string to be operated on is not an IP address followed by a
15526 slash and an integer (that is, a network address in CIDR notation), the
15527 expansion fails. Otherwise, this operator converts the IP address to binary,
15528 masks off the least significant bits according to the bit count, and converts
15529 the result back to text, with mask appended. For example,
15530 </para>
15531 <literallayout class="monospaced">
15532 ${mask:10.111.131.206/28}
15533 </literallayout>
15534 <para>
15535 returns the string <quote>10.111.131.192/28</quote>. Since this operation is expected to
15536 be mostly used for looking up masked addresses in files, the result for an IPv6
15537 address uses dots to separate components instead of colons, because colon
15538 terminates a key string in lsearch files. So, for example,
15539 </para>
15540 <literallayout class="monospaced">
15541 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
15542 </literallayout>
15543 <para>
15544 returns the string
15545 </para>
15546 <literallayout class="monospaced">
15547 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
15548 </literallayout>
15549 <para>
15550 Letters in IPv6 addresses are always output in lower case.
15551 </para>
15552 </listitem></varlistentry>
15553 <varlistentry>
15554 <term><emphasis role="bold">${md5:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15555 <listitem>
15556 <para>
15557 <indexterm role="concept">
15558 <primary>MD5 hash</primary>
15559 </indexterm>
15560 <indexterm role="concept">
15561 <primary>expansion</primary>
15562 <secondary>MD5 hash</secondary>
15563 </indexterm>
15564 <indexterm role="concept">
15565 <primary>certificate</primary>
15566 <secondary>fingerprint</secondary>
15567 </indexterm>
15568 <indexterm role="concept">
15569 <primary><option>md5</option> expansion item</primary>
15570 </indexterm>
15571 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
15572 as a 32-digit hexadecimal number, in which any letters are in lower case.
15573 </para>
15574 <para>
15575 If the string is a single variable of type certificate,
15576 returns the MD5 hash fingerprint of the certificate.
15577 </para>
15578 </listitem></varlistentry>
15579 <varlistentry>
15580 <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>
15581 <listitem>
15582 <para>
15583 <indexterm role="concept">
15584 <primary>expansion</primary>
15585 <secondary>numeric hash</secondary>
15586 </indexterm>
15587 <indexterm role="concept">
15588 <primary>hash function</primary>
15589 <secondary>numeric</secondary>
15590 </indexterm>
15591 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
15592 that can be used when the two parameters are fixed numbers (as opposed to
15593 strings that change when expanded). The effect is the same as
15594 </para>
15595 <literallayout class="monospaced">
15596 ${nhash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
15597 </literallayout>
15598 <para>
15599 See the description of the general <option>nhash</option> item above for details.
15600 </para>
15601 </listitem></varlistentry>
15602 <varlistentry>
15603 <term><emphasis role="bold">${quote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15604 <listitem>
15605 <para>
15606 <indexterm role="concept">
15607 <primary>quoting</primary>
15608 <secondary>in string expansions</secondary>
15609 </indexterm>
15610 <indexterm role="concept">
15611 <primary>expansion</primary>
15612 <secondary>quoting</secondary>
15613 </indexterm>
15614 <indexterm role="concept">
15615 <primary><option>quote</option> expansion item</primary>
15616 </indexterm>
15617 The <option>quote</option> operator puts its argument into double quotes if it
15618 is an empty string or
15619 contains anything other than letters, digits, underscores, dots, and hyphens.
15620 Any occurrences of double quotes and backslashes are escaped with a backslash.
15621 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
15622 respectively For example,
15623 </para>
15624 <literallayout class="monospaced">
15625 ${quote:ab"*"cd}
15626 </literallayout>
15627 <para>
15628 becomes
15629 </para>
15630 <literallayout class="monospaced">
15631 "ab\"*\"cd"
15632 </literallayout>
15633 <para>
15634 The place where this is useful is when the argument is a substitution from a
15635 variable or a message header.
15636 </para>
15637 </listitem></varlistentry>
15638 <varlistentry>
15639 <term><emphasis role="bold">${quote_local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15640 <listitem>
15641 <para>
15642 <indexterm role="concept">
15643 <primary><option>quote_local_part</option> expansion item</primary>
15644 </indexterm>
15645 This operator is like <option>quote</option>, except that it quotes the string only if
15646 required to do so by the rules of RFC 2822 for quoting local parts. For
15647 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
15648 If you are creating a new email address from the contents of <varname>$local_part</varname>
15649 (or any other unknown data), you should always use this operator.
15650 </para>
15651 </listitem></varlistentry>
15652 <varlistentry>
15653 <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>
15654 <listitem>
15655 <para>
15656 <indexterm role="concept">
15657 <primary>quoting</primary>
15658 <secondary>lookup-specific</secondary>
15659 </indexterm>
15660 This operator applies lookup-specific quoting rules to the string. Each
15661 query-style lookup type has its own quoting rules which are described with
15662 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
15663 </para>
15664 <literallayout class="monospaced">
15665 ${quote_ldap:two * two}
15666 </literallayout>
15667 <para>
15668 returns
15669 </para>
15670 <literallayout class="monospaced">
15671 two%20%5C2A%20two
15672 </literallayout>
15673 <para>
15674 For single-key lookup types, no quoting is ever necessary and this operator
15675 yields an unchanged string.
15676 </para>
15677 </listitem></varlistentry>
15678 <varlistentry>
15679 <term><emphasis role="bold">${randint:</emphasis>&lt;<emphasis>n</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15680 <listitem>
15681 <para>
15682 <indexterm role="concept">
15683 <primary>random number</primary>
15684 </indexterm>
15685 This operator returns a somewhat random number which is less than the
15686 supplied number and is at least 0.  The quality of this randomness depends
15687 on how Exim was built; the values are not suitable for keying material.
15688 If Exim is linked against OpenSSL then RAND_pseudo_bytes() is used.
15689 If Exim is linked against GnuTLS then gnutls_rnd(GNUTLS_RND_NONCE) is used,
15690 for versions of GnuTLS with that function.
15691 Otherwise, the implementation may be arc4random(), random() seeded by
15692 srandomdev() or srandom(), or a custom implementation even weaker than
15693 random().
15694 </para>
15695 </listitem></varlistentry>
15696 <varlistentry>
15697 <term><emphasis role="bold">${reverse_ip:</emphasis>&lt;<emphasis>ipaddr</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15698 <listitem>
15699 <para>
15700 <indexterm role="concept">
15701 <primary>expansion</primary>
15702 <secondary>IP address</secondary>
15703 </indexterm>
15704 This operator reverses an IP address; for IPv4 addresses, the result is in
15705 dotted-quad decimal form, while for IPv6 addresses the result is in
15706 dotted-nibble hexadecimal form.  In both cases, this is the "natural" form
15707 for DNS.  For example,
15708 </para>
15709 <literallayout class="monospaced">
15710 ${reverse_ip:192.0.2.4}
15711 ${reverse_ip:2001:0db8:c42:9:1:abcd:192.0.2.127}
15712 </literallayout>
15713 <para>
15714 returns
15715 </para>
15716 <literallayout class="monospaced">
15717 4.2.0.192
15718 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
15719 </literallayout>
15720 </listitem></varlistentry>
15721 <varlistentry>
15722 <term><emphasis role="bold">${rfc2047:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15723 <listitem>
15724 <para>
15725 <indexterm role="concept">
15726 <primary>expansion</primary>
15727 <secondary>RFC 2047</secondary>
15728 </indexterm>
15729 <indexterm role="concept">
15730 <primary>RFC 2047</primary>
15731 <secondary>expansion operator</secondary>
15732 </indexterm>
15733 <indexterm role="concept">
15734 <primary><option>rfc2047</option> expansion item</primary>
15735 </indexterm>
15736 This operator encodes text according to the rules of RFC 2047. This is an
15737 encoding that is used in header lines to encode non-ASCII characters. It is
15738 assumed that the input string is in the encoding specified by the
15739 <option>headers_charset</option> option, which gets its default at build time. If the string
15740 contains only characters in the range 33&ndash;126, and no instances of the
15741 characters
15742 </para>
15743 <literallayout class="monospaced">
15744 ? = ( ) &lt; &gt; @ , ; : \ " . [ ] _
15745 </literallayout>
15746 <para>
15747 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
15748 string, using as many <quote>encoded words</quote> as necessary to encode all the
15749 characters.
15750 </para>
15751 </listitem></varlistentry>
15752 <varlistentry>
15753 <term><emphasis role="bold">${rfc2047d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15754 <listitem>
15755 <para>
15756 <indexterm role="concept">
15757 <primary>expansion</primary>
15758 <secondary>RFC 2047</secondary>
15759 </indexterm>
15760 <indexterm role="concept">
15761 <primary>RFC 2047</primary>
15762 <secondary>decoding</secondary>
15763 </indexterm>
15764 <indexterm role="concept">
15765 <primary><option>rfc2047d</option> expansion item</primary>
15766 </indexterm>
15767 This operator decodes strings that are encoded as per RFC 2047. Binary zero
15768 bytes are replaced by question marks. Characters are converted into the
15769 character set defined by <option>headers_charset</option>. Overlong RFC 2047 <quote>words</quote> are
15770 not recognized unless <option>check_rfc2047_length</option> is set false.
15771 </para>
15772 <para>
15773 <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
15774 access a header line, RFC 2047 decoding is done automatically. You do not need
15775 to use this operator as well.
15776 </para>
15777 </listitem></varlistentry>
15778 <varlistentry>
15779 <term><emphasis role="bold">${rxquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15780 <listitem>
15781 <para>
15782 <indexterm role="concept">
15783 <primary>quoting</primary>
15784 <secondary>in regular expressions</secondary>
15785 </indexterm>
15786 <indexterm role="concept">
15787 <primary>regular expressions</primary>
15788 <secondary>quoting</secondary>
15789 </indexterm>
15790 <indexterm role="concept">
15791 <primary><option>rxquote</option> expansion item</primary>
15792 </indexterm>
15793 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
15794 characters in its argument. This is useful when substituting the values of
15795 variables or headers inside regular expressions.
15796 </para>
15797 </listitem></varlistentry>
15798 <varlistentry>
15799 <term><emphasis role="bold">${sha1:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15800 <listitem>
15801 <para>
15802 <indexterm role="concept">
15803 <primary>SHA-1 hash</primary>
15804 </indexterm>
15805 <indexterm role="concept">
15806 <primary>expansion</primary>
15807 <secondary>SHA-1 hashing</secondary>
15808 </indexterm>
15809 <indexterm role="concept">
15810 <primary>certificate</primary>
15811 <secondary>fingerprint</secondary>
15812 </indexterm>
15813 <indexterm role="concept">
15814 <primary><option>sha2</option> expansion item</primary>
15815 </indexterm>
15816 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
15817 it as a 40-digit hexadecimal number, in which any letters are in upper case.
15818 </para>
15819 <para>
15820 If the string is a single variable of type certificate,
15821 returns the SHA-1 hash fingerprint of the certificate.
15822 </para>
15823 </listitem></varlistentry>
15824 <varlistentry>
15825 <term><emphasis role="bold">${sha256:</emphasis>&lt;<emphasis>certificate</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15826 <listitem>
15827 <para>
15828 <indexterm role="concept">
15829 <primary>SHA-256 hash</primary>
15830 </indexterm>
15831 <indexterm role="concept">
15832 <primary>certificate</primary>
15833 <secondary>fingerprint</secondary>
15834 </indexterm>
15835 <indexterm role="concept">
15836 <primary>expansion</primary>
15837 <secondary>SHA-256 hashing</secondary>
15838 </indexterm>
15839 <indexterm role="concept">
15840 <primary><option>sha256</option> expansion item</primary>
15841 </indexterm>
15842 The <option>sha256</option> operator computes the SHA-256 hash fingerprint of the
15843 certificate,
15844 and returns
15845 it as a 64-digit hexadecimal number, in which any letters are in upper case.
15846 Only arguments which are a single variable of certificate type are supported.
15847 </para>
15848 </listitem></varlistentry>
15849 <varlistentry>
15850 <term><emphasis role="bold">${stat:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15851 <listitem>
15852 <para>
15853 <indexterm role="concept">
15854 <primary>expansion</primary>
15855 <secondary>statting a file</secondary>
15856 </indexterm>
15857 <indexterm role="concept">
15858 <primary>file</primary>
15859 <secondary>extracting characteristics</secondary>
15860 </indexterm>
15861 <indexterm role="concept">
15862 <primary><option>stat</option> expansion item</primary>
15863 </indexterm>
15864 The string, after expansion, must be a file path. A call to the <function>stat()</function>
15865 function is made for this path. If <function>stat()</function> fails, an error occurs and the
15866 expansion fails. If it succeeds, the data from the stat replaces the item, as a
15867 series of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; pairs, where the values are all numerical,
15868 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
15869 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
15870 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
15871 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
15872 can extract individual fields using the <option>extract</option> expansion item.
15873 </para>
15874 <para>
15875 The use of the <option>stat</option> expansion in users&#x2019; filter files can be locked out by
15876 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
15877 systems for files larger than 2GB.
15878 </para>
15879 </listitem></varlistentry>
15880 <varlistentry>
15881 <term><emphasis role="bold">${str2b64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15882 <listitem>
15883 <para>
15884 <indexterm role="concept">
15885 <primary><option>str2b64</option> expansion item</primary>
15886 </indexterm>
15887 </para>
15888 <para revisionflag="changed">
15889 Now deprecated, a synonym for the <option>base64</option> expansion operator.
15890 </para>
15891 </listitem></varlistentry>
15892 <varlistentry>
15893 <term><emphasis role="bold">${strlen:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15894 <listitem>
15895 <para>
15896 <indexterm role="concept">
15897 <primary>expansion</primary>
15898 <secondary>string length</secondary>
15899 </indexterm>
15900 <indexterm role="concept">
15901 <primary>string</primary>
15902 <secondary>length in expansion</secondary>
15903 </indexterm>
15904 <indexterm role="concept">
15905 <primary><option>strlen</option> expansion item</primary>
15906 </indexterm>
15907 The item is replace by the length of the expanded string, expressed as a
15908 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
15909 </para>
15910 </listitem></varlistentry>
15911 <varlistentry>
15912 <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>
15913 <listitem>
15914 <para>
15915 <indexterm role="concept">
15916 <primary><option>substr</option> expansion item</primary>
15917 </indexterm>
15918 <indexterm role="concept">
15919 <primary>substring extraction</primary>
15920 </indexterm>
15921 <indexterm role="concept">
15922 <primary>expansion</primary>
15923 <secondary>substring expansion</secondary>
15924 </indexterm>
15925 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
15926 can be used when the two parameters are fixed numbers (as opposed to strings
15927 that change when expanded). The effect is the same as
15928 </para>
15929 <literallayout class="monospaced">
15930 ${substr{&lt;start&gt;}{&lt;length&gt;}{&lt;string&gt;}}
15931 </literallayout>
15932 <para>
15933 See the description of the general <option>substr</option> item above for details. The
15934 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
15935 </para>
15936 </listitem></varlistentry>
15937 <varlistentry>
15938 <term><emphasis role="bold">${time_eval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15939 <listitem>
15940 <para>
15941 <indexterm role="concept">
15942 <primary><option>time_eval</option> expansion item</primary>
15943 </indexterm>
15944 <indexterm role="concept">
15945 <primary>time interval</primary>
15946 <secondary>decoding</secondary>
15947 </indexterm>
15948 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
15949 seconds.
15950 </para>
15951 </listitem></varlistentry>
15952 <varlistentry>
15953 <term><emphasis role="bold">${time_interval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15954 <listitem>
15955 <para>
15956 <indexterm role="concept">
15957 <primary><option>time_interval</option> expansion item</primary>
15958 </indexterm>
15959 <indexterm role="concept">
15960 <primary>time interval</primary>
15961 <secondary>formatting</secondary>
15962 </indexterm>
15963 The argument (after sub-expansion) must be a sequence of decimal digits that
15964 represents an interval of time as a number of seconds. It is converted into a
15965 number of larger units and output in Exim&#x2019;s normal time format, for example,
15966 <literal>1w3d4h2m6s</literal>.
15967 </para>
15968 </listitem></varlistentry>
15969 <varlistentry>
15970 <term><emphasis role="bold">${uc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15971 <listitem>
15972 <para>
15973 <indexterm role="concept">
15974 <primary>case forcing in strings</primary>
15975 </indexterm>
15976 <indexterm role="concept">
15977 <primary>string</primary>
15978 <secondary>case forcing</secondary>
15979 </indexterm>
15980 <indexterm role="concept">
15981 <primary>upper casing</primary>
15982 </indexterm>
15983 <indexterm role="concept">
15984 <primary>expansion</primary>
15985 <secondary>case forcing</secondary>
15986 </indexterm>
15987 <indexterm role="concept">
15988 <primary><option>uc</option> expansion item</primary>
15989 </indexterm>
15990 This forces the letters in the string into upper-case.
15991 </para>
15992 </listitem></varlistentry>
15993 <varlistentry>
15994 <term><emphasis role="bold">${utf8clean:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15995 <listitem>
15996 <para>
15997 <indexterm role="concept">
15998 <primary>correction of invalid utf-8 sequences in strings</primary>
15999 </indexterm>
16000 <indexterm role="concept">
16001 <primary>utf-8</primary>
16002 <secondary>utf-8 sequences</secondary>
16003 </indexterm>
16004 <indexterm role="concept">
16005 <primary>incorrect utf-8</primary>
16006 </indexterm>
16007 <indexterm role="concept">
16008 <primary>expansion</primary>
16009 <secondary>utf-8 forcing</secondary>
16010 </indexterm>
16011 <indexterm role="concept">
16012 <primary><option>utf8clean</option> expansion item</primary>
16013 </indexterm>
16014 This replaces any invalid utf-8 sequence in the string by the character <literal>?</literal>.
16015 </para>
16016 </listitem></varlistentry>
16017 <varlistentry revisionflag="changed">
16018 <term><emphasis role="bold">${utf8_domain_to_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16019 <term><emphasis role="bold">${utf8_domain_from_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16020 <term><emphasis role="bold">${utf8_localpart_to_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16021 <term><emphasis role="bold">${utf8_localpart_from_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16022 <listitem>
16023 <para revisionflag="changed">
16024 <indexterm role="concept">
16025 <primary>expansion</primary>
16026 <secondary>UTF-8</secondary>
16027 </indexterm>
16028 <indexterm role="concept">
16029 <primary>UTF-8</primary>
16030 <secondary>expansion</secondary>
16031 </indexterm>
16032 <indexterm role="concept">
16033 <primary>EAI</primary>
16034 </indexterm>
16035 <indexterm role="concept">
16036 <primary>internationalisation</primary>
16037 </indexterm>
16038 <indexterm role="concept">
16039 <primary><option>utf8_domain_to_alabel</option> expansion item</primary>
16040 </indexterm>
16041 <indexterm role="concept">
16042 <primary><option>utf8_domain_from_alabel</option> expansion item</primary>
16043 </indexterm>
16044 <indexterm role="concept">
16045 <primary><option>utf8_localpart_to_alabel</option> expansion item</primary>
16046 </indexterm>
16047 <indexterm role="concept">
16048 <primary><option>utf8_localpart_from_alabel</option> expansion item</primary>
16049 </indexterm>
16050 These convert EAI mail name components between UTF-8 and a-label forms.
16051 For information on internationalisation support see <xref linkend="SECTi18nMTA"/>.
16052 </para>
16053 </listitem></varlistentry>
16054 </variablelist>
16055 </section>
16056 <section id="SECTexpcond">
16057 <title>Expansion conditions</title>
16058 <para>
16059 <indexterm role="concept" id="IIDexpcond" class="startofrange">
16060 <primary>expansion</primary>
16061 <secondary>conditions</secondary>
16062 </indexterm>
16063 The following conditions are available for testing by the <option>${if</option> construct
16064 while expanding strings:
16065 </para>
16066 <variablelist>
16067 <varlistentry>
16068 <term><emphasis role="bold">!</emphasis>&lt;<emphasis>condition</emphasis>&gt;</term>
16069 <listitem>
16070 <para>
16071 <indexterm role="concept">
16072 <primary>expansion</primary>
16073 <secondary>negating a condition</secondary>
16074 </indexterm>
16075 <indexterm role="concept">
16076 <primary>negation</primary>
16077 <secondary>in expansion condition</secondary>
16078 </indexterm>
16079 Preceding any condition with an exclamation mark negates the result of the
16080 condition.
16081 </para>
16082 </listitem></varlistentry>
16083 <varlistentry>
16084 <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>
16085 <listitem>
16086 <para>
16087 <indexterm role="concept">
16088 <primary>numeric comparison</primary>
16089 </indexterm>
16090 <indexterm role="concept">
16091 <primary>expansion</primary>
16092 <secondary>numeric comparison</secondary>
16093 </indexterm>
16094 There are a number of symbolic operators for doing numeric comparisons. They
16095 are:
16096 </para>
16097 <literallayout>
16098 <literal>=   </literal>   equal
16099 <literal>==  </literal>   equal
16100 <literal>&gt;   </literal>   greater
16101 <literal>&gt;=  </literal>   greater or equal
16102 <literal>&lt;   </literal>   less
16103 <literal>&lt;=  </literal>   less or equal
16104 </literallayout>
16105 <para>
16106 For example:
16107 </para>
16108 <literallayout class="monospaced">
16109 ${if &gt;{$message_size}{10M} ...
16110 </literallayout>
16111 <para>
16112 Note that the general negation operator provides for inequality testing. The
16113 two strings must take the form of optionally signed decimal integers,
16114 optionally followed by one of the letters <quote>K</quote>, <quote>M</quote> or <quote>G</quote> (in either upper or
16115 lower case), signifying multiplication by 1024, 1024*1024 or 1024*1024*1024, respectively.
16116 As a special case, the numerical value of an empty string is taken as
16117 zero.
16118 </para>
16119 <para>
16120 In all cases, a relative comparator OP is testing if &lt;<emphasis>string1</emphasis>&gt; OP
16121 &lt;<emphasis>string2</emphasis>&gt;; the above example is checking if <varname>$message_size</varname> is larger than
16122 10M, not if 10M is larger than <varname>$message_size</varname>.
16123 </para>
16124 </listitem></varlistentry>
16125 <varlistentry>
16126 <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>
16127 <listitem>
16128 <para>
16129 <indexterm role="concept">
16130 <primary>expansion</primary>
16131 <secondary>calling an acl</secondary>
16132 </indexterm>
16133 <indexterm role="concept">
16134 <primary><option>acl</option></primary>
16135 <secondary>expansion condition</secondary>
16136 </indexterm>
16137 The name and zero to nine argument strings are first expanded separately.  The expanded
16138 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
16139 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
16140 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
16141 and may use the variables; if another acl expansion is used the values
16142 are restored after it returns.  If the ACL sets
16143 a value using a "message =" modifier the variable $value becomes
16144 the result of the expansion, otherwise it is empty.
16145 If the ACL returns accept the condition is true; if deny, false.
16146 If the ACL returns defer the result is a forced-fail.
16147 </para>
16148 </listitem></varlistentry>
16149 <varlistentry>
16150 <term><emphasis role="bold">bool&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16151 <listitem>
16152 <para>
16153 <indexterm role="concept">
16154 <primary>expansion</primary>
16155 <secondary>boolean parsing</secondary>
16156 </indexterm>
16157 <indexterm role="concept">
16158 <primary><option>bool</option> expansion condition</primary>
16159 </indexterm>
16160 This condition turns a string holding a true or false representation into
16161 a boolean state.  It parses <quote>true</quote>, <quote>false</quote>, <quote>yes</quote> and <quote>no</quote>
16162 (case-insensitively); also integer numbers map to true if non-zero,
16163 false if zero.
16164 An empty string is treated as false.
16165 Leading and trailing whitespace is ignored;
16166 thus a string consisting only of whitespace is false.
16167 All other string values will result in expansion failure.
16168 </para>
16169 <para>
16170 When combined with ACL variables, this expansion condition will let you
16171 make decisions in one place and act on those decisions in another place.
16172 For example:
16173 </para>
16174 <literallayout class="monospaced">
16175 ${if bool{$acl_m_privileged_sender} ...
16176 </literallayout>
16177 </listitem></varlistentry>
16178 <varlistentry>
16179 <term><emphasis role="bold">bool_lax&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16180 <listitem>
16181 <para>
16182 <indexterm role="concept">
16183 <primary>expansion</primary>
16184 <secondary>boolean parsing</secondary>
16185 </indexterm>
16186 <indexterm role="concept">
16187 <primary><option>bool_lax</option> expansion condition</primary>
16188 </indexterm>
16189 Like <option>bool</option>, this condition turns a string into a boolean state.  But
16190 where <option>bool</option> accepts a strict set of strings, <option>bool_lax</option> uses the same
16191 loose definition that the Router <option>condition</option> option uses.  The empty string
16192 and the values <quote>false</quote>, <quote>no</quote> and <quote>0</quote> map to false, all others map to
16193 true.  Leading and trailing whitespace is ignored.
16194 </para>
16195 <para>
16196 Note that where <quote>bool{00}</quote> is false, <quote>bool_lax{00}</quote> is true.
16197 </para>
16198 </listitem></varlistentry>
16199 <varlistentry>
16200 <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>
16201 <listitem>
16202 <para>
16203 <indexterm role="concept">
16204 <primary>expansion</primary>
16205 <secondary>encrypted comparison</secondary>
16206 </indexterm>
16207 <indexterm role="concept">
16208 <primary>encrypted strings, comparing</primary>
16209 </indexterm>
16210 <indexterm role="concept">
16211 <primary><option>crypteq</option> expansion condition</primary>
16212 </indexterm>
16213 This condition is included in the Exim binary if it is built to support any
16214 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
16215 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
16216 included in the binary.
16217 </para>
16218 <para>
16219 The <option>crypteq</option> condition has two arguments. The first is encrypted and
16220 compared against the second, which is already encrypted. The second string may
16221 be in the LDAP form for storing encrypted strings, which starts with the
16222 encryption type in curly brackets, followed by the data. If the second string
16223 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
16224 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
16225 Typically this will be a field from a password file. An example of an encrypted
16226 string in LDAP form is:
16227 </para>
16228 <literallayout class="monospaced">
16229 {md5}CY9rzUYh03PK3k6DJie09g==
16230 </literallayout>
16231 <para>
16232 If such a string appears directly in an expansion, the curly brackets have to
16233 be quoted, because they are part of the expansion syntax. For example:
16234 </para>
16235 <literallayout class="monospaced">
16236 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
16237 </literallayout>
16238 <para>
16239 The following encryption types (whose names are matched case-independently) are
16240 supported:
16241 </para>
16242 <itemizedlist>
16243 <listitem>
16244 <para>
16245 <indexterm role="concept">
16246 <primary>MD5 hash</primary>
16247 </indexterm>
16248 <indexterm role="concept">
16249 <primary>base64 encoding</primary>
16250 <secondary>in encrypted password</secondary>
16251 </indexterm>
16252 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
16253 printable characters to compare with the remainder of the second string. If the
16254 length of the comparison string is 24, Exim assumes that it is base64 encoded
16255 (as in the above example). If the length is 32, Exim assumes that it is a
16256 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
16257 comparison fails.
16258 </para>
16259 </listitem>
16260 <listitem>
16261 <para>
16262 <indexterm role="concept">
16263 <primary>SHA-1 hash</primary>
16264 </indexterm>
16265 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
16266 printable characters to compare with the remainder of the second string. If the
16267 length of the comparison string is 28, Exim assumes that it is base64 encoded.
16268 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
16269 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
16270 </para>
16271 </listitem>
16272 <listitem>
16273 <para>
16274 <indexterm role="concept">
16275 <primary><function>crypt()</function></primary>
16276 </indexterm>
16277 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
16278 only the first eight characters of the password. However, in modern operating
16279 systems this is no longer true, and in many cases the entire password is used,
16280 whatever its length.
16281 </para>
16282 </listitem>
16283 <listitem>
16284 <para>
16285 <indexterm role="concept">
16286 <primary><function>crypt16()</function></primary>
16287 </indexterm>
16288 <option>{crypt16}</option> calls the <function>crypt16()</function> function, which was originally created to
16289 use up to 16 characters of the password in some operating systems. Again, in
16290 modern operating systems, more characters may be used.
16291 </para>
16292 </listitem>
16293 </itemizedlist>
16294 <para>
16295 Exim has its own version of <function>crypt16()</function>, which is just a double call to
16296 <function>crypt()</function>. For operating systems that have their own version, setting
16297 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
16298 operating system version instead of its own. This option is set by default in
16299 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
16300 support <function>crypt16()</function>.
16301 </para>
16302 <para>
16303 Some years after Exim&#x2019;s <function>crypt16()</function> was implemented, a user discovered that
16304 it was not using the same algorithm as some operating systems&#x2019; versions. It
16305 turns out that as well as <function>crypt16()</function> there is a function called
16306 <function>bigcrypt()</function> in some operating systems. This may or may not use the same
16307 algorithm, and both of them may be different to Exim&#x2019;s built-in <function>crypt16()</function>.
16308 </para>
16309 <para>
16310 However, since there is now a move away from the traditional <function>crypt()</function>
16311 functions towards using SHA1 and other algorithms, tidying up this area of
16312 Exim is seen as very low priority.
16313 </para>
16314 <para>
16315 If you do not put a encryption type (in curly brackets) in a <option>crypteq</option>
16316 comparison, the default is usually either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as
16317 determined by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default
16318 default is <literal>{crypt}</literal>. Whatever the default, you can always use either
16319 function by specifying it explicitly in curly brackets.
16320 </para>
16321 </listitem></varlistentry>
16322 <varlistentry>
16323 <term><emphasis role="bold">def:</emphasis>&lt;<emphasis>variable&nbsp;name</emphasis>&gt;</term>
16324 <listitem>
16325 <para>
16326 <indexterm role="concept">
16327 <primary>expansion</primary>
16328 <secondary>checking for empty variable</secondary>
16329 </indexterm>
16330 <indexterm role="concept">
16331 <primary><option>def</option> expansion condition</primary>
16332 </indexterm>
16333 The <option>def</option> condition must be followed by the name of one of the expansion
16334 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
16335 variable does not contain the empty string. For example:
16336 </para>
16337 <literallayout class="monospaced">
16338 ${if def:sender_ident {from $sender_ident}}
16339 </literallayout>
16340 <para>
16341 Note that the variable name is given without a leading <option>$</option> character. If the
16342 variable does not exist, the expansion fails.
16343 </para>
16344 </listitem></varlistentry>
16345 <varlistentry>
16346 <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>
16347 <listitem>
16348 <para>
16349 <indexterm role="concept">
16350 <primary>expansion</primary>
16351 <secondary>checking header line existence</secondary>
16352 </indexterm>
16353 This condition is true if a message is being processed and the named header
16354 exists in the message. For example,
16355 </para>
16356 <literallayout class="monospaced">
16357 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
16358 </literallayout>
16359 <para>
16360 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
16361 the header name must be terminated by a colon if white space does not follow.
16362 </para>
16363 </listitem></varlistentry>
16364 <varlistentry>
16365 <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>
16366 <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>
16367 <listitem>
16368 <para>
16369 <indexterm role="concept">
16370 <primary>string</primary>
16371 <secondary>comparison</secondary>
16372 </indexterm>
16373 <indexterm role="concept">
16374 <primary>expansion</primary>
16375 <secondary>string comparison</secondary>
16376 </indexterm>
16377 <indexterm role="concept">
16378 <primary><option>eq</option> expansion condition</primary>
16379 </indexterm>
16380 <indexterm role="concept">
16381 <primary><option>eqi</option> expansion condition</primary>
16382 </indexterm>
16383 The two substrings are first expanded. The condition is true if the two
16384 resulting strings are identical. For <option>eq</option> the comparison includes the case of
16385 letters, whereas for <option>eqi</option> the comparison is case-independent.
16386 </para>
16387 </listitem></varlistentry>
16388 <varlistentry>
16389 <term><emphasis role="bold">exists&nbsp;{</emphasis>&lt;<emphasis>file&nbsp;name</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16390 <listitem>
16391 <para>
16392 <indexterm role="concept">
16393 <primary>expansion</primary>
16394 <secondary>file existence test</secondary>
16395 </indexterm>
16396 <indexterm role="concept">
16397 <primary>file</primary>
16398 <secondary>existence test</secondary>
16399 </indexterm>
16400 <indexterm role="concept">
16401 <primary><option>exists</option>, expansion condition</primary>
16402 </indexterm>
16403 The substring is first expanded and then interpreted as an absolute path. The
16404 condition is true if the named file (or directory) exists. The existence test
16405 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
16406 users&#x2019; filter files may be locked out by the system administrator.
16407 </para>
16408 </listitem></varlistentry>
16409 <varlistentry>
16410 <term><emphasis role="bold">first_delivery</emphasis></term>
16411 <listitem>
16412 <para>
16413 <indexterm role="concept">
16414 <primary>delivery</primary>
16415 <secondary>first</secondary>
16416 </indexterm>
16417 <indexterm role="concept">
16418 <primary>first delivery</primary>
16419 </indexterm>
16420 <indexterm role="concept">
16421 <primary>expansion</primary>
16422 <secondary>first delivery test</secondary>
16423 </indexterm>
16424 <indexterm role="concept">
16425 <primary><option>first_delivery</option> expansion condition</primary>
16426 </indexterm>
16427 This condition, which has no data, is true during a message&#x2019;s first delivery
16428 attempt. It is false during any subsequent delivery attempts.
16429 </para>
16430 </listitem></varlistentry>
16431 <varlistentry>
16432 <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>
16433 <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>
16434 <listitem>
16435 <para>
16436 <indexterm role="concept">
16437 <primary>list</primary>
16438 <secondary>iterative conditions</secondary>
16439 </indexterm>
16440 <indexterm role="concept">
16441 <primary>expansion</primary>
16442 <secondary><emphasis role="bold">forall</emphasis> condition</secondary>
16443 </indexterm>
16444 <indexterm role="concept">
16445 <primary>expansion</primary>
16446 <secondary><emphasis role="bold">forany</emphasis> condition</secondary>
16447 </indexterm>
16448 <indexterm role="variable">
16449 <primary><varname>$item</varname></primary>
16450 </indexterm>
16451 These conditions iterate over a list. The first argument is expanded to form
16452 the list. By default, the list separator is a colon, but it can be changed by
16453 the normal method. The second argument is interpreted as a condition that is to
16454 be applied to each item in the list in turn. During the interpretation of the
16455 condition, the current list item is placed in a variable called <varname>$item</varname>.
16456 </para>
16457 <itemizedlist>
16458 <listitem>
16459 <para>
16460 For <emphasis role="bold">forany</emphasis>, interpretation stops if the condition is true for any item, and
16461 the result of the whole condition is true. If the condition is false for all
16462 items in the list, the overall condition is false.
16463 </para>
16464 </listitem>
16465 <listitem>
16466 <para>
16467 For <emphasis role="bold">forall</emphasis>, interpretation stops if the condition is false for any item,
16468 and the result of the whole condition is false. If the condition is true for
16469 all items in the list, the overall condition is true.
16470 </para>
16471 </listitem>
16472 </itemizedlist>
16473 <para>
16474 Note that negation of <emphasis role="bold">forany</emphasis> means that the condition must be false for all
16475 items for the overall condition to succeed, and negation of <emphasis role="bold">forall</emphasis> means
16476 that the condition must be false for at least one item. In this example, the
16477 list separator is changed to a comma:
16478 </para>
16479 <literallayout class="monospaced">
16480 ${if forany{&lt;, $recipients}{match{$item}{^user3@}}{yes}{no}}
16481 </literallayout>
16482 <para>
16483 The value of <varname>$item</varname> is saved and restored while <emphasis role="bold">forany</emphasis> or <emphasis role="bold">forall</emphasis> is
16484 being processed, to enable these expansion items to be nested.
16485 </para>
16486 <para>
16487 To scan a named list, expand it with the <emphasis role="bold">listnamed</emphasis> operator.
16488 </para>
16489 </listitem></varlistentry>
16490 <varlistentry>
16491 <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>
16492 <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>
16493 <listitem>
16494 <para>
16495 <indexterm role="concept">
16496 <primary>string</primary>
16497 <secondary>comparison</secondary>
16498 </indexterm>
16499 <indexterm role="concept">
16500 <primary>expansion</primary>
16501 <secondary>string comparison</secondary>
16502 </indexterm>
16503 <indexterm role="concept">
16504 <primary><option>ge</option> expansion condition</primary>
16505 </indexterm>
16506 <indexterm role="concept">
16507 <primary><option>gei</option> expansion condition</primary>
16508 </indexterm>
16509 The two substrings are first expanded. The condition is true if the first
16510 string is lexically greater than or equal to the second string. For <option>ge</option> the
16511 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
16512 case-independent.
16513 </para>
16514 </listitem></varlistentry>
16515 <varlistentry>
16516 <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>
16517 <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>
16518 <listitem>
16519 <para>
16520 <indexterm role="concept">
16521 <primary>string</primary>
16522 <secondary>comparison</secondary>
16523 </indexterm>
16524 <indexterm role="concept">
16525 <primary>expansion</primary>
16526 <secondary>string comparison</secondary>
16527 </indexterm>
16528 <indexterm role="concept">
16529 <primary><option>gt</option> expansion condition</primary>
16530 </indexterm>
16531 <indexterm role="concept">
16532 <primary><option>gti</option> expansion condition</primary>
16533 </indexterm>
16534 The two substrings are first expanded. The condition is true if the first
16535 string is lexically greater than the second string. For <option>gt</option> the comparison
16536 includes the case of letters, whereas for <option>gti</option> the comparison is
16537 case-independent.
16538 </para>
16539 </listitem></varlistentry>
16540 <varlistentry>
16541 <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>
16542 <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>
16543 <listitem>
16544 <para>
16545 <indexterm role="concept">
16546 <primary>string</primary>
16547 <secondary>comparison</secondary>
16548 </indexterm>
16549 <indexterm role="concept">
16550 <primary>list</primary>
16551 <secondary>iterative conditions</secondary>
16552 </indexterm>
16553 Both strings are expanded; the second string is treated as a list of simple
16554 strings; if the first string is a member of the second, then the condition
16555 is true.
16556 </para>
16557 <para>
16558 These are simpler to use versions of the more powerful <emphasis role="bold">forany</emphasis> condition.
16559 Examples, and the <emphasis role="bold">forany</emphasis> equivalents:
16560 </para>
16561 <literallayout class="monospaced">
16562 ${if inlist{needle}{foo:needle:bar}}
16563   ${if forany{foo:needle:bar}{eq{$item}{needle}}}
16564 ${if inlisti{Needle}{fOo:NeeDLE:bAr}}
16565   ${if forany{fOo:NeeDLE:bAr}{eqi{$item}{Needle}}}
16566 </literallayout>
16567 </listitem></varlistentry>
16568 <varlistentry>
16569 <term><emphasis role="bold">isip&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16570 <term><emphasis role="bold">isip4&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16571 <term><emphasis role="bold">isip6&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16572 <listitem>
16573 <para>
16574 <indexterm role="concept">
16575 <primary>IP address</primary>
16576 <secondary>testing string format</secondary>
16577 </indexterm>
16578 <indexterm role="concept">
16579 <primary>string</primary>
16580 <secondary>testing for IP address</secondary>
16581 </indexterm>
16582 <indexterm role="concept">
16583 <primary><option>isip</option> expansion condition</primary>
16584 </indexterm>
16585 <indexterm role="concept">
16586 <primary><option>isip4</option> expansion condition</primary>
16587 </indexterm>
16588 <indexterm role="concept">
16589 <primary><option>isip6</option> expansion condition</primary>
16590 </indexterm>
16591 The substring is first expanded, and then tested to see if it has the form of
16592 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
16593 <option>isip4</option> and <option>isip6</option> test specifically for IPv4 or IPv6 addresses.
16594 </para>
16595 <para>
16596 For an IPv4 address, the test is for four dot-separated components, each of
16597 which consists of from one to three digits. For an IPv6 address, up to eight
16598 colon-separated components are permitted, each containing from one to four
16599 hexadecimal digits. There may be fewer than eight components if an empty
16600 component (adjacent colons) is present. Only one empty component is permitted.
16601 </para>
16602 <para>
16603 <emphasis role="bold">Note</emphasis>: The checks are just on the form of the address; actual numerical
16604 values are not considered. Thus, for example, 999.999.999.999 passes the IPv4
16605 check. The main use of these tests is to distinguish between IP addresses and
16606 host names, or between IPv4 and IPv6 addresses. For example, you could use
16607 </para>
16608 <literallayout class="monospaced">
16609 ${if isip4{$sender_host_address}...
16610 </literallayout>
16611 <para>
16612 to test which IP version an incoming SMTP connection is using.
16613 </para>
16614 </listitem></varlistentry>
16615 <varlistentry>
16616 <term><emphasis role="bold">ldapauth&nbsp;{</emphasis>&lt;<emphasis>ldap&nbsp;query</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16617 <listitem>
16618 <para>
16619 <indexterm role="concept">
16620 <primary>LDAP</primary>
16621 <secondary>use for authentication</secondary>
16622 </indexterm>
16623 <indexterm role="concept">
16624 <primary>expansion</primary>
16625 <secondary>LDAP authentication test</secondary>
16626 </indexterm>
16627 <indexterm role="concept">
16628 <primary><option>ldapauth</option> expansion condition</primary>
16629 </indexterm>
16630 This condition supports user authentication using LDAP. See section
16631 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
16632 queries. For this use, the query must contain a user name and password. The
16633 query itself is not used, and can be empty. The condition is true if the
16634 password is not empty, and the user name and password are accepted by the LDAP
16635 server. An empty password is rejected without calling LDAP because LDAP binds
16636 with an empty password are considered anonymous regardless of the username, and
16637 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
16638 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
16639 this can be used.
16640 </para>
16641 </listitem></varlistentry>
16642 <varlistentry>
16643 <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>
16644 <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>
16645 <listitem>
16646 <para>
16647 <indexterm role="concept">
16648 <primary>string</primary>
16649 <secondary>comparison</secondary>
16650 </indexterm>
16651 <indexterm role="concept">
16652 <primary>expansion</primary>
16653 <secondary>string comparison</secondary>
16654 </indexterm>
16655 <indexterm role="concept">
16656 <primary><option>le</option> expansion condition</primary>
16657 </indexterm>
16658 <indexterm role="concept">
16659 <primary><option>lei</option> expansion condition</primary>
16660 </indexterm>
16661 The two substrings are first expanded. The condition is true if the first
16662 string is lexically less than or equal to the second string. For <option>le</option> the
16663 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
16664 case-independent.
16665 </para>
16666 </listitem></varlistentry>
16667 <varlistentry>
16668 <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>
16669 <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>
16670 <listitem>
16671 <para>
16672 <indexterm role="concept">
16673 <primary>string</primary>
16674 <secondary>comparison</secondary>
16675 </indexterm>
16676 <indexterm role="concept">
16677 <primary>expansion</primary>
16678 <secondary>string comparison</secondary>
16679 </indexterm>
16680 <indexterm role="concept">
16681 <primary><option>lt</option> expansion condition</primary>
16682 </indexterm>
16683 <indexterm role="concept">
16684 <primary><option>lti</option> expansion condition</primary>
16685 </indexterm>
16686 The two substrings are first expanded. The condition is true if the first
16687 string is lexically less than the second string. For <option>lt</option> the comparison
16688 includes the case of letters, whereas for <option>lti</option> the comparison is
16689 case-independent.
16690 </para>
16691 </listitem></varlistentry>
16692 <varlistentry>
16693 <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>
16694 <listitem>
16695 <para>
16696 <indexterm role="concept">
16697 <primary>expansion</primary>
16698 <secondary>regular expression comparison</secondary>
16699 </indexterm>
16700 <indexterm role="concept">
16701 <primary>regular expressions</primary>
16702 <secondary>match in expanded string</secondary>
16703 </indexterm>
16704 <indexterm role="concept">
16705 <primary><option>match</option> expansion condition</primary>
16706 </indexterm>
16707 The two substrings are first expanded. The second is then treated as a regular
16708 expression and applied to the first. Because of the pre-expansion, if the
16709 regular expression contains dollar, or backslash characters, they must be
16710 escaped. Care must also be taken if the regular expression contains braces
16711 (curly brackets). A closing brace must be escaped so that it is not taken as a
16712 premature termination of &lt;<emphasis>string2</emphasis>&gt;. The easiest approach is to use the
16713 <literal>\N</literal> feature to disable expansion of the regular expression.
16714 For example,
16715 </para>
16716 <literallayout class="monospaced">
16717 ${if match {$local_part}{\N^\d{3}\N} ...
16718 </literallayout>
16719 <para>
16720 If the whole expansion string is in double quotes, further escaping of
16721 backslashes is also required.
16722 </para>
16723 <para>
16724 The condition is true if the regular expression match succeeds.
16725 The regular expression is not required to begin with a circumflex
16726 metacharacter, but if there is no circumflex, the expression is not anchored,
16727 and it may match anywhere in the subject, not just at the start. If you want
16728 the pattern to match at the end of the subject, you must include the <literal>$</literal>
16729 metacharacter at an appropriate point.
16730 </para>
16731 <para>
16732 <indexterm role="concept">
16733 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
16734 <secondary>in <option>if</option> expansion</secondary>
16735 </indexterm>
16736 At the start of an <option>if</option> expansion the values of the numeric variable
16737 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
16738 succeeds causes them to be reset to the substrings of that condition and they
16739 will have these values during the expansion of the success string. At the end
16740 of the <option>if</option> expansion, the previous values are restored. After testing a
16741 combination of conditions using <option>or</option>, the subsequent values of the numeric
16742 variables are those of the condition that succeeded.
16743 </para>
16744 </listitem></varlistentry>
16745 <varlistentry>
16746 <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>
16747 <listitem>
16748 <para>
16749 <indexterm role="concept">
16750 <primary><option>match_address</option> expansion condition</primary>
16751 </indexterm>
16752 See <emphasis role="bold">match_local_part</emphasis>.
16753 </para>
16754 </listitem></varlistentry>
16755 <varlistentry>
16756 <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>
16757 <listitem>
16758 <para>
16759 <indexterm role="concept">
16760 <primary><option>match_domain</option> expansion condition</primary>
16761 </indexterm>
16762 See <emphasis role="bold">match_local_part</emphasis>.
16763 </para>
16764 </listitem></varlistentry>
16765 <varlistentry>
16766 <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>
16767 <listitem>
16768 <para>
16769 <indexterm role="concept">
16770 <primary><option>match_ip</option> expansion condition</primary>
16771 </indexterm>
16772 This condition matches an IP address to a list of IP address patterns. It must
16773 be followed by two argument strings. The first (after expansion) must be an IP
16774 address or an empty string. The second (not expanded) is a restricted host
16775 list that can match only an IP address, not a host name. For example:
16776 </para>
16777 <literallayout class="monospaced">
16778 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
16779 </literallayout>
16780 <para>
16781 The specific types of host list item that are permitted in the list are:
16782 </para>
16783 <itemizedlist>
16784 <listitem>
16785 <para>
16786 An IP address, optionally with a CIDR mask.
16787 </para>
16788 </listitem>
16789 <listitem>
16790 <para>
16791 A single asterisk, which matches any IP address.
16792 </para>
16793 </listitem>
16794 <listitem>
16795 <para>
16796 An empty item, which matches only if the IP address is empty. This could be
16797 useful for testing for a locally submitted message or one from specific hosts
16798 in a single test such as
16799 </para>
16800 <literallayout class="monospaced">
16801   ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
16802 </literallayout>
16803 <para>
16804 where the first item in the list is the empty string.
16805 </para>
16806 </listitem>
16807 <listitem>
16808 <para>
16809 The item @[] matches any of the local host&#x2019;s interface addresses.
16810 </para>
16811 </listitem>
16812 <listitem>
16813 <para>
16814 Single-key lookups are assumed to be like <quote>net-</quote> style lookups in host lists,
16815 even if <literal>net-</literal> is not specified. There is never any attempt to turn the IP
16816 address into a host name. The most common type of linear search for
16817 <emphasis role="bold">match_ip</emphasis> is likely to be <emphasis role="bold">iplsearch</emphasis>, in which the file can contain CIDR
16818 masks. For example:
16819 </para>
16820 <literallayout class="monospaced">
16821   ${if match_ip{$sender_host_address}{iplsearch;/some/file}...
16822 </literallayout>
16823 <para>
16824 It is of course possible to use other kinds of lookup, and in such a case, you
16825 do need to specify the <literal>net-</literal> prefix if you want to specify a specific
16826 address mask, for example:
16827 </para>
16828 <literallayout class="monospaced">
16829   ${if match_ip{$sender_host_address}{net24-dbm;/some/file}...
16830 </literallayout>
16831 <para>
16832 However, unless you are combining a <option>match_ip</option> condition with others, it is
16833 just as easy to use the fact that a lookup is itself a condition, and write:
16834 </para>
16835 <literallayout class="monospaced">
16836   ${lookup{${mask:$sender_host_address/24}}dbm{/a/file}...
16837 </literallayout>
16838 </listitem>
16839 </itemizedlist>
16840 <para>
16841 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
16842 Exim was built with the EXPAND_LISTMATCH_RHS option.
16843 </para>
16844 <para>
16845 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
16846 </para>
16847 </listitem></varlistentry>
16848 <varlistentry>
16849 <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>
16850 <listitem>
16851 <para>
16852 <indexterm role="concept">
16853 <primary>domain list</primary>
16854 <secondary>in expansion condition</secondary>
16855 </indexterm>
16856 <indexterm role="concept">
16857 <primary>address list</primary>
16858 <secondary>in expansion condition</secondary>
16859 </indexterm>
16860 <indexterm role="concept">
16861 <primary>local part</primary>
16862 <secondary>list, in expansion condition</secondary>
16863 </indexterm>
16864 <indexterm role="concept">
16865 <primary><option>match_local_part</option> expansion condition</primary>
16866 </indexterm>
16867 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
16868 possible to test domain, address, and local part lists within expansions. Each
16869 condition requires two arguments: an item and a list to match. A trivial
16870 example is:
16871 </para>
16872 <literallayout class="monospaced">
16873 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
16874 </literallayout>
16875 <para>
16876 In each case, the second argument may contain any of the allowable items for a
16877 list of the appropriate type. Also, because the second argument (after
16878 expansion) is a standard form of list, it is possible to refer to a named list.
16879 Thus, you can use conditions like this:
16880 </para>
16881 <literallayout class="monospaced">
16882 ${if match_domain{$domain}{+local_domains}{...
16883 </literallayout>
16884 <para>
16885 <indexterm role="concept">
16886 <primary><literal>+caseful</literal></primary>
16887 </indexterm>
16888 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
16889 item can be used, as in all address lists, to cause subsequent items to
16890 have their local parts matched casefully. Domains are always matched
16891 caselessly.
16892 </para>
16893 <para>
16894 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
16895 Exim was built with the EXPAND_LISTMATCH_RHS option.
16896 </para>
16897 <para>
16898 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
16899 hosts have two identities: a name and an IP address, and it is not clear
16900 how to specify cleanly how such a test would work. However, IP addresses can be
16901 matched using <option>match_ip</option>.
16902 </para>
16903 </listitem></varlistentry>
16904 <varlistentry>
16905 <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>
16906 <listitem>
16907 <para>
16908 <indexterm role="concept">
16909 <primary>PAM authentication</primary>
16910 </indexterm>
16911 <indexterm role="concept">
16912 <primary>AUTH</primary>
16913 <secondary>with PAM</secondary>
16914 </indexterm>
16915 <indexterm role="concept">
16916 <primary>Solaris</primary>
16917 <secondary>PAM support</secondary>
16918 </indexterm>
16919 <indexterm role="concept">
16920 <primary>expansion</primary>
16921 <secondary>PAM authentication test</secondary>
16922 </indexterm>
16923 <indexterm role="concept">
16924 <primary><option>pam</option> expansion condition</primary>
16925 </indexterm>
16926 <emphasis>Pluggable Authentication Modules</emphasis>
16927 (<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
16928 available in the latest releases of Solaris and in some GNU/Linux
16929 distributions. The Exim support, which is intended for use in conjunction with
16930 the SMTP AUTH command, is available only if Exim is compiled with
16931 </para>
16932 <literallayout class="monospaced">
16933 SUPPORT_PAM=yes
16934 </literallayout>
16935 <para>
16936 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
16937 in some releases of GNU/Linux <option>-ldl</option> is also needed.
16938 </para>
16939 <para>
16940 The argument string is first expanded, and the result must be a
16941 colon-separated list of strings. Leading and trailing white space is ignored.
16942 The PAM module is initialized with the service name <quote>exim</quote> and the user name
16943 taken from the first item in the colon-separated data string (&lt;<emphasis>string1</emphasis>&gt;).
16944 The remaining items in the data string are passed over in response to requests
16945 from the authentication function. In the simple case there will only be one
16946 request, for a password, so the data consists of just two strings.
16947 </para>
16948 <para>
16949 There can be problems if any of the strings are permitted to contain colon
16950 characters. In the usual way, these have to be doubled to avoid being taken as
16951 separators. If the data is being inserted from a variable, the <option>sg</option> expansion
16952 item can be used to double any existing colons. For example, the configuration
16953 of a LOGIN authenticator might contain this setting:
16954 </para>
16955 <literallayout class="monospaced">
16956 server_condition = ${if pam{$auth1:${sg{$auth2}{:}{::}}}}
16957 </literallayout>
16958 <para>
16959 For a PLAIN authenticator you could use:
16960 </para>
16961 <literallayout class="monospaced">
16962 server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}}
16963 </literallayout>
16964 <para>
16965 In some operating systems, PAM authentication can be done only from a process
16966 running as root. Since Exim is running as the Exim user when receiving
16967 messages, this means that PAM cannot be used directly in those systems.
16968 A patched version of the <emphasis>pam_unix</emphasis> module that comes with the
16969 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>.
16970 The patched module allows one special uid/gid combination, in addition to root,
16971 to authenticate. If you build the patched module to allow the Exim user and
16972 group, PAM can then be used from an Exim authenticator.
16973 </para>
16974 </listitem></varlistentry>
16975 <varlistentry>
16976 <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>
16977 <listitem>
16978 <para>
16979 <indexterm role="concept">
16980 <primary><emphasis>pwcheck</emphasis> daemon</primary>
16981 </indexterm>
16982 <indexterm role="concept">
16983 <primary>Cyrus</primary>
16984 </indexterm>
16985 <indexterm role="concept">
16986 <primary>expansion</primary>
16987 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
16988 </indexterm>
16989 <indexterm role="concept">
16990 <primary><option>pwcheck</option> expansion condition</primary>
16991 </indexterm>
16992 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
16993 This is one way of making it possible for passwords to be checked by a process
16994 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
16995 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
16996 </para>
16997 <para>
16998 The pwcheck support is not included in Exim by default. You need to specify
16999 the location of the pwcheck daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
17000 building Exim. For example:
17001 </para>
17002 <literallayout class="monospaced">
17003 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
17004 </literallayout>
17005 <para>
17006 You do not need to install the full Cyrus software suite in order to use
17007 the pwcheck daemon. You can compile and install just the daemon alone
17008 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
17009 access to the <filename>/var/pwcheck</filename> directory.
17010 </para>
17011 <para>
17012 The <option>pwcheck</option> condition takes one argument, which must be the user name and
17013 password, separated by a colon. For example, in a LOGIN authenticator
17014 configuration, you might have this:
17015 </para>
17016 <literallayout class="monospaced">
17017 server_condition = ${if pwcheck{$auth1:$auth2}}
17018 </literallayout>
17019 <para>
17020 Again, for a PLAIN authenticator configuration, this would be:
17021 </para>
17022 <literallayout class="monospaced">
17023 server_condition = ${if pwcheck{$auth2:$auth3}}
17024 </literallayout>
17025 </listitem></varlistentry>
17026 <varlistentry>
17027 <term><emphasis role="bold">queue_running</emphasis></term>
17028 <listitem>
17029 <para>
17030 <indexterm role="concept">
17031 <primary>queue runner</primary>
17032 <secondary>detecting when delivering from</secondary>
17033 </indexterm>
17034 <indexterm role="concept">
17035 <primary>expansion</primary>
17036 <secondary>queue runner test</secondary>
17037 </indexterm>
17038 <indexterm role="concept">
17039 <primary><option>queue_running</option> expansion condition</primary>
17040 </indexterm>
17041 This condition, which has no data, is true during delivery attempts that are
17042 initiated by queue runner processes, and false otherwise.
17043 </para>
17044 </listitem></varlistentry>
17045 <varlistentry>
17046 <term><emphasis role="bold">radius&nbsp;{</emphasis>&lt;<emphasis>authentication&nbsp;string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17047 <listitem>
17048 <para>
17049 <indexterm role="concept">
17050 <primary>Radius</primary>
17051 </indexterm>
17052 <indexterm role="concept">
17053 <primary>expansion</primary>
17054 <secondary>Radius authentication</secondary>
17055 </indexterm>
17056 <indexterm role="concept">
17057 <primary><option>radius</option> expansion condition</primary>
17058 </indexterm>
17059 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
17060 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
17061 the Radius client configuration file in order to build Exim with Radius
17062 support.
17063 </para>
17064 <para>
17065 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
17066 library, using the original API. If you are using release 0.4.0 or later of
17067 this library, you need to set
17068 </para>
17069 <literallayout class="monospaced">
17070 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
17071 </literallayout>
17072 <para>
17073 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
17074 <option>libradius</option> library that comes with FreeBSD. To do this, set
17075 </para>
17076 <literallayout class="monospaced">
17077 RADIUS_LIB_TYPE=RADLIB
17078 </literallayout>
17079 <para>
17080 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
17081 You may also have to supply a suitable setting in EXTRALIBS so that the
17082 Radius library can be found when Exim is linked.
17083 </para>
17084 <para>
17085 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
17086 Radius client library, which calls the Radius server. The condition is true if
17087 the authentication is successful. For example:
17088 </para>
17089 <literallayout class="monospaced">
17090 server_condition = ${if radius{&lt;arguments&gt;}}
17091 </literallayout>
17092 </listitem></varlistentry>
17093 <varlistentry>
17094 <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>
17095 <listitem>
17096 <para>
17097 <indexterm role="concept">
17098 <primary><emphasis>saslauthd</emphasis> daemon</primary>
17099 </indexterm>
17100 <indexterm role="concept">
17101 <primary>Cyrus</primary>
17102 </indexterm>
17103 <indexterm role="concept">
17104 <primary>expansion</primary>
17105 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
17106 </indexterm>
17107 <indexterm role="concept">
17108 <primary><option>saslauthd</option> expansion condition</primary>
17109 </indexterm>
17110 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
17111 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
17112 Using this daemon is one way of making it possible for passwords to be checked
17113 by a process that is not running as root.
17114 </para>
17115 <para>
17116 The saslauthd support is not included in Exim by default. You need to specify
17117 the location of the saslauthd daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
17118 building Exim. For example:
17119 </para>
17120 <literallayout class="monospaced">
17121 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
17122 </literallayout>
17123 <para>
17124 You do not need to install the full Cyrus software suite in order to use
17125 the saslauthd daemon. You can compile and install just the daemon alone
17126 from the Cyrus SASL library.
17127 </para>
17128 <para>
17129 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
17130 two are mandatory. For example:
17131 </para>
17132 <literallayout class="monospaced">
17133 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
17134 </literallayout>
17135 <para>
17136 The service and the realm are optional (which is why the arguments are enclosed
17137 in their own set of braces). For details of the meaning of the service and
17138 realm, and how to run the daemon, consult the Cyrus documentation.
17139 </para>
17140 </listitem></varlistentry>
17141 </variablelist>
17142 </section>
17143 <section id="SECID84">
17144 <title>Combining expansion conditions</title>
17145 <para>
17146 <indexterm role="concept">
17147 <primary>expansion</primary>
17148 <secondary>combining conditions</secondary>
17149 </indexterm>
17150 Several conditions can be tested at once by combining them using the <option>and</option>
17151 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
17152 conditions on their own, and precede their lists of sub-conditions. Each
17153 sub-condition must be enclosed in braces within the overall braces that contain
17154 the list. No repetition of <option>if</option> is used.
17155 </para>
17156 <variablelist>
17157 <varlistentry>
17158 <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>
17159 <listitem>
17160 <para>
17161 <indexterm role="concept">
17162 <primary><quote>or</quote> expansion condition</primary>
17163 </indexterm>
17164 <indexterm role="concept">
17165 <primary>expansion</primary>
17166 <secondary><quote>or</quote> of conditions</secondary>
17167 </indexterm>
17168 The sub-conditions are evaluated from left to right. The condition is true if
17169 any one of the sub-conditions is true.
17170 For example,
17171 </para>
17172 <literallayout class="monospaced">
17173 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
17174 </literallayout>
17175 <para>
17176 When a true sub-condition is found, the following ones are parsed but not
17177 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
17178 numeric variables afterwards are taken from the first one that succeeds.
17179 </para>
17180 </listitem></varlistentry>
17181 <varlistentry>
17182 <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>
17183 <listitem>
17184 <para>
17185 <indexterm role="concept">
17186 <primary><quote>and</quote> expansion condition</primary>
17187 </indexterm>
17188 <indexterm role="concept">
17189 <primary>expansion</primary>
17190 <secondary><quote>and</quote> of conditions</secondary>
17191 </indexterm>
17192 The sub-conditions are evaluated from left to right. The condition is true if
17193 all of the sub-conditions are true. If there are several <quote>match</quote>
17194 sub-conditions, the values of the numeric variables afterwards are taken from
17195 the last one. When a false sub-condition is found, the following ones are
17196 parsed but not evaluated.
17197 </para>
17198 </listitem></varlistentry>
17199 </variablelist>
17200 <para>
17201 <indexterm role="concept" startref="IIDexpcond" class="endofrange"/>
17202 </para>
17203 </section>
17204 <section id="SECTexpvar">
17205 <title>Expansion variables</title>
17206 <para>
17207 <indexterm role="concept">
17208 <primary>expansion</primary>
17209 <secondary>variables, list of</secondary>
17210 </indexterm>
17211 This section contains an alphabetical list of all the expansion variables. Some
17212 of them are available only when Exim is compiled with specific options such as
17213 support for TLS or the content scanning extension.
17214 </para>
17215 <variablelist>
17216 <varlistentry>
17217 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
17218 <listitem>
17219 <para>
17220 <indexterm role="concept">
17221 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
17222 </indexterm>
17223 When a <option>match</option> expansion condition succeeds, these variables contain the
17224 captured substrings identified by the regular expression during subsequent
17225 processing of the success string of the containing <option>if</option> expansion item.
17226 In the expansion condition case
17227 they do not retain their values afterwards; in fact, their previous
17228 values are restored at the end of processing an <option>if</option> item. The numerical
17229 variables may also be set externally by some other matching process which
17230 precedes the expansion of the string. For example, the commands available in
17231 Exim filter files include an <option>if</option> command with its own regular expression
17232 matching condition.
17233 </para>
17234 </listitem></varlistentry>
17235 <varlistentry>
17236 <term><varname>$acl_arg1</varname>, <varname>$acl_arg2</varname>, etc</term>
17237 <listitem>
17238 <para>
17239 Within an acl condition, expansion condition or expansion item
17240 any arguments are copied to these variables,
17241 any unused variables being made empty.
17242 </para>
17243 </listitem></varlistentry>
17244 <varlistentry>
17245 <term><varname>$acl_c...</varname></term>
17246 <listitem>
17247 <para>
17248 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
17249 can be given any name that starts with <varname>$acl_c</varname> and is at least six characters
17250 long, but the sixth character must be either a digit or an underscore. For
17251 example: <varname>$acl_c5</varname>, <varname>$acl_c_mycount</varname>. The values of the <varname>$acl_c...</varname>
17252 variables persist throughout the lifetime of an SMTP connection. They can be
17253 used to pass information between ACLs and between different invocations of the
17254 same ACL. When a message is received, the values of these variables are saved
17255 with the message, and can be accessed by filters, routers, and transports
17256 during subsequent delivery.
17257 </para>
17258 </listitem></varlistentry>
17259 <varlistentry>
17260 <term><varname>$acl_m...</varname></term>
17261 <listitem>
17262 <para>
17263 These variables are like the <varname>$acl_c...</varname> variables, except that their values
17264 are reset after a message has been received. Thus, if several messages are
17265 received in one SMTP connection, <varname>$acl_m...</varname> values are not passed on from one
17266 message to the next, as <varname>$acl_c...</varname> values are. The <varname>$acl_m...</varname> variables are
17267 also reset by MAIL, RSET, EHLO, HELO, and after starting a TLS session. When a
17268 message is received, the values of these variables are saved with the message,
17269 and can be accessed by filters, routers, and transports during subsequent
17270 delivery.
17271 </para>
17272 </listitem></varlistentry>
17273 <varlistentry>
17274 <term><varname>$acl_narg</varname></term>
17275 <listitem>
17276 <para>
17277 Within an acl condition, expansion condition or expansion item
17278 this variable has the number of arguments.
17279 </para>
17280 </listitem></varlistentry>
17281 <varlistentry>
17282 <term><varname>$acl_verify_message</varname></term>
17283 <listitem>
17284 <para>
17285 <indexterm role="variable">
17286 <primary><varname>$acl_verify_message</varname></primary>
17287 </indexterm>
17288 After an address verification has failed, this variable contains the failure
17289 message. It retains its value for use in subsequent modifiers. The message can
17290 be preserved by coding like this:
17291 </para>
17292 <literallayout class="monospaced">
17293 warn !verify = sender
17294      set acl_m0 = $acl_verify_message
17295 </literallayout>
17296 <para>
17297 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
17298 <option>log_message</option> modifiers, to include information about the verification
17299 failure.
17300 </para>
17301 </listitem></varlistentry>
17302 <varlistentry>
17303 <term><varname>$address_data</varname></term>
17304 <listitem>
17305 <para>
17306 <indexterm role="variable">
17307 <primary><varname>$address_data</varname></primary>
17308 </indexterm>
17309 This variable is set by means of the <option>address_data</option> option in routers. The
17310 value then remains with the address while it is processed by subsequent routers
17311 and eventually a transport. If the transport is handling multiple addresses,
17312 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
17313 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
17314 user filter files.
17315 </para>
17316 <para>
17317 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
17318 a recipient address, the final value is still in the variable for subsequent
17319 conditions and modifiers of the ACL statement. If routing the address caused it
17320 to be redirected to just one address, the child address is also routed as part
17321 of the verification, and in this case the final value of <varname>$address_data</varname> is
17322 from the child&#x2019;s routing.
17323 </para>
17324 <para>
17325 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
17326 sender address, the final value is also preserved, but this time in
17327 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
17328 address.
17329 </para>
17330 <para>
17331 In both cases (recipient and sender verification), the value does not persist
17332 after the end of the current ACL statement. If you want to preserve
17333 these values for longer, you can save them in ACL variables.
17334 </para>
17335 </listitem></varlistentry>
17336 <varlistentry>
17337 <term><varname>$address_file</varname></term>
17338 <listitem>
17339 <para>
17340 <indexterm role="variable">
17341 <primary><varname>$address_file</varname></primary>
17342 </indexterm>
17343 When, as a result of aliasing, forwarding, or filtering, a message is directed
17344 to a specific file, this variable holds the name of the file when the transport
17345 is running. At other times, the variable is empty. For example, using the
17346 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
17347 </para>
17348 <literallayout class="monospaced">
17349 /home/r2d2/savemail
17350 </literallayout>
17351 <para>
17352 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
17353 contains the text string <literal>/home/r2d2/savemail</literal>.
17354 <indexterm role="concept">
17355 <primary>Sieve filter</primary>
17356 <secondary>value of <varname>$address_file</varname></secondary>
17357 </indexterm>
17358 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
17359 then up to the transport configuration to generate an appropriate absolute path
17360 to the relevant file.
17361 </para>
17362 </listitem></varlistentry>
17363 <varlistentry>
17364 <term><varname>$address_pipe</varname></term>
17365 <listitem>
17366 <para>
17367 <indexterm role="variable">
17368 <primary><varname>$address_pipe</varname></primary>
17369 </indexterm>
17370 When, as a result of aliasing or forwarding, a message is directed to a pipe,
17371 this variable holds the pipe command when the transport is running.
17372 </para>
17373 </listitem></varlistentry>
17374 <varlistentry>
17375 <term><varname>$auth1</varname> &ndash; <varname>$auth3</varname></term>
17376 <listitem>
17377 <para>
17378 <indexterm role="variable">
17379 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
17380 </indexterm>
17381 These variables are used in SMTP authenticators (see chapters
17382 <xref linkend="CHAPplaintext"/>&ndash;<xref linkend="CHAPtlsauth"/>). Elsewhere, they are empty.
17383 </para>
17384 </listitem></varlistentry>
17385 <varlistentry>
17386 <term><varname>$authenticated_id</varname></term>
17387 <listitem>
17388 <para>
17389 <indexterm role="concept">
17390 <primary>authentication</primary>
17391 <secondary>id</secondary>
17392 </indexterm>
17393 <indexterm role="variable">
17394 <primary><varname>$authenticated_id</varname></primary>
17395 </indexterm>
17396 When a server successfully authenticates a client it may be configured to
17397 preserve some of the authentication information in the variable
17398 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
17399 user/password authenticator configuration might preserve the user name for use
17400 in the routers. Note that this is not the same information that is saved in
17401 <varname>$sender_host_authenticated</varname>.
17402 When a message is submitted locally (that is, not over a TCP connection)
17403 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
17404 process. However, a trusted user can override this by means of the <option>-oMai</option>
17405 command line option.
17406 </para>
17407 </listitem></varlistentry>
17408 <varlistentry>
17409 <term><varname>$authenticated_fail_id</varname></term>
17410 <listitem>
17411 <para>
17412 <indexterm role="concept">
17413 <primary>authentication</primary>
17414 <secondary>fail</secondary>
17415 </indexterm>
17416 <indexterm role="variable">
17417 <primary><varname>$authenticated_fail_id</varname></primary>
17418 </indexterm>
17419 When an authentication attempt fails, the variable <varname>$authenticated_fail_id</varname>
17420 will contain the failed authentication id. If more than one authentication
17421 id is attempted, it will contain only the last one. The variable is
17422 available for processing in the ACL&#x2019;s, generally the quit or notquit ACL.
17423 A message to a local recipient could still be accepted without requiring
17424 authentication, which means this variable could also be visible in all of
17425 the ACL&#x2019;s as well.
17426 </para>
17427 </listitem></varlistentry>
17428 <varlistentry>
17429 <term><varname>$authenticated_sender</varname></term>
17430 <listitem>
17431 <para>
17432 <indexterm role="concept">
17433 <primary>sender</primary>
17434 <secondary>authenticated</secondary>
17435 </indexterm>
17436 <indexterm role="concept">
17437 <primary>authentication</primary>
17438 <secondary>sender</secondary>
17439 </indexterm>
17440 <indexterm role="concept">
17441 <primary>AUTH</primary>
17442 <secondary>on MAIL command</secondary>
17443 </indexterm>
17444 <indexterm role="variable">
17445 <primary><varname>$authenticated_sender</varname></primary>
17446 </indexterm>
17447 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
17448 SMTP MAIL command if it believes the sender is sufficiently trusted, as
17449 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
17450 <quote>&lt;&gt;</quote>, it is set as the authenticated sender of the message, and the value is
17451 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
17452 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
17453 </para>
17454 <para>
17455 <indexterm role="variable">
17456 <primary><varname>$qualify_domain</varname></primary>
17457 </indexterm>
17458 When a message is submitted locally (that is, not over a TCP connection), the
17459 value of <varname>$authenticated_sender</varname> is an address constructed from the login
17460 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
17461 can override this by means of the <option>-oMas</option> command line option.
17462 </para>
17463 </listitem></varlistentry>
17464 <varlistentry>
17465 <term><varname>$authentication_failed</varname></term>
17466 <listitem>
17467 <para>
17468 <indexterm role="concept">
17469 <primary>authentication</primary>
17470 <secondary>failure</secondary>
17471 </indexterm>
17472 <indexterm role="variable">
17473 <primary><varname>$authentication_failed</varname></primary>
17474 </indexterm>
17475 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
17476 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
17477 possible to distinguish between <quote>did not try to authenticate</quote>
17478 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
17479 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
17480 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>). Failure includes any
17481 negative response to an AUTH command, including (for example) an attempt to use
17482 an undefined mechanism.
17483 </para>
17484 </listitem></varlistentry>
17485 <varlistentry>
17486 <term><varname>$av_failed</varname></term>
17487 <listitem>
17488 <para>
17489 <indexterm role="concept">
17490 <primary>content scanning</primary>
17491 <secondary>AV scanner failure</secondary>
17492 </indexterm>
17493 This variable is available when Exim is compiled with the content-scanning
17494 extension. It is set to <quote>0</quote> by default, but will be set to <quote>1</quote> if any
17495 problem occurs with the virus scanner (specified by <option>av_scanner</option>) during
17496 the ACL malware condition.
17497 </para>
17498 </listitem></varlistentry>
17499 <varlistentry>
17500 <term><varname>$body_linecount</varname></term>
17501 <listitem>
17502 <para>
17503 <indexterm role="concept">
17504 <primary>message body</primary>
17505 <secondary>line count</secondary>
17506 </indexterm>
17507 <indexterm role="concept">
17508 <primary>body of message</primary>
17509 <secondary>line count</secondary>
17510 </indexterm>
17511 <indexterm role="variable">
17512 <primary><varname>$body_linecount</varname></primary>
17513 </indexterm>
17514 When a message is being received or delivered, this variable contains the
17515 number of lines in the message&#x2019;s body. See also <varname>$message_linecount</varname>.
17516 </para>
17517 </listitem></varlistentry>
17518 <varlistentry>
17519 <term><varname>$body_zerocount</varname></term>
17520 <listitem>
17521 <para>
17522 <indexterm role="concept">
17523 <primary>message body</primary>
17524 <secondary>binary zero count</secondary>
17525 </indexterm>
17526 <indexterm role="concept">
17527 <primary>body of message</primary>
17528 <secondary>binary zero count</secondary>
17529 </indexterm>
17530 <indexterm role="concept">
17531 <primary>binary zero</primary>
17532 <secondary>in message body</secondary>
17533 </indexterm>
17534 <indexterm role="variable">
17535 <primary><varname>$body_zerocount</varname></primary>
17536 </indexterm>
17537 When a message is being received or delivered, this variable contains the
17538 number of binary zero bytes (ASCII NULs) in the message&#x2019;s body.
17539 </para>
17540 </listitem></varlistentry>
17541 <varlistentry>
17542 <term><varname>$bounce_recipient</varname></term>
17543 <listitem>
17544 <para>
17545 <indexterm role="variable">
17546 <primary><varname>$bounce_recipient</varname></primary>
17547 </indexterm>
17548 This is set to the recipient address of a bounce message while Exim is creating
17549 it. It is useful if a customized bounce message text file is in use (see
17550 chapter <xref linkend="CHAPemsgcust"/>).
17551 </para>
17552 </listitem></varlistentry>
17553 <varlistentry>
17554 <term><varname>$bounce_return_size_limit</varname></term>
17555 <listitem>
17556 <para>
17557 <indexterm role="variable">
17558 <primary><varname>$bounce_return_size_limit</varname></primary>
17559 </indexterm>
17560 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
17561 up to a multiple of 1000. It is useful when a customized error message text
17562 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
17563 </para>
17564 </listitem></varlistentry>
17565 <varlistentry>
17566 <term><varname>$caller_gid</varname></term>
17567 <listitem>
17568 <para>
17569 <indexterm role="concept">
17570 <primary>gid (group id)</primary>
17571 <secondary>caller</secondary>
17572 </indexterm>
17573 <indexterm role="variable">
17574 <primary><varname>$caller_gid</varname></primary>
17575 </indexterm>
17576 The real group id under which the process that called Exim was running. This is
17577 not the same as the group id of the originator of a message (see
17578 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
17579 incarnation normally contains the Exim gid.
17580 </para>
17581 </listitem></varlistentry>
17582 <varlistentry>
17583 <term><varname>$caller_uid</varname></term>
17584 <listitem>
17585 <para>
17586 <indexterm role="concept">
17587 <primary>uid (user id)</primary>
17588 <secondary>caller</secondary>
17589 </indexterm>
17590 <indexterm role="variable">
17591 <primary><varname>$caller_uid</varname></primary>
17592 </indexterm>
17593 The real user id under which the process that called Exim was running. This is
17594 not the same as the user id of the originator of a message (see
17595 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
17596 incarnation normally contains the Exim uid.
17597 </para>
17598 </listitem></varlistentry>
17599 <varlistentry>
17600 <term><varname>$callout_address</varname></term>
17601 <listitem>
17602 <para>
17603 <indexterm role="variable">
17604 <primary><varname>$callout_address</varname></primary>
17605 </indexterm>
17606 After a callout for verification, spamd or malware daemon service, the
17607 address that was connected to.
17608 </para>
17609 </listitem></varlistentry>
17610 <varlistentry>
17611 <term><varname>$compile_number</varname></term>
17612 <listitem>
17613 <para>
17614 <indexterm role="variable">
17615 <primary><varname>$compile_number</varname></primary>
17616 </indexterm>
17617 The building process for Exim keeps a count of the number
17618 of times it has been compiled. This serves to distinguish different
17619 compilations of the same version of the program.
17620 </para>
17621 </listitem></varlistentry>
17622 <varlistentry>
17623 <term><varname>$config_dir</varname></term>
17624 <listitem>
17625 <para>
17626 <indexterm role="variable">
17627 <primary><varname>$config_dir</varname></primary>
17628 </indexterm>
17629 The directory name of the main configuration file. That is, the content of
17630 <varname>$config_file</varname> with the last component stripped. The value does not
17631 contain the trailing slash. If <varname>$config_file</varname> does not contain a slash,
17632 <varname>$config_dir</varname> is ".".
17633 </para>
17634 </listitem></varlistentry>
17635 <varlistentry>
17636 <term><varname>$config_file</varname></term>
17637 <listitem>
17638 <para>
17639 <indexterm role="variable">
17640 <primary><varname>$config_file</varname></primary>
17641 </indexterm>
17642 The name of the main configuration file Exim is using.
17643 </para>
17644 </listitem></varlistentry>
17645 <varlistentry>
17646 <term><varname>$demime_errorlevel</varname></term>
17647 <listitem>
17648 <para>
17649 <indexterm role="variable">
17650 <primary><varname>$demime_errorlevel</varname></primary>
17651 </indexterm>
17652 This variable is available when Exim is compiled with
17653 the content-scanning extension and the obsolete <option>demime</option> condition. For
17654 details, see section <xref linkend="SECTdemimecond"/>.
17655 </para>
17656 </listitem></varlistentry>
17657 <varlistentry>
17658 <term><varname>$demime_reason</varname></term>
17659 <listitem>
17660 <para>
17661 <indexterm role="variable">
17662 <primary><varname>$demime_reason</varname></primary>
17663 </indexterm>
17664 This variable is available when Exim is compiled with the
17665 content-scanning extension and the obsolete <option>demime</option> condition. For details,
17666 see section <xref linkend="SECTdemimecond"/>.
17667 </para>
17668 </listitem></varlistentry>
17669 <varlistentry>
17670 <term><varname>$dkim_cur_signer</varname></term>
17671 <term><varname>$dkim_verify_status</varname></term>
17672 <term><varname>$dkim_verify_reason</varname></term>
17673 <term><varname>$dkim_domain</varname></term>
17674 <term><varname>$dkim_identity</varname></term>
17675 <term><varname>$dkim_selector</varname></term>
17676 <term><varname>$dkim_algo</varname></term>
17677 <term><varname>$dkim_canon_body</varname></term>
17678 <term><varname>$dkim_canon_headers</varname></term>
17679 <term><varname>$dkim_copiedheaders</varname></term>
17680 <term><varname>$dkim_bodylength</varname></term>
17681 <term><varname>$dkim_created</varname></term>
17682 <term><varname>$dkim_expires</varname></term>
17683 <term><varname>$dkim_headernames</varname></term>
17684 <term><varname>$dkim_key_testing</varname></term>
17685 <term><varname>$dkim_key_nosubdomains</varname></term>
17686 <term><varname>$dkim_key_srvtype</varname></term>
17687 <term><varname>$dkim_key_granularity</varname></term>
17688 <term><varname>$dkim_key_notes</varname></term>
17689 <term><varname>$dkim_key_length</varname></term>
17690 <listitem>
17691 <para>
17692 These variables are only available within the DKIM ACL.
17693 For details see chapter <xref linkend="CHAPdkim"/>.
17694 </para>
17695 </listitem></varlistentry>
17696 <varlistentry>
17697 <term><varname>$dkim_signers</varname></term>
17698 <listitem>
17699 <para>
17700 <indexterm role="variable">
17701 <primary><varname>$dkim_signers</varname></primary>
17702 </indexterm>
17703 When a message has been received this variable contains
17704 a colon-separated list of signer domains and identities for the message.
17705 For details see chapter <xref linkend="CHAPdkim"/>.
17706 </para>
17707 </listitem></varlistentry>
17708 <varlistentry>
17709 <term><varname>$dnslist_domain</varname></term>
17710 <term><varname>$dnslist_matched</varname></term>
17711 <term><varname>$dnslist_text</varname></term>
17712 <term><varname>$dnslist_value</varname></term>
17713 <listitem>
17714 <para>
17715 <indexterm role="variable">
17716 <primary><varname>$dnslist_domain</varname></primary>
17717 </indexterm>
17718 <indexterm role="variable">
17719 <primary><varname>$dnslist_matched</varname></primary>
17720 </indexterm>
17721 <indexterm role="variable">
17722 <primary><varname>$dnslist_text</varname></primary>
17723 </indexterm>
17724 <indexterm role="variable">
17725 <primary><varname>$dnslist_value</varname></primary>
17726 </indexterm>
17727 <indexterm role="concept">
17728 <primary>black list (DNS)</primary>
17729 </indexterm>
17730 When a DNS (black) list lookup succeeds, these variables are set to contain
17731 the following data from the lookup: the list&#x2019;s domain name, the key that was
17732 looked up, the contents of any associated TXT record, and the value from the
17733 main A record. See section <xref linkend="SECID204"/> for more details.
17734 </para>
17735 </listitem></varlistentry>
17736 <varlistentry>
17737 <term><varname>$domain</varname></term>
17738 <listitem>
17739 <para>
17740 <indexterm role="variable">
17741 <primary><varname>$domain</varname></primary>
17742 </indexterm>
17743 When an address is being routed, or delivered on its own, this variable
17744 contains the domain. Uppercase letters in the domain are converted into lower
17745 case for <varname>$domain</varname>.
17746 </para>
17747 <para>
17748 Global address rewriting happens when a message is received, so the value of
17749 <varname>$domain</varname> during routing and delivery is the value after rewriting. <varname>$domain</varname>
17750 is set during user filtering, but not during system filtering, because a
17751 message may have many recipients and the system filter is called just once.
17752 </para>
17753 <para>
17754 When more than one address is being delivered at once (for example, several
17755 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
17756 have the same domain. Transports can be restricted to handling only one domain
17757 at a time if the value of <varname>$domain</varname> is required at transport time &ndash; this is
17758 the default for local transports. For further details of the environment in
17759 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
17760 </para>
17761 <para>
17762 <indexterm role="option">
17763 <primary><option>delay_warning_condition</option></primary>
17764 </indexterm>
17765 At the end of a delivery, if all deferred addresses have the same domain, it is
17766 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
17767 </para>
17768 <para>
17769 The <varname>$domain</varname> variable is also used in some other circumstances:
17770 </para>
17771 <itemizedlist>
17772 <listitem>
17773 <para>
17774 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
17775 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
17776 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
17777 normally set during the running of the MAIL ACL. However, if the sender address
17778 is verified with a callout during the MAIL ACL, the sender domain is placed in
17779 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
17780 the <command>smtp</command> transport.
17781 </para>
17782 </listitem>
17783 <listitem>
17784 <para>
17785 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
17786 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
17787 it can be used in the expansion of the replacement address, for example, to
17788 rewrite domains by file lookup.
17789 </para>
17790 </listitem>
17791 <listitem>
17792 <para>
17793 With one important exception, whenever a domain list is being scanned,
17794 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
17795 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
17796 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
17797 that, in a RCPT ACL, the sender domain list can be dependent on the
17798 recipient domain (which is what is in <varname>$domain</varname> at this time).
17799 </para>
17800 </listitem>
17801 <listitem>
17802 <para>
17803 <indexterm role="concept">
17804 <primary>ETRN</primary>
17805 <secondary>value of <varname>$domain</varname></secondary>
17806 </indexterm>
17807 <indexterm role="option">
17808 <primary><option>smtp_etrn_command</option></primary>
17809 </indexterm>
17810 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
17811 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
17812 </para>
17813 </listitem>
17814 </itemizedlist>
17815 </listitem></varlistentry>
17816 <varlistentry>
17817 <term><varname>$domain_data</varname></term>
17818 <listitem>
17819 <para>
17820 <indexterm role="variable">
17821 <primary><varname>$domain_data</varname></primary>
17822 </indexterm>
17823 When the <option>domains</option> option on a router matches a domain by
17824 means of a lookup, the data read by the lookup is available during the running
17825 of the router as <varname>$domain_data</varname>. In addition, if the driver routes the
17826 address to a transport, the value is available in that transport. If the
17827 transport is handling multiple addresses, the value from the first address is
17828 used.
17829 </para>
17830 <para>
17831 <varname>$domain_data</varname> is also set when the <option>domains</option> condition in an ACL matches a
17832 domain by means of a lookup. The data read by the lookup is available during
17833 the rest of the ACL statement. In all other situations, this variable expands
17834 to nothing.
17835 </para>
17836 </listitem></varlistentry>
17837 <varlistentry>
17838 <term><varname>$exim_gid</varname></term>
17839 <listitem>
17840 <para>
17841 <indexterm role="variable">
17842 <primary><varname>$exim_gid</varname></primary>
17843 </indexterm>
17844 This variable contains the numerical value of the Exim group id.
17845 </para>
17846 </listitem></varlistentry>
17847 <varlistentry>
17848 <term><varname>$exim_path</varname></term>
17849 <listitem>
17850 <para>
17851 <indexterm role="variable">
17852 <primary><varname>$exim_path</varname></primary>
17853 </indexterm>
17854 This variable contains the path to the Exim binary.
17855 </para>
17856 </listitem></varlistentry>
17857 <varlistentry>
17858 <term><varname>$exim_uid</varname></term>
17859 <listitem>
17860 <para>
17861 <indexterm role="variable">
17862 <primary><varname>$exim_uid</varname></primary>
17863 </indexterm>
17864 This variable contains the numerical value of the Exim user id.
17865 </para>
17866 </listitem></varlistentry>
17867 <varlistentry>
17868 <term><varname>$exim_version</varname></term>
17869 <listitem>
17870 <para>
17871 <indexterm role="variable">
17872 <primary><varname>$exim_version</varname></primary>
17873 </indexterm>
17874 This variable contains the version string of the Exim build.
17875 The first character is a major version number, currently 4.
17876 Then after a dot, the next group of digits is a minor version number.
17877 There may be other characters following the minor version.
17878 </para>
17879 </listitem></varlistentry>
17880 <varlistentry>
17881 <term><varname>$found_extension</varname></term>
17882 <listitem>
17883 <para>
17884 <indexterm role="variable">
17885 <primary><varname>$found_extension</varname></primary>
17886 </indexterm>
17887 This variable is available when Exim is compiled with the
17888 content-scanning extension and the obsolete <option>demime</option> condition. For details,
17889 see section <xref linkend="SECTdemimecond"/>.
17890 </para>
17891 </listitem></varlistentry>
17892 <varlistentry>
17893 <term><varname>$header_</varname>&lt;<emphasis>name</emphasis>&gt;</term>
17894 <listitem>
17895 <para>
17896 This is not strictly an expansion variable. It is expansion syntax for
17897 inserting the message header line with the given name. Note that the name must
17898 be terminated by colon or white space, because it may contain a wide variety of
17899 characters. Note also that braces must <emphasis>not</emphasis> be used.
17900 </para>
17901 </listitem></varlistentry>
17902 <varlistentry>
17903 <term><varname>$headers_added</varname></term>
17904 <listitem>
17905 <para>
17906 <indexterm role="variable">
17907 <primary><varname>$headers_added</varname></primary>
17908 </indexterm>
17909 Within an ACL this variable contains the headers added so far by
17910 the ACL modifier add_header (section <xref linkend="SECTaddheadacl"/>).
17911 The headers are a newline-separated list.
17912 </para>
17913 </listitem></varlistentry>
17914 <varlistentry>
17915 <term><varname>$home</varname></term>
17916 <listitem>
17917 <para>
17918 <indexterm role="variable">
17919 <primary><varname>$home</varname></primary>
17920 </indexterm>
17921 When the <option>check_local_user</option> option is set for a router, the user&#x2019;s home
17922 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
17923 means it is set during the running of users&#x2019; filter files. A router may also
17924 explicitly set a home directory for use by a transport; this can be overridden
17925 by a setting on the transport itself.
17926 </para>
17927 <para>
17928 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
17929 of the environment variable HOME, which is subject to the
17930 <option>keep_environment</option> and <option>add_environment</option> main config options.
17931 </para>
17932 </listitem></varlistentry>
17933 <varlistentry>
17934 <term><varname>$host</varname></term>
17935 <listitem>
17936 <para>
17937 <indexterm role="variable">
17938 <primary><varname>$host</varname></primary>
17939 </indexterm>
17940 If a router assigns an address to a transport (any transport), and passes a
17941 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
17942 to run is the name of the first host on the list. Note that this applies both
17943 to local and remote transports.
17944 </para>
17945 <para>
17946 <indexterm role="concept">
17947 <primary>transport</primary>
17948 <secondary>filter</secondary>
17949 </indexterm>
17950 <indexterm role="concept">
17951 <primary>filter</primary>
17952 <secondary>transport filter</secondary>
17953 </indexterm>
17954 For the <command>smtp</command> transport, if there is more than one host, the value of
17955 <varname>$host</varname> changes as the transport works its way through the list. In
17956 particular, when the <command>smtp</command> transport is expanding its options for encryption
17957 using TLS, or for specifying a transport filter (see chapter
17958 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
17959 is connected.
17960 </para>
17961 <para>
17962 When used in the client part of an authenticator configuration (see chapter
17963 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
17964 client is connected.
17965 </para>
17966 </listitem></varlistentry>
17967 <varlistentry>
17968 <term><varname>$host_address</varname></term>
17969 <listitem>
17970 <para>
17971 <indexterm role="variable">
17972 <primary><varname>$host_address</varname></primary>
17973 </indexterm>
17974 This variable is set to the remote host&#x2019;s IP address whenever <varname>$host</varname> is set
17975 for a remote connection. It is also set to the IP address that is being checked
17976 when the <option>ignore_target_hosts</option> option is being processed.
17977 </para>
17978 </listitem></varlistentry>
17979 <varlistentry>
17980 <term><varname>$host_data</varname></term>
17981 <listitem>
17982 <para>
17983 <indexterm role="variable">
17984 <primary><varname>$host_data</varname></primary>
17985 </indexterm>
17986 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
17987 result of the lookup is made available in the <varname>$host_data</varname> variable. This
17988 allows you, for example, to do things like this:
17989 </para>
17990 <literallayout class="monospaced">
17991 deny  hosts = net-lsearch;/some/file
17992 message = $host_data
17993 </literallayout>
17994 </listitem></varlistentry>
17995 <varlistentry>
17996 <term><varname>$host_lookup_deferred</varname></term>
17997 <listitem>
17998 <para>
17999 <indexterm role="concept">
18000 <primary>host name</primary>
18001 <secondary>lookup, failure of</secondary>
18002 </indexterm>
18003 <indexterm role="variable">
18004 <primary><varname>$host_lookup_deferred</varname></primary>
18005 </indexterm>
18006 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
18007 message comes from a remote host and there is an attempt to look up the host&#x2019;s
18008 name from its IP address, and the attempt is not successful, one of these
18009 variables is set to <quote>1</quote>.
18010 </para>
18011 <itemizedlist>
18012 <listitem>
18013 <para>
18014 If the lookup receives a definite negative response (for example, a DNS lookup
18015 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
18016 </para>
18017 </listitem>
18018 <listitem>
18019 <para>
18020 If there is any kind of problem during the lookup, such that Exim cannot
18021 tell whether or not the host name is defined (for example, a timeout for a DNS
18022 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
18023 </para>
18024 </listitem>
18025 </itemizedlist>
18026 <para>
18027 Looking up a host&#x2019;s name from its IP address consists of more than just a
18028 single reverse lookup. Exim checks that a forward lookup of at least one of the
18029 names it receives from a reverse lookup yields the original IP address. If this
18030 is not the case, Exim does not accept the looked up name(s), and
18031 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
18032 IP address (for example, the existence of a PTR record in the DNS) is not
18033 sufficient on its own for the success of a host name lookup. If the reverse
18034 lookup succeeds, but there is a lookup problem such as a timeout when checking
18035 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
18036 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
18037 </para>
18038 </listitem></varlistentry>
18039 <varlistentry>
18040 <term><varname>$host_lookup_failed</varname></term>
18041 <listitem>
18042 <para>
18043 <indexterm role="variable">
18044 <primary><varname>$host_lookup_failed</varname></primary>
18045 </indexterm>
18046 See <varname>$host_lookup_deferred</varname>.
18047 </para>
18048 </listitem></varlistentry>
18049 <varlistentry>
18050 <term><varname>$host_port</varname></term>
18051 <listitem>
18052 <para>
18053 <indexterm role="variable">
18054 <primary><varname>$host_port</varname></primary>
18055 </indexterm>
18056 This variable is set to the remote host&#x2019;s TCP port whenever <varname>$host</varname> is set
18057 for an outbound connection.
18058 </para>
18059 </listitem></varlistentry>
18060 <varlistentry>
18061 <term><varname>$initial_cwd</varname></term>
18062 <listitem>
18063 <para>
18064 <indexterm role="variable">
18065 <primary><varname>$initial_cwd</varname></primary>
18066 </indexterm>
18067 This variable contains the full path name of the initial working
18068 directory of the current Exim process. This may differ from the current
18069 working directory, as Exim changes this to "/" during early startup, and
18070 to <varname>$spool_directory</varname> later.
18071 </para>
18072 </listitem></varlistentry>
18073 <varlistentry>
18074 <term><varname>$inode</varname></term>
18075 <listitem>
18076 <para>
18077 <indexterm role="variable">
18078 <primary><varname>$inode</varname></primary>
18079 </indexterm>
18080 The only time this variable is set is while expanding the <option>directory_file</option>
18081 option in the <command>appendfile</command> transport. The variable contains the inode number
18082 of the temporary file which is about to be renamed. It can be used to construct
18083 a unique name for the file.
18084 </para>
18085 </listitem></varlistentry>
18086 <varlistentry>
18087 <term><varname>$interface_address</varname></term>
18088 <listitem>
18089 <para>
18090 <indexterm role="variable">
18091 <primary><varname>$interface_address</varname></primary>
18092 </indexterm>
18093 This is an obsolete name for <varname>$received_ip_address</varname>.
18094 </para>
18095 </listitem></varlistentry>
18096 <varlistentry>
18097 <term><varname>$interface_port</varname></term>
18098 <listitem>
18099 <para>
18100 <indexterm role="variable">
18101 <primary><varname>$interface_port</varname></primary>
18102 </indexterm>
18103 This is an obsolete name for <varname>$received_port</varname>.
18104 </para>
18105 </listitem></varlistentry>
18106 <varlistentry>
18107 <term><varname>$item</varname></term>
18108 <listitem>
18109 <para>
18110 <indexterm role="variable">
18111 <primary><varname>$item</varname></primary>
18112 </indexterm>
18113 This variable is used during the expansion of <emphasis role="bold">forall</emphasis> and <emphasis role="bold">forany</emphasis>
18114 conditions (see section <xref linkend="SECTexpcond"/>), and <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and
18115 <emphasis role="bold">reduce</emphasis> items (see section <xref linkend="SECTexpcond"/>). In other circumstances, it is
18116 empty.
18117 </para>
18118 </listitem></varlistentry>
18119 <varlistentry>
18120 <term><varname>$ldap_dn</varname></term>
18121 <listitem>
18122 <para>
18123 <indexterm role="variable">
18124 <primary><varname>$ldap_dn</varname></primary>
18125 </indexterm>
18126 This variable, which is available only when Exim is compiled with LDAP support,
18127 contains the DN from the last entry in the most recently successful LDAP
18128 lookup.
18129 </para>
18130 </listitem></varlistentry>
18131 <varlistentry>
18132 <term><varname>$load_average</varname></term>
18133 <listitem>
18134 <para>
18135 <indexterm role="variable">
18136 <primary><varname>$load_average</varname></primary>
18137 </indexterm>
18138 This variable contains the system load average, multiplied by 1000 so that it
18139 is an integer. For example, if the load average is 0.21, the value of the
18140 variable is 210. The value is recomputed every time the variable is referenced.
18141 </para>
18142 </listitem></varlistentry>
18143 <varlistentry>
18144 <term><varname>$local_part</varname></term>
18145 <listitem>
18146 <para>
18147 <indexterm role="variable">
18148 <primary><varname>$local_part</varname></primary>
18149 </indexterm>
18150 When an address is being routed, or delivered on its own, this
18151 variable contains the local part. When a number of addresses are being
18152 delivered together (for example, multiple RCPT commands in an SMTP
18153 session), <varname>$local_part</varname> is not set.
18154 </para>
18155 <para>
18156 Global address rewriting happens when a message is received, so the value of
18157 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
18158 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
18159 because a message may have many recipients and the system filter is called just
18160 once.
18161 </para>
18162 <para>
18163 <indexterm role="variable">
18164 <primary><varname>$local_part_prefix</varname></primary>
18165 </indexterm>
18166 <indexterm role="variable">
18167 <primary><varname>$local_part_suffix</varname></primary>
18168 </indexterm>
18169 If a local part prefix or suffix has been recognized, it is not included in the
18170 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
18171 any prefix or suffix are in <varname>$local_part_prefix</varname> and
18172 <varname>$local_part_suffix</varname>, respectively.
18173 </para>
18174 <para>
18175 When a message is being delivered to a file, pipe, or autoreply transport as a
18176 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
18177 the parent address, not to the file name or command (see <varname>$address_file</varname> and
18178 <varname>$address_pipe</varname>).
18179 </para>
18180 <para>
18181 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
18182 local part of the recipient address.
18183 </para>
18184 <para>
18185 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
18186 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
18187 it can be used in the expansion of the replacement address, for example.
18188 </para>
18189 <para>
18190 In all cases, all quoting is removed from the local part. For example, for both
18191 the addresses
18192 </para>
18193 <literallayout class="monospaced">
18194 "abc:xyz"@test.example
18195 abc\:xyz@test.example
18196 </literallayout>
18197 <para>
18198 the value of <varname>$local_part</varname> is
18199 </para>
18200 <literallayout class="monospaced">
18201 abc:xyz
18202 </literallayout>
18203 <para>
18204 If you use <varname>$local_part</varname> to create another address, you should always wrap it
18205 inside a quoting operator. For example, in a <command>redirect</command> router you could
18206 have:
18207 </para>
18208 <literallayout class="monospaced">
18209 data = ${quote_local_part:$local_part}@new.domain.example
18210 </literallayout>
18211 <para>
18212 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
18213 to process local parts in a case-dependent manner in a router, you can set the
18214 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
18215 </para>
18216 </listitem></varlistentry>
18217 <varlistentry>
18218 <term><varname>$local_part_data</varname></term>
18219 <listitem>
18220 <para>
18221 <indexterm role="variable">
18222 <primary><varname>$local_part_data</varname></primary>
18223 </indexterm>
18224 When the <option>local_parts</option> option on a router matches a local part by means of a
18225 lookup, the data read by the lookup is available during the running of the
18226 router as <varname>$local_part_data</varname>. In addition, if the driver routes the address
18227 to a transport, the value is available in that transport. If the transport is
18228 handling multiple addresses, the value from the first address is used.
18229 </para>
18230 <para>
18231 <varname>$local_part_data</varname> is also set when the <option>local_parts</option> condition in an ACL
18232 matches a local part by means of a lookup. The data read by the lookup is
18233 available during the rest of the ACL statement. In all other situations, this
18234 variable expands to nothing.
18235 </para>
18236 </listitem></varlistentry>
18237 <varlistentry>
18238 <term><varname>$local_part_prefix</varname></term>
18239 <listitem>
18240 <para>
18241 <indexterm role="variable">
18242 <primary><varname>$local_part_prefix</varname></primary>
18243 </indexterm>
18244 When an address is being routed or delivered, and a
18245 specific prefix for the local part was recognized, it is available in this
18246 variable, having been removed from <varname>$local_part</varname>.
18247 </para>
18248 </listitem></varlistentry>
18249 <varlistentry>
18250 <term><varname>$local_part_suffix</varname></term>
18251 <listitem>
18252 <para>
18253 <indexterm role="variable">
18254 <primary><varname>$local_part_suffix</varname></primary>
18255 </indexterm>
18256 When an address is being routed or delivered, and a
18257 specific suffix for the local part was recognized, it is available in this
18258 variable, having been removed from <varname>$local_part</varname>.
18259 </para>
18260 </listitem></varlistentry>
18261 <varlistentry>
18262 <term><varname>$local_scan_data</varname></term>
18263 <listitem>
18264 <para>
18265 <indexterm role="variable">
18266 <primary><varname>$local_scan_data</varname></primary>
18267 </indexterm>
18268 This variable contains the text returned by the <function>local_scan()</function> function when
18269 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
18270 </para>
18271 </listitem></varlistentry>
18272 <varlistentry>
18273 <term><varname>$local_user_gid</varname></term>
18274 <listitem>
18275 <para>
18276 <indexterm role="variable">
18277 <primary><varname>$local_user_gid</varname></primary>
18278 </indexterm>
18279 See <varname>$local_user_uid</varname>.
18280 </para>
18281 </listitem></varlistentry>
18282 <varlistentry>
18283 <term><varname>$local_user_uid</varname></term>
18284 <listitem>
18285 <para>
18286 <indexterm role="variable">
18287 <primary><varname>$local_user_uid</varname></primary>
18288 </indexterm>
18289 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
18290 <option>check_local_user</option> router precondition succeeds. This means that their values
18291 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
18292 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
18293 router-specific expansions. At all other times, the values in these variables
18294 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
18295 </para>
18296 </listitem></varlistentry>
18297 <varlistentry>
18298 <term><varname>$localhost_number</varname></term>
18299 <listitem>
18300 <para>
18301 <indexterm role="variable">
18302 <primary><varname>$localhost_number</varname></primary>
18303 </indexterm>
18304 This contains the expanded value of the
18305 <option>localhost_number</option> option. The expansion happens after the main options have
18306 been read.
18307 </para>
18308 </listitem></varlistentry>
18309 <varlistentry>
18310 <term><varname>$log_inodes</varname></term>
18311 <listitem>
18312 <para>
18313 <indexterm role="variable">
18314 <primary><varname>$log_inodes</varname></primary>
18315 </indexterm>
18316 The number of free inodes in the disk partition where Exim&#x2019;s
18317 log files are being written. The value is recalculated whenever the variable is
18318 referenced. If the relevant file system does not have the concept of inodes,
18319 the value of is -1. See also the <option>check_log_inodes</option> option.
18320 </para>
18321 </listitem></varlistentry>
18322 <varlistentry>
18323 <term><varname>$log_space</varname></term>
18324 <listitem>
18325 <para>
18326 <indexterm role="variable">
18327 <primary><varname>$log_space</varname></primary>
18328 </indexterm>
18329 The amount of free space (as a number of kilobytes) in the disk
18330 partition where Exim&#x2019;s log files are being written. The value is recalculated
18331 whenever the variable is referenced. If the operating system does not have the
18332 ability to find the amount of free space (only true for experimental systems),
18333 the space value is -1. See also the <option>check_log_space</option> option.
18334 </para>
18335 </listitem></varlistentry>
18336 <varlistentry>
18337 <term><varname>$lookup_dnssec_authenticated</varname></term>
18338 <listitem>
18339 <para>
18340 <indexterm role="variable">
18341 <primary><varname>$lookup_dnssec_authenticated</varname></primary>
18342 </indexterm>
18343 This variable is set after a DNS lookup done by
18344 a dnsdb lookup expansion, dnslookup router or smtp transport.
18345 <indexterm role="concept">
18346 <primary>DNS</primary>
18347 <secondary>DNSSEC</secondary>
18348 </indexterm>
18349 It will be empty if <command>DNSSEC</command> was not requested,
18350 <quote>no</quote> if the result was not labelled as authenticated data
18351 and <quote>yes</quote> if it was.
18352 Results that are labelled as authoritative answer that match
18353 the <option>dns_trust_aa</option> configuration variable count also
18354 as authenticated data.
18355 </para>
18356 </listitem></varlistentry>
18357 <varlistentry>
18358 <term><varname>$mailstore_basename</varname></term>
18359 <listitem>
18360 <para>
18361 <indexterm role="variable">
18362 <primary><varname>$mailstore_basename</varname></primary>
18363 </indexterm>
18364 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
18365 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
18366 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
18367 contains the basename of the files that are being written, that is, the name
18368 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
18369 variable is empty.
18370 </para>
18371 </listitem></varlistentry>
18372 <varlistentry>
18373 <term><varname>$malware_name</varname></term>
18374 <listitem>
18375 <para>
18376 <indexterm role="variable">
18377 <primary><varname>$malware_name</varname></primary>
18378 </indexterm>
18379 This variable is available when Exim is compiled with the
18380 content-scanning extension. It is set to the name of the virus that was found
18381 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
18382 </para>
18383 </listitem></varlistentry>
18384 <varlistentry>
18385 <term><varname>$max_received_linelength</varname></term>
18386 <listitem>
18387 <para>
18388 <indexterm role="variable">
18389 <primary><varname>$max_received_linelength</varname></primary>
18390 </indexterm>
18391 <indexterm role="concept">
18392 <primary>maximum</primary>
18393 <secondary>line length</secondary>
18394 </indexterm>
18395 <indexterm role="concept">
18396 <primary>line length</primary>
18397 <secondary>maximum</secondary>
18398 </indexterm>
18399 This variable contains the number of bytes in the longest line that was
18400 received as part of the message, not counting the line termination
18401 character(s).
18402 </para>
18403 </listitem></varlistentry>
18404 <varlistentry>
18405 <term><varname>$message_age</varname></term>
18406 <listitem>
18407 <para>
18408 <indexterm role="concept">
18409 <primary>message</primary>
18410 <secondary>age of</secondary>
18411 </indexterm>
18412 <indexterm role="variable">
18413 <primary><varname>$message_age</varname></primary>
18414 </indexterm>
18415 This variable is set at the start of a delivery attempt to contain the number
18416 of seconds since the message was received. It does not change during a single
18417 delivery attempt.
18418 </para>
18419 </listitem></varlistentry>
18420 <varlistentry>
18421 <term><varname>$message_body</varname></term>
18422 <listitem>
18423 <para>
18424 <indexterm role="concept">
18425 <primary>body of message</primary>
18426 <secondary>expansion variable</secondary>
18427 </indexterm>
18428 <indexterm role="concept">
18429 <primary>message body</primary>
18430 <secondary>in expansion</secondary>
18431 </indexterm>
18432 <indexterm role="concept">
18433 <primary>binary zero</primary>
18434 <secondary>in message body</secondary>
18435 </indexterm>
18436 <indexterm role="variable">
18437 <primary><varname>$message_body</varname></primary>
18438 </indexterm>
18439 <indexterm role="option">
18440 <primary><option>message_body_visible</option></primary>
18441 </indexterm>
18442 This variable contains the initial portion of a message&#x2019;s body while it is
18443 being delivered, and is intended mainly for use in filter files. The maximum
18444 number of characters of the body that are put into the variable is set by the
18445 <option>message_body_visible</option> configuration option; the default is 500.
18446 </para>
18447 <para>
18448 <indexterm role="option">
18449 <primary><option>message_body_newlines</option></primary>
18450 </indexterm>
18451 By default, newlines are converted into spaces in <varname>$message_body</varname>, to make it
18452 easier to search for phrases that might be split over a line break. However,
18453 this can be disabled by setting <option>message_body_newlines</option> to be true. Binary
18454 zeros are always converted into spaces.
18455 </para>
18456 </listitem></varlistentry>
18457 <varlistentry>
18458 <term><varname>$message_body_end</varname></term>
18459 <listitem>
18460 <para>
18461 <indexterm role="concept">
18462 <primary>body of message</primary>
18463 <secondary>expansion variable</secondary>
18464 </indexterm>
18465 <indexterm role="concept">
18466 <primary>message body</primary>
18467 <secondary>in expansion</secondary>
18468 </indexterm>
18469 <indexterm role="variable">
18470 <primary><varname>$message_body_end</varname></primary>
18471 </indexterm>
18472 This variable contains the final portion of a message&#x2019;s
18473 body while it is being delivered. The format and maximum size are as for
18474 <varname>$message_body</varname>.
18475 </para>
18476 </listitem></varlistentry>
18477 <varlistentry>
18478 <term><varname>$message_body_size</varname></term>
18479 <listitem>
18480 <para>
18481 <indexterm role="concept">
18482 <primary>body of message</primary>
18483 <secondary>size</secondary>
18484 </indexterm>
18485 <indexterm role="concept">
18486 <primary>message body</primary>
18487 <secondary>size</secondary>
18488 </indexterm>
18489 <indexterm role="variable">
18490 <primary><varname>$message_body_size</varname></primary>
18491 </indexterm>
18492 When a message is being delivered, this variable contains the size of the body
18493 in bytes. The count starts from the character after the blank line that
18494 separates the body from the header. Newlines are included in the count. See
18495 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
18496 </para>
18497 </listitem></varlistentry>
18498 <varlistentry>
18499 <term><varname>$message_exim_id</varname></term>
18500 <listitem>
18501 <para>
18502 <indexterm role="variable">
18503 <primary><varname>$message_exim_id</varname></primary>
18504 </indexterm>
18505 When a message is being received or delivered, this variable contains the
18506 unique message id that is generated and used by Exim to identify the message.
18507 An id is not created for a message until after its header has been successfully
18508 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
18509 line; it is the local id that Exim assigns to the message, for example:
18510 <literal>1BXTIK-0001yO-VA</literal>.
18511 </para>
18512 </listitem></varlistentry>
18513 <varlistentry>
18514 <term><varname>$message_headers</varname></term>
18515 <listitem>
18516 <para>
18517 <indexterm role="variable">
18518 <primary><varname>$message_headers</varname></primary>
18519 </indexterm>
18520 This variable contains a concatenation of all the header lines when a message
18521 is being processed, except for lines added by routers or transports. The header
18522 lines are separated by newline characters. Their contents are decoded in the
18523 same way as a header line that is inserted by <option>bheader</option>.
18524 </para>
18525 </listitem></varlistentry>
18526 <varlistentry>
18527 <term><varname>$message_headers_raw</varname></term>
18528 <listitem>
18529 <para>
18530 <indexterm role="variable">
18531 <primary><varname>$message_headers_raw</varname></primary>
18532 </indexterm>
18533 This variable is like <varname>$message_headers</varname> except that no processing of the
18534 contents of header lines is done.
18535 </para>
18536 </listitem></varlistentry>
18537 <varlistentry>
18538 <term><varname>$message_id</varname></term>
18539 <listitem>
18540 <para>
18541 This is an old name for <varname>$message_exim_id</varname>. It is now deprecated.
18542 </para>
18543 </listitem></varlistentry>
18544 <varlistentry>
18545 <term><varname>$message_linecount</varname></term>
18546 <listitem>
18547 <para>
18548 <indexterm role="variable">
18549 <primary><varname>$message_linecount</varname></primary>
18550 </indexterm>
18551 This variable contains the total number of lines in the header and body of the
18552 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
18553 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
18554 number of lines received. Before delivery happens (that is, before filters,
18555 routers, and transports run) the count is increased to include the
18556 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
18557 lines that are added by ACLs. The blank line that separates the message header
18558 from the body is not counted.
18559 </para>
18560 <para>
18561 As with the special case of <varname>$message_size</varname>, during the expansion of the
18562 appendfile transport&#x2019;s maildir_tag option in maildir format, the value of
18563 <varname>$message_linecount</varname> is the precise size of the number of newlines in the
18564 file that has been written (minus one for the blank line between the
18565 header and the body).
18566 </para>
18567 <para>
18568 Here is an example of the use of this variable in a DATA ACL:
18569 </para>
18570 <literallayout class="monospaced">
18571 deny message   = Too many lines in message header
18572      condition = \
18573       ${if &lt;{250}{${eval:$message_linecount - $body_linecount}}}
18574 </literallayout>
18575 <para>
18576 In the MAIL and RCPT ACLs, the value is zero because at that stage the
18577 message has not yet been received.
18578 </para>
18579 </listitem></varlistentry>
18580 <varlistentry>
18581 <term><varname>$message_size</varname></term>
18582 <listitem>
18583 <para>
18584 <indexterm role="concept">
18585 <primary>size</primary>
18586 <secondary>of message</secondary>
18587 </indexterm>
18588 <indexterm role="concept">
18589 <primary>message</primary>
18590 <secondary>size</secondary>
18591 </indexterm>
18592 <indexterm role="variable">
18593 <primary><varname>$message_size</varname></primary>
18594 </indexterm>
18595 When a message is being processed, this variable contains its size in bytes. In
18596 most cases, the size includes those headers that were received with the
18597 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
18598 deliveries as they are written. However, there is one special case: during the
18599 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
18600 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
18601 precise size of the file that has been written. See also
18602 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
18603 </para>
18604 <para>
18605 <indexterm role="concept">
18606 <primary>RCPT</primary>
18607 <secondary>value of <varname>$message_size</varname></secondary>
18608 </indexterm>
18609 While running a per message ACL (mail/rcpt/predata), <varname>$message_size</varname>
18610 contains the size supplied on the MAIL command, or -1 if no size was given. The
18611 value may not, of course, be truthful.
18612 </para>
18613 </listitem></varlistentry>
18614 <varlistentry>
18615 <term><varname>$mime_</varname><emphasis>xxx</emphasis></term>
18616 <listitem>
18617 <para>
18618 A number of variables whose names start with <varname>$mime</varname> are
18619 available when Exim is compiled with the content-scanning extension. For
18620 details, see section <xref linkend="SECTscanmimepart"/>.
18621 </para>
18622 </listitem></varlistentry>
18623 <varlistentry>
18624 <term><varname>$n0</varname> &ndash; <varname>$n9</varname></term>
18625 <listitem>
18626 <para>
18627 These variables are counters that can be incremented by means
18628 of the <option>add</option> command in filter files.
18629 </para>
18630 </listitem></varlistentry>
18631 <varlistentry>
18632 <term><varname>$original_domain</varname></term>
18633 <listitem>
18634 <para>
18635 <indexterm role="variable">
18636 <primary><varname>$domain</varname></primary>
18637 </indexterm>
18638 <indexterm role="variable">
18639 <primary><varname>$original_domain</varname></primary>
18640 </indexterm>
18641 When a top-level address is being processed for delivery, this contains the
18642 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
18643 generated by an alias, forward, or filter file) is being processed, this
18644 variable contains the domain of the original address (lower cased). This
18645 differs from <varname>$parent_domain</varname> only when there is more than one level of
18646 aliasing or forwarding. When more than one address is being delivered in a
18647 single transport run, <varname>$original_domain</varname> is not set.
18648 </para>
18649 <para>
18650 If a new address is created by means of a <option>deliver</option> command in a system
18651 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
18652 part <emphasis>system-filter</emphasis> and the default qualify domain.
18653 </para>
18654 </listitem></varlistentry>
18655 <varlistentry>
18656 <term><varname>$original_local_part</varname></term>
18657 <listitem>
18658 <para>
18659 <indexterm role="variable">
18660 <primary><varname>$local_part</varname></primary>
18661 </indexterm>
18662 <indexterm role="variable">
18663 <primary><varname>$original_local_part</varname></primary>
18664 </indexterm>
18665 When a top-level address is being processed for delivery, this contains the
18666 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
18667 local part, because <varname>$original_local_part</varname> always contains the full local
18668 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
18669 filter file) is being processed, this variable contains the full local part of
18670 the original address.
18671 </para>
18672 <para>
18673 If the router that did the redirection processed the local part
18674 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
18675 This variable differs from <varname>$parent_local_part</varname> only when there is more than
18676 one level of aliasing or forwarding. When more than one address is being
18677 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
18678 </para>
18679 <para>
18680 If a new address is created by means of a <option>deliver</option> command in a system
18681 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
18682 part <emphasis>system-filter</emphasis> and the default qualify domain.
18683 </para>
18684 </listitem></varlistentry>
18685 <varlistentry>
18686 <term><varname>$originator_gid</varname></term>
18687 <listitem>
18688 <para>
18689 <indexterm role="concept">
18690 <primary>gid (group id)</primary>
18691 <secondary>of originating user</secondary>
18692 </indexterm>
18693 <indexterm role="concept">
18694 <primary>sender</primary>
18695 <secondary>gid</secondary>
18696 </indexterm>
18697 <indexterm role="variable">
18698 <primary><varname>$caller_gid</varname></primary>
18699 </indexterm>
18700 <indexterm role="variable">
18701 <primary><varname>$originator_gid</varname></primary>
18702 </indexterm>
18703 This variable contains the value of <varname>$caller_gid</varname> that was set when the
18704 message was received. For messages received via the command line, this is the
18705 gid of the sending user. For messages received by SMTP over TCP/IP, this is
18706 normally the gid of the Exim user.
18707 </para>
18708 </listitem></varlistentry>
18709 <varlistentry>
18710 <term><varname>$originator_uid</varname></term>
18711 <listitem>
18712 <para>
18713 <indexterm role="concept">
18714 <primary>uid (user id)</primary>
18715 <secondary>of originating user</secondary>
18716 </indexterm>
18717 <indexterm role="concept">
18718 <primary>sender</primary>
18719 <secondary>uid</secondary>
18720 </indexterm>
18721 <indexterm role="variable">
18722 <primary><varname>$caller_uid</varname></primary>
18723 </indexterm>
18724 <indexterm role="variable">
18725 <primary><varname>$originaltor_uid</varname></primary>
18726 </indexterm>
18727 The value of <varname>$caller_uid</varname> that was set when the message was received. For
18728 messages received via the command line, this is the uid of the sending user.
18729 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
18730 user.
18731 </para>
18732 </listitem></varlistentry>
18733 <varlistentry>
18734 <term><varname>$parent_domain</varname></term>
18735 <listitem>
18736 <para>
18737 <indexterm role="variable">
18738 <primary><varname>$parent_domain</varname></primary>
18739 </indexterm>
18740 This variable is similar to <varname>$original_domain</varname> (see
18741 above), except that it refers to the immediately preceding parent address.
18742 </para>
18743 </listitem></varlistentry>
18744 <varlistentry>
18745 <term><varname>$parent_local_part</varname></term>
18746 <listitem>
18747 <para>
18748 <indexterm role="variable">
18749 <primary><varname>$parent_local_part</varname></primary>
18750 </indexterm>
18751 This variable is similar to <varname>$original_local_part</varname>
18752 (see above), except that it refers to the immediately preceding parent address.
18753 </para>
18754 </listitem></varlistentry>
18755 <varlistentry>
18756 <term><varname>$pid</varname></term>
18757 <listitem>
18758 <para>
18759 <indexterm role="concept">
18760 <primary>pid (process id)</primary>
18761 <secondary>of current process</secondary>
18762 </indexterm>
18763 <indexterm role="variable">
18764 <primary><varname>$pid</varname></primary>
18765 </indexterm>
18766 This variable contains the current process id.
18767 </para>
18768 </listitem></varlistentry>
18769 <varlistentry>
18770 <term><varname>$pipe_addresses</varname></term>
18771 <listitem>
18772 <para>
18773 <indexterm role="concept">
18774 <primary>filter</primary>
18775 <secondary>transport filter</secondary>
18776 </indexterm>
18777 <indexterm role="concept">
18778 <primary>transport</primary>
18779 <secondary>filter</secondary>
18780 </indexterm>
18781 <indexterm role="variable">
18782 <primary><varname>$pipe_addresses</varname></primary>
18783 </indexterm>
18784 This is not an expansion variable, but is mentioned here because the string
18785 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
18786 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
18787 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
18788 It cannot be used in general expansion strings, and provokes an <quote>unknown
18789 variable</quote> error if encountered.
18790 </para>
18791 </listitem></varlistentry>
18792 <varlistentry>
18793 <term><varname>$primary_hostname</varname></term>
18794 <listitem>
18795 <para>
18796 <indexterm role="variable">
18797 <primary><varname>$primary_hostname</varname></primary>
18798 </indexterm>
18799 This variable contains the value set by <option>primary_hostname</option> in the
18800 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
18801 a single-component name, Exim calls <function>gethostbyname()</function> (or
18802 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
18803 qualified host name. See also <varname>$smtp_active_hostname</varname>.
18804 </para>
18805 </listitem></varlistentry>
18806 <varlistentry revisionflag="changed">
18807 <term><varname>$proxy_host_address</varname></term>
18808 <term><varname>$proxy_host_port</varname></term>
18809 <term><varname>$proxy_target_address</varname></term>
18810 <term><varname>$proxy_target_port</varname></term>
18811 <term><varname>$proxy_session</varname></term>
18812 <listitem>
18813 <para revisionflag="changed">
18814 These variables are only available when built with Proxy Protocol
18815 or Socks5 support
18816 For details see chapter <xref linkend="SECTproxyInbound"/>.
18817 </para>
18818 </listitem></varlistentry>
18819 <varlistentry revisionflag="changed">
18820 <term><varname>$prdr_requested</varname></term>
18821 <listitem>
18822 <para revisionflag="changed">
18823 <indexterm role="concept">
18824 <primary>PRDR</primary>
18825 <secondary>variable for</secondary>
18826 </indexterm>
18827 This variable is set to <quote>yes</quote> if PRDR was requested by the client for the
18828 current message, otherwise <quote>no</quote>.
18829 </para>
18830 </listitem></varlistentry>
18831 <varlistentry>
18832 <term><varname>$prvscheck_address</varname></term>
18833 <listitem>
18834 <para>
18835 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
18836 which is described in sections <xref linkend="SECTexpansionitems"/> and
18837 <xref linkend="SECTverifyPRVS"/>.
18838 </para>
18839 </listitem></varlistentry>
18840 <varlistentry>
18841 <term><varname>$prvscheck_keynum</varname></term>
18842 <listitem>
18843 <para>
18844 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
18845 which is described in sections <xref linkend="SECTexpansionitems"/> and
18846 <xref linkend="SECTverifyPRVS"/>.
18847 </para>
18848 </listitem></varlistentry>
18849 <varlistentry>
18850 <term><varname>$prvscheck_result</varname></term>
18851 <listitem>
18852 <para>
18853 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
18854 which is described in sections <xref linkend="SECTexpansionitems"/> and
18855 <xref linkend="SECTverifyPRVS"/>.
18856 </para>
18857 </listitem></varlistentry>
18858 <varlistentry>
18859 <term><varname>$qualify_domain</varname></term>
18860 <listitem>
18861 <para>
18862 <indexterm role="variable">
18863 <primary><varname>$qualify_domain</varname></primary>
18864 </indexterm>
18865 The value set for the <option>qualify_domain</option> option in the configuration file.
18866 </para>
18867 </listitem></varlistentry>
18868 <varlistentry>
18869 <term><varname>$qualify_recipient</varname></term>
18870 <listitem>
18871 <para>
18872 <indexterm role="variable">
18873 <primary><varname>$qualify_recipient</varname></primary>
18874 </indexterm>
18875 The value set for the <option>qualify_recipient</option> option in the configuration file,
18876 or if not set, the value of <varname>$qualify_domain</varname>.
18877 </para>
18878 </listitem></varlistentry>
18879 <varlistentry>
18880 <term><varname>$rcpt_count</varname></term>
18881 <listitem>
18882 <para>
18883 <indexterm role="variable">
18884 <primary><varname>$rcpt_count</varname></primary>
18885 </indexterm>
18886 When a message is being received by SMTP, this variable contains the number of
18887 RCPT commands received for the current message. If this variable is used in a
18888 RCPT ACL, its value includes the current command.
18889 </para>
18890 </listitem></varlistentry>
18891 <varlistentry>
18892 <term><varname>$rcpt_defer_count</varname></term>
18893 <listitem>
18894 <para>
18895 <indexterm role="variable">
18896 <primary><varname>$rcpt_defer_count</varname></primary>
18897 </indexterm>
18898 <indexterm role="concept">
18899 <primary>4<emphasis>xx</emphasis> responses</primary>
18900 <secondary>count of</secondary>
18901 </indexterm>
18902 When a message is being received by SMTP, this variable contains the number of
18903 RCPT commands in the current message that have previously been rejected with a
18904 temporary (4<emphasis>xx</emphasis>) response.
18905 </para>
18906 </listitem></varlistentry>
18907 <varlistentry>
18908 <term><varname>$rcpt_fail_count</varname></term>
18909 <listitem>
18910 <para>
18911 <indexterm role="variable">
18912 <primary><varname>$rcpt_fail_count</varname></primary>
18913 </indexterm>
18914 When a message is being received by SMTP, this variable contains the number of
18915 RCPT commands in the current message that have previously been rejected with a
18916 permanent (5<emphasis>xx</emphasis>) response.
18917 </para>
18918 </listitem></varlistentry>
18919 <varlistentry>
18920 <term><varname>$received_count</varname></term>
18921 <listitem>
18922 <para>
18923 <indexterm role="variable">
18924 <primary><varname>$received_count</varname></primary>
18925 </indexterm>
18926 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
18927 including the one added by Exim (so its value is always greater than zero). It
18928 is available in the DATA ACL, the non-SMTP ACL, and while routing and
18929 delivering.
18930 </para>
18931 </listitem></varlistentry>
18932 <varlistentry>
18933 <term><varname>$received_for</varname></term>
18934 <listitem>
18935 <para>
18936 <indexterm role="variable">
18937 <primary><varname>$received_for</varname></primary>
18938 </indexterm>
18939 If there is only a single recipient address in an incoming message, this
18940 variable contains that address when the <emphasis>Received:</emphasis> header line is being
18941 built. The value is copied after recipient rewriting has happened, but before
18942 the <function>local_scan()</function> function is run.
18943 </para>
18944 </listitem></varlistentry>
18945 <varlistentry>
18946 <term><varname>$received_ip_address</varname></term>
18947 <listitem>
18948 <para>
18949 <indexterm role="variable">
18950 <primary><varname>$received_ip_address</varname></primary>
18951 </indexterm>
18952 As soon as an Exim server starts processing an incoming TCP/IP connection, this
18953 variable is set to the address of the local IP interface, and <varname>$received_port</varname>
18954 is set to the local port number. (The remote IP address and port are in
18955 <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.) When testing with <option>-bh</option>,
18956 the port value is -1 unless it has been set using the <option>-oMi</option> command line
18957 option.
18958 </para>
18959 <para>
18960 As well as being useful in ACLs (including the <quote>connect</quote> ACL), these variable
18961 could be used, for example, to make the file name for a TLS certificate depend
18962 on which interface and/or port is being used for the incoming connection. The
18963 values of <varname>$received_ip_address</varname> and <varname>$received_port</varname> are saved with any
18964 messages that are received, thus making these variables available at delivery
18965 time.
18966 For outbound connections see <varname>$sending_ip_address</varname>.
18967 </para>
18968 </listitem></varlistentry>
18969 <varlistentry>
18970 <term><varname>$received_port</varname></term>
18971 <listitem>
18972 <para>
18973 <indexterm role="variable">
18974 <primary><varname>$received_port</varname></primary>
18975 </indexterm>
18976 See <varname>$received_ip_address</varname>.
18977 </para>
18978 </listitem></varlistentry>
18979 <varlistentry>
18980 <term><varname>$received_protocol</varname></term>
18981 <listitem>
18982 <para>
18983 <indexterm role="variable">
18984 <primary><varname>$received_protocol</varname></primary>
18985 </indexterm>
18986 When a message is being processed, this variable contains the name of the
18987 protocol by which it was received. Most of the names used by Exim are defined
18988 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
18989 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
18990 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
18991 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
18992 connection and the client was successfully authenticated.
18993 </para>
18994 <para>
18995 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
18996 automatically set up on connection without the use of STARTTLS (see
18997 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
18998 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
18999 where the client initially uses EHLO, sets up an encrypted connection using
19000 STARTTLS, and then uses HELO afterwards.
19001 </para>
19002 <para>
19003 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
19004 messages that are injected locally by trusted callers. This is commonly used to
19005 identify messages that are being re-injected after some kind of scanning.
19006 </para>
19007 </listitem></varlistentry>
19008 <varlistentry>
19009 <term><varname>$received_time</varname></term>
19010 <listitem>
19011 <para>
19012 <indexterm role="variable">
19013 <primary><varname>$received_time</varname></primary>
19014 </indexterm>
19015 This variable contains the date and time when the current message was received,
19016 as a number of seconds since the start of the Unix epoch.
19017 </para>
19018 </listitem></varlistentry>
19019 <varlistentry>
19020 <term><varname>$recipient_data</varname></term>
19021 <listitem>
19022 <para>
19023 <indexterm role="variable">
19024 <primary><varname>$recipient_data</varname></primary>
19025 </indexterm>
19026 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
19027 condition. It contains the data from the lookup, and the value remains set
19028 until the next <option>recipients</option> test. Thus, you can do things like this:
19029 </para>
19030 <literallayout>
19031 <literal>require recipients  = cdb*@;/some/file</literal>
19032 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
19033 </literallayout>
19034 <para>
19035 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
19036 method in the address list, using the semicolon syntax as in the example above.
19037 The variable is not set for a lookup that is used as part of the string
19038 expansion that all such lists undergo before being interpreted.
19039 </para>
19040 </listitem></varlistentry>
19041 <varlistentry>
19042 <term><varname>$recipient_verify_failure</varname></term>
19043 <listitem>
19044 <para>
19045 <indexterm role="variable">
19046 <primary><varname>$recipient_verify_failure</varname></primary>
19047 </indexterm>
19048 In an ACL, when a recipient verification fails, this variable contains
19049 information about the failure. It is set to one of the following words:
19050 </para>
19051 <itemizedlist>
19052 <listitem>
19053 <para>
19054 <quote>qualify</quote>: The address was unqualified (no domain), and the message
19055 was neither local nor came from an exempted host.
19056 </para>
19057 </listitem>
19058 <listitem>
19059 <para>
19060 <quote>route</quote>: Routing failed.
19061 </para>
19062 </listitem>
19063 <listitem>
19064 <para>
19065 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
19066 or before the MAIL command (that is, on initial connection, HELO, or
19067 MAIL).
19068 </para>
19069 </listitem>
19070 <listitem>
19071 <para>
19072 <quote>recipient</quote>: The RCPT command in a callout was rejected.
19073 </para>
19074 </listitem>
19075 <listitem>
19076 <para>
19077 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
19078 </para>
19079 </listitem>
19080 </itemizedlist>
19081 <para>
19082 The main use of this variable is expected to be to distinguish between
19083 rejections of MAIL and rejections of RCPT.
19084 </para>
19085 </listitem></varlistentry>
19086 <varlistentry>
19087 <term><varname>$recipients</varname></term>
19088 <listitem>
19089 <para>
19090 <indexterm role="variable">
19091 <primary><varname>$recipients</varname></primary>
19092 </indexterm>
19093 This variable contains a list of envelope recipients for a message. A comma and
19094 a space separate the addresses in the replacement text. However, the variable
19095 is not generally available, to prevent exposure of Bcc recipients in
19096 unprivileged users&#x2019; filter files. You can use <varname>$recipients</varname> only in these
19097 cases:
19098 </para>
19099 <orderedlist numeration="arabic">
19100 <listitem>
19101 <para>
19102 In a system filter file.
19103 </para>
19104 </listitem>
19105 <listitem>
19106 <para>
19107 In the ACLs associated with the DATA command and with non-SMTP messages, that
19108 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
19109 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
19110 <option>acl_not_smtp_mime</option>.
19111 </para>
19112 </listitem>
19113 <listitem>
19114 <para>
19115 From within a <function>local_scan()</function> function.
19116 </para>
19117 </listitem>
19118 </orderedlist>
19119 </listitem></varlistentry>
19120 <varlistentry>
19121 <term><varname>$recipients_count</varname></term>
19122 <listitem>
19123 <para>
19124 <indexterm role="variable">
19125 <primary><varname>$recipients_count</varname></primary>
19126 </indexterm>
19127 When a message is being processed, this variable contains the number of
19128 envelope recipients that came with the message. Duplicates are not excluded
19129 from the count. While a message is being received over SMTP, the number
19130 increases for each accepted recipient. It can be referenced in an ACL.
19131 </para>
19132 </listitem></varlistentry>
19133 <varlistentry>
19134 <term><varname>$regex_match_string</varname></term>
19135 <listitem>
19136 <para>
19137 <indexterm role="variable">
19138 <primary><varname>$regex_match_string</varname></primary>
19139 </indexterm>
19140 This variable is set to contain the matching regular expression after a
19141 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
19142 </para>
19143 </listitem></varlistentry>
19144 <varlistentry>
19145 <term><varname>$regex1</varname>, <varname>$regex2</varname>, etc</term>
19146 <listitem>
19147 <para>
19148 <indexterm role="concept">
19149 <primary>regex submatch variables (<varname>$1regex</varname> <varname>$2regex</varname> etc)</primary>
19150 </indexterm>
19151 When a <option>regex</option> or <option>mime_regex</option> ACL condition succeeds,
19152 these variables contain the
19153 captured substrings identified by the regular expression.
19154 </para>
19155 </listitem></varlistentry>
19156 <varlistentry>
19157 <term><varname>$reply_address</varname></term>
19158 <listitem>
19159 <para>
19160 <indexterm role="variable">
19161 <primary><varname>$reply_address</varname></primary>
19162 </indexterm>
19163 When a message is being processed, this variable contains the contents of the
19164 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
19165 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
19166 white space, the value is not processed in any way. In particular, no RFC 2047
19167 decoding or character code translation takes place.
19168 </para>
19169 </listitem></varlistentry>
19170 <varlistentry>
19171 <term><varname>$return_path</varname></term>
19172 <listitem>
19173 <para>
19174 <indexterm role="variable">
19175 <primary><varname>$return_path</varname></primary>
19176 </indexterm>
19177 When a message is being delivered, this variable contains the return path &ndash;
19178 the sender field that will be sent as part of the envelope. It is not enclosed
19179 in &lt;&gt; characters. At the start of routing an address, <varname>$return_path</varname> has the
19180 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
19181 mailing list has been expanded by a router which specifies a different address
19182 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
19183 address, whereas <varname>$sender_address</varname> always contains the original sender address
19184 that was received with the message. In other words, <varname>$sender_address</varname> contains
19185 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
19186 envelope sender.
19187 </para>
19188 </listitem></varlistentry>
19189 <varlistentry>
19190 <term><varname>$return_size_limit</varname></term>
19191 <listitem>
19192 <para>
19193 <indexterm role="variable">
19194 <primary><varname>$return_size_limit</varname></primary>
19195 </indexterm>
19196 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
19197 </para>
19198 </listitem></varlistentry>
19199 <varlistentry>
19200 <term><varname>$router_name</varname></term>
19201 <listitem>
19202 <para>
19203 <indexterm role="concept">
19204 <primary>router</primary>
19205 <secondary>name</secondary>
19206 </indexterm>
19207 <indexterm role="concept">
19208 <primary>name</primary>
19209 <secondary>of router</secondary>
19210 </indexterm>
19211 <indexterm role="variable">
19212 <primary><varname>$router_name</varname></primary>
19213 </indexterm>
19214 During the running of a router this variable contains its name.
19215 </para>
19216 </listitem></varlistentry>
19217 <varlistentry>
19218 <term><varname>$runrc</varname></term>
19219 <listitem>
19220 <para>
19221 <indexterm role="concept">
19222 <primary>return code</primary>
19223 <secondary>from <option>run</option> expansion</secondary>
19224 </indexterm>
19225 <indexterm role="variable">
19226 <primary><varname>$runrc</varname></primary>
19227 </indexterm>
19228 This variable contains the return code from a command that is run by the
19229 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
19230 assume the order in which option values are expanded, except for those
19231 preconditions whose order of testing is documented. Therefore, you cannot
19232 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
19233 another.
19234 </para>
19235 </listitem></varlistentry>
19236 <varlistentry>
19237 <term><varname>$self_hostname</varname></term>
19238 <listitem>
19239 <para>
19240 <indexterm role="option">
19241 <primary><option>self</option></primary>
19242 <secondary>value of host name</secondary>
19243 </indexterm>
19244 <indexterm role="variable">
19245 <primary><varname>$self_hostname</varname></primary>
19246 </indexterm>
19247 When an address is routed to a supposedly remote host that turns out to be the
19248 local host, what happens is controlled by the <option>self</option> generic router option.
19249 One of its values causes the address to be passed to another router. When this
19250 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
19251 original router encountered. In other circumstances its contents are null.
19252 </para>
19253 </listitem></varlistentry>
19254 <varlistentry>
19255 <term><varname>$sender_address</varname></term>
19256 <listitem>
19257 <para>
19258 <indexterm role="variable">
19259 <primary><varname>$sender_address</varname></primary>
19260 </indexterm>
19261 When a message is being processed, this variable contains the sender&#x2019;s address
19262 that was received in the message&#x2019;s envelope. The case of letters in the address
19263 is retained, in both the local part and the domain. For bounce messages, the
19264 value of this variable is the empty string. See also <varname>$return_path</varname>.
19265 </para>
19266 </listitem></varlistentry>
19267 <varlistentry>
19268 <term><varname>$sender_address_data</varname></term>
19269 <listitem>
19270 <para>
19271 <indexterm role="variable">
19272 <primary><varname>$address_data</varname></primary>
19273 </indexterm>
19274 <indexterm role="variable">
19275 <primary><varname>$sender_address_data</varname></primary>
19276 </indexterm>
19277 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
19278 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
19279 distinguish it from data from a recipient address. The value does not persist
19280 after the end of the current ACL statement. If you want to preserve it for
19281 longer, you can save it in an ACL variable.
19282 </para>
19283 </listitem></varlistentry>
19284 <varlistentry>
19285 <term><varname>$sender_address_domain</varname></term>
19286 <listitem>
19287 <para>
19288 <indexterm role="variable">
19289 <primary><varname>$sender_address_domain</varname></primary>
19290 </indexterm>
19291 The domain portion of <varname>$sender_address</varname>.
19292 </para>
19293 </listitem></varlistentry>
19294 <varlistentry>
19295 <term><varname>$sender_address_local_part</varname></term>
19296 <listitem>
19297 <para>
19298 <indexterm role="variable">
19299 <primary><varname>$sender_address_local_part</varname></primary>
19300 </indexterm>
19301 The local part portion of <varname>$sender_address</varname>.
19302 </para>
19303 </listitem></varlistentry>
19304 <varlistentry>
19305 <term><varname>$sender_data</varname></term>
19306 <listitem>
19307 <para>
19308 <indexterm role="variable">
19309 <primary><varname>$sender_data</varname></primary>
19310 </indexterm>
19311 This variable is set after a lookup success in an ACL <option>senders</option> condition or
19312 in a router <option>senders</option> option. It contains the data from the lookup, and the
19313 value remains set until the next <option>senders</option> test. Thus, you can do things like
19314 this:
19315 </para>
19316 <literallayout>
19317 <literal>require senders      = cdb*@;/some/file</literal>
19318 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
19319 </literallayout>
19320 <para>
19321 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
19322 method in the address list, using the semicolon syntax as in the example above.
19323 The variable is not set for a lookup that is used as part of the string
19324 expansion that all such lists undergo before being interpreted.
19325 </para>
19326 </listitem></varlistentry>
19327 <varlistentry>
19328 <term><varname>$sender_fullhost</varname></term>
19329 <listitem>
19330 <para>
19331 <indexterm role="variable">
19332 <primary><varname>$sender_fullhost</varname></primary>
19333 </indexterm>
19334 When a message is received from a remote host, this variable contains the host
19335 name and IP address in a single string. It ends with the IP address in square
19336 brackets, followed by a colon and a port number if the logging of ports is
19337 enabled. The format of the rest of the string depends on whether the host
19338 issued a HELO or EHLO SMTP command, and whether the host name was verified by
19339 looking up its IP address. (Looking up the IP address can be forced by the
19340 <option>host_lookup</option> option, independent of verification.) A plain host name at the
19341 start of the string is a verified host name; if this is not present,
19342 verification either failed or was not requested. A host name in parentheses is
19343 the argument of a HELO or EHLO command. This is omitted if it is identical to
19344 the verified host name or to the host&#x2019;s IP address in square brackets.
19345 </para>
19346 </listitem></varlistentry>
19347 <varlistentry>
19348 <term><varname>$sender_helo_dnssec</varname></term>
19349 <listitem>
19350 <para>
19351 <indexterm role="variable">
19352 <primary><varname>$sender_helo_dnssec</varname></primary>
19353 </indexterm>
19354 This boolean variable is true if a successful HELO verification was
19355 <indexterm role="concept">
19356 <primary>DNS</primary>
19357 <secondary>DNSSEC</secondary>
19358 </indexterm>
19359 done using DNS information the resolver library stated was authenticated data.
19360 </para>
19361 </listitem></varlistentry>
19362 <varlistentry>
19363 <term><varname>$sender_helo_name</varname></term>
19364 <listitem>
19365 <para>
19366 <indexterm role="variable">
19367 <primary><varname>$sender_helo_name</varname></primary>
19368 </indexterm>
19369 When a message is received from a remote host that has issued a HELO or EHLO
19370 command, the argument of that command is placed in this variable. It is also
19371 set if HELO or EHLO is used when a message is received using SMTP locally via
19372 the <option>-bs</option> or <option>-bS</option> options.
19373 </para>
19374 </listitem></varlistentry>
19375 <varlistentry>
19376 <term><varname>$sender_host_address</varname></term>
19377 <listitem>
19378 <para>
19379 <indexterm role="variable">
19380 <primary><varname>$sender_host_address</varname></primary>
19381 </indexterm>
19382 When a message is received from a remote host using SMTP,
19383 this variable contains that
19384 host&#x2019;s IP address. For locally non-SMTP submitted messages, it is empty.
19385 </para>
19386 </listitem></varlistentry>
19387 <varlistentry>
19388 <term><varname>$sender_host_authenticated</varname></term>
19389 <listitem>
19390 <para>
19391 <indexterm role="variable">
19392 <primary><varname>$sender_host_authenticated</varname></primary>
19393 </indexterm>
19394 This variable contains the name (not the public name) of the authenticator
19395 driver that successfully authenticated the client from which the message was
19396 received. It is empty if there was no successful authentication. See also
19397 <varname>$authenticated_id</varname>.
19398 </para>
19399 </listitem></varlistentry>
19400 <varlistentry>
19401 <term><varname>$sender_host_dnssec</varname></term>
19402 <listitem>
19403 <para>
19404 <indexterm role="variable">
19405 <primary><varname>$sender_host_dnssec</varname></primary>
19406 </indexterm>
19407 If an attempt to populate <varname>$sender_host_name</varname> has been made
19408 (by reference, <option>hosts_lookup</option> or
19409 otherwise) then this boolean will have been set true if, and only if, the
19410 resolver library states that both
19411 the reverse and forward DNS were authenticated data.  At all
19412 other times, this variable is false.
19413 </para>
19414 <para>
19415 <indexterm role="concept">
19416 <primary>DNS</primary>
19417 <secondary>DNSSEC</secondary>
19418 </indexterm>
19419 It is likely that you will need to coerce DNSSEC support on in the resolver
19420 library, by setting:
19421 </para>
19422 <literallayout class="monospaced">
19423 dns_dnssec_ok = 1
19424 </literallayout>
19425 <para>
19426 Exim does not perform DNSSEC validation itself, instead leaving that to a
19427 validating resolver (e.g. unbound, or bind with suitable configuration).
19428 </para>
19429 <para>
19430 If you have changed <option>host_lookup_order</option> so that <literal>bydns</literal> is not the first
19431 mechanism in the list, then this variable will be false.
19432 </para>
19433 </listitem></varlistentry>
19434 <varlistentry>
19435 <term><varname>$sender_host_name</varname></term>
19436 <listitem>
19437 <para>
19438 <indexterm role="variable">
19439 <primary><varname>$sender_host_name</varname></primary>
19440 </indexterm>
19441 When a message is received from a remote host, this variable contains the
19442 host&#x2019;s name as obtained by looking up its IP address. For messages received by
19443 other means, this variable is empty.
19444 </para>
19445 <para>
19446 <indexterm role="variable">
19447 <primary><varname>$host_lookup_failed</varname></primary>
19448 </indexterm>
19449 If the host name has not previously been looked up, a reference to
19450 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
19451 A looked up name is accepted only if it leads back to the original IP address
19452 via a forward lookup. If either the reverse or the forward lookup fails to find
19453 any data, or if the forward lookup does not yield the original IP address,
19454 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
19455 </para>
19456 <para>
19457 <indexterm role="variable">
19458 <primary><varname>$host_lookup_deferred</varname></primary>
19459 </indexterm>
19460 However, if either of the lookups cannot be completed (for example, there is a
19461 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
19462 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
19463 </para>
19464 <para>
19465 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
19466 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
19467 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
19468 is set to <quote>1</quote>.
19469 </para>
19470 <para>
19471 Exim does not automatically look up every calling host&#x2019;s name. If you want
19472 maximum efficiency, you should arrange your configuration so that it avoids
19473 these lookups altogether. The lookup happens only if one or more of the
19474 following are true:
19475 </para>
19476 <itemizedlist>
19477 <listitem>
19478 <para>
19479 A string containing <varname>$sender_host_name</varname> is expanded.
19480 </para>
19481 </listitem>
19482 <listitem>
19483 <para>
19484 The calling host matches the list in <option>host_lookup</option>. In the default
19485 configuration, this option is set to *, so it must be changed if lookups are
19486 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
19487 </para>
19488 </listitem>
19489 <listitem>
19490 <para>
19491 Exim needs the host name in order to test an item in a host list. The items
19492 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
19493 <xref linkend="SECThoslispatnamsk"/>.
19494 </para>
19495 </listitem>
19496 <listitem>
19497 <para>
19498 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
19499 In this case, the host name is required to compare with the name quoted in any
19500 EHLO or HELO commands that the client issues.
19501 </para>
19502 </listitem>
19503 <listitem>
19504 <para>
19505 The remote host issues a EHLO or HELO command that quotes one of the
19506 domains in <option>helo_lookup_domains</option>. The default value of this option is
19507 </para>
19508 <literallayout class="monospaced">
19509   helo_lookup_domains = @ : @[]
19510 </literallayout>
19511 <para>
19512 which causes a lookup if a remote host (incorrectly) gives the server&#x2019;s name or
19513 IP address in an EHLO or HELO command.
19514 </para>
19515 </listitem>
19516 </itemizedlist>
19517 </listitem></varlistentry>
19518 <varlistentry>
19519 <term><varname>$sender_host_port</varname></term>
19520 <listitem>
19521 <para>
19522 <indexterm role="variable">
19523 <primary><varname>$sender_host_port</varname></primary>
19524 </indexterm>
19525 When a message is received from a remote host, this variable contains the port
19526 number that was used on the remote host.
19527 </para>
19528 </listitem></varlistentry>
19529 <varlistentry>
19530 <term><varname>$sender_ident</varname></term>
19531 <listitem>
19532 <para>
19533 <indexterm role="variable">
19534 <primary><varname>$sender_ident</varname></primary>
19535 </indexterm>
19536 When a message is received from a remote host, this variable contains the
19537 identification received in response to an RFC 1413 request. When a message has
19538 been received locally, this variable contains the login name of the user that
19539 called Exim.
19540 </para>
19541 </listitem></varlistentry>
19542 <varlistentry>
19543 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
19544 <listitem>
19545 <para>
19546 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
19547 <option>ratelimit</option> ACL condition. Details are given in section
19548 <xref linkend="SECTratelimiting"/>.
19549 </para>
19550 </listitem></varlistentry>
19551 <varlistentry>
19552 <term><varname>$sender_rcvhost</varname></term>
19553 <listitem>
19554 <para>
19555 <indexterm role="concept">
19556 <primary>DNS</primary>
19557 <secondary>reverse lookup</secondary>
19558 </indexterm>
19559 <indexterm role="concept">
19560 <primary>reverse DNS lookup</primary>
19561 </indexterm>
19562 <indexterm role="variable">
19563 <primary><varname>$sender_rcvhost</varname></primary>
19564 </indexterm>
19565 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
19566 either the verified host name (as obtained from a reverse DNS lookup) or, if
19567 there is no verified host name, the IP address in square brackets. After that
19568 there may be text in parentheses. When the first item is a verified host name,
19569 the first thing in the parentheses is the IP address in square brackets,
19570 followed by a colon and a port number if port logging is enabled. When the
19571 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
19572 the parentheses.
19573 </para>
19574 <para>
19575 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
19576 was used and its argument was not identical to the real host name or IP
19577 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
19578 all three items are present in the parentheses, a newline and tab are inserted
19579 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
19580 </para>
19581 </listitem></varlistentry>
19582 <varlistentry>
19583 <term><varname>$sender_verify_failure</varname></term>
19584 <listitem>
19585 <para>
19586 <indexterm role="variable">
19587 <primary><varname>$sender_verify_failure</varname></primary>
19588 </indexterm>
19589 In an ACL, when a sender verification fails, this variable contains information
19590 about the failure. The details are the same as for
19591 <varname>$recipient_verify_failure</varname>.
19592 </para>
19593 </listitem></varlistentry>
19594 <varlistentry>
19595 <term><varname>$sending_ip_address</varname></term>
19596 <listitem>
19597 <para>
19598 <indexterm role="variable">
19599 <primary><varname>$sending_ip_address</varname></primary>
19600 </indexterm>
19601 This variable is set whenever an outgoing SMTP connection to another host has
19602 been set up. It contains the IP address of the local interface that is being
19603 used. This is useful if a host that has more than one IP address wants to take
19604 on different personalities depending on which one is being used. For incoming
19605 connections, see <varname>$received_ip_address</varname>.
19606 </para>
19607 </listitem></varlistentry>
19608 <varlistentry>
19609 <term><varname>$sending_port</varname></term>
19610 <listitem>
19611 <para>
19612 <indexterm role="variable">
19613 <primary><varname>$sending_port</varname></primary>
19614 </indexterm>
19615 This variable is set whenever an outgoing SMTP connection to another host has
19616 been set up. It contains the local port that is being used. For incoming
19617 connections, see <varname>$received_port</varname>.
19618 </para>
19619 </listitem></varlistentry>
19620 <varlistentry>
19621 <term><varname>$smtp_active_hostname</varname></term>
19622 <listitem>
19623 <para>
19624 <indexterm role="variable">
19625 <primary><varname>$smtp_active_hostname</varname></primary>
19626 </indexterm>
19627 During an incoming SMTP session, this variable contains the value of the active
19628 host name, as specified by the <option>smtp_active_hostname</option> option. The value of
19629 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
19630 value can be consulted during routing and delivery.
19631 </para>
19632 </listitem></varlistentry>
19633 <varlistentry>
19634 <term><varname>$smtp_command</varname></term>
19635 <listitem>
19636 <para>
19637 <indexterm role="variable">
19638 <primary><varname>$smtp_command</varname></primary>
19639 </indexterm>
19640 During the processing of an incoming SMTP command, this variable contains the
19641 entire command. This makes it possible to distinguish between HELO and EHLO in
19642 the HELO ACL, and also to distinguish between commands such as these:
19643 </para>
19644 <literallayout class="monospaced">
19645 MAIL FROM:&lt;&gt;
19646 MAIL FROM: &lt;&gt;
19647 </literallayout>
19648 <para>
19649 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
19650 command, the address in <varname>$smtp_command</varname> is the original address before any
19651 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
19652 the address after SMTP-time rewriting.
19653 </para>
19654 </listitem></varlistentry>
19655 <varlistentry>
19656 <term><varname>$smtp_command_argument</varname></term>
19657 <listitem>
19658 <para>
19659 <indexterm role="concept">
19660 <primary>SMTP</primary>
19661 <secondary>command, argument for</secondary>
19662 </indexterm>
19663 <indexterm role="variable">
19664 <primary><varname>$smtp_command_argument</varname></primary>
19665 </indexterm>
19666 While an ACL is running to check an SMTP command, this variable contains the
19667 argument, that is, the text that follows the command name, with leading white
19668 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
19669 somewhat redundant, but is retained for backwards compatibility.
19670 </para>
19671 </listitem></varlistentry>
19672 <varlistentry>
19673 <term><varname>$smtp_count_at_connection_start</varname></term>
19674 <listitem>
19675 <para>
19676 <indexterm role="variable">
19677 <primary><varname>$smtp_count_at_connection_start</varname></primary>
19678 </indexterm>
19679 This variable is set greater than zero only in processes spawned by the Exim
19680 daemon for handling incoming SMTP connections. The name is deliberately long,
19681 in order to emphasize what the contents are. When the daemon accepts a new
19682 connection, it increments this variable. A copy of the variable is passed to
19683 the child process that handles the connection, but its value is fixed, and
19684 never changes. It is only an approximation of how many incoming connections
19685 there actually are, because many other connections may come and go while a
19686 single connection is being processed. When a child process terminates, the
19687 daemon decrements its copy of the variable.
19688 </para>
19689 </listitem></varlistentry>
19690 <varlistentry>
19691 <term><varname>$sn0</varname> &ndash; <varname>$sn9</varname></term>
19692 <listitem>
19693 <para>
19694 These variables are copies of the values of the <varname>$n0</varname> &ndash; <varname>$n9</varname> accumulators
19695 that were current at the end of the system filter file. This allows a system
19696 filter file to set values that can be tested in users&#x2019; filter files. For
19697 example, a system filter could set a value indicating how likely it is that a
19698 message is junk mail.
19699 </para>
19700 </listitem></varlistentry>
19701 <varlistentry>
19702 <term><varname>$spam_</varname><emphasis>xxx</emphasis></term>
19703 <listitem>
19704 <para>
19705 A number of variables whose names start with <varname>$spam</varname> are available when Exim
19706 is compiled with the content-scanning extension. For details, see section
19707 <xref linkend="SECTscanspamass"/>.
19708 </para>
19709 </listitem></varlistentry>
19710 <varlistentry>
19711 <term><varname>$spool_directory</varname></term>
19712 <listitem>
19713 <para>
19714 <indexterm role="variable">
19715 <primary><varname>$spool_directory</varname></primary>
19716 </indexterm>
19717 The name of Exim&#x2019;s spool directory.
19718 </para>
19719 </listitem></varlistentry>
19720 <varlistentry>
19721 <term><varname>$spool_inodes</varname></term>
19722 <listitem>
19723 <para>
19724 <indexterm role="variable">
19725 <primary><varname>$spool_inodes</varname></primary>
19726 </indexterm>
19727 The number of free inodes in the disk partition where Exim&#x2019;s spool files are
19728 being written. The value is recalculated whenever the variable is referenced.
19729 If the relevant file system does not have the concept of inodes, the value of
19730 is -1. See also the <option>check_spool_inodes</option> option.
19731 </para>
19732 </listitem></varlistentry>
19733 <varlistentry>
19734 <term><varname>$spool_space</varname></term>
19735 <listitem>
19736 <para>
19737 <indexterm role="variable">
19738 <primary><varname>$spool_space</varname></primary>
19739 </indexterm>
19740 The amount of free space (as a number of kilobytes) in the disk partition where
19741 Exim&#x2019;s spool files are being written. The value is recalculated whenever the
19742 variable is referenced. If the operating system does not have the ability to
19743 find the amount of free space (only true for experimental systems), the space
19744 value is -1. For example, to check in an ACL that there is at least 50
19745 megabytes free on the spool, you could write:
19746 </para>
19747 <literallayout class="monospaced">
19748 condition = ${if &gt; {$spool_space}{50000}}
19749 </literallayout>
19750 <para>
19751 See also the <option>check_spool_space</option> option.
19752 </para>
19753 </listitem></varlistentry>
19754 <varlistentry>
19755 <term><varname>$thisaddress</varname></term>
19756 <listitem>
19757 <para>
19758 <indexterm role="variable">
19759 <primary><varname>$thisaddress</varname></primary>
19760 </indexterm>
19761 This variable is set only during the processing of the <option>foranyaddress</option>
19762 command in a filter file. Its use is explained in the description of that
19763 command, which can be found in the separate document entitled <emphasis>Exim&#x2019;s
19764 interfaces to mail filtering</emphasis>.
19765 </para>
19766 </listitem></varlistentry>
19767 <varlistentry>
19768 <term><varname>$tls_in_bits</varname></term>
19769 <listitem>
19770 <para>
19771 <indexterm role="variable">
19772 <primary><varname>$tls_in_bits</varname></primary>
19773 </indexterm>
19774 Contains an approximation of the TLS cipher&#x2019;s bit-strength
19775 on the inbound connection; the meaning of
19776 this depends upon the TLS implementation used.
19777 If TLS has not been negotiated, the value will be 0.
19778 The value of this is automatically fed into the Cyrus SASL authenticator
19779 when acting as a server, to specify the "external SSF" (a SASL term).
19780 </para>
19781 <para>
19782 The deprecated <varname>$tls_bits</varname> variable refers to the inbound side
19783 except when used in the context of an outbound SMTP delivery, when it refers to
19784 the outbound.
19785 </para>
19786 </listitem></varlistentry>
19787 <varlistentry>
19788 <term><varname>$tls_out_bits</varname></term>
19789 <listitem>
19790 <para>
19791 <indexterm role="variable">
19792 <primary><varname>$tls_out_bits</varname></primary>
19793 </indexterm>
19794 Contains an approximation of the TLS cipher&#x2019;s bit-strength
19795 on an outbound SMTP connection; the meaning of
19796 this depends upon the TLS implementation used.
19797 If TLS has not been negotiated, the value will be 0.
19798 </para>
19799 </listitem></varlistentry>
19800 <varlistentry>
19801 <term><varname>$tls_in_ourcert</varname></term>
19802 <listitem>
19803 <para>
19804 <indexterm role="variable">
19805 <primary><varname>$tls_in_ourcert</varname></primary>
19806 </indexterm>
19807 <indexterm role="concept">
19808 <primary>certificate</primary>
19809 <secondary>veriables</secondary>
19810 </indexterm>
19811 This variable refers to the certificate presented to the peer of an
19812 inbound connection when the message was received.
19813 It is only useful as the argument of a
19814 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
19815 or a <option>def</option> condition.
19816 </para>
19817 </listitem></varlistentry>
19818 <varlistentry>
19819 <term><varname>$tls_in_peercert</varname></term>
19820 <listitem>
19821 <para>
19822 <indexterm role="variable">
19823 <primary><varname>$tls_in_peercert</varname></primary>
19824 </indexterm>
19825 This variable refers to the certificate presented by the peer of an
19826 inbound connection when the message was received.
19827 It is only useful as the argument of a
19828 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
19829 or a <option>def</option> condition.
19830 If certificate verification fails it may refer to a failing chain element
19831 which is not the leaf.
19832 </para>
19833 </listitem></varlistentry>
19834 <varlistentry>
19835 <term><varname>$tls_out_ourcert</varname></term>
19836 <listitem>
19837 <para>
19838 <indexterm role="variable">
19839 <primary><varname>$tls_out_ourcert</varname></primary>
19840 </indexterm>
19841 This variable refers to the certificate presented to the peer of an
19842 outbound connection.  It is only useful as the argument of a
19843 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
19844 or a <option>def</option> condition.
19845 </para>
19846 </listitem></varlistentry>
19847 <varlistentry>
19848 <term><varname>$tls_out_peercert</varname></term>
19849 <listitem>
19850 <para>
19851 <indexterm role="variable">
19852 <primary><varname>$tls_out_peercert</varname></primary>
19853 </indexterm>
19854 This variable refers to the certificate presented by the peer of an
19855 outbound connection.  It is only useful as the argument of a
19856 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
19857 or a <option>def</option> condition.
19858 If certificate verification fails it may refer to a failing chain element
19859 which is not the leaf.
19860 </para>
19861 </listitem></varlistentry>
19862 <varlistentry>
19863 <term><varname>$tls_in_certificate_verified</varname></term>
19864 <listitem>
19865 <para>
19866 <indexterm role="variable">
19867 <primary><varname>$tls_in_certificate_verified</varname></primary>
19868 </indexterm>
19869 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
19870 message was received, and <quote>0</quote> otherwise.
19871 </para>
19872 <para>
19873 The deprecated <varname>$tls_certificate_verified</varname> variable refers to the inbound side
19874 except when used in the context of an outbound SMTP delivery, when it refers to
19875 the outbound.
19876 </para>
19877 </listitem></varlistentry>
19878 <varlistentry>
19879 <term><varname>$tls_out_certificate_verified</varname></term>
19880 <listitem>
19881 <para>
19882 <indexterm role="variable">
19883 <primary><varname>$tls_out_certificate_verified</varname></primary>
19884 </indexterm>
19885 This variable is set to <quote>1</quote> if a TLS certificate was verified when an
19886 outbound SMTP connection was made,
19887 and <quote>0</quote> otherwise.
19888 </para>
19889 </listitem></varlistentry>
19890 <varlistentry>
19891 <term><varname>$tls_in_cipher</varname></term>
19892 <listitem>
19893 <para>
19894 <indexterm role="variable">
19895 <primary><varname>$tls_in_cipher</varname></primary>
19896 </indexterm>
19897 <indexterm role="variable">
19898 <primary><varname>$tls_cipher</varname></primary>
19899 </indexterm>
19900 When a message is received from a remote host over an encrypted SMTP
19901 connection, this variable is set to the cipher suite that was negotiated, for
19902 example DES-CBC3-SHA. In other circumstances, in particular, for message
19903 received over unencrypted connections, the variable is empty. Testing
19904 <varname>$tls_cipher</varname> for emptiness is one way of distinguishing between encrypted and
19905 non-encrypted connections during ACL processing.
19906 </para>
19907 <para>
19908 The deprecated <varname>$tls_cipher</varname> variable is the same as <varname>$tls_in_cipher</varname> during message reception,
19909 but in the context of an outward SMTP delivery taking place via the <command>smtp</command> transport
19910 becomes the same as <varname>$tls_out_cipher</varname>.
19911 </para>
19912 </listitem></varlistentry>
19913 <varlistentry>
19914 <term><varname>$tls_out_cipher</varname></term>
19915 <listitem>
19916 <para>
19917 <indexterm role="variable">
19918 <primary><varname>$tls_out_cipher</varname></primary>
19919 </indexterm>
19920 This variable is
19921 cleared before any outgoing SMTP connection is made,
19922 and then set to the outgoing cipher suite if one is negotiated. See chapter
19923 <xref linkend="CHAPTLS"/> for details of TLS support and chapter <xref linkend="CHAPsmtptrans"/> for
19924 details of the <command>smtp</command> transport.
19925 </para>
19926 </listitem></varlistentry>
19927 <varlistentry>
19928 <term><varname>$tls_in_ocsp</varname></term>
19929 <listitem>
19930 <para>
19931 <indexterm role="variable">
19932 <primary><varname>$tls_in_ocsp</varname></primary>
19933 </indexterm>
19934 When a message is received from a remote client connection
19935 the result of any OCSP request from the client is encoded in this variable:
19936 </para>
19937 <literallayout class="monospaced">
19938 0 OCSP proof was not requested (default value)
19939 1 No response to request
19940 2 Response not verified
19941 3 Verification failed
19942 4 Verification succeeded
19943 </literallayout>
19944 </listitem></varlistentry>
19945 <varlistentry>
19946 <term><varname>$tls_out_ocsp</varname></term>
19947 <listitem>
19948 <para>
19949 <indexterm role="variable">
19950 <primary><varname>$tls_out_ocsp</varname></primary>
19951 </indexterm>
19952 When a message is sent to a remote host connection
19953 the result of any OCSP request made is encoded in this variable.
19954 See <varname>$tls_in_ocsp</varname> for values.
19955 </para>
19956 </listitem></varlistentry>
19957 <varlistentry>
19958 <term><varname>$tls_in_peerdn</varname></term>
19959 <listitem>
19960 <para>
19961 <indexterm role="variable">
19962 <primary><varname>$tls_in_peerdn</varname></primary>
19963 </indexterm>
19964 <indexterm role="variable">
19965 <primary><varname>$tls_peerdn</varname></primary>
19966 </indexterm>
19967 <indexterm role="concept">
19968 <primary>certificate</primary>
19969 <secondary>extracting fields</secondary>
19970 </indexterm>
19971 When a message is received from a remote host over an encrypted SMTP
19972 connection, and Exim is configured to request a certificate from the client,
19973 the value of the Distinguished Name of the certificate is made available in the
19974 <varname>$tls_in_peerdn</varname> during subsequent processing.
19975 If certificate verification fails it may refer to a failing chain element
19976 which is not the leaf.
19977 </para>
19978 <para>
19979 The deprecated <varname>$tls_peerdn</varname> variable refers to the inbound side
19980 except when used in the context of an outbound SMTP delivery, when it refers to
19981 the outbound.
19982 </para>
19983 </listitem></varlistentry>
19984 <varlistentry>
19985 <term><varname>$tls_out_peerdn</varname></term>
19986 <listitem>
19987 <para>
19988 <indexterm role="variable">
19989 <primary><varname>$tls_out_peerdn</varname></primary>
19990 </indexterm>
19991 When a message is being delivered to a remote host over an encrypted SMTP
19992 connection, and Exim is configured to request a certificate from the server,
19993 the value of the Distinguished Name of the certificate is made available in the
19994 <varname>$tls_out_peerdn</varname> during subsequent processing.
19995 If certificate verification fails it may refer to a failing chain element
19996 which is not the leaf.
19997 </para>
19998 </listitem></varlistentry>
19999 <varlistentry>
20000 <term><varname>$tls_in_sni</varname></term>
20001 <listitem>
20002 <para>
20003 <indexterm role="variable">
20004 <primary><varname>$tls_in_sni</varname></primary>
20005 </indexterm>
20006 <indexterm role="variable">
20007 <primary><varname>$tls_sni</varname></primary>
20008 </indexterm>
20009 <indexterm role="concept">
20010 <primary>TLS</primary>
20011 <secondary>Server Name Indication</secondary>
20012 </indexterm>
20013 When a TLS session is being established, if the client sends the Server
20014 Name Indication extension, the value will be placed in this variable.
20015 If the variable appears in <option>tls_certificate</option> then this option and
20016 some others, described in <xref linkend="SECTtlssni"/>,
20017 will be re-expanded early in the TLS session, to permit
20018 a different certificate to be presented (and optionally a different key to be
20019 used) to the client, based upon the value of the SNI extension.
20020 </para>
20021 <para>
20022 The deprecated <varname>$tls_sni</varname> variable refers to the inbound side
20023 except when used in the context of an outbound SMTP delivery, when it refers to
20024 the outbound.
20025 </para>
20026 </listitem></varlistentry>
20027 <varlistentry>
20028 <term><varname>$tls_out_sni</varname></term>
20029 <listitem>
20030 <para>
20031 <indexterm role="variable">
20032 <primary><varname>$tls_out_sni</varname></primary>
20033 </indexterm>
20034 <indexterm role="concept">
20035 <primary>TLS</primary>
20036 <secondary>Server Name Indication</secondary>
20037 </indexterm>
20038 During outbound
20039 SMTP deliveries, this variable reflects the value of the <option>tls_sni</option> option on
20040 the transport.
20041 </para>
20042 </listitem></varlistentry>
20043 <varlistentry>
20044 <term><varname>$tod_bsdinbox</varname></term>
20045 <listitem>
20046 <para>
20047 <indexterm role="variable">
20048 <primary><varname>$tod_bsdinbox</varname></primary>
20049 </indexterm>
20050 The time of day and the date, in the format required for BSD-style mailbox
20051 files, for example: Thu Oct 17 17:14:09 1995.
20052 </para>
20053 </listitem></varlistentry>
20054 <varlistentry>
20055 <term><varname>$tod_epoch</varname></term>
20056 <listitem>
20057 <para>
20058 <indexterm role="variable">
20059 <primary><varname>$tod_epoch</varname></primary>
20060 </indexterm>
20061 The time and date as a number of seconds since the start of the Unix epoch.
20062 </para>
20063 </listitem></varlistentry>
20064 <varlistentry>
20065 <term><varname>$tod_epoch_l</varname></term>
20066 <listitem>
20067 <para>
20068 <indexterm role="variable">
20069 <primary><varname>$tod_epoch_l</varname></primary>
20070 </indexterm>
20071 The time and date as a number of microseconds since the start of the Unix epoch.
20072 </para>
20073 </listitem></varlistentry>
20074 <varlistentry>
20075 <term><varname>$tod_full</varname></term>
20076 <listitem>
20077 <para>
20078 <indexterm role="variable">
20079 <primary><varname>$tod_full</varname></primary>
20080 </indexterm>
20081 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
20082 +0100. The timezone is always given as a numerical offset from UTC, with
20083 positive values used for timezones that are ahead (east) of UTC, and negative
20084 values for those that are behind (west).
20085 </para>
20086 </listitem></varlistentry>
20087 <varlistentry>
20088 <term><varname>$tod_log</varname></term>
20089 <listitem>
20090 <para>
20091 <indexterm role="variable">
20092 <primary><varname>$tod_log</varname></primary>
20093 </indexterm>
20094 The time and date in the format used for writing Exim&#x2019;s log files, for example:
20095 1995-10-12 15:32:29, but without a timezone.
20096 </para>
20097 </listitem></varlistentry>
20098 <varlistentry>
20099 <term><varname>$tod_logfile</varname></term>
20100 <listitem>
20101 <para>
20102 <indexterm role="variable">
20103 <primary><varname>$tod_logfile</varname></primary>
20104 </indexterm>
20105 This variable contains the date in the format yyyymmdd. This is the format that
20106 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
20107 flag.
20108 </para>
20109 </listitem></varlistentry>
20110 <varlistentry>
20111 <term><varname>$tod_zone</varname></term>
20112 <listitem>
20113 <para>
20114 <indexterm role="variable">
20115 <primary><varname>$tod_zone</varname></primary>
20116 </indexterm>
20117 This variable contains the numerical value of the local timezone, for example:
20118 -0500.
20119 </para>
20120 </listitem></varlistentry>
20121 <varlistentry>
20122 <term><varname>$tod_zulu</varname></term>
20123 <listitem>
20124 <para>
20125 <indexterm role="variable">
20126 <primary><varname>$tod_zulu</varname></primary>
20127 </indexterm>
20128 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
20129 by ISO 8601, for example: 20030221154023Z.
20130 </para>
20131 </listitem></varlistentry>
20132 <varlistentry>
20133 <term><varname>$transport_name</varname></term>
20134 <listitem>
20135 <para>
20136 <indexterm role="concept">
20137 <primary>transport</primary>
20138 <secondary>name</secondary>
20139 </indexterm>
20140 <indexterm role="concept">
20141 <primary>name</primary>
20142 <secondary>of transport</secondary>
20143 </indexterm>
20144 <indexterm role="variable">
20145 <primary><varname>$transport_name</varname></primary>
20146 </indexterm>
20147 During the running of a transport, this variable contains its name.
20148 </para>
20149 </listitem></varlistentry>
20150 <varlistentry>
20151 <term><varname>$value</varname></term>
20152 <listitem>
20153 <para>
20154 <indexterm role="variable">
20155 <primary><varname>$value</varname></primary>
20156 </indexterm>
20157 This variable contains the result of an expansion lookup, extraction operation,
20158 or external command, as described above. It is also used during a
20159 <emphasis role="bold">reduce</emphasis> expansion.
20160 </para>
20161 </listitem></varlistentry>
20162 <varlistentry>
20163 <term><varname>$verify_mode</varname></term>
20164 <listitem>
20165 <para>
20166 <indexterm role="variable">
20167 <primary><varname>$verify_mode</varname></primary>
20168 </indexterm>
20169 While a router or transport is being run in verify mode
20170 or for cutthrough delivery,
20171 contains "S" for sender-verification or "R" for recipient-verification.
20172 Otherwise, empty.
20173 </para>
20174 </listitem></varlistentry>
20175 <varlistentry>
20176 <term><varname>$version_number</varname></term>
20177 <listitem>
20178 <para>
20179 <indexterm role="variable">
20180 <primary><varname>$version_number</varname></primary>
20181 </indexterm>
20182 The version number of Exim.
20183 </para>
20184 </listitem></varlistentry>
20185 <varlistentry>
20186 <term><varname>$warn_message_delay</varname></term>
20187 <listitem>
20188 <para>
20189 <indexterm role="variable">
20190 <primary><varname>$warn_message_delay</varname></primary>
20191 </indexterm>
20192 This variable is set only during the creation of a message warning about a
20193 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
20194 </para>
20195 </listitem></varlistentry>
20196 <varlistentry>
20197 <term><varname>$warn_message_recipients</varname></term>
20198 <listitem>
20199 <para>
20200 <indexterm role="variable">
20201 <primary><varname>$warn_message_recipients</varname></primary>
20202 </indexterm>
20203 This variable is set only during the creation of a message warning about a
20204 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
20205 </para>
20206 </listitem></varlistentry>
20207 </variablelist>
20208 <para>
20209 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
20210 </para>
20211 </section>
20212 </chapter>
20213
20214 <chapter id="CHAPperl">
20215 <title>Embedded Perl</title>
20216 <para>
20217 <indexterm role="concept" id="IIDperl" class="startofrange">
20218 <primary>Perl</primary>
20219 <secondary>calling from Exim</secondary>
20220 </indexterm>
20221 Exim can be built to include an embedded Perl interpreter. When this is done,
20222 Perl subroutines can be called as part of the string expansion process. To make
20223 use of the Perl support, you need version 5.004 or later of Perl installed on
20224 your system. To include the embedded interpreter in the Exim binary, include
20225 the line
20226 </para>
20227 <literallayout class="monospaced">
20228 EXIM_PERL = perl.o
20229 </literallayout>
20230 <para>
20231 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
20232 </para>
20233 <section id="SECID85">
20234 <title>Setting up so Perl can be used</title>
20235 <para>
20236 <indexterm role="option">
20237 <primary><option>perl_startup</option></primary>
20238 </indexterm>
20239 Access to Perl subroutines is via a global configuration option called
20240 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
20241 no <option>perl_startup</option> option in the Exim configuration file then no Perl
20242 interpreter is started and there is almost no overhead for Exim (since none of
20243 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
20244 option then the associated value is taken to be Perl code which is executed in
20245 a newly created Perl interpreter.
20246 </para>
20247 <para>
20248 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
20249 need backslashes before any characters to escape special meanings. The option
20250 should usually be something like
20251 </para>
20252 <literallayout class="monospaced">
20253 perl_startup = do '/etc/exim.pl'
20254 </literallayout>
20255 <para>
20256 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
20257 use from Exim. Exim can be configured either to start up a Perl interpreter as
20258 soon as it is entered, or to wait until the first time it is needed. Starting
20259 the interpreter at the beginning ensures that it is done while Exim still has
20260 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
20261 fact used in a particular run. Also, note that this does not mean that Exim is
20262 necessarily running as root when Perl is called at a later time. By default,
20263 the interpreter is started only when it is needed, but this can be changed in
20264 two ways:
20265 </para>
20266 <itemizedlist>
20267 <listitem>
20268 <para>
20269 <indexterm role="option">
20270 <primary><option>perl_at_start</option></primary>
20271 </indexterm>
20272 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
20273 a startup when Exim is entered.
20274 </para>
20275 </listitem>
20276 <listitem>
20277 <para>
20278 The command line option <option>-ps</option> also requests a startup when Exim is entered,
20279 overriding the setting of <option>perl_at_start</option>.
20280 </para>
20281 </listitem>
20282 </itemizedlist>
20283 <para>
20284 There is also a command line option <option>-pd</option> (for delay) which suppresses the
20285 initial startup, even if <option>perl_at_start</option> is set.
20286 </para>
20287 </section>
20288 <section id="SECID86">
20289 <title>Calling Perl subroutines</title>
20290 <para>
20291 When the configuration file includes a <option>perl_startup</option> option you can make use
20292 of the string expansion item to call the Perl subroutines that are defined
20293 by the <option>perl_startup</option> code. The operator is used in any of the following
20294 forms:
20295 </para>
20296 <literallayout class="monospaced">
20297 ${perl{foo}}
20298 ${perl{foo}{argument}}
20299 ${perl{foo}{argument1}{argument2} ... }
20300 </literallayout>
20301 <para>
20302 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
20303 arguments may be passed. Passing more than this results in an expansion failure
20304 with an error message of the form
20305 </para>
20306 <literallayout class="monospaced">
20307 Too many arguments passed to Perl subroutine "foo" (max is 8)
20308 </literallayout>
20309 <para>
20310 The return value of the Perl subroutine is evaluated in a scalar context before
20311 it is passed back to Exim to be inserted into the expanded string. If the
20312 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
20313 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
20314 by obeying Perl&#x2019;s <option>die</option> function, the expansion fails with the error message
20315 that was passed to <option>die</option>.
20316 </para>
20317 </section>
20318 <section id="SECID87">
20319 <title>Calling Exim functions from Perl</title>
20320 <para>
20321 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
20322 is available to call back into Exim&#x2019;s string expansion function. For example,
20323 the Perl code
20324 </para>
20325 <literallayout class="monospaced">
20326 my $lp = Exim::expand_string('$local_part');
20327 </literallayout>
20328 <para>
20329 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
20330 Note those are single quotes and not double quotes to protect against
20331 <varname>$local_part</varname> being interpolated as a Perl variable.
20332 </para>
20333 <para>
20334 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
20335 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
20336 expansion string, the Perl call from the original expansion string fails with
20337 an appropriate error message, in the same way as if <option>die</option> were used.
20338 </para>
20339 <para>
20340 <indexterm role="concept">
20341 <primary>debugging</primary>
20342 <secondary>from embedded Perl</secondary>
20343 </indexterm>
20344 <indexterm role="concept">
20345 <primary>log</primary>
20346 <secondary>writing from embedded Perl</secondary>
20347 </indexterm>
20348 Two other Exim functions are available for use from within Perl code.
20349 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim&#x2019;s
20350 debugging is enabled. If you want a newline at the end, you must supply it.
20351 <emphasis>Exim::log_write()</emphasis> writes a string to Exim&#x2019;s main log, adding a leading
20352 timestamp. In this case, you should not supply a terminating newline.
20353 </para>
20354 </section>
20355 <section id="SECID88">
20356 <title>Use of standard output and error by Perl</title>
20357 <para>
20358 <indexterm role="concept">
20359 <primary>Perl</primary>
20360 <secondary>standard output and error</secondary>
20361 </indexterm>
20362 You should not write to the standard error or output streams from within your
20363 Perl code, as it is not defined how these are set up. In versions of Exim
20364 before 4.50, it is possible for the standard output or error to refer to the
20365 SMTP connection during message reception via the daemon. Writing to this stream
20366 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
20367 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
20368 avoided, but the output is lost.
20369 </para>
20370 <para>
20371 <indexterm role="concept">
20372 <primary>Perl</primary>
20373 <secondary>use of <option>warn</option></secondary>
20374 </indexterm>
20375 The Perl <option>warn</option> statement writes to the standard error stream by default.
20376 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
20377 you have no control. When Exim starts up the Perl interpreter, it arranges for
20378 output from the <option>warn</option> statement to be written to the Exim main log. You can
20379 change this by including appropriate Perl magic somewhere in your Perl code.
20380 For example, to discard <option>warn</option> output completely, you need this:
20381 </para>
20382 <literallayout class="monospaced">
20383 $SIG{__WARN__} = sub { };
20384 </literallayout>
20385 <para>
20386 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
20387 example, the code for the subroutine is empty, so it does nothing, but you can
20388 include any Perl code that you like. The text of the <option>warn</option> message is passed
20389 as the first subroutine argument.
20390 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
20391 </para>
20392 </section>
20393 </chapter>
20394
20395 <chapter id="CHAPinterfaces">
20396 <title>Starting the daemon and the use of network interfaces</title>
20397 <titleabbrev>Starting the daemon</titleabbrev>
20398 <para>
20399 <indexterm role="concept">
20400 <primary>daemon</primary>
20401 <secondary>starting</secondary>
20402 </indexterm>
20403 <indexterm role="concept">
20404 <primary>interface</primary>
20405 <secondary>listening</secondary>
20406 </indexterm>
20407 <indexterm role="concept">
20408 <primary>network interface</primary>
20409 </indexterm>
20410 <indexterm role="concept">
20411 <primary>interface</primary>
20412 <secondary>network</secondary>
20413 </indexterm>
20414 <indexterm role="concept">
20415 <primary>IP address</primary>
20416 <secondary>for listening</secondary>
20417 </indexterm>
20418 <indexterm role="concept">
20419 <primary>daemon</primary>
20420 <secondary>listening IP addresses</secondary>
20421 </indexterm>
20422 <indexterm role="concept">
20423 <primary>TCP/IP</primary>
20424 <secondary>setting listening interfaces</secondary>
20425 </indexterm>
20426 <indexterm role="concept">
20427 <primary>TCP/IP</primary>
20428 <secondary>setting listening ports</secondary>
20429 </indexterm>
20430 A host that is connected to a TCP/IP network may have one or more physical
20431 hardware network interfaces. Each of these interfaces may be configured as one
20432 or more <quote>logical</quote> interfaces, which are the entities that a program actually
20433 works with. Each of these logical interfaces is associated with an IP address.
20434 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
20435 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
20436 knowledge about the host&#x2019;s interfaces for use in three different circumstances:
20437 </para>
20438 <orderedlist numeration="arabic">
20439 <listitem>
20440 <para>
20441 When a listening daemon is started, Exim needs to know which interfaces
20442 and ports to listen on.
20443 </para>
20444 </listitem>
20445 <listitem>
20446 <para>
20447 When Exim is routing an address, it needs to know which IP addresses
20448 are associated with local interfaces. This is required for the correct
20449 processing of MX lists by removing the local host and others with the
20450 same or higher priority values. Also, Exim needs to detect cases
20451 when an address is routed to an IP address that in fact belongs to the
20452 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
20453 option of the smtp transport is set (as appropriate), this is treated
20454 as an error situation.
20455 </para>
20456 </listitem>
20457 <listitem>
20458 <para>
20459 When Exim connects to a remote host, it may need to know which interface to use
20460 for the outgoing connection.
20461 </para>
20462 </listitem>
20463 </orderedlist>
20464 <para>
20465 Exim&#x2019;s default behaviour is likely to be appropriate in the vast majority
20466 of cases. If your host has only one interface, and you want all its IP
20467 addresses to be treated in the same way, and you are using only the
20468 standard SMTP port, you should not need to take any special action. The
20469 rest of this chapter does not apply to you.
20470 </para>
20471 <para>
20472 In a more complicated situation you may want to listen only on certain
20473 interfaces, or on different ports, and for this reason there are a number of
20474 options that can be used to influence Exim&#x2019;s behaviour. The rest of this
20475 chapter describes how they operate.
20476 </para>
20477 <para>
20478 When a message is received over TCP/IP, the interface and port that were
20479 actually used are set in <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
20480 </para>
20481 <section id="SECID89">
20482 <title>Starting a listening daemon</title>
20483 <para>
20484 When a listening daemon is started (by means of the <option>-bd</option> command line
20485 option), the interfaces and ports on which it listens are controlled by the
20486 following options:
20487 </para>
20488 <itemizedlist>
20489 <listitem>
20490 <para>
20491 <option>daemon_smtp_ports</option> contains a list of default ports
20492 or service names.
20493 (For backward compatibility, this option can also be specified in the singular.)
20494 </para>
20495 </listitem>
20496 <listitem>
20497 <para>
20498 <option>local_interfaces</option> contains list of interface IP addresses on which to
20499 listen. Each item may optionally also specify a port.
20500 </para>
20501 </listitem>
20502 </itemizedlist>
20503 <para>
20504 The default list separator in both cases is a colon, but this can be changed as
20505 described in section <xref linkend="SECTlistconstruct"/>. When IPv6 addresses are involved,
20506 it is usually best to change the separator to avoid having to double all the
20507 colons. For example:
20508 </para>
20509 <literallayout class="monospaced">
20510 local_interfaces = &lt;; 127.0.0.1 ; \
20511                       192.168.23.65 ; \
20512                       ::1 ; \
20513                       3ffe:ffff:836f::fe86:a061
20514 </literallayout>
20515 <para>
20516 There are two different formats for specifying a port along with an IP address
20517 in <option>local_interfaces</option>:
20518 </para>
20519 <orderedlist numeration="arabic">
20520 <listitem>
20521 <para>
20522 The port is added onto the address with a dot separator. For example, to listen
20523 on port 1234 on two different IP addresses:
20524 </para>
20525 <literallayout class="monospaced">
20526 local_interfaces = &lt;; 192.168.23.65.1234 ; \
20527                       3ffe:ffff:836f::fe86:a061.1234
20528 </literallayout>
20529 </listitem>
20530 <listitem>
20531 <para>
20532 The IP address is enclosed in square brackets, and the port is added
20533 with a colon separator, for example:
20534 </para>
20535 <literallayout class="monospaced">
20536 local_interfaces = &lt;; [192.168.23.65]:1234 ; \
20537                       [3ffe:ffff:836f::fe86:a061]:1234
20538 </literallayout>
20539 </listitem>
20540 </orderedlist>
20541 <para>
20542 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
20543 default setting contains just one port:
20544 </para>
20545 <literallayout class="monospaced">
20546 daemon_smtp_ports = smtp
20547 </literallayout>
20548 <para>
20549 If more than one port is listed, each interface that does not have its own port
20550 specified listens on all of them. Ports that are listed in
20551 <option>daemon_smtp_ports</option> can be identified either by name (defined in
20552 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
20553 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
20554 </para>
20555 </section>
20556 <section id="SECID90">
20557 <title>Special IP listening addresses</title>
20558 <para>
20559 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
20560 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
20561 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
20562 instead of setting up separate listening sockets for each interface. The
20563 default value of <option>local_interfaces</option> is
20564 </para>
20565 <literallayout class="monospaced">
20566 local_interfaces = 0.0.0.0
20567 </literallayout>
20568 <para>
20569 when Exim is built without IPv6 support; otherwise it is:
20570 </para>
20571 <literallayout class="monospaced">
20572 local_interfaces = &lt;; ::0 ; 0.0.0.0
20573 </literallayout>
20574 <para>
20575 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
20576 </para>
20577 </section>
20578 <section id="SECID91">
20579 <title>Overriding local_interfaces and daemon_smtp_ports</title>
20580 <para>
20581 The <option>-oX</option> command line option can be used to override the values of
20582 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
20583 instance. Another way of doing this would be to use macros and the <option>-D</option>
20584 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
20585 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
20586 exim.
20587 </para>
20588 <para>
20589 The value of <option>-oX</option> is a list of items. The default colon separator can be
20590 changed in the usual way if required. If there are any items that do not
20591 contain dots or colons (that is, are not IP addresses), the value of
20592 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
20593 items that do contain dots or colons, the value of <option>local_interfaces</option> is
20594 replaced by those items. Thus, for example,
20595 </para>
20596 <literallayout class="monospaced">
20597 -oX 1225
20598 </literallayout>
20599 <para>
20600 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
20601 whereas
20602 </para>
20603 <literallayout class="monospaced">
20604 -oX 192.168.34.5.1125
20605 </literallayout>
20606 <para>
20607 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
20608 (However, since <option>local_interfaces</option> now contains no items without ports, the
20609 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
20610 </para>
20611 </section>
20612 <section id="SECTsupobssmt">
20613 <title>Support for the obsolete SSMTP (or SMTPS) protocol</title>
20614 <para>
20615 <indexterm role="concept">
20616 <primary>ssmtp protocol</primary>
20617 </indexterm>
20618 <indexterm role="concept">
20619 <primary>smtps protocol</primary>
20620 </indexterm>
20621 <indexterm role="concept">
20622 <primary>SMTP</primary>
20623 <secondary>ssmtp protocol</secondary>
20624 </indexterm>
20625 <indexterm role="concept">
20626 <primary>SMTP</primary>
20627 <secondary>smtps protocol</secondary>
20628 </indexterm>
20629 Exim supports the obsolete SSMTP protocol (also known as SMTPS) that was used
20630 before the STARTTLS command was standardized for SMTP. Some legacy clients
20631 still use this protocol. If the <option>tls_on_connect_ports</option> option is set to a
20632 list of port numbers or service names,
20633 connections to those ports must use SSMTP. The most
20634 common use of this option is expected to be
20635 </para>
20636 <literallayout class="monospaced">
20637 tls_on_connect_ports = 465
20638 </literallayout>
20639 <para>
20640 because 465 is the usual port number used by the legacy clients. There is also
20641 a command line option <option>-tls-on-connect</option>, which forces all ports to behave in
20642 this way when a daemon is started.
20643 </para>
20644 <para>
20645 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
20646 daemon to listen on those ports. You must still specify them in
20647 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
20648 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
20649 connections via the daemon.)
20650 </para>
20651 </section>
20652 <section id="SECID92">
20653 <title>IPv6 address scopes</title>
20654 <para>
20655 <indexterm role="concept">
20656 <primary>IPv6</primary>
20657 <secondary>address scopes</secondary>
20658 </indexterm>
20659 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
20660 can, in principle, have the same link-local IPv6 address on different
20661 interfaces. Thus, additional information is needed, over and above the IP
20662 address, to distinguish individual interfaces. A convention of using a
20663 percent sign followed by something (often the interface name) has been
20664 adopted in some cases, leading to addresses like this:
20665 </para>
20666 <literallayout class="monospaced">
20667 fe80::202:b3ff:fe03:45c1%eth0
20668 </literallayout>
20669 <para>
20670 To accommodate this usage, a percent sign followed by an arbitrary string is
20671 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
20672 to convert a textual IPv6 address for actual use. This function recognizes the
20673 percent convention in operating systems that support it, and it processes the
20674 address appropriately. Unfortunately, some older libraries have problems with
20675 <function>getaddrinfo()</function>. If
20676 </para>
20677 <literallayout class="monospaced">
20678 IPV6_USE_INET_PTON=yes
20679 </literallayout>
20680 <para>
20681 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
20682 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
20683 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
20684 function.) Of course, this means that the additional functionality of
20685 <function>getaddrinfo()</function> &ndash; recognizing scoped addresses &ndash; is lost.
20686 </para>
20687 </section>
20688 <section id="SECID93">
20689 <title>Disabling IPv6</title>
20690 <para>
20691 <indexterm role="concept">
20692 <primary>IPv6</primary>
20693 <secondary>disabling</secondary>
20694 </indexterm>
20695 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
20696 run on a host whose kernel does not support IPv6. The binary will fall back to
20697 using IPv4, but it may waste resources looking up AAAA records, and trying to
20698 connect to IPv6 addresses, causing delays to mail delivery. If you set the
20699 <indexterm role="option">
20700 <primary><option>disable_ipv6</option></primary>
20701 </indexterm>
20702 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
20703 activities take place. AAAA records are never looked up, and any IPv6 addresses
20704 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
20705 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
20706 to handle IPv6 literal addresses.
20707 </para>
20708 <para>
20709 On the other hand, when IPv6 is in use, there may be times when you want to
20710 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
20711 option to globally suppress the lookup of AAAA records for specified domains,
20712 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
20713 IPv6 addresses in an individual router.
20714 </para>
20715 </section>
20716 <section id="SECID94">
20717 <title>Examples of starting a listening daemon</title>
20718 <para>
20719 The default case in an IPv6 environment is
20720 </para>
20721 <literallayout class="monospaced">
20722 daemon_smtp_ports = smtp
20723 local_interfaces = &lt;; ::0 ; 0.0.0.0
20724 </literallayout>
20725 <para>
20726 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
20727 Either one or two sockets may be used, depending on the characteristics of
20728 the TCP/IP stack. (This is complicated and messy; for more information,
20729 read the comments in the <filename>daemon.c</filename> source file.)
20730 </para>
20731 <para>
20732 To specify listening on ports 25 and 26 on all interfaces:
20733 </para>
20734 <literallayout class="monospaced">
20735 daemon_smtp_ports = 25 : 26
20736 </literallayout>
20737 <para>
20738 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
20739 </para>
20740 <literallayout class="monospaced">
20741 local_interfaces = &lt;; ::0.25     ; ::0.26 \
20742                       0.0.0.0.25 ; 0.0.0.0.26
20743 </literallayout>
20744 <para>
20745 To listen on the default port on all IPv4 interfaces, and on port 26 on the
20746 IPv4 loopback address only:
20747 </para>
20748 <literallayout class="monospaced">
20749 local_interfaces = 0.0.0.0 : 127.0.0.1.26
20750 </literallayout>
20751 <para>
20752 To specify listening on the default port on specific interfaces only:
20753 </para>
20754 <literallayout class="monospaced">
20755 local_interfaces = 10.0.0.67 : 192.168.34.67
20756 </literallayout>
20757 <para>
20758 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
20759 </para>
20760 </section>
20761 <section id="SECTreclocipadd">
20762 <title>Recognizing the local host</title>
20763 <para>
20764 The <option>local_interfaces</option> option is also used when Exim needs to determine
20765 whether or not an IP address refers to the local host. That is, the IP
20766 addresses of all the interfaces on which a daemon is listening are always
20767 treated as local.
20768 </para>
20769 <para>
20770 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
20771 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
20772 available interfaces from the operating system, and extracts the relevant
20773 (that is, IPv4 or IPv6) addresses to use for checking.
20774 </para>
20775 <para>
20776 Some systems set up large numbers of virtual interfaces in order to provide
20777 many virtual web servers. In this situation, you may want to listen for
20778 email on only a few of the available interfaces, but nevertheless treat all
20779 interfaces as local when routing. You can do this by setting
20780 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
20781 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
20782 used for listening. Consider this example:
20783 </para>
20784 <literallayout class="monospaced">
20785 local_interfaces = &lt;; 127.0.0.1 ; ::1 ; \
20786                       192.168.53.235 ; \
20787                       3ffe:2101:12:1:a00:20ff:fe86:a061
20788
20789 extra_local_interfaces = &lt;; ::0 ; 0.0.0.0
20790 </literallayout>
20791 <para>
20792 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
20793 address, but all available interface addresses are treated as local when
20794 Exim is routing.
20795 </para>
20796 <para>
20797 In some environments the local host name may be in an MX list, but with an IP
20798 address that is not assigned to any local interface. In other cases it may be
20799 desirable to treat other host names as if they referred to the local host. Both
20800 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
20801 This contains host names rather than IP addresses. When a host is referenced
20802 during routing, either via an MX record or directly, it is treated as the local
20803 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
20804 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
20805 </para>
20806 </section>
20807 <section id="SECID95">
20808 <title>Delivering to a remote host</title>
20809 <para>
20810 Delivery to a remote host is handled by the smtp transport. By default, it
20811 allows the system&#x2019;s TCP/IP functions to choose which interface to use (if
20812 there is more than one) when connecting to a remote host. However, the
20813 <option>interface</option> option can be set to specify which interface is used. See the
20814 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
20815 details.
20816 </para>
20817 </section>
20818 </chapter>
20819
20820 <chapter id="CHAPmainconfig">
20821 <title>Main configuration</title>
20822 <para>
20823 <indexterm role="concept" id="IIDconfima" class="startofrange">
20824 <primary>configuration file</primary>
20825 <secondary>main section</secondary>
20826 </indexterm>
20827 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
20828 <primary>main configuration</primary>
20829 </indexterm>
20830 The first part of the run time configuration file contains three types of item:
20831 </para>
20832 <itemizedlist>
20833 <listitem>
20834 <para>
20835 Macro definitions: These lines start with an upper case letter. See section
20836 <xref linkend="SECTmacrodefs"/> for details of macro processing.
20837 </para>
20838 </listitem>
20839 <listitem>
20840 <para>
20841 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
20842 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
20843 section <xref linkend="SECTnamedlists"/>.
20844 </para>
20845 </listitem>
20846 <listitem>
20847 <para>
20848 Main configuration settings: Each setting occupies one line of the file
20849 (with possible continuations). If any setting is preceded by the word
20850 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
20851 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
20852 settings.
20853 </para>
20854 </listitem>
20855 </itemizedlist>
20856 <para>
20857 This chapter specifies all the main configuration options, along with their
20858 types and default values. For ease of finding a particular option, they appear
20859 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
20860 are now so many options, they are first listed briefly in functional groups, as
20861 an aid to finding the name of the option you are looking for. Some options are
20862 listed in more than one group.
20863 </para>
20864 <section id="SECID96">
20865 <title>Miscellaneous</title>
20866 <informaltable frame="none">
20867 <tgroup cols="2" colsep="0" rowsep="0">
20868 <colspec colwidth="196pt" align="left"/>
20869 <colspec colwidth="254pt" align="left"/>
20870 <tbody>
20871 <row>
20872 <entry><option>bi_command</option></entry>
20873 <entry>to run for <option>-bi</option> command line option</entry>
20874 </row>
20875 <row>
20876 <entry><option>disable_ipv6</option></entry>
20877 <entry>do no IPv6 processing</entry>
20878 </row>
20879 <row>
20880 <entry><option>keep_malformed</option></entry>
20881 <entry>for broken files &ndash; should not happen</entry>
20882 </row>
20883 <row>
20884 <entry><option>localhost_number</option></entry>
20885 <entry>for unique message ids in clusters</entry>
20886 </row>
20887 <row>
20888 <entry><option>message_body_newlines</option></entry>
20889 <entry>retain newlines in <varname>$message_body</varname></entry>
20890 </row>
20891 <row>
20892 <entry><option>message_body_visible</option></entry>
20893 <entry>how much to show in <varname>$message_body</varname></entry>
20894 </row>
20895 <row>
20896 <entry><option>mua_wrapper</option></entry>
20897 <entry>run in <quote>MUA wrapper</quote> mode</entry>
20898 </row>
20899 <row>
20900 <entry><option>print_topbitchars</option></entry>
20901 <entry>top-bit characters are printing</entry>
20902 </row>
20903 <row>
20904 <entry><option>timezone</option></entry>
20905 <entry>force time zone</entry>
20906 </row>
20907 </tbody>
20908 </tgroup>
20909 </informaltable>
20910 </section>
20911 <section id="SECID97">
20912 <title>Exim parameters</title>
20913 <informaltable frame="none">
20914 <tgroup cols="2" colsep="0" rowsep="0">
20915 <colspec colwidth="196pt" align="left"/>
20916 <colspec colwidth="254pt" align="left"/>
20917 <tbody>
20918 <row>
20919 <entry><option>exim_group</option></entry>
20920 <entry>override compiled-in value</entry>
20921 </row>
20922 <row>
20923 <entry><option>exim_path</option></entry>
20924 <entry>override compiled-in value</entry>
20925 </row>
20926 <row>
20927 <entry><option>exim_user</option></entry>
20928 <entry>override compiled-in value</entry>
20929 </row>
20930 <row>
20931 <entry><option>primary_hostname</option></entry>
20932 <entry>default from <function>uname()</function></entry>
20933 </row>
20934 <row>
20935 <entry><option>split_spool_directory</option></entry>
20936 <entry>use multiple directories</entry>
20937 </row>
20938 <row>
20939 <entry><option>spool_directory</option></entry>
20940 <entry>override compiled-in value</entry>
20941 </row>
20942 </tbody>
20943 </tgroup>
20944 </informaltable>
20945 </section>
20946 <section id="SECID98">
20947 <title>Privilege controls</title>
20948 <informaltable frame="none">
20949 <tgroup cols="2" colsep="0" rowsep="0">
20950 <colspec colwidth="196pt" align="left"/>
20951 <colspec colwidth="254pt" align="left"/>
20952 <tbody>
20953 <row>
20954 <entry><option>admin_groups</option></entry>
20955 <entry>groups that are Exim admin users</entry>
20956 </row>
20957 <row>
20958 <entry><option>deliver_drop_privilege</option></entry>
20959 <entry>drop root for delivery processes</entry>
20960 </row>
20961 <row>
20962 <entry><option>local_from_check</option></entry>
20963 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
20964 </row>
20965 <row>
20966 <entry><option>local_from_prefix</option></entry>
20967 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
20968 </row>
20969 <row>
20970 <entry><option>local_from_suffix</option></entry>
20971 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
20972 </row>
20973 <row>
20974 <entry><option>local_sender_retain</option></entry>
20975 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
20976 </row>
20977 <row>
20978 <entry><option>never_users</option></entry>
20979 <entry>do not run deliveries as these</entry>
20980 </row>
20981 <row>
20982 <entry><option>prod_requires_admin</option></entry>
20983 <entry>forced delivery requires admin user</entry>
20984 </row>
20985 <row>
20986 <entry><option>queue_list_requires_admin</option></entry>
20987 <entry>queue listing requires admin user</entry>
20988 </row>
20989 <row>
20990 <entry><option>trusted_groups</option></entry>
20991 <entry>groups that are trusted</entry>
20992 </row>
20993 <row>
20994 <entry><option>trusted_users</option></entry>
20995 <entry>users that are trusted</entry>
20996 </row>
20997 </tbody>
20998 </tgroup>
20999 </informaltable>
21000 </section>
21001 <section id="SECID99">
21002 <title>Logging</title>
21003 <informaltable frame="none">
21004 <tgroup cols="2" colsep="0" rowsep="0">
21005 <colspec colwidth="196pt" align="left"/>
21006 <colspec colwidth="254pt" align="left"/>
21007 <tbody>
21008 <row>
21009 <entry><option>event_action</option></entry>
21010 <entry>custom logging</entry>
21011 </row>
21012 <row>
21013 <entry><option>hosts_connection_nolog</option></entry>
21014 <entry>exemption from connect logging</entry>
21015 </row>
21016 <row>
21017 <entry><option>log_file_path</option></entry>
21018 <entry>override compiled-in value</entry>
21019 </row>
21020 <row>
21021 <entry><option>log_selector</option></entry>
21022 <entry>set/unset optional logging</entry>
21023 </row>
21024 <row>
21025 <entry><option>log_timezone</option></entry>
21026 <entry>add timezone to log lines</entry>
21027 </row>
21028 <row>
21029 <entry><option>message_logs</option></entry>
21030 <entry>create per-message logs</entry>
21031 </row>
21032 <row>
21033 <entry><option>preserve_message_logs</option></entry>
21034 <entry>after message completion</entry>
21035 </row>
21036 <row>
21037 <entry><option>process_log_path</option></entry>
21038 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
21039 </row>
21040 <row>
21041 <entry><option>slow_lookup_log</option></entry>
21042 <entry>control logging of slow DNS lookups</entry>
21043 </row>
21044 <row>
21045 <entry><option>syslog_duplication</option></entry>
21046 <entry>controls duplicate log lines on syslog</entry>
21047 </row>
21048 <row>
21049 <entry><option>syslog_facility</option></entry>
21050 <entry>set syslog <quote>facility</quote> field</entry>
21051 </row>
21052 <row>
21053 <entry><option>syslog_processname</option></entry>
21054 <entry>set syslog <quote>ident</quote> field</entry>
21055 </row>
21056 <row>
21057 <entry><option>syslog_timestamp</option></entry>
21058 <entry>timestamp syslog lines</entry>
21059 </row>
21060 <row>
21061 <entry><option>write_rejectlog</option></entry>
21062 <entry>control use of message log</entry>
21063 </row>
21064 </tbody>
21065 </tgroup>
21066 </informaltable>
21067 </section>
21068 <section id="SECID100">
21069 <title>Frozen messages</title>
21070 <informaltable frame="none">
21071 <tgroup cols="2" colsep="0" rowsep="0">
21072 <colspec colwidth="196pt" align="left"/>
21073 <colspec colwidth="254pt" align="left"/>
21074 <tbody>
21075 <row>
21076 <entry><option>auto_thaw</option></entry>
21077 <entry>sets time for retrying frozen messages</entry>
21078 </row>
21079 <row>
21080 <entry><option>freeze_tell</option></entry>
21081 <entry>send message when freezing</entry>
21082 </row>
21083 <row>
21084 <entry><option>move_frozen_messages</option></entry>
21085 <entry>to another directory</entry>
21086 </row>
21087 <row>
21088 <entry><option>timeout_frozen_after</option></entry>
21089 <entry>keep frozen messages only so long</entry>
21090 </row>
21091 </tbody>
21092 </tgroup>
21093 </informaltable>
21094 </section>
21095 <section id="SECID101">
21096 <title>Data lookups</title>
21097 <informaltable frame="none">
21098 <tgroup cols="2" colsep="0" rowsep="0">
21099 <colspec colwidth="196pt" align="left"/>
21100 <colspec colwidth="254pt" align="left"/>
21101 <tbody>
21102 <row>
21103 <entry><option>ibase_servers</option></entry>
21104 <entry>InterBase servers</entry>
21105 </row>
21106 <row>
21107 <entry><option>ldap_ca_cert_dir</option></entry>
21108 <entry>dir of CA certs to verify LDAP server&#x2019;s</entry>
21109 </row>
21110 <row>
21111 <entry><option>ldap_ca_cert_file</option></entry>
21112 <entry>file of CA certs to verify LDAP server&#x2019;s</entry>
21113 </row>
21114 <row>
21115 <entry><option>ldap_cert_file</option></entry>
21116 <entry>client cert file for LDAP</entry>
21117 </row>
21118 <row>
21119 <entry><option>ldap_cert_key</option></entry>
21120 <entry>client key file for LDAP</entry>
21121 </row>
21122 <row>
21123 <entry><option>ldap_cipher_suite</option></entry>
21124 <entry>TLS negotiation preference control</entry>
21125 </row>
21126 <row>
21127 <entry><option>ldap_default_servers</option></entry>
21128 <entry>used if no server in query</entry>
21129 </row>
21130 <row>
21131 <entry><option>ldap_require_cert</option></entry>
21132 <entry>action to take without LDAP server cert</entry>
21133 </row>
21134 <row>
21135 <entry><option>ldap_start_tls</option></entry>
21136 <entry>require TLS within LDAP</entry>
21137 </row>
21138 <row>
21139 <entry><option>ldap_version</option></entry>
21140 <entry>set protocol version</entry>
21141 </row>
21142 <row>
21143 <entry><option>lookup_open_max</option></entry>
21144 <entry>lookup files held open</entry>
21145 </row>
21146 <row>
21147 <entry><option>mysql_servers</option></entry>
21148 <entry>default MySQL servers</entry>
21149 </row>
21150 <row>
21151 <entry><option>oracle_servers</option></entry>
21152 <entry>Oracle servers</entry>
21153 </row>
21154 <row>
21155 <entry><option>pgsql_servers</option></entry>
21156 <entry>default PostgreSQL servers</entry>
21157 </row>
21158 <row>
21159 <entry><option>sqlite_lock_timeout</option></entry>
21160 <entry>as it says</entry>
21161 </row>
21162 </tbody>
21163 </tgroup>
21164 </informaltable>
21165 </section>
21166 <section id="SECID102">
21167 <title>Message ids</title>
21168 <informaltable frame="none">
21169 <tgroup cols="2" colsep="0" rowsep="0">
21170 <colspec colwidth="196pt" align="left"/>
21171 <colspec colwidth="254pt" align="left"/>
21172 <tbody>
21173 <row>
21174 <entry><option>message_id_header_domain</option></entry>
21175 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
21176 </row>
21177 <row>
21178 <entry><option>message_id_header_text</option></entry>
21179 <entry>ditto</entry>
21180 </row>
21181 </tbody>
21182 </tgroup>
21183 </informaltable>
21184 </section>
21185 <section id="SECID103">
21186 <title>Embedded Perl Startup</title>
21187 <informaltable frame="none">
21188 <tgroup cols="2" colsep="0" rowsep="0">
21189 <colspec colwidth="196pt" align="left"/>
21190 <colspec colwidth="254pt" align="left"/>
21191 <tbody>
21192 <row>
21193 <entry><option>perl_at_start</option></entry>
21194 <entry>always start the interpreter</entry>
21195 </row>
21196 <row>
21197 <entry><option>perl_startup</option></entry>
21198 <entry>code to obey when starting Perl</entry>
21199 </row>
21200 </tbody>
21201 </tgroup>
21202 </informaltable>
21203 </section>
21204 <section id="SECID104">
21205 <title>Daemon</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>daemon_smtp_ports</option></entry>
21213 <entry>default ports</entry>
21214 </row>
21215 <row>
21216 <entry><option>daemon_startup_retries</option></entry>
21217 <entry>number of times to retry</entry>
21218 </row>
21219 <row>
21220 <entry><option>daemon_startup_sleep</option></entry>
21221 <entry>time to sleep between tries</entry>
21222 </row>
21223 <row>
21224 <entry><option>extra_local_interfaces</option></entry>
21225 <entry>not necessarily listened on</entry>
21226 </row>
21227 <row>
21228 <entry><option>local_interfaces</option></entry>
21229 <entry>on which to listen, with optional ports</entry>
21230 </row>
21231 <row>
21232 <entry><option>pid_file_path</option></entry>
21233 <entry>override compiled-in value</entry>
21234 </row>
21235 <row>
21236 <entry><option>queue_run_max</option></entry>
21237 <entry>maximum simultaneous queue runners</entry>
21238 </row>
21239 </tbody>
21240 </tgroup>
21241 </informaltable>
21242 </section>
21243 <section id="SECID105">
21244 <title>Resource control</title>
21245 <informaltable frame="none">
21246 <tgroup cols="2" colsep="0" rowsep="0">
21247 <colspec colwidth="196pt" align="left"/>
21248 <colspec colwidth="254pt" align="left"/>
21249 <tbody>
21250 <row>
21251 <entry><option>check_log_inodes</option></entry>
21252 <entry>before accepting a message</entry>
21253 </row>
21254 <row>
21255 <entry><option>check_log_space</option></entry>
21256 <entry>before accepting a message</entry>
21257 </row>
21258 <row>
21259 <entry><option>check_spool_inodes</option></entry>
21260 <entry>before accepting a message</entry>
21261 </row>
21262 <row>
21263 <entry><option>check_spool_space</option></entry>
21264 <entry>before accepting a message</entry>
21265 </row>
21266 <row>
21267 <entry><option>deliver_queue_load_max</option></entry>
21268 <entry>no queue deliveries if load high</entry>
21269 </row>
21270 <row>
21271 <entry><option>queue_only_load</option></entry>
21272 <entry>queue incoming if load high</entry>
21273 </row>
21274 <row>
21275 <entry><option>queue_only_load_latch</option></entry>
21276 <entry>don&#x2019;t re-evaluate load for each message</entry>
21277 </row>
21278 <row>
21279 <entry><option>queue_run_max</option></entry>
21280 <entry>maximum simultaneous queue runners</entry>
21281 </row>
21282 <row>
21283 <entry><option>remote_max_parallel</option></entry>
21284 <entry>parallel SMTP delivery per message</entry>
21285 </row>
21286 <row>
21287 <entry><option>smtp_accept_max</option></entry>
21288 <entry>simultaneous incoming connections</entry>
21289 </row>
21290 <row>
21291 <entry><option>smtp_accept_max_nonmail</option></entry>
21292 <entry>non-mail commands</entry>
21293 </row>
21294 <row>
21295 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
21296 <entry>hosts to which the limit applies</entry>
21297 </row>
21298 <row>
21299 <entry><option>smtp_accept_max_per_connection</option></entry>
21300 <entry>messages per connection</entry>
21301 </row>
21302 <row>
21303 <entry><option>smtp_accept_max_per_host</option></entry>
21304 <entry>connections from one host</entry>
21305 </row>
21306 <row>
21307 <entry><option>smtp_accept_queue</option></entry>
21308 <entry>queue mail if more connections</entry>
21309 </row>
21310 <row>
21311 <entry><option>smtp_accept_queue_per_connection</option></entry>
21312 <entry>queue if more messages per connection</entry>
21313 </row>
21314 <row>
21315 <entry><option>smtp_accept_reserve</option></entry>
21316 <entry>only reserve hosts if more connections</entry>
21317 </row>
21318 <row>
21319 <entry><option>smtp_check_spool_space</option></entry>
21320 <entry>from SIZE on MAIL command</entry>
21321 </row>
21322 <row>
21323 <entry><option>smtp_connect_backlog</option></entry>
21324 <entry>passed to TCP/IP stack</entry>
21325 </row>
21326 <row>
21327 <entry><option>smtp_load_reserve</option></entry>
21328 <entry>SMTP from reserved hosts if load high</entry>
21329 </row>
21330 <row>
21331 <entry><option>smtp_reserve_hosts</option></entry>
21332 <entry>these are the reserve hosts</entry>
21333 </row>
21334 </tbody>
21335 </tgroup>
21336 </informaltable>
21337 </section>
21338 <section id="SECID106">
21339 <title>Policy controls</title>
21340 <informaltable frame="none">
21341 <tgroup cols="2" colsep="0" rowsep="0">
21342 <colspec colwidth="196pt" align="left"/>
21343 <colspec colwidth="254pt" align="left"/>
21344 <tbody>
21345 <row>
21346 <entry><option>acl_not_smtp</option></entry>
21347 <entry>ACL for non-SMTP messages</entry>
21348 </row>
21349 <row>
21350 <entry><option>acl_not_smtp_mime</option></entry>
21351 <entry>ACL for non-SMTP MIME parts</entry>
21352 </row>
21353 <row>
21354 <entry><option>acl_not_smtp_start</option></entry>
21355 <entry>ACL for start of non-SMTP message</entry>
21356 </row>
21357 <row>
21358 <entry><option>acl_smtp_auth</option></entry>
21359 <entry>ACL for AUTH</entry>
21360 </row>
21361 <row>
21362 <entry><option>acl_smtp_connect</option></entry>
21363 <entry>ACL for connection</entry>
21364 </row>
21365 <row>
21366 <entry><option>acl_smtp_data</option></entry>
21367 <entry>ACL for DATA</entry>
21368 </row>
21369 <row>
21370 <entry><option>acl_smtp_data_prdr</option></entry>
21371 <entry>ACL for DATA, per-recipient</entry>
21372 </row>
21373 <row>
21374 <entry><option>acl_smtp_dkim</option></entry>
21375 <entry>ACL for DKIM verification</entry>
21376 </row>
21377 <row>
21378 <entry><option>acl_smtp_etrn</option></entry>
21379 <entry>ACL for ETRN</entry>
21380 </row>
21381 <row>
21382 <entry><option>acl_smtp_expn</option></entry>
21383 <entry>ACL for EXPN</entry>
21384 </row>
21385 <row>
21386 <entry><option>acl_smtp_helo</option></entry>
21387 <entry>ACL for EHLO or HELO</entry>
21388 </row>
21389 <row>
21390 <entry><option>acl_smtp_mail</option></entry>
21391 <entry>ACL for MAIL</entry>
21392 </row>
21393 <row>
21394 <entry><option>acl_smtp_mailauth</option></entry>
21395 <entry>ACL for AUTH on MAIL command</entry>
21396 </row>
21397 <row>
21398 <entry><option>acl_smtp_mime</option></entry>
21399 <entry>ACL for MIME parts</entry>
21400 </row>
21401 <row>
21402 <entry><option>acl_smtp_notquit</option></entry>
21403 <entry>ACL for non-QUIT terminations</entry>
21404 </row>
21405 <row>
21406 <entry><option>acl_smtp_predata</option></entry>
21407 <entry>ACL for start of data</entry>
21408 </row>
21409 <row>
21410 <entry><option>acl_smtp_quit</option></entry>
21411 <entry>ACL for QUIT</entry>
21412 </row>
21413 <row>
21414 <entry><option>acl_smtp_rcpt</option></entry>
21415 <entry>ACL for RCPT</entry>
21416 </row>
21417 <row>
21418 <entry><option>acl_smtp_starttls</option></entry>
21419 <entry>ACL for STARTTLS</entry>
21420 </row>
21421 <row>
21422 <entry><option>acl_smtp_vrfy</option></entry>
21423 <entry>ACL for VRFY</entry>
21424 </row>
21425 <row>
21426 <entry><option>av_scanner</option></entry>
21427 <entry>specify virus scanner</entry>
21428 </row>
21429 <row>
21430 <entry><option>check_rfc2047_length</option></entry>
21431 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
21432 </row>
21433 <row>
21434 <entry><option>dns_csa_search_limit</option></entry>
21435 <entry>control CSA parent search depth</entry>
21436 </row>
21437 <row>
21438 <entry><option>dns_csa_use_reverse</option></entry>
21439 <entry>en/disable CSA IP reverse search</entry>
21440 </row>
21441 <row>
21442 <entry><option>header_maxsize</option></entry>
21443 <entry>total size of message header</entry>
21444 </row>
21445 <row>
21446 <entry><option>header_line_maxsize</option></entry>
21447 <entry>individual header line limit</entry>
21448 </row>
21449 <row>
21450 <entry><option>helo_accept_junk_hosts</option></entry>
21451 <entry>allow syntactic junk from these hosts</entry>
21452 </row>
21453 <row>
21454 <entry><option>helo_allow_chars</option></entry>
21455 <entry>allow illegal chars in HELO names</entry>
21456 </row>
21457 <row>
21458 <entry><option>helo_lookup_domains</option></entry>
21459 <entry>lookup hostname for these HELO names</entry>
21460 </row>
21461 <row>
21462 <entry><option>helo_try_verify_hosts</option></entry>
21463 <entry>HELO soft-checked for these hosts</entry>
21464 </row>
21465 <row>
21466 <entry><option>helo_verify_hosts</option></entry>
21467 <entry>HELO hard-checked for these hosts</entry>
21468 </row>
21469 <row>
21470 <entry><option>host_lookup</option></entry>
21471 <entry>host name looked up for these hosts</entry>
21472 </row>
21473 <row>
21474 <entry><option>host_lookup_order</option></entry>
21475 <entry>order of DNS and local name lookups</entry>
21476 </row>
21477 <row>
21478 <entry><option>hosts_proxy</option></entry>
21479 <entry>use proxy protocol for these hosts</entry>
21480 </row>
21481 <row>
21482 <entry><option>host_reject_connection</option></entry>
21483 <entry>reject connection from these hosts</entry>
21484 </row>
21485 <row>
21486 <entry><option>hosts_treat_as_local</option></entry>
21487 <entry>useful in some cluster configurations</entry>
21488 </row>
21489 <row>
21490 <entry><option>local_scan_timeout</option></entry>
21491 <entry>timeout for <function>local_scan()</function></entry>
21492 </row>
21493 <row>
21494 <entry><option>message_size_limit</option></entry>
21495 <entry>for all messages</entry>
21496 </row>
21497 <row>
21498 <entry><option>percent_hack_domains</option></entry>
21499 <entry>recognize %-hack for these domains</entry>
21500 </row>
21501 <row>
21502 <entry><option>spamd_address</option></entry>
21503 <entry>set interface to SpamAssassin</entry>
21504 </row>
21505 <row>
21506 <entry><option>strict_acl_vars</option></entry>
21507 <entry>object to unset ACL variables</entry>
21508 </row>
21509 </tbody>
21510 </tgroup>
21511 </informaltable>
21512 </section>
21513 <section id="SECID107">
21514 <title>Callout cache</title>
21515 <informaltable frame="none">
21516 <tgroup cols="2" colsep="0" rowsep="0">
21517 <colspec colwidth="196pt" align="left"/>
21518 <colspec colwidth="254pt" align="left"/>
21519 <tbody>
21520 <row>
21521 <entry><option>callout_domain_negative_expire</option></entry>
21522 <entry>timeout for negative domain cache item</entry>
21523 </row>
21524 <row>
21525 <entry><option>callout_domain_positive_expire</option></entry>
21526 <entry>timeout for positive domain cache item</entry>
21527 </row>
21528 <row>
21529 <entry><option>callout_negative_expire</option></entry>
21530 <entry>timeout for negative address cache item</entry>
21531 </row>
21532 <row>
21533 <entry><option>callout_positive_expire</option></entry>
21534 <entry>timeout for positive address cache item</entry>
21535 </row>
21536 <row>
21537 <entry><option>callout_random_local_part</option></entry>
21538 <entry>string to use for <quote>random</quote> testing</entry>
21539 </row>
21540 </tbody>
21541 </tgroup>
21542 </informaltable>
21543 </section>
21544 <section id="SECID108">
21545 <title>TLS</title>
21546 <informaltable frame="none">
21547 <tgroup cols="2" colsep="0" rowsep="0">
21548 <colspec colwidth="196pt" align="left"/>
21549 <colspec colwidth="254pt" align="left"/>
21550 <tbody>
21551 <row>
21552 <entry><option>gnutls_compat_mode</option></entry>
21553 <entry>use GnuTLS compatibility mode</entry>
21554 </row>
21555 <row>
21556 <entry><option>gnutls_allow_auto_pkcs11</option></entry>
21557 <entry>allow GnuTLS to autoload PKCS11 modules</entry>
21558 </row>
21559 <row>
21560 <entry><option>openssl_options</option></entry>
21561 <entry>adjust OpenSSL compatibility options</entry>
21562 </row>
21563 <row>
21564 <entry><option>tls_advertise_hosts</option></entry>
21565 <entry>advertise TLS to these hosts</entry>
21566 </row>
21567 <row>
21568 <entry><option>tls_certificate</option></entry>
21569 <entry>location of server certificate</entry>
21570 </row>
21571 <row>
21572 <entry><option>tls_crl</option></entry>
21573 <entry>certificate revocation list</entry>
21574 </row>
21575 <row>
21576 <entry><option>tls_dh_max_bits</option></entry>
21577 <entry>clamp D-H bit count suggestion</entry>
21578 </row>
21579 <row>
21580 <entry><option>tls_dhparam</option></entry>
21581 <entry>DH parameters for server</entry>
21582 </row>
21583 <row>
21584 <entry><option>tls_eccurve</option></entry>
21585 <entry>EC curve selection for server</entry>
21586 </row>
21587 <row>
21588 <entry><option>tls_ocsp_file</option></entry>
21589 <entry>location of server certificate status proof</entry>
21590 </row>
21591 <row>
21592 <entry><option>tls_on_connect_ports</option></entry>
21593 <entry>specify SSMTP (SMTPS) ports</entry>
21594 </row>
21595 <row>
21596 <entry><option>tls_privatekey</option></entry>
21597 <entry>location of server private key</entry>
21598 </row>
21599 <row>
21600 <entry><option>tls_remember_esmtp</option></entry>
21601 <entry>don&#x2019;t reset after starting TLS</entry>
21602 </row>
21603 <row>
21604 <entry><option>tls_require_ciphers</option></entry>
21605 <entry>specify acceptable ciphers</entry>
21606 </row>
21607 <row>
21608 <entry><option>tls_try_verify_hosts</option></entry>
21609 <entry>try to verify client certificate</entry>
21610 </row>
21611 <row>
21612 <entry><option>tls_verify_certificates</option></entry>
21613 <entry>expected client certificates</entry>
21614 </row>
21615 <row>
21616 <entry><option>tls_verify_hosts</option></entry>
21617 <entry>insist on client certificate verify</entry>
21618 </row>
21619 </tbody>
21620 </tgroup>
21621 </informaltable>
21622 </section>
21623 <section id="SECID109">
21624 <title>Local user handling</title>
21625 <informaltable frame="none">
21626 <tgroup cols="2" colsep="0" rowsep="0">
21627 <colspec colwidth="196pt" align="left"/>
21628 <colspec colwidth="254pt" align="left"/>
21629 <tbody>
21630 <row>
21631 <entry><option>finduser_retries</option></entry>
21632 <entry>useful in NIS environments</entry>
21633 </row>
21634 <row>
21635 <entry><option>gecos_name</option></entry>
21636 <entry>used when creating <emphasis>Sender:</emphasis></entry>
21637 </row>
21638 <row>
21639 <entry><option>gecos_pattern</option></entry>
21640 <entry>ditto</entry>
21641 </row>
21642 <row>
21643 <entry><option>max_username_length</option></entry>
21644 <entry>for systems that truncate</entry>
21645 </row>
21646 <row>
21647 <entry><option>unknown_login</option></entry>
21648 <entry>used when no login name found</entry>
21649 </row>
21650 <row>
21651 <entry><option>unknown_username</option></entry>
21652 <entry>ditto</entry>
21653 </row>
21654 <row>
21655 <entry><option>uucp_from_pattern</option></entry>
21656 <entry>for recognizing <quote>From </quote> lines</entry>
21657 </row>
21658 <row>
21659 <entry><option>uucp_from_sender</option></entry>
21660 <entry>ditto</entry>
21661 </row>
21662 </tbody>
21663 </tgroup>
21664 </informaltable>
21665 </section>
21666 <section id="SECID110">
21667 <title>All incoming messages (SMTP and non-SMTP)</title>
21668 <informaltable frame="none">
21669 <tgroup cols="2" colsep="0" rowsep="0">
21670 <colspec colwidth="196pt" align="left"/>
21671 <colspec colwidth="254pt" align="left"/>
21672 <tbody>
21673 <row>
21674 <entry><option>header_maxsize</option></entry>
21675 <entry>total size of message header</entry>
21676 </row>
21677 <row>
21678 <entry><option>header_line_maxsize</option></entry>
21679 <entry>individual header line limit</entry>
21680 </row>
21681 <row>
21682 <entry><option>message_size_limit</option></entry>
21683 <entry>applies to all messages</entry>
21684 </row>
21685 <row>
21686 <entry><option>percent_hack_domains</option></entry>
21687 <entry>recognize %-hack for these domains</entry>
21688 </row>
21689 <row>
21690 <entry><option>received_header_text</option></entry>
21691 <entry>expanded to make <emphasis>Received:</emphasis></entry>
21692 </row>
21693 <row>
21694 <entry><option>received_headers_max</option></entry>
21695 <entry>for mail loop detection</entry>
21696 </row>
21697 <row>
21698 <entry><option>recipients_max</option></entry>
21699 <entry>limit per message</entry>
21700 </row>
21701 <row>
21702 <entry><option>recipients_max_reject</option></entry>
21703 <entry>permanently reject excess recipients</entry>
21704 </row>
21705 </tbody>
21706 </tgroup>
21707 </informaltable>
21708 </section>
21709 <section id="SECID111">
21710 <title>Non-SMTP incoming messages</title>
21711 <informaltable frame="none">
21712 <tgroup cols="2" colsep="0" rowsep="0">
21713 <colspec colwidth="196pt" align="left"/>
21714 <colspec colwidth="254pt" align="left"/>
21715 <tbody>
21716 <row>
21717 <entry><option>receive_timeout</option></entry>
21718 <entry>for non-SMTP messages</entry>
21719 </row>
21720 </tbody>
21721 </tgroup>
21722 </informaltable>
21723 </section>
21724 <section id="SECID112">
21725 <title>Incoming SMTP messages</title>
21726 <para>
21727 See also the <emphasis>Policy controls</emphasis> section above.
21728 </para>
21729 <informaltable frame="none">
21730 <tgroup cols="2" colsep="0" rowsep="0">
21731 <colspec colwidth="196pt" align="left"/>
21732 <colspec colwidth="254pt" align="left"/>
21733 <tbody>
21734 <row>
21735 <entry><option>dkim_verify_signers</option></entry>
21736 <entry>DKIM domain for which DKIM ACL is run</entry>
21737 </row>
21738 <row>
21739 <entry><option>host_lookup</option></entry>
21740 <entry>host name looked up for these hosts</entry>
21741 </row>
21742 <row>
21743 <entry><option>host_lookup_order</option></entry>
21744 <entry>order of DNS and local name lookups</entry>
21745 </row>
21746 <row>
21747 <entry><option>recipient_unqualified_hosts</option></entry>
21748 <entry>may send unqualified recipients</entry>
21749 </row>
21750 <row>
21751 <entry><option>rfc1413_hosts</option></entry>
21752 <entry>make ident calls to these hosts</entry>
21753 </row>
21754 <row>
21755 <entry><option>rfc1413_query_timeout</option></entry>
21756 <entry>zero disables ident calls</entry>
21757 </row>
21758 <row>
21759 <entry><option>sender_unqualified_hosts</option></entry>
21760 <entry>may send unqualified senders</entry>
21761 </row>
21762 <row>
21763 <entry><option>smtp_accept_keepalive</option></entry>
21764 <entry>some TCP/IP magic</entry>
21765 </row>
21766 <row>
21767 <entry><option>smtp_accept_max</option></entry>
21768 <entry>simultaneous incoming connections</entry>
21769 </row>
21770 <row>
21771 <entry><option>smtp_accept_max_nonmail</option></entry>
21772 <entry>non-mail commands</entry>
21773 </row>
21774 <row>
21775 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
21776 <entry>hosts to which the limit applies</entry>
21777 </row>
21778 <row>
21779 <entry><option>smtp_accept_max_per_connection</option></entry>
21780 <entry>messages per connection</entry>
21781 </row>
21782 <row>
21783 <entry><option>smtp_accept_max_per_host</option></entry>
21784 <entry>connections from one host</entry>
21785 </row>
21786 <row>
21787 <entry><option>smtp_accept_queue</option></entry>
21788 <entry>queue mail if more connections</entry>
21789 </row>
21790 <row>
21791 <entry><option>smtp_accept_queue_per_connection</option></entry>
21792 <entry>queue if more messages per connection</entry>
21793 </row>
21794 <row>
21795 <entry><option>smtp_accept_reserve</option></entry>
21796 <entry>only reserve hosts if more connections</entry>
21797 </row>
21798 <row>
21799 <entry><option>smtp_active_hostname</option></entry>
21800 <entry>host name to use in messages</entry>
21801 </row>
21802 <row>
21803 <entry><option>smtp_banner</option></entry>
21804 <entry>text for welcome banner</entry>
21805 </row>
21806 <row>
21807 <entry><option>smtp_check_spool_space</option></entry>
21808 <entry>from SIZE on MAIL command</entry>
21809 </row>
21810 <row>
21811 <entry><option>smtp_connect_backlog</option></entry>
21812 <entry>passed to TCP/IP stack</entry>
21813 </row>
21814 <row>
21815 <entry><option>smtp_enforce_sync</option></entry>
21816 <entry>of SMTP command/responses</entry>
21817 </row>
21818 <row>
21819 <entry><option>smtp_etrn_command</option></entry>
21820 <entry>what to run for ETRN</entry>
21821 </row>
21822 <row>
21823 <entry><option>smtp_etrn_serialize</option></entry>
21824 <entry>only one at once</entry>
21825 </row>
21826 <row>
21827 <entry><option>smtp_load_reserve</option></entry>
21828 <entry>only reserve hosts if this load</entry>
21829 </row>
21830 <row>
21831 <entry><option>smtp_max_unknown_commands</option></entry>
21832 <entry>before dropping connection</entry>
21833 </row>
21834 <row>
21835 <entry><option>smtp_ratelimit_hosts</option></entry>
21836 <entry>apply ratelimiting to these hosts</entry>
21837 </row>
21838 <row>
21839 <entry><option>smtp_ratelimit_mail</option></entry>
21840 <entry>ratelimit for MAIL commands</entry>
21841 </row>
21842 <row>
21843 <entry><option>smtp_ratelimit_rcpt</option></entry>
21844 <entry>ratelimit for RCPT commands</entry>
21845 </row>
21846 <row>
21847 <entry><option>smtp_receive_timeout</option></entry>
21848 <entry>per command or data line</entry>
21849 </row>
21850 <row>
21851 <entry><option>smtp_reserve_hosts</option></entry>
21852 <entry>these are the reserve hosts</entry>
21853 </row>
21854 <row>
21855 <entry><option>smtp_return_error_details</option></entry>
21856 <entry>give detail on rejections</entry>
21857 </row>
21858 </tbody>
21859 </tgroup>
21860 </informaltable>
21861 </section>
21862 <section id="SECID113">
21863 <title>SMTP extensions</title>
21864 <informaltable frame="none">
21865 <tgroup cols="2" colsep="0" rowsep="0">
21866 <colspec colwidth="196pt" align="left"/>
21867 <colspec colwidth="254pt" align="left"/>
21868 <tbody>
21869 <row>
21870 <entry><option>accept_8bitmime</option></entry>
21871 <entry>advertise 8BITMIME</entry>
21872 </row>
21873 <row>
21874 <entry><option>auth_advertise_hosts</option></entry>
21875 <entry>advertise AUTH to these hosts</entry>
21876 </row>
21877 <row>
21878 <entry><option>dsn_advertise_hosts</option></entry>
21879 <entry>advertise DSN extensions to these hosts</entry>
21880 </row>
21881 <row>
21882 <entry><option>ignore_fromline_hosts</option></entry>
21883 <entry>allow <quote>From </quote> from these hosts</entry>
21884 </row>
21885 <row>
21886 <entry><option>ignore_fromline_local</option></entry>
21887 <entry>allow <quote>From </quote> from local SMTP</entry>
21888 </row>
21889 <row>
21890 <entry><option>pipelining_advertise_hosts</option></entry>
21891 <entry>advertise pipelining to these hosts</entry>
21892 </row>
21893 <row>
21894 <entry><option>prdr_enable</option></entry>
21895 <entry>advertise PRDR to all hosts</entry>
21896 </row>
21897 <row>
21898 <entry><option>smtputf8_advertise_hosts</option></entry>
21899 <entry>advertise SMTPUTF8 to these hosts</entry>
21900 </row>
21901 <row>
21902 <entry><option>tls_advertise_hosts</option></entry>
21903 <entry>advertise TLS to these hosts</entry>
21904 </row>
21905 </tbody>
21906 </tgroup>
21907 </informaltable>
21908 </section>
21909 <section id="SECID114">
21910 <title>Processing messages</title>
21911 <informaltable frame="none">
21912 <tgroup cols="2" colsep="0" rowsep="0">
21913 <colspec colwidth="196pt" align="left"/>
21914 <colspec colwidth="254pt" align="left"/>
21915 <tbody>
21916 <row>
21917 <entry><option>allow_domain_literals</option></entry>
21918 <entry>recognize domain literal syntax</entry>
21919 </row>
21920 <row>
21921 <entry><option>allow_mx_to_ip</option></entry>
21922 <entry>allow MX to point to IP address</entry>
21923 </row>
21924 <row>
21925 <entry><option>allow_utf8_domains</option></entry>
21926 <entry>in addresses</entry>
21927 </row>
21928 <row>
21929 <entry><option>check_rfc2047_length</option></entry>
21930 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
21931 </row>
21932 <row>
21933 <entry><option>delivery_date_remove</option></entry>
21934 <entry>from incoming messages</entry>
21935 </row>
21936 <row>
21937 <entry><option>envelope_to_remove</option></entry>
21938 <entry>from incoming messages</entry>
21939 </row>
21940 <row>
21941 <entry><option>extract_addresses_remove_arguments</option></entry>
21942 <entry>affects <option>-t</option> processing</entry>
21943 </row>
21944 <row>
21945 <entry><option>headers_charset</option></entry>
21946 <entry>default for translations</entry>
21947 </row>
21948 <row>
21949 <entry><option>qualify_domain</option></entry>
21950 <entry>default for senders</entry>
21951 </row>
21952 <row>
21953 <entry><option>qualify_recipient</option></entry>
21954 <entry>default for recipients</entry>
21955 </row>
21956 <row>
21957 <entry><option>return_path_remove</option></entry>
21958 <entry>from incoming messages</entry>
21959 </row>
21960 <row>
21961 <entry><option>strip_excess_angle_brackets</option></entry>
21962 <entry>in addresses</entry>
21963 </row>
21964 <row>
21965 <entry><option>strip_trailing_dot</option></entry>
21966 <entry>at end of addresses</entry>
21967 </row>
21968 <row>
21969 <entry><option>untrusted_set_sender</option></entry>
21970 <entry>untrusted can set envelope sender</entry>
21971 </row>
21972 </tbody>
21973 </tgroup>
21974 </informaltable>
21975 </section>
21976 <section id="SECID115">
21977 <title>System filter</title>
21978 <informaltable frame="none">
21979 <tgroup cols="2" colsep="0" rowsep="0">
21980 <colspec colwidth="196pt" align="left"/>
21981 <colspec colwidth="254pt" align="left"/>
21982 <tbody>
21983 <row>
21984 <entry><option>system_filter</option></entry>
21985 <entry>locate system filter</entry>
21986 </row>
21987 <row>
21988 <entry><option>system_filter_directory_transport</option></entry>
21989 <entry>transport for delivery to a directory</entry>
21990 </row>
21991 <row>
21992 <entry><option>system_filter_file_transport</option></entry>
21993 <entry>transport for delivery to a file</entry>
21994 </row>
21995 <row>
21996 <entry><option>system_filter_group</option></entry>
21997 <entry>group for filter running</entry>
21998 </row>
21999 <row>
22000 <entry><option>system_filter_pipe_transport</option></entry>
22001 <entry>transport for delivery to a pipe</entry>
22002 </row>
22003 <row>
22004 <entry><option>system_filter_reply_transport</option></entry>
22005 <entry>transport for autoreply delivery</entry>
22006 </row>
22007 <row>
22008 <entry><option>system_filter_user</option></entry>
22009 <entry>user for filter running</entry>
22010 </row>
22011 </tbody>
22012 </tgroup>
22013 </informaltable>
22014 </section>
22015 <section id="SECID116">
22016 <title>Routing and delivery</title>
22017 <informaltable frame="none">
22018 <tgroup cols="2" colsep="0" rowsep="0">
22019 <colspec colwidth="196pt" align="left"/>
22020 <colspec colwidth="254pt" align="left"/>
22021 <tbody>
22022 <row>
22023 <entry><option>disable_ipv6</option></entry>
22024 <entry>do no IPv6 processing</entry>
22025 </row>
22026 <row>
22027 <entry><option>dns_again_means_nonexist</option></entry>
22028 <entry>for broken domains</entry>
22029 </row>
22030 <row>
22031 <entry><option>dns_check_names_pattern</option></entry>
22032 <entry>pre-DNS syntax check</entry>
22033 </row>
22034 <row>
22035 <entry><option>dns_dnssec_ok</option></entry>
22036 <entry>parameter for resolver</entry>
22037 </row>
22038 <row>
22039 <entry><option>dns_ipv4_lookup</option></entry>
22040 <entry>only v4 lookup for these domains</entry>
22041 </row>
22042 <row>
22043 <entry><option>dns_retrans</option></entry>
22044 <entry>parameter for resolver</entry>
22045 </row>
22046 <row>
22047 <entry><option>dns_retry</option></entry>
22048 <entry>parameter for resolver</entry>
22049 </row>
22050 <row>
22051 <entry><option>dns_trust_aa</option></entry>
22052 <entry>DNS zones trusted as authentic</entry>
22053 </row>
22054 <row>
22055 <entry><option>dns_use_edns0</option></entry>
22056 <entry>parameter for resolver</entry>
22057 </row>
22058 <row>
22059 <entry><option>hold_domains</option></entry>
22060 <entry>hold delivery for these domains</entry>
22061 </row>
22062 <row>
22063 <entry><option>local_interfaces</option></entry>
22064 <entry>for routing checks</entry>
22065 </row>
22066 <row>
22067 <entry><option>queue_domains</option></entry>
22068 <entry>no immediate delivery for these</entry>
22069 </row>
22070 <row>
22071 <entry><option>queue_only</option></entry>
22072 <entry>no immediate delivery at all</entry>
22073 </row>
22074 <row>
22075 <entry><option>queue_only_file</option></entry>
22076 <entry>no immediate delivery if file exists</entry>
22077 </row>
22078 <row>
22079 <entry><option>queue_only_load</option></entry>
22080 <entry>no immediate delivery if load is high</entry>
22081 </row>
22082 <row>
22083 <entry><option>queue_only_load_latch</option></entry>
22084 <entry>don&#x2019;t re-evaluate load for each message</entry>
22085 </row>
22086 <row>
22087 <entry><option>queue_only_override</option></entry>
22088 <entry>allow command line to override</entry>
22089 </row>
22090 <row>
22091 <entry><option>queue_run_in_order</option></entry>
22092 <entry>order of arrival</entry>
22093 </row>
22094 <row>
22095 <entry><option>queue_run_max</option></entry>
22096 <entry>of simultaneous queue runners</entry>
22097 </row>
22098 <row>
22099 <entry><option>queue_smtp_domains</option></entry>
22100 <entry>no immediate SMTP delivery for these</entry>
22101 </row>
22102 <row>
22103 <entry><option>remote_max_parallel</option></entry>
22104 <entry>parallel SMTP delivery per message</entry>
22105 </row>
22106 <row>
22107 <entry><option>remote_sort_domains</option></entry>
22108 <entry>order of remote deliveries</entry>
22109 </row>
22110 <row>
22111 <entry><option>retry_data_expire</option></entry>
22112 <entry>timeout for retry data</entry>
22113 </row>
22114 <row>
22115 <entry><option>retry_interval_max</option></entry>
22116 <entry>safety net for retry rules</entry>
22117 </row>
22118 </tbody>
22119 </tgroup>
22120 </informaltable>
22121 </section>
22122 <section id="SECID117">
22123 <title>Bounce and warning messages</title>
22124 <informaltable frame="none">
22125 <tgroup cols="2" colsep="0" rowsep="0">
22126 <colspec colwidth="196pt" align="left"/>
22127 <colspec colwidth="254pt" align="left"/>
22128 <tbody>
22129 <row>
22130 <entry><option>bounce_message_file</option></entry>
22131 <entry>content of bounce</entry>
22132 </row>
22133 <row>
22134 <entry><option>bounce_message_text</option></entry>
22135 <entry>content of bounce</entry>
22136 </row>
22137 <row>
22138 <entry><option>bounce_return_body</option></entry>
22139 <entry>include body if returning message</entry>
22140 </row>
22141 <row>
22142 <entry><option>bounce_return_linesize_limit</option></entry>
22143 <entry>limit on returned message line length</entry>
22144 </row>
22145 <row>
22146 <entry><option>bounce_return_message</option></entry>
22147 <entry>include original message in bounce</entry>
22148 </row>
22149 <row>
22150 <entry><option>bounce_return_size_limit</option></entry>
22151 <entry>limit on returned message</entry>
22152 </row>
22153 <row>
22154 <entry><option>bounce_sender_authentication</option></entry>
22155 <entry>send authenticated sender with bounce</entry>
22156 </row>
22157 <row>
22158 <entry><option>dsn_from</option></entry>
22159 <entry>set <emphasis>From:</emphasis> contents in bounces</entry>
22160 </row>
22161 <row>
22162 <entry><option>errors_copy</option></entry>
22163 <entry>copy bounce messages</entry>
22164 </row>
22165 <row>
22166 <entry><option>errors_reply_to</option></entry>
22167 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
22168 </row>
22169 <row>
22170 <entry><option>delay_warning</option></entry>
22171 <entry>time schedule</entry>
22172 </row>
22173 <row>
22174 <entry><option>delay_warning_condition</option></entry>
22175 <entry>condition for warning messages</entry>
22176 </row>
22177 <row>
22178 <entry><option>ignore_bounce_errors_after</option></entry>
22179 <entry>discard undeliverable bounces</entry>
22180 </row>
22181 <row>
22182 <entry><option>smtp_return_error_details</option></entry>
22183 <entry>give detail on rejections</entry>
22184 </row>
22185 <row>
22186 <entry><option>warn_message_file</option></entry>
22187 <entry>content of warning message</entry>
22188 </row>
22189 </tbody>
22190 </tgroup>
22191 </informaltable>
22192 </section>
22193 <section id="SECTalomo">
22194 <title>Alphabetical list of main options</title>
22195 <para>
22196 Those options that undergo string expansion before use are marked with
22197 &dagger;.
22198 </para>
22199 <para>
22200 <indexterm role="option">
22201 <primary><option>accept_8bitmime</option></primary>
22202 </indexterm>
22203 </para>
22204 <informaltable frame="all">
22205 <tgroup cols="4" colsep="0" rowsep="0">
22206 <colspec colwidth="8*" align="left"/>
22207 <colspec colwidth="6*" align="center"/>
22208 <colspec colwidth="6*" align="center"/>
22209 <colspec colwidth="6*" align="right"/>
22210 <tbody>
22211 <row>
22212 <entry><option>accept_8bitmime</option></entry>
22213 <entry>Use: <emphasis>main</emphasis></entry>
22214 <entry>Type: <emphasis>boolean</emphasis></entry>
22215 <entry>Default: <emphasis>true</emphasis></entry>
22216 </row>
22217 </tbody>
22218 </tgroup>
22219 </informaltable>
22220 <para>
22221 <indexterm role="concept">
22222 <primary>8BITMIME</primary>
22223 </indexterm>
22224 <indexterm role="concept">
22225 <primary>8-bit characters</primary>
22226 </indexterm>
22227 <indexterm role="concept">
22228 <primary>log</primary>
22229 <secondary>selectors</secondary>
22230 </indexterm>
22231 <indexterm role="concept">
22232 <primary>log</primary>
22233 <secondary>8BITMIME</secondary>
22234 </indexterm>
22235 This option causes Exim to send 8BITMIME in its response to an SMTP
22236 EHLO command, and to accept the BODY= parameter on MAIL commands.
22237 However, though Exim is 8-bit clean, it is not a protocol converter, and it
22238 takes no steps to do anything special with messages received by this route.
22239 </para>
22240 <para>
22241 Historically Exim kept this option off by default, but the maintainers
22242 feel that in today&#x2019;s Internet, this causes more problems than it solves.
22243 It now defaults to true.
22244 A more detailed analysis of the issues is provided by Dan Bernstein:
22245 </para>
22246 <literallayout>
22247 <emphasis role="bold"><ulink url="http://cr.yp.to/smtp/8bitmime.html">http://cr.yp.to/smtp/8bitmime.html</ulink></emphasis>
22248 </literallayout>
22249 <para>
22250 To log received 8BITMIME status use
22251 </para>
22252 <literallayout class="monospaced">
22253 log_selector = +8bitmime
22254 </literallayout>
22255 <para>
22256 <indexterm role="option">
22257 <primary><option>acl_not_smtp</option></primary>
22258 </indexterm>
22259 </para>
22260 <informaltable frame="all">
22261 <tgroup cols="4" colsep="0" rowsep="0">
22262 <colspec colwidth="8*" align="left"/>
22263 <colspec colwidth="6*" align="center"/>
22264 <colspec colwidth="6*" align="center"/>
22265 <colspec colwidth="6*" align="right"/>
22266 <tbody>
22267 <row>
22268 <entry><option>acl_not_smtp</option></entry>
22269 <entry>Use: <emphasis>main</emphasis></entry>
22270 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22271 <entry>Default: <emphasis>unset</emphasis></entry>
22272 </row>
22273 </tbody>
22274 </tgroup>
22275 </informaltable>
22276 <para>
22277 <indexterm role="concept">
22278 <primary>access control lists (ACLs)</primary>
22279 <secondary>for non-SMTP messages</secondary>
22280 </indexterm>
22281 <indexterm role="concept">
22282 <primary>non-SMTP messages</primary>
22283 <secondary>ACLs for</secondary>
22284 </indexterm>
22285 This option defines the ACL that is run when a non-SMTP message has been
22286 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
22287 further details.
22288 </para>
22289 <para>
22290 <indexterm role="option">
22291 <primary><option>acl_not_smtp_mime</option></primary>
22292 </indexterm>
22293 </para>
22294 <informaltable frame="all">
22295 <tgroup cols="4" colsep="0" rowsep="0">
22296 <colspec colwidth="8*" align="left"/>
22297 <colspec colwidth="6*" align="center"/>
22298 <colspec colwidth="6*" align="center"/>
22299 <colspec colwidth="6*" align="right"/>
22300 <tbody>
22301 <row>
22302 <entry><option>acl_not_smtp_mime</option></entry>
22303 <entry>Use: <emphasis>main</emphasis></entry>
22304 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22305 <entry>Default: <emphasis>unset</emphasis></entry>
22306 </row>
22307 </tbody>
22308 </tgroup>
22309 </informaltable>
22310 <para>
22311 This option defines the ACL that is run for individual MIME parts of non-SMTP
22312 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
22313 SMTP messages.
22314 </para>
22315 <para>
22316 <indexterm role="option">
22317 <primary><option>acl_not_smtp_start</option></primary>
22318 </indexterm>
22319 </para>
22320 <informaltable frame="all">
22321 <tgroup cols="4" colsep="0" rowsep="0">
22322 <colspec colwidth="8*" align="left"/>
22323 <colspec colwidth="6*" align="center"/>
22324 <colspec colwidth="6*" align="center"/>
22325 <colspec colwidth="6*" align="right"/>
22326 <tbody>
22327 <row>
22328 <entry><option>acl_not_smtp_start</option></entry>
22329 <entry>Use: <emphasis>main</emphasis></entry>
22330 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22331 <entry>Default: <emphasis>unset</emphasis></entry>
22332 </row>
22333 </tbody>
22334 </tgroup>
22335 </informaltable>
22336 <para>
22337 <indexterm role="concept">
22338 <primary>access control lists (ACLs)</primary>
22339 <secondary>at start of non-SMTP message</secondary>
22340 </indexterm>
22341 <indexterm role="concept">
22342 <primary>non-SMTP messages</primary>
22343 <secondary>ACLs for</secondary>
22344 </indexterm>
22345 This option defines the ACL that is run before Exim starts reading a
22346 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
22347 </para>
22348 <para>
22349 <indexterm role="option">
22350 <primary><option>acl_smtp_auth</option></primary>
22351 </indexterm>
22352 </para>
22353 <informaltable frame="all">
22354 <tgroup cols="4" colsep="0" rowsep="0">
22355 <colspec colwidth="8*" align="left"/>
22356 <colspec colwidth="6*" align="center"/>
22357 <colspec colwidth="6*" align="center"/>
22358 <colspec colwidth="6*" align="right"/>
22359 <tbody>
22360 <row>
22361 <entry><option>acl_smtp_auth</option></entry>
22362 <entry>Use: <emphasis>main</emphasis></entry>
22363 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22364 <entry>Default: <emphasis>unset</emphasis></entry>
22365 </row>
22366 </tbody>
22367 </tgroup>
22368 </informaltable>
22369 <para>
22370 <indexterm role="concept">
22371 <primary>access control lists (ACLs)</primary>
22372 <secondary>setting up for SMTP commands</secondary>
22373 </indexterm>
22374 <indexterm role="concept">
22375 <primary>AUTH</primary>
22376 <secondary>ACL for</secondary>
22377 </indexterm>
22378 This option defines the ACL that is run when an SMTP AUTH command is
22379 received. See chapter <xref linkend="CHAPACL"/> for further details.
22380 </para>
22381 <para>
22382 <indexterm role="option">
22383 <primary><option>acl_smtp_connect</option></primary>
22384 </indexterm>
22385 </para>
22386 <informaltable frame="all">
22387 <tgroup cols="4" colsep="0" rowsep="0">
22388 <colspec colwidth="8*" align="left"/>
22389 <colspec colwidth="6*" align="center"/>
22390 <colspec colwidth="6*" align="center"/>
22391 <colspec colwidth="6*" align="right"/>
22392 <tbody>
22393 <row>
22394 <entry><option>acl_smtp_connect</option></entry>
22395 <entry>Use: <emphasis>main</emphasis></entry>
22396 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22397 <entry>Default: <emphasis>unset</emphasis></entry>
22398 </row>
22399 </tbody>
22400 </tgroup>
22401 </informaltable>
22402 <para>
22403 <indexterm role="concept">
22404 <primary>access control lists (ACLs)</primary>
22405 <secondary>on SMTP connection</secondary>
22406 </indexterm>
22407 This option defines the ACL that is run when an SMTP connection is received.
22408 See chapter <xref linkend="CHAPACL"/> for further details.
22409 </para>
22410 <para>
22411 <indexterm role="option">
22412 <primary><option>acl_smtp_data</option></primary>
22413 </indexterm>
22414 </para>
22415 <informaltable frame="all">
22416 <tgroup cols="4" colsep="0" rowsep="0">
22417 <colspec colwidth="8*" align="left"/>
22418 <colspec colwidth="6*" align="center"/>
22419 <colspec colwidth="6*" align="center"/>
22420 <colspec colwidth="6*" align="right"/>
22421 <tbody>
22422 <row>
22423 <entry><option>acl_smtp_data</option></entry>
22424 <entry>Use: <emphasis>main</emphasis></entry>
22425 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22426 <entry>Default: <emphasis>unset</emphasis></entry>
22427 </row>
22428 </tbody>
22429 </tgroup>
22430 </informaltable>
22431 <para>
22432 <indexterm role="concept">
22433 <primary>DATA</primary>
22434 <secondary>ACL for</secondary>
22435 </indexterm>
22436 This option defines the ACL that is run after an SMTP DATA command has been
22437 processed and the message itself has been received, but before the final
22438 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
22439 </para>
22440 <para>
22441 <indexterm role="option">
22442 <primary><option>acl_smtp_data_prdr</option></primary>
22443 </indexterm>
22444 </para>
22445 <informaltable frame="all">
22446 <tgroup cols="4" colsep="0" rowsep="0">
22447 <colspec colwidth="8*" align="left"/>
22448 <colspec colwidth="6*" align="center"/>
22449 <colspec colwidth="6*" align="center"/>
22450 <colspec colwidth="6*" align="right"/>
22451 <tbody>
22452 <row>
22453 <entry><option>acl_smtp_data_prdr</option></entry>
22454 <entry>Use: <emphasis>main</emphasis></entry>
22455 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22456 <entry>Default: <emphasis>accept</emphasis></entry>
22457 </row>
22458 </tbody>
22459 </tgroup>
22460 </informaltable>
22461 <para>
22462 <indexterm role="concept">
22463 <primary>PRDR</primary>
22464 <secondary>ACL for</secondary>
22465 </indexterm>
22466 <indexterm role="concept">
22467 <primary>DATA</primary>
22468 <secondary>PRDR ACL for</secondary>
22469 </indexterm>
22470 <indexterm role="concept">
22471 <primary>access control lists (ACLs)</primary>
22472 <secondary>PRDR-related</secondary>
22473 </indexterm>
22474 <indexterm role="concept">
22475 <primary>access control lists (ACLs)</primary>
22476 <secondary>per-user data processing</secondary>
22477 </indexterm>
22478 This option defines the ACL that,
22479 if the PRDR feature has been negotiated,
22480 is run for each recipient after an SMTP DATA command has been
22481 processed and the message itself has been received, but before the
22482 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
22483 </para>
22484 <para>
22485 <indexterm role="option">
22486 <primary><option>acl_smtp_dkim</option></primary>
22487 </indexterm>
22488 </para>
22489 <informaltable frame="all">
22490 <tgroup cols="4" colsep="0" rowsep="0">
22491 <colspec colwidth="8*" align="left"/>
22492 <colspec colwidth="6*" align="center"/>
22493 <colspec colwidth="6*" align="center"/>
22494 <colspec colwidth="6*" align="right"/>
22495 <tbody>
22496 <row>
22497 <entry><option>acl_smtp_dkim</option></entry>
22498 <entry>Use: <emphasis>main</emphasis></entry>
22499 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22500 <entry>Default: <emphasis>unset</emphasis></entry>
22501 </row>
22502 </tbody>
22503 </tgroup>
22504 </informaltable>
22505 <para>
22506 <indexterm role="concept">
22507 <primary>DKIM</primary>
22508 <secondary>ACL for</secondary>
22509 </indexterm>
22510 This option defines the ACL that is run for each DKIM signature
22511 of a received message.
22512 See chapter <xref linkend="CHAPdkim"/> for further details.
22513 </para>
22514 <para>
22515 <indexterm role="option">
22516 <primary><option>acl_smtp_etrn</option></primary>
22517 </indexterm>
22518 </para>
22519 <informaltable frame="all">
22520 <tgroup cols="4" colsep="0" rowsep="0">
22521 <colspec colwidth="8*" align="left"/>
22522 <colspec colwidth="6*" align="center"/>
22523 <colspec colwidth="6*" align="center"/>
22524 <colspec colwidth="6*" align="right"/>
22525 <tbody>
22526 <row>
22527 <entry><option>acl_smtp_etrn</option></entry>
22528 <entry>Use: <emphasis>main</emphasis></entry>
22529 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22530 <entry>Default: <emphasis>unset</emphasis></entry>
22531 </row>
22532 </tbody>
22533 </tgroup>
22534 </informaltable>
22535 <para>
22536 <indexterm role="concept">
22537 <primary>ETRN</primary>
22538 <secondary>ACL for</secondary>
22539 </indexterm>
22540 This option defines the ACL that is run when an SMTP ETRN command is
22541 received. See chapter <xref linkend="CHAPACL"/> for further details.
22542 </para>
22543 <para>
22544 <indexterm role="option">
22545 <primary><option>acl_smtp_expn</option></primary>
22546 </indexterm>
22547 </para>
22548 <informaltable frame="all">
22549 <tgroup cols="4" colsep="0" rowsep="0">
22550 <colspec colwidth="8*" align="left"/>
22551 <colspec colwidth="6*" align="center"/>
22552 <colspec colwidth="6*" align="center"/>
22553 <colspec colwidth="6*" align="right"/>
22554 <tbody>
22555 <row>
22556 <entry><option>acl_smtp_expn</option></entry>
22557 <entry>Use: <emphasis>main</emphasis></entry>
22558 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22559 <entry>Default: <emphasis>unset</emphasis></entry>
22560 </row>
22561 </tbody>
22562 </tgroup>
22563 </informaltable>
22564 <para>
22565 <indexterm role="concept">
22566 <primary>EXPN</primary>
22567 <secondary>ACL for</secondary>
22568 </indexterm>
22569 This option defines the ACL that is run when an SMTP EXPN command is
22570 received. See chapter <xref linkend="CHAPACL"/> for further details.
22571 </para>
22572 <para>
22573 <indexterm role="option">
22574 <primary><option>acl_smtp_helo</option></primary>
22575 </indexterm>
22576 </para>
22577 <informaltable frame="all">
22578 <tgroup cols="4" colsep="0" rowsep="0">
22579 <colspec colwidth="8*" align="left"/>
22580 <colspec colwidth="6*" align="center"/>
22581 <colspec colwidth="6*" align="center"/>
22582 <colspec colwidth="6*" align="right"/>
22583 <tbody>
22584 <row>
22585 <entry><option>acl_smtp_helo</option></entry>
22586 <entry>Use: <emphasis>main</emphasis></entry>
22587 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22588 <entry>Default: <emphasis>unset</emphasis></entry>
22589 </row>
22590 </tbody>
22591 </tgroup>
22592 </informaltable>
22593 <para>
22594 <indexterm role="concept">
22595 <primary>EHLO</primary>
22596 <secondary>ACL for</secondary>
22597 </indexterm>
22598 <indexterm role="concept">
22599 <primary>HELO</primary>
22600 <secondary>ACL for</secondary>
22601 </indexterm>
22602 This option defines the ACL that is run when an SMTP EHLO or HELO
22603 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
22604 </para>
22605 <para>
22606 <indexterm role="option">
22607 <primary><option>acl_smtp_mail</option></primary>
22608 </indexterm>
22609 </para>
22610 <informaltable frame="all">
22611 <tgroup cols="4" colsep="0" rowsep="0">
22612 <colspec colwidth="8*" align="left"/>
22613 <colspec colwidth="6*" align="center"/>
22614 <colspec colwidth="6*" align="center"/>
22615 <colspec colwidth="6*" align="right"/>
22616 <tbody>
22617 <row>
22618 <entry><option>acl_smtp_mail</option></entry>
22619 <entry>Use: <emphasis>main</emphasis></entry>
22620 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22621 <entry>Default: <emphasis>unset</emphasis></entry>
22622 </row>
22623 </tbody>
22624 </tgroup>
22625 </informaltable>
22626 <para>
22627 <indexterm role="concept">
22628 <primary>MAIL</primary>
22629 <secondary>ACL for</secondary>
22630 </indexterm>
22631 This option defines the ACL that is run when an SMTP MAIL command is
22632 received. See chapter <xref linkend="CHAPACL"/> for further details.
22633 </para>
22634 <para>
22635 <indexterm role="option">
22636 <primary><option>acl_smtp_mailauth</option></primary>
22637 </indexterm>
22638 </para>
22639 <informaltable frame="all">
22640 <tgroup cols="4" colsep="0" rowsep="0">
22641 <colspec colwidth="8*" align="left"/>
22642 <colspec colwidth="6*" align="center"/>
22643 <colspec colwidth="6*" align="center"/>
22644 <colspec colwidth="6*" align="right"/>
22645 <tbody>
22646 <row>
22647 <entry><option>acl_smtp_mailauth</option></entry>
22648 <entry>Use: <emphasis>main</emphasis></entry>
22649 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22650 <entry>Default: <emphasis>unset</emphasis></entry>
22651 </row>
22652 </tbody>
22653 </tgroup>
22654 </informaltable>
22655 <para>
22656 <indexterm role="concept">
22657 <primary>AUTH</primary>
22658 <secondary>on MAIL command</secondary>
22659 </indexterm>
22660 This option defines the ACL that is run when there is an AUTH parameter on
22661 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
22662 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
22663 </para>
22664 <para>
22665 <indexterm role="option">
22666 <primary><option>acl_smtp_mime</option></primary>
22667 </indexterm>
22668 </para>
22669 <informaltable frame="all">
22670 <tgroup cols="4" colsep="0" rowsep="0">
22671 <colspec colwidth="8*" align="left"/>
22672 <colspec colwidth="6*" align="center"/>
22673 <colspec colwidth="6*" align="center"/>
22674 <colspec colwidth="6*" align="right"/>
22675 <tbody>
22676 <row>
22677 <entry><option>acl_smtp_mime</option></entry>
22678 <entry>Use: <emphasis>main</emphasis></entry>
22679 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22680 <entry>Default: <emphasis>unset</emphasis></entry>
22681 </row>
22682 </tbody>
22683 </tgroup>
22684 </informaltable>
22685 <para>
22686 <indexterm role="concept">
22687 <primary>MIME content scanning</primary>
22688 <secondary>ACL for</secondary>
22689 </indexterm>
22690 This option is available when Exim is built with the content-scanning
22691 extension. It defines the ACL that is run for each MIME part in a message. See
22692 section <xref linkend="SECTscanmimepart"/> for details.
22693 </para>
22694 <para>
22695 <indexterm role="option">
22696 <primary><option>acl_smtp_notquit</option></primary>
22697 </indexterm>
22698 </para>
22699 <informaltable frame="all">
22700 <tgroup cols="4" colsep="0" rowsep="0">
22701 <colspec colwidth="8*" align="left"/>
22702 <colspec colwidth="6*" align="center"/>
22703 <colspec colwidth="6*" align="center"/>
22704 <colspec colwidth="6*" align="right"/>
22705 <tbody>
22706 <row>
22707 <entry><option>acl_smtp_notquit</option></entry>
22708 <entry>Use: <emphasis>main</emphasis></entry>
22709 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22710 <entry>Default: <emphasis>unset</emphasis></entry>
22711 </row>
22712 </tbody>
22713 </tgroup>
22714 </informaltable>
22715 <para>
22716 <indexterm role="concept">
22717 <primary>not-QUIT, ACL for</primary>
22718 </indexterm>
22719 This option defines the ACL that is run when an SMTP session
22720 ends without a QUIT command being received.
22721 See chapter <xref linkend="CHAPACL"/> for further details.
22722 </para>
22723 <para>
22724 <indexterm role="option">
22725 <primary><option>acl_smtp_predata</option></primary>
22726 </indexterm>
22727 </para>
22728 <informaltable frame="all">
22729 <tgroup cols="4" colsep="0" rowsep="0">
22730 <colspec colwidth="8*" align="left"/>
22731 <colspec colwidth="6*" align="center"/>
22732 <colspec colwidth="6*" align="center"/>
22733 <colspec colwidth="6*" align="right"/>
22734 <tbody>
22735 <row>
22736 <entry><option>acl_smtp_predata</option></entry>
22737 <entry>Use: <emphasis>main</emphasis></entry>
22738 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22739 <entry>Default: <emphasis>unset</emphasis></entry>
22740 </row>
22741 </tbody>
22742 </tgroup>
22743 </informaltable>
22744 <para>
22745 This option defines the ACL that is run when an SMTP DATA command is
22746 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
22747 further details.
22748 </para>
22749 <para>
22750 <indexterm role="option">
22751 <primary><option>acl_smtp_quit</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_quit</option></entry>
22763 <entry>Use: <emphasis>main</emphasis></entry>
22764 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22765 <entry>Default: <emphasis>unset</emphasis></entry>
22766 </row>
22767 </tbody>
22768 </tgroup>
22769 </informaltable>
22770 <para>
22771 <indexterm role="concept">
22772 <primary>QUIT, ACL for</primary>
22773 </indexterm>
22774 This option defines the ACL that is run when an SMTP QUIT command is
22775 received. See chapter <xref linkend="CHAPACL"/> for further details.
22776 </para>
22777 <para>
22778 <indexterm role="option">
22779 <primary><option>acl_smtp_rcpt</option></primary>
22780 </indexterm>
22781 </para>
22782 <informaltable frame="all">
22783 <tgroup cols="4" colsep="0" rowsep="0">
22784 <colspec colwidth="8*" align="left"/>
22785 <colspec colwidth="6*" align="center"/>
22786 <colspec colwidth="6*" align="center"/>
22787 <colspec colwidth="6*" align="right"/>
22788 <tbody>
22789 <row>
22790 <entry><option>acl_smtp_rcpt</option></entry>
22791 <entry>Use: <emphasis>main</emphasis></entry>
22792 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22793 <entry>Default: <emphasis>unset</emphasis></entry>
22794 </row>
22795 </tbody>
22796 </tgroup>
22797 </informaltable>
22798 <para>
22799 <indexterm role="concept">
22800 <primary>RCPT</primary>
22801 <secondary>ACL for</secondary>
22802 </indexterm>
22803 This option defines the ACL that is run when an SMTP RCPT command is
22804 received. See chapter <xref linkend="CHAPACL"/> for further details.
22805 </para>
22806 <para>
22807 <indexterm role="option">
22808 <primary><option>acl_smtp_starttls</option></primary>
22809 </indexterm>
22810 </para>
22811 <informaltable frame="all">
22812 <tgroup cols="4" colsep="0" rowsep="0">
22813 <colspec colwidth="8*" align="left"/>
22814 <colspec colwidth="6*" align="center"/>
22815 <colspec colwidth="6*" align="center"/>
22816 <colspec colwidth="6*" align="right"/>
22817 <tbody>
22818 <row>
22819 <entry><option>acl_smtp_starttls</option></entry>
22820 <entry>Use: <emphasis>main</emphasis></entry>
22821 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22822 <entry>Default: <emphasis>unset</emphasis></entry>
22823 </row>
22824 </tbody>
22825 </tgroup>
22826 </informaltable>
22827 <para>
22828 <indexterm role="concept">
22829 <primary>STARTTLS, ACL for</primary>
22830 </indexterm>
22831 This option defines the ACL that is run when an SMTP STARTTLS command is
22832 received. See chapter <xref linkend="CHAPACL"/> for further details.
22833 </para>
22834 <para>
22835 <indexterm role="option">
22836 <primary><option>acl_smtp_vrfy</option></primary>
22837 </indexterm>
22838 </para>
22839 <informaltable frame="all">
22840 <tgroup cols="4" colsep="0" rowsep="0">
22841 <colspec colwidth="8*" align="left"/>
22842 <colspec colwidth="6*" align="center"/>
22843 <colspec colwidth="6*" align="center"/>
22844 <colspec colwidth="6*" align="right"/>
22845 <tbody>
22846 <row>
22847 <entry><option>acl_smtp_vrfy</option></entry>
22848 <entry>Use: <emphasis>main</emphasis></entry>
22849 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22850 <entry>Default: <emphasis>unset</emphasis></entry>
22851 </row>
22852 </tbody>
22853 </tgroup>
22854 </informaltable>
22855 <para>
22856 <indexterm role="concept">
22857 <primary>VRFY</primary>
22858 <secondary>ACL for</secondary>
22859 </indexterm>
22860 This option defines the ACL that is run when an SMTP VRFY command is
22861 received. See chapter <xref linkend="CHAPACL"/> for further details.
22862 </para>
22863 <para revisionflag="changed">
22864 <indexterm role="option">
22865 <primary><option>add_environment</option></primary>
22866 </indexterm>
22867 </para>
22868 <informaltable frame="all" revisionflag="changed">
22869 <tgroup cols="4" colsep="0" rowsep="0">
22870 <colspec colwidth="8*" align="left"/>
22871 <colspec colwidth="6*" align="center"/>
22872 <colspec colwidth="6*" align="center"/>
22873 <colspec colwidth="6*" align="right"/>
22874 <tbody>
22875 <row>
22876 <entry><option>add_environment</option></entry>
22877 <entry>Use: <emphasis>main</emphasis></entry>
22878 <entry>Type: <emphasis>string list</emphasis></entry>
22879 <entry>Default: <emphasis>empty</emphasis></entry>
22880 </row>
22881 </tbody>
22882 </tgroup>
22883 </informaltable>
22884 <para revisionflag="changed">
22885 <indexterm role="concept">
22886 <primary>environment</primary>
22887 <secondary>set values</secondary>
22888 </indexterm>
22889 This option allows to set individual environment variables that the
22890 currently linked libraries and programs in child processes use.
22891 See <xref linkend="SECTpipeenv"/> for the environment of <command>pipe</command> transports.
22892 </para>
22893 <para>
22894 <indexterm role="option">
22895 <primary><option>admin_groups</option></primary>
22896 </indexterm>
22897 </para>
22898 <informaltable frame="all">
22899 <tgroup cols="4" colsep="0" rowsep="0">
22900 <colspec colwidth="8*" align="left"/>
22901 <colspec colwidth="6*" align="center"/>
22902 <colspec colwidth="6*" align="center"/>
22903 <colspec colwidth="6*" align="right"/>
22904 <tbody>
22905 <row>
22906 <entry><option>admin_groups</option></entry>
22907 <entry>Use: <emphasis>main</emphasis></entry>
22908 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
22909 <entry>Default: <emphasis>unset</emphasis></entry>
22910 </row>
22911 </tbody>
22912 </tgroup>
22913 </informaltable>
22914 <para>
22915 <indexterm role="concept">
22916 <primary>admin user</primary>
22917 </indexterm>
22918 This option is expanded just once, at the start of Exim&#x2019;s processing. If the
22919 current group or any of the supplementary groups of an Exim caller is in this
22920 colon-separated list, the caller has admin privileges. If all your system
22921 programmers are in a specific group, for example, you can give them all Exim
22922 admin privileges by putting that group in <option>admin_groups</option>. However, this does
22923 not permit them to read Exim&#x2019;s spool files (whose group owner is the Exim gid).
22924 To permit this, you have to add individuals to the Exim group.
22925 </para>
22926 <para>
22927 <indexterm role="option">
22928 <primary><option>allow_domain_literals</option></primary>
22929 </indexterm>
22930 </para>
22931 <informaltable frame="all">
22932 <tgroup cols="4" colsep="0" rowsep="0">
22933 <colspec colwidth="8*" align="left"/>
22934 <colspec colwidth="6*" align="center"/>
22935 <colspec colwidth="6*" align="center"/>
22936 <colspec colwidth="6*" align="right"/>
22937 <tbody>
22938 <row>
22939 <entry><option>allow_domain_literals</option></entry>
22940 <entry>Use: <emphasis>main</emphasis></entry>
22941 <entry>Type: <emphasis>boolean</emphasis></entry>
22942 <entry>Default: <emphasis>false</emphasis></entry>
22943 </row>
22944 </tbody>
22945 </tgroup>
22946 </informaltable>
22947 <para>
22948 <indexterm role="concept">
22949 <primary>domain literal</primary>
22950 </indexterm>
22951 If this option is set, the RFC 2822 domain literal format is permitted in
22952 email addresses. The option is not set by default, because the domain literal
22953 format is not normally required these days, and few people know about it. It
22954 has, however, been exploited by mail abusers.
22955 </para>
22956 <para>
22957 Unfortunately, it seems that some DNS black list maintainers are using this
22958 format to report black listing to postmasters. If you want to accept messages
22959 addressed to your hosts by IP address, you need to set
22960 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
22961 domains (defined in the named domain list <option>local_domains</option> in the default
22962 configuration). This <quote>magic string</quote> matches the domain literal form of all
22963 the local host&#x2019;s IP addresses.
22964 </para>
22965 <para>
22966 <indexterm role="option">
22967 <primary><option>allow_mx_to_ip</option></primary>
22968 </indexterm>
22969 </para>
22970 <informaltable frame="all">
22971 <tgroup cols="4" colsep="0" rowsep="0">
22972 <colspec colwidth="8*" align="left"/>
22973 <colspec colwidth="6*" align="center"/>
22974 <colspec colwidth="6*" align="center"/>
22975 <colspec colwidth="6*" align="right"/>
22976 <tbody>
22977 <row>
22978 <entry><option>allow_mx_to_ip</option></entry>
22979 <entry>Use: <emphasis>main</emphasis></entry>
22980 <entry>Type: <emphasis>boolean</emphasis></entry>
22981 <entry>Default: <emphasis>false</emphasis></entry>
22982 </row>
22983 </tbody>
22984 </tgroup>
22985 </informaltable>
22986 <para>
22987 <indexterm role="concept">
22988 <primary>MX record</primary>
22989 <secondary>pointing to IP address</secondary>
22990 </indexterm>
22991 It appears that more and more DNS zone administrators are breaking the rules
22992 and putting domain names that look like IP addresses on the right hand side of
22993 MX records. Exim follows the rules and rejects this, giving an error message
22994 that explains the misconfiguration. However, some other MTAs support this
22995 practice, so to avoid <quote>Why can&#x2019;t Exim do this?</quote> complaints,
22996 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
22997 recommended, except when you have no other choice.
22998 </para>
22999 <para>
23000 <indexterm role="option">
23001 <primary><option>allow_utf8_domains</option></primary>
23002 </indexterm>
23003 </para>
23004 <informaltable frame="all">
23005 <tgroup cols="4" colsep="0" rowsep="0">
23006 <colspec colwidth="8*" align="left"/>
23007 <colspec colwidth="6*" align="center"/>
23008 <colspec colwidth="6*" align="center"/>
23009 <colspec colwidth="6*" align="right"/>
23010 <tbody>
23011 <row>
23012 <entry><option>allow_utf8_domains</option></entry>
23013 <entry>Use: <emphasis>main</emphasis></entry>
23014 <entry>Type: <emphasis>boolean</emphasis></entry>
23015 <entry>Default: <emphasis>false</emphasis></entry>
23016 </row>
23017 </tbody>
23018 </tgroup>
23019 </informaltable>
23020 <para>
23021 <indexterm role="concept">
23022 <primary>domain</primary>
23023 <secondary>UTF-8 characters in</secondary>
23024 </indexterm>
23025 <indexterm role="concept">
23026 <primary>UTF-8</primary>
23027 <secondary>in domain name</secondary>
23028 </indexterm>
23029 Lots of discussion is going on about internationalized domain names. One
23030 camp is strongly in favour of just using UTF-8 characters, and it seems
23031 that at least two other MTAs permit this. This option allows Exim users to
23032 experiment if they wish.
23033 </para>
23034 <para>
23035 If it is set true, Exim&#x2019;s domain parsing function allows valid
23036 UTF-8 multicharacters to appear in domain name components, in addition to
23037 letters, digits, and hyphens. However, just setting this option is not
23038 enough; if you want to look up these domain names in the DNS, you must also
23039 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
23040 suitable setting is:
23041 </para>
23042 <literallayout class="monospaced">
23043 dns_check_names_pattern = (?i)^(?&gt;(?(1)\.|())[a-z0-9\xc0-\xff]\
23044   (?&gt;[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
23045 </literallayout>
23046 <para>
23047 Alternatively, you can just disable this feature by setting
23048 </para>
23049 <literallayout class="monospaced">
23050 dns_check_names_pattern =
23051 </literallayout>
23052 <para>
23053 That is, set the option to an empty string so that no check is done.
23054 </para>
23055 <para>
23056 <indexterm role="option">
23057 <primary><option>auth_advertise_hosts</option></primary>
23058 </indexterm>
23059 </para>
23060 <informaltable frame="all">
23061 <tgroup cols="4" colsep="0" rowsep="0">
23062 <colspec colwidth="8*" align="left"/>
23063 <colspec colwidth="6*" align="center"/>
23064 <colspec colwidth="6*" align="center"/>
23065 <colspec colwidth="6*" align="right"/>
23066 <tbody>
23067 <row>
23068 <entry><option>auth_advertise_hosts</option></entry>
23069 <entry>Use: <emphasis>main</emphasis></entry>
23070 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23071 <entry>Default: <emphasis>*</emphasis></entry>
23072 </row>
23073 </tbody>
23074 </tgroup>
23075 </informaltable>
23076 <para>
23077 <indexterm role="concept">
23078 <primary>authentication</primary>
23079 <secondary>advertising</secondary>
23080 </indexterm>
23081 <indexterm role="concept">
23082 <primary>AUTH</primary>
23083 <secondary>advertising</secondary>
23084 </indexterm>
23085 If any server authentication mechanisms are configured, Exim advertises them in
23086 response to an EHLO command only if the calling host matches this list.
23087 Otherwise, Exim does not advertise AUTH.
23088 Exim does not accept AUTH commands from clients to which it has not
23089 advertised the availability of AUTH. The advertising of individual
23090 authentication mechanisms can be controlled by the use of the
23091 <option>server_advertise_condition</option> generic authenticator option on the individual
23092 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
23093 </para>
23094 <para>
23095 Certain mail clients (for example, Netscape) require the user to provide a name
23096 and password for authentication if AUTH is advertised, even though it may
23097 not be needed (the host may accept messages from hosts on its local LAN without
23098 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
23099 to make these clients more friendly by excluding them from the set of hosts to
23100 which Exim advertises AUTH.
23101 </para>
23102 <para>
23103 <indexterm role="concept">
23104 <primary>AUTH</primary>
23105 <secondary>advertising when encrypted</secondary>
23106 </indexterm>
23107 If you want to advertise the availability of AUTH only when the connection
23108 is encrypted using TLS, you can make use of the fact that the value of this
23109 option is expanded, with a setting like this:
23110 </para>
23111 <literallayout class="monospaced">
23112 auth_advertise_hosts = ${if eq{$tls_in_cipher}{}{}{*}}
23113 </literallayout>
23114 <para>
23115 <indexterm role="variable">
23116 <primary><varname>$tls_in_cipher</varname></primary>
23117 </indexterm>
23118 If <varname>$tls_in_cipher</varname> is empty, the session is not encrypted, and the result of
23119 the expansion is empty, thus matching no hosts. Otherwise, the result of the
23120 expansion is *, which matches all hosts.
23121 </para>
23122 <para>
23123 <indexterm role="option">
23124 <primary><option>auto_thaw</option></primary>
23125 </indexterm>
23126 </para>
23127 <informaltable frame="all">
23128 <tgroup cols="4" colsep="0" rowsep="0">
23129 <colspec colwidth="8*" align="left"/>
23130 <colspec colwidth="6*" align="center"/>
23131 <colspec colwidth="6*" align="center"/>
23132 <colspec colwidth="6*" align="right"/>
23133 <tbody>
23134 <row>
23135 <entry><option>auto_thaw</option></entry>
23136 <entry>Use: <emphasis>main</emphasis></entry>
23137 <entry>Type: <emphasis>time</emphasis></entry>
23138 <entry>Default: <emphasis>0s</emphasis></entry>
23139 </row>
23140 </tbody>
23141 </tgroup>
23142 </informaltable>
23143 <para>
23144 <indexterm role="concept">
23145 <primary>thawing messages</primary>
23146 </indexterm>
23147 <indexterm role="concept">
23148 <primary>unfreezing messages</primary>
23149 </indexterm>
23150 If this option is set to a time greater than zero, a queue runner will try a
23151 new delivery attempt on any frozen message, other than a bounce message, if
23152 this much time has passed since it was frozen. This may result in the message
23153 being re-frozen if nothing has changed since the last attempt. It is a way of
23154 saying <quote>keep on trying, even though there are big problems</quote>.
23155 </para>
23156 <para>
23157 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
23158 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
23159 thought to be very useful any more, and its use should probably be avoided.
23160 </para>
23161 <para>
23162 <indexterm role="option">
23163 <primary><option>av_scanner</option></primary>
23164 </indexterm>
23165 </para>
23166 <informaltable frame="all">
23167 <tgroup cols="4" colsep="0" rowsep="0">
23168 <colspec colwidth="8*" align="left"/>
23169 <colspec colwidth="6*" align="center"/>
23170 <colspec colwidth="6*" align="center"/>
23171 <colspec colwidth="6*" align="right"/>
23172 <tbody>
23173 <row>
23174 <entry><option>av_scanner</option></entry>
23175 <entry>Use: <emphasis>main</emphasis></entry>
23176 <entry>Type: <emphasis>string</emphasis></entry>
23177 <entry>Default: <emphasis>see below</emphasis></entry>
23178 </row>
23179 </tbody>
23180 </tgroup>
23181 </informaltable>
23182 <para>
23183 This option is available if Exim is built with the content-scanning extension.
23184 It specifies which anti-virus scanner to use. The default value is:
23185 </para>
23186 <literallayout class="monospaced">
23187 sophie:/var/run/sophie
23188 </literallayout>
23189 <para>
23190 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
23191 before use. See section <xref linkend="SECTscanvirus"/> for further details.
23192 </para>
23193 <para>
23194 <indexterm role="option">
23195 <primary><option>bi_command</option></primary>
23196 </indexterm>
23197 </para>
23198 <informaltable frame="all">
23199 <tgroup cols="4" colsep="0" rowsep="0">
23200 <colspec colwidth="8*" align="left"/>
23201 <colspec colwidth="6*" align="center"/>
23202 <colspec colwidth="6*" align="center"/>
23203 <colspec colwidth="6*" align="right"/>
23204 <tbody>
23205 <row>
23206 <entry><option>bi_command</option></entry>
23207 <entry>Use: <emphasis>main</emphasis></entry>
23208 <entry>Type: <emphasis>string</emphasis></entry>
23209 <entry>Default: <emphasis>unset</emphasis></entry>
23210 </row>
23211 </tbody>
23212 </tgroup>
23213 </informaltable>
23214 <para>
23215 <indexterm role="option">
23216 <primary><option>-bi</option></primary>
23217 </indexterm>
23218 This option supplies the name of a command that is run when Exim is called with
23219 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
23220 just the command name, it is not a complete command line. If an argument is
23221 required, it must come from the <option>-oA</option> command line option.
23222 </para>
23223 <para>
23224 <indexterm role="option">
23225 <primary><option>bounce_message_file</option></primary>
23226 </indexterm>
23227 </para>
23228 <informaltable frame="all">
23229 <tgroup cols="4" colsep="0" rowsep="0">
23230 <colspec colwidth="8*" align="left"/>
23231 <colspec colwidth="6*" align="center"/>
23232 <colspec colwidth="6*" align="center"/>
23233 <colspec colwidth="6*" align="right"/>
23234 <tbody>
23235 <row>
23236 <entry><option>bounce_message_file</option></entry>
23237 <entry>Use: <emphasis>main</emphasis></entry>
23238 <entry>Type: <emphasis>string</emphasis></entry>
23239 <entry>Default: <emphasis>unset</emphasis></entry>
23240 </row>
23241 </tbody>
23242 </tgroup>
23243 </informaltable>
23244 <para>
23245 <indexterm role="concept">
23246 <primary>bounce message</primary>
23247 <secondary>customizing</secondary>
23248 </indexterm>
23249 <indexterm role="concept">
23250 <primary>customizing</primary>
23251 <secondary>bounce message</secondary>
23252 </indexterm>
23253 This option defines a template file containing paragraphs of text to be used
23254 for constructing bounce messages.  Details of the file&#x2019;s contents are given in
23255 chapter <xref linkend="CHAPemsgcust"/>. See also <option>warn_message_file</option>.
23256 </para>
23257 <para>
23258 <indexterm role="option">
23259 <primary><option>bounce_message_text</option></primary>
23260 </indexterm>
23261 </para>
23262 <informaltable frame="all">
23263 <tgroup cols="4" colsep="0" rowsep="0">
23264 <colspec colwidth="8*" align="left"/>
23265 <colspec colwidth="6*" align="center"/>
23266 <colspec colwidth="6*" align="center"/>
23267 <colspec colwidth="6*" align="right"/>
23268 <tbody>
23269 <row>
23270 <entry><option>bounce_message_text</option></entry>
23271 <entry>Use: <emphasis>main</emphasis></entry>
23272 <entry>Type: <emphasis>string</emphasis></entry>
23273 <entry>Default: <emphasis>unset</emphasis></entry>
23274 </row>
23275 </tbody>
23276 </tgroup>
23277 </informaltable>
23278 <para>
23279 When this option is set, its contents are included in the default bounce
23280 message immediately after <quote>This message was created automatically by mail
23281 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
23282 </para>
23283 <para>
23284 <indexterm role="option">
23285 <primary><option>bounce_return_body</option></primary>
23286 </indexterm>
23287 </para>
23288 <informaltable frame="all">
23289 <tgroup cols="4" colsep="0" rowsep="0">
23290 <colspec colwidth="8*" align="left"/>
23291 <colspec colwidth="6*" align="center"/>
23292 <colspec colwidth="6*" align="center"/>
23293 <colspec colwidth="6*" align="right"/>
23294 <tbody>
23295 <row>
23296 <entry><option>bounce_return_body</option></entry>
23297 <entry>Use: <emphasis>main</emphasis></entry>
23298 <entry>Type: <emphasis>boolean</emphasis></entry>
23299 <entry>Default: <emphasis>true</emphasis></entry>
23300 </row>
23301 </tbody>
23302 </tgroup>
23303 </informaltable>
23304 <para>
23305 <indexterm role="concept">
23306 <primary>bounce message</primary>
23307 <secondary>including body</secondary>
23308 </indexterm>
23309 This option controls whether the body of an incoming message is included in a
23310 bounce message when <option>bounce_return_message</option> is true. The default setting
23311 causes the entire message, both header and body, to be returned (subject to the
23312 value of <option>bounce_return_size_limit</option>). If this option is false, only the
23313 message header is included. In the case of a non-SMTP message containing an
23314 error that is detected during reception, only those header lines preceding the
23315 point at which the error was detected are returned.
23316 <indexterm role="concept">
23317 <primary>bounce message</primary>
23318 <secondary>including original</secondary>
23319 </indexterm>
23320 </para>
23321 <para>
23322 <indexterm role="option">
23323 <primary><option>bounce_return_linesize_limit</option></primary>
23324 </indexterm>
23325 </para>
23326 <informaltable frame="all">
23327 <tgroup cols="4" colsep="0" rowsep="0">
23328 <colspec colwidth="8*" align="left"/>
23329 <colspec colwidth="6*" align="center"/>
23330 <colspec colwidth="6*" align="center"/>
23331 <colspec colwidth="6*" align="right"/>
23332 <tbody>
23333 <row>
23334 <entry><option>bounce_return_linesize_limit</option></entry>
23335 <entry>Use: <emphasis>main</emphasis></entry>
23336 <entry>Type: <emphasis>integer</emphasis></entry>
23337 <entry>Default: <emphasis>998</emphasis></entry>
23338 </row>
23339 </tbody>
23340 </tgroup>
23341 </informaltable>
23342 <para>
23343 <indexterm role="concept">
23344 <primary>size</primary>
23345 <secondary>of bounce lines, limit</secondary>
23346 </indexterm>
23347 <indexterm role="concept">
23348 <primary>bounce message</primary>
23349 <secondary>line length limit</secondary>
23350 </indexterm>
23351 <indexterm role="concept">
23352 <primary>limit</primary>
23353 <secondary>bounce message line length</secondary>
23354 </indexterm>
23355 This option sets a limit in bytes on the line length of messages
23356 that are returned to senders due to delivery problems,
23357 when <option>bounce_return_message</option> is true.
23358 The default value corresponds to RFC limits.
23359 If the message being returned has lines longer than this value it is
23360 treated as if the <option>bounce_return_size_limit</option> (below) restriction was exceeded.
23361 </para>
23362 <para>
23363 The option also applies to bounces returned when an error is detected
23364 during reception of a message.
23365 In this case lines from the original are truncated.
23366 </para>
23367 <para>
23368 The option does not apply to messages generated by an <command>autoreply</command> transport.
23369 </para>
23370 <para>
23371 <indexterm role="option">
23372 <primary><option>bounce_return_message</option></primary>
23373 </indexterm>
23374 </para>
23375 <informaltable frame="all">
23376 <tgroup cols="4" colsep="0" rowsep="0">
23377 <colspec colwidth="8*" align="left"/>
23378 <colspec colwidth="6*" align="center"/>
23379 <colspec colwidth="6*" align="center"/>
23380 <colspec colwidth="6*" align="right"/>
23381 <tbody>
23382 <row>
23383 <entry><option>bounce_return_message</option></entry>
23384 <entry>Use: <emphasis>main</emphasis></entry>
23385 <entry>Type: <emphasis>boolean</emphasis></entry>
23386 <entry>Default: <emphasis>true</emphasis></entry>
23387 </row>
23388 </tbody>
23389 </tgroup>
23390 </informaltable>
23391 <para>
23392 If this option is set false, none of the original message is included in
23393 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
23394 <option>bounce_return_body</option>.
23395 </para>
23396 <para>
23397 <indexterm role="option">
23398 <primary><option>bounce_return_size_limit</option></primary>
23399 </indexterm>
23400 </para>
23401 <informaltable frame="all">
23402 <tgroup cols="4" colsep="0" rowsep="0">
23403 <colspec colwidth="8*" align="left"/>
23404 <colspec colwidth="6*" align="center"/>
23405 <colspec colwidth="6*" align="center"/>
23406 <colspec colwidth="6*" align="right"/>
23407 <tbody>
23408 <row>
23409 <entry><option>bounce_return_size_limit</option></entry>
23410 <entry>Use: <emphasis>main</emphasis></entry>
23411 <entry>Type: <emphasis>integer</emphasis></entry>
23412 <entry>Default: <emphasis>100K</emphasis></entry>
23413 </row>
23414 </tbody>
23415 </tgroup>
23416 </informaltable>
23417 <para>
23418 <indexterm role="concept">
23419 <primary>size</primary>
23420 <secondary>of bounce, limit</secondary>
23421 </indexterm>
23422 <indexterm role="concept">
23423 <primary>bounce message</primary>
23424 <secondary>size limit</secondary>
23425 </indexterm>
23426 <indexterm role="concept">
23427 <primary>limit</primary>
23428 <secondary>bounce message size</secondary>
23429 </indexterm>
23430 This option sets a limit in bytes on the size of messages that are returned to
23431 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
23432 limit should be less than the value of the global <option>message_size_limit</option> and of
23433 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
23434 that Exim generates. If this option is set to zero there is no limit.
23435 </para>
23436 <para>
23437 When the body of any message that is to be included in a bounce message is
23438 greater than the limit, it is truncated, and a comment pointing this out is
23439 added at the top. The actual cutoff may be greater than the value given, owing
23440 to the use of buffering for transferring the message in chunks (typically 8K in
23441 size). The idea is to save bandwidth on those undeliverable 15-megabyte
23442 messages.
23443 </para>
23444 <para>
23445 <indexterm role="option">
23446 <primary><option>bounce_sender_authentication</option></primary>
23447 </indexterm>
23448 </para>
23449 <informaltable frame="all">
23450 <tgroup cols="4" colsep="0" rowsep="0">
23451 <colspec colwidth="8*" align="left"/>
23452 <colspec colwidth="6*" align="center"/>
23453 <colspec colwidth="6*" align="center"/>
23454 <colspec colwidth="6*" align="right"/>
23455 <tbody>
23456 <row>
23457 <entry><option>bounce_sender_authentication</option></entry>
23458 <entry>Use: <emphasis>main</emphasis></entry>
23459 <entry>Type: <emphasis>string</emphasis></entry>
23460 <entry>Default: <emphasis>unset</emphasis></entry>
23461 </row>
23462 </tbody>
23463 </tgroup>
23464 </informaltable>
23465 <para>
23466 <indexterm role="concept">
23467 <primary>bounce message</primary>
23468 <secondary>sender authentication</secondary>
23469 </indexterm>
23470 <indexterm role="concept">
23471 <primary>authentication</primary>
23472 <secondary>bounce message</secondary>
23473 </indexterm>
23474 <indexterm role="concept">
23475 <primary>AUTH</primary>
23476 <secondary>on bounce message</secondary>
23477 </indexterm>
23478 This option provides an authenticated sender address that is sent with any
23479 bounce messages generated by Exim that are sent over an authenticated SMTP
23480 connection. A typical setting might be:
23481 </para>
23482 <literallayout class="monospaced">
23483 bounce_sender_authentication = mailer-daemon@my.domain.example
23484 </literallayout>
23485 <para>
23486 which would cause bounce messages to be sent using the SMTP command:
23487 </para>
23488 <literallayout class="monospaced">
23489 MAIL FROM:&lt;&gt; AUTH=mailer-daemon@my.domain.example
23490 </literallayout>
23491 <para>
23492 The value of <option>bounce_sender_authentication</option> must always be a complete email
23493 address.
23494 </para>
23495 <para>
23496 <indexterm role="option">
23497 <primary><option>callout_domain_negative_expire</option></primary>
23498 </indexterm>
23499 </para>
23500 <informaltable frame="all">
23501 <tgroup cols="4" colsep="0" rowsep="0">
23502 <colspec colwidth="8*" align="left"/>
23503 <colspec colwidth="6*" align="center"/>
23504 <colspec colwidth="6*" align="center"/>
23505 <colspec colwidth="6*" align="right"/>
23506 <tbody>
23507 <row>
23508 <entry><option>callout_domain_negative_expire</option></entry>
23509 <entry>Use: <emphasis>main</emphasis></entry>
23510 <entry>Type: <emphasis>time</emphasis></entry>
23511 <entry>Default: <emphasis>3h</emphasis></entry>
23512 </row>
23513 </tbody>
23514 </tgroup>
23515 </informaltable>
23516 <para>
23517 <indexterm role="concept">
23518 <primary>caching</primary>
23519 <secondary>callout timeouts</secondary>
23520 </indexterm>
23521 <indexterm role="concept">
23522 <primary>callout</primary>
23523 <secondary>caching timeouts</secondary>
23524 </indexterm>
23525 This option specifies the expiry time for negative callout cache data for a
23526 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
23527 section <xref linkend="SECTcallvercache"/> for details of the caching.
23528 </para>
23529 <para>
23530 <indexterm role="option">
23531 <primary><option>callout_domain_positive_expire</option></primary>
23532 </indexterm>
23533 </para>
23534 <informaltable frame="all">
23535 <tgroup cols="4" colsep="0" rowsep="0">
23536 <colspec colwidth="8*" align="left"/>
23537 <colspec colwidth="6*" align="center"/>
23538 <colspec colwidth="6*" align="center"/>
23539 <colspec colwidth="6*" align="right"/>
23540 <tbody>
23541 <row>
23542 <entry><option>callout_domain_positive_expire</option></entry>
23543 <entry>Use: <emphasis>main</emphasis></entry>
23544 <entry>Type: <emphasis>time</emphasis></entry>
23545 <entry>Default: <emphasis>7d</emphasis></entry>
23546 </row>
23547 </tbody>
23548 </tgroup>
23549 </informaltable>
23550 <para>
23551 This option specifies the expiry time for positive callout cache data for a
23552 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
23553 section <xref linkend="SECTcallvercache"/> for details of the caching.
23554 </para>
23555 <para>
23556 <indexterm role="option">
23557 <primary><option>callout_negative_expire</option></primary>
23558 </indexterm>
23559 </para>
23560 <informaltable frame="all">
23561 <tgroup cols="4" colsep="0" rowsep="0">
23562 <colspec colwidth="8*" align="left"/>
23563 <colspec colwidth="6*" align="center"/>
23564 <colspec colwidth="6*" align="center"/>
23565 <colspec colwidth="6*" align="right"/>
23566 <tbody>
23567 <row>
23568 <entry><option>callout_negative_expire</option></entry>
23569 <entry>Use: <emphasis>main</emphasis></entry>
23570 <entry>Type: <emphasis>time</emphasis></entry>
23571 <entry>Default: <emphasis>2h</emphasis></entry>
23572 </row>
23573 </tbody>
23574 </tgroup>
23575 </informaltable>
23576 <para>
23577 This option specifies the expiry time for negative callout cache data for an
23578 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
23579 section <xref linkend="SECTcallvercache"/> for details of the caching.
23580 </para>
23581 <para>
23582 <indexterm role="option">
23583 <primary><option>callout_positive_expire</option></primary>
23584 </indexterm>
23585 </para>
23586 <informaltable frame="all">
23587 <tgroup cols="4" colsep="0" rowsep="0">
23588 <colspec colwidth="8*" align="left"/>
23589 <colspec colwidth="6*" align="center"/>
23590 <colspec colwidth="6*" align="center"/>
23591 <colspec colwidth="6*" align="right"/>
23592 <tbody>
23593 <row>
23594 <entry><option>callout_positive_expire</option></entry>
23595 <entry>Use: <emphasis>main</emphasis></entry>
23596 <entry>Type: <emphasis>time</emphasis></entry>
23597 <entry>Default: <emphasis>24h</emphasis></entry>
23598 </row>
23599 </tbody>
23600 </tgroup>
23601 </informaltable>
23602 <para>
23603 This option specifies the expiry time for positive callout cache data for an
23604 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
23605 section <xref linkend="SECTcallvercache"/> for details of the caching.
23606 </para>
23607 <para>
23608 <indexterm role="option">
23609 <primary><option>callout_random_local_part</option></primary>
23610 </indexterm>
23611 </para>
23612 <informaltable frame="all">
23613 <tgroup cols="4" colsep="0" rowsep="0">
23614 <colspec colwidth="8*" align="left"/>
23615 <colspec colwidth="6*" align="center"/>
23616 <colspec colwidth="6*" align="center"/>
23617 <colspec colwidth="6*" align="right"/>
23618 <tbody>
23619 <row>
23620 <entry><option>callout_random_local_part</option></entry>
23621 <entry>Use: <emphasis>main</emphasis></entry>
23622 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23623 <entry>Default: <emphasis>see below</emphasis></entry>
23624 </row>
23625 </tbody>
23626 </tgroup>
23627 </informaltable>
23628 <para>
23629 This option defines the <quote>random</quote> local part that can be used as part of
23630 callout verification. The default value is
23631 </para>
23632 <literallayout class="monospaced">
23633 $primary_hostname-$tod_epoch-testing
23634 </literallayout>
23635 <para>
23636 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
23637 </para>
23638 <para>
23639 <indexterm role="option">
23640 <primary><option>check_log_inodes</option></primary>
23641 </indexterm>
23642 </para>
23643 <informaltable frame="all">
23644 <tgroup cols="4" colsep="0" rowsep="0">
23645 <colspec colwidth="8*" align="left"/>
23646 <colspec colwidth="6*" align="center"/>
23647 <colspec colwidth="6*" align="center"/>
23648 <colspec colwidth="6*" align="right"/>
23649 <tbody>
23650 <row>
23651 <entry><option>check_log_inodes</option></entry>
23652 <entry>Use: <emphasis>main</emphasis></entry>
23653 <entry>Type: <emphasis>integer</emphasis></entry>
23654 <entry>Default: <emphasis>0</emphasis></entry>
23655 </row>
23656 </tbody>
23657 </tgroup>
23658 </informaltable>
23659 <para>
23660 See <option>check_spool_space</option> below.
23661 </para>
23662 <para>
23663 <indexterm role="option">
23664 <primary><option>check_log_space</option></primary>
23665 </indexterm>
23666 </para>
23667 <informaltable frame="all">
23668 <tgroup cols="4" colsep="0" rowsep="0">
23669 <colspec colwidth="8*" align="left"/>
23670 <colspec colwidth="6*" align="center"/>
23671 <colspec colwidth="6*" align="center"/>
23672 <colspec colwidth="6*" align="right"/>
23673 <tbody>
23674 <row>
23675 <entry><option>check_log_space</option></entry>
23676 <entry>Use: <emphasis>main</emphasis></entry>
23677 <entry>Type: <emphasis>integer</emphasis></entry>
23678 <entry>Default: <emphasis>0</emphasis></entry>
23679 </row>
23680 </tbody>
23681 </tgroup>
23682 </informaltable>
23683 <para>
23684 See <option>check_spool_space</option> below.
23685 </para>
23686 <para>
23687 <indexterm role="option">
23688 <primary><option>check_rfc2047_length</option></primary>
23689 </indexterm>
23690 <indexterm role="concept">
23691 <primary>RFC 2047</primary>
23692 <secondary>disabling length check</secondary>
23693 </indexterm>
23694 <indexterm role="option">
23695 <primary><option>check_rfc2047_length</option></primary>
23696 </indexterm>
23697 </para>
23698 <informaltable frame="all">
23699 <tgroup cols="4" colsep="0" rowsep="0">
23700 <colspec colwidth="8*" align="left"/>
23701 <colspec colwidth="6*" align="center"/>
23702 <colspec colwidth="6*" align="center"/>
23703 <colspec colwidth="6*" align="right"/>
23704 <tbody>
23705 <row>
23706 <entry><option>check_rfc2047_length</option></entry>
23707 <entry>Use: <emphasis>main</emphasis></entry>
23708 <entry>Type: <emphasis>boolean</emphasis></entry>
23709 <entry>Default: <emphasis>true</emphasis></entry>
23710 </row>
23711 </tbody>
23712 </tgroup>
23713 </informaltable>
23714 <para>
23715 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
23716 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
23717 word; strings to be encoded that exceed this length are supposed to use
23718 multiple encoded words. By default, Exim does not recognize encoded words that
23719 exceed the maximum length. However, it seems that some software, in violation
23720 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
23721 set false, Exim recognizes encoded words of any length.
23722 </para>
23723 <para>
23724 <indexterm role="option">
23725 <primary><option>check_spool_inodes</option></primary>
23726 </indexterm>
23727 </para>
23728 <informaltable frame="all">
23729 <tgroup cols="4" colsep="0" rowsep="0">
23730 <colspec colwidth="8*" align="left"/>
23731 <colspec colwidth="6*" align="center"/>
23732 <colspec colwidth="6*" align="center"/>
23733 <colspec colwidth="6*" align="right"/>
23734 <tbody>
23735 <row>
23736 <entry><option>check_spool_inodes</option></entry>
23737 <entry>Use: <emphasis>main</emphasis></entry>
23738 <entry>Type: <emphasis>integer</emphasis></entry>
23739 <entry>Default: <emphasis>0</emphasis></entry>
23740 </row>
23741 </tbody>
23742 </tgroup>
23743 </informaltable>
23744 <para>
23745 See <option>check_spool_space</option> below.
23746 </para>
23747 <para>
23748 <indexterm role="option">
23749 <primary><option>check_spool_space</option></primary>
23750 </indexterm>
23751 </para>
23752 <informaltable frame="all">
23753 <tgroup cols="4" colsep="0" rowsep="0">
23754 <colspec colwidth="8*" align="left"/>
23755 <colspec colwidth="6*" align="center"/>
23756 <colspec colwidth="6*" align="center"/>
23757 <colspec colwidth="6*" align="right"/>
23758 <tbody>
23759 <row>
23760 <entry><option>check_spool_space</option></entry>
23761 <entry>Use: <emphasis>main</emphasis></entry>
23762 <entry>Type: <emphasis>integer</emphasis></entry>
23763 <entry>Default: <emphasis>0</emphasis></entry>
23764 </row>
23765 </tbody>
23766 </tgroup>
23767 </informaltable>
23768 <para>
23769 <indexterm role="concept">
23770 <primary>checking disk space</primary>
23771 </indexterm>
23772 <indexterm role="concept">
23773 <primary>disk space, checking</primary>
23774 </indexterm>
23775 <indexterm role="concept">
23776 <primary>spool directory</primary>
23777 <secondary>checking space</secondary>
23778 </indexterm>
23779 The four <option>check_...</option> options allow for checking of disk resources before a
23780 message is accepted.
23781 </para>
23782 <para>
23783 <indexterm role="variable">
23784 <primary><varname>$log_inodes</varname></primary>
23785 </indexterm>
23786 <indexterm role="variable">
23787 <primary><varname>$log_space</varname></primary>
23788 </indexterm>
23789 <indexterm role="variable">
23790 <primary><varname>$spool_inodes</varname></primary>
23791 </indexterm>
23792 <indexterm role="variable">
23793 <primary><varname>$spool_space</varname></primary>
23794 </indexterm>
23795 When any of these options are set, they apply to all incoming messages. If you
23796 want to apply different checks to different kinds of message, you can do so by
23797 testing the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
23798 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
23799 </para>
23800 <para>
23801 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
23802 either value is greater than zero, for example:
23803 </para>
23804 <literallayout class="monospaced">
23805 check_spool_space = 10M
23806 check_spool_inodes = 100
23807 </literallayout>
23808 <para>
23809 The spool partition is the one that contains the directory defined by
23810 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
23811 transit.
23812 </para>
23813 <para>
23814 <option>check_log_space</option> and <option>check_log_inodes</option>  check the partition in which log
23815 files are written if either is greater than zero. These should be set only if
23816 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
23817 </para>
23818 <para>
23819 If there is less space or fewer inodes than requested, Exim refuses to accept
23820 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
23821 error response to the MAIL command. If ESMTP is in use and there was a
23822 SIZE parameter on the MAIL command, its value is added to the
23823 <option>check_spool_space</option> value, and the check is performed even if
23824 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
23825 </para>
23826 <para>
23827 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
23828 number of kilobytes. If a non-multiple of 1024 is specified, it is rounded up.
23829 </para>
23830 <para>
23831 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
23832 failure a message is written to stderr and Exim exits with a non-zero code, as
23833 it obviously cannot send an error message of any kind.
23834 </para>
23835 <para>
23836 <indexterm role="option">
23837 <primary><option>daemon_smtp_ports</option></primary>
23838 </indexterm>
23839 </para>
23840 <informaltable frame="all">
23841 <tgroup cols="4" colsep="0" rowsep="0">
23842 <colspec colwidth="8*" align="left"/>
23843 <colspec colwidth="6*" align="center"/>
23844 <colspec colwidth="6*" align="center"/>
23845 <colspec colwidth="6*" align="right"/>
23846 <tbody>
23847 <row>
23848 <entry><option>daemon_smtp_ports</option></entry>
23849 <entry>Use: <emphasis>main</emphasis></entry>
23850 <entry>Type: <emphasis>string</emphasis></entry>
23851 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
23852 </row>
23853 </tbody>
23854 </tgroup>
23855 </informaltable>
23856 <para>
23857 <indexterm role="concept">
23858 <primary>port</primary>
23859 <secondary>for daemon</secondary>
23860 </indexterm>
23861 <indexterm role="concept">
23862 <primary>TCP/IP</primary>
23863 <secondary>setting listening ports</secondary>
23864 </indexterm>
23865 This option specifies one or more default SMTP ports on which the Exim daemon
23866 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
23867 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
23868 </para>
23869 <para>
23870 <indexterm role="option">
23871 <primary><option>daemon_startup_retries</option></primary>
23872 </indexterm>
23873 </para>
23874 <informaltable frame="all">
23875 <tgroup cols="4" colsep="0" rowsep="0">
23876 <colspec colwidth="8*" align="left"/>
23877 <colspec colwidth="6*" align="center"/>
23878 <colspec colwidth="6*" align="center"/>
23879 <colspec colwidth="6*" align="right"/>
23880 <tbody>
23881 <row>
23882 <entry><option>daemon_startup_retries</option></entry>
23883 <entry>Use: <emphasis>main</emphasis></entry>
23884 <entry>Type: <emphasis>integer</emphasis></entry>
23885 <entry>Default: <emphasis>9</emphasis></entry>
23886 </row>
23887 </tbody>
23888 </tgroup>
23889 </informaltable>
23890 <para>
23891 <indexterm role="concept">
23892 <primary>daemon startup, retrying</primary>
23893 </indexterm>
23894 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
23895 the daemon at startup when it cannot immediately bind a listening socket
23896 (typically because the socket is already in use): <option>daemon_startup_retries</option>
23897 defines the number of retries after the first failure, and
23898 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
23899 </para>
23900 <para>
23901 <indexterm role="option">
23902 <primary><option>daemon_startup_sleep</option></primary>
23903 </indexterm>
23904 </para>
23905 <informaltable frame="all">
23906 <tgroup cols="4" colsep="0" rowsep="0">
23907 <colspec colwidth="8*" align="left"/>
23908 <colspec colwidth="6*" align="center"/>
23909 <colspec colwidth="6*" align="center"/>
23910 <colspec colwidth="6*" align="right"/>
23911 <tbody>
23912 <row>
23913 <entry><option>daemon_startup_sleep</option></entry>
23914 <entry>Use: <emphasis>main</emphasis></entry>
23915 <entry>Type: <emphasis>time</emphasis></entry>
23916 <entry>Default: <emphasis>30s</emphasis></entry>
23917 </row>
23918 </tbody>
23919 </tgroup>
23920 </informaltable>
23921 <para>
23922 See <option>daemon_startup_retries</option>.
23923 </para>
23924 <para>
23925 <indexterm role="option">
23926 <primary><option>delay_warning</option></primary>
23927 </indexterm>
23928 </para>
23929 <informaltable frame="all">
23930 <tgroup cols="4" colsep="0" rowsep="0">
23931 <colspec colwidth="8*" align="left"/>
23932 <colspec colwidth="6*" align="center"/>
23933 <colspec colwidth="6*" align="center"/>
23934 <colspec colwidth="6*" align="right"/>
23935 <tbody>
23936 <row>
23937 <entry><option>delay_warning</option></entry>
23938 <entry>Use: <emphasis>main</emphasis></entry>
23939 <entry>Type: <emphasis>time list</emphasis></entry>
23940 <entry>Default: <emphasis>24h</emphasis></entry>
23941 </row>
23942 </tbody>
23943 </tgroup>
23944 </informaltable>
23945 <para>
23946 <indexterm role="concept">
23947 <primary>warning of delay</primary>
23948 </indexterm>
23949 <indexterm role="concept">
23950 <primary>delay warning, specifying</primary>
23951 </indexterm>
23952 When a message is delayed, Exim sends a warning message to the sender at
23953 intervals specified by this option. The data is a colon-separated list of times
23954 after which to send warning messages. If the value of the option is an empty
23955 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
23956 message has been on the queue for longer than the last time, the last interval
23957 between the times is used to compute subsequent warning times. For example,
23958 with
23959 </para>
23960 <literallayout class="monospaced">
23961 delay_warning = 4h:8h:24h
23962 </literallayout>
23963 <para>
23964 the first message is sent after 4 hours, the second after 8 hours, and
23965 the third one after 24 hours. After that, messages are sent every 16 hours,
23966 because that is the interval between the last two times on the list. If you set
23967 just one time, it specifies the repeat interval. For example, with:
23968 </para>
23969 <literallayout class="monospaced">
23970 delay_warning = 6h
23971 </literallayout>
23972 <para>
23973 messages are repeated every six hours. To stop warnings after a given time, set
23974 a very large time at the end of the list. For example:
23975 </para>
23976 <literallayout class="monospaced">
23977 delay_warning = 2h:12h:99d
23978 </literallayout>
23979 <para>
23980 Note that the option is only evaluated at the time a delivery attempt fails,
23981 which depends on retry and queue-runner configuration.
23982 Typically retries will be configured more frequently than warning messages.
23983 </para>
23984 <para>
23985 <indexterm role="option">
23986 <primary><option>delay_warning_condition</option></primary>
23987 </indexterm>
23988 </para>
23989 <informaltable frame="all">
23990 <tgroup cols="4" colsep="0" rowsep="0">
23991 <colspec colwidth="8*" align="left"/>
23992 <colspec colwidth="6*" align="center"/>
23993 <colspec colwidth="6*" align="center"/>
23994 <colspec colwidth="6*" align="right"/>
23995 <tbody>
23996 <row>
23997 <entry><option>delay_warning_condition</option></entry>
23998 <entry>Use: <emphasis>main</emphasis></entry>
23999 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24000 <entry>Default: <emphasis>see below</emphasis></entry>
24001 </row>
24002 </tbody>
24003 </tgroup>
24004 </informaltable>
24005 <para>
24006 <indexterm role="variable">
24007 <primary><varname>$domain</varname></primary>
24008 </indexterm>
24009 The string is expanded at the time a warning message might be sent. If all the
24010 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
24011 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
24012 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
24013 <quote>false</quote> (the comparison being done caselessly) then the warning message is
24014 not sent. The default is:
24015 </para>
24016 <literallayout class="monospaced">
24017 delay_warning_condition = ${if or {\
24018   { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
24019   { match{$h_precedence:}{(?i)bulk|list|junk} }\
24020   { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
24021   } {no}{yes}}
24022 </literallayout>
24023 <para>
24024 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
24025 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
24026 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
24027 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
24028 </para>
24029 <para>
24030 <indexterm role="option">
24031 <primary><option>deliver_drop_privilege</option></primary>
24032 </indexterm>
24033 </para>
24034 <informaltable frame="all">
24035 <tgroup cols="4" colsep="0" rowsep="0">
24036 <colspec colwidth="8*" align="left"/>
24037 <colspec colwidth="6*" align="center"/>
24038 <colspec colwidth="6*" align="center"/>
24039 <colspec colwidth="6*" align="right"/>
24040 <tbody>
24041 <row>
24042 <entry><option>deliver_drop_privilege</option></entry>
24043 <entry>Use: <emphasis>main</emphasis></entry>
24044 <entry>Type: <emphasis>boolean</emphasis></entry>
24045 <entry>Default: <emphasis>false</emphasis></entry>
24046 </row>
24047 </tbody>
24048 </tgroup>
24049 </informaltable>
24050 <para>
24051 <indexterm role="concept">
24052 <primary>unprivileged delivery</primary>
24053 </indexterm>
24054 <indexterm role="concept">
24055 <primary>delivery</primary>
24056 <secondary>unprivileged</secondary>
24057 </indexterm>
24058 If this option is set true, Exim drops its root privilege at the start of a
24059 delivery process, and runs as the Exim user throughout. This severely restricts
24060 the kinds of local delivery that are possible, but is viable in certain types
24061 of configuration. There is a discussion about the use of root privilege in
24062 chapter <xref linkend="CHAPsecurity"/>.
24063 </para>
24064 <para>
24065 <indexterm role="option">
24066 <primary><option>deliver_queue_load_max</option></primary>
24067 </indexterm>
24068 </para>
24069 <informaltable frame="all">
24070 <tgroup cols="4" colsep="0" rowsep="0">
24071 <colspec colwidth="8*" align="left"/>
24072 <colspec colwidth="6*" align="center"/>
24073 <colspec colwidth="6*" align="center"/>
24074 <colspec colwidth="6*" align="right"/>
24075 <tbody>
24076 <row>
24077 <entry><option>deliver_queue_load_max</option></entry>
24078 <entry>Use: <emphasis>main</emphasis></entry>
24079 <entry>Type: <emphasis>fixed-point</emphasis></entry>
24080 <entry>Default: <emphasis>unset</emphasis></entry>
24081 </row>
24082 </tbody>
24083 </tgroup>
24084 </informaltable>
24085 <para>
24086 <indexterm role="concept">
24087 <primary>load average</primary>
24088 </indexterm>
24089 <indexterm role="concept">
24090 <primary>queue runner</primary>
24091 <secondary>abandoning</secondary>
24092 </indexterm>
24093 When this option is set, a queue run is abandoned if the system load average
24094 becomes greater than the value of the option. The option has no effect on
24095 ancient operating systems on which Exim cannot determine the load average.
24096 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
24097 </para>
24098 <para>
24099 <indexterm role="option">
24100 <primary><option>delivery_date_remove</option></primary>
24101 </indexterm>
24102 </para>
24103 <informaltable frame="all">
24104 <tgroup cols="4" colsep="0" rowsep="0">
24105 <colspec colwidth="8*" align="left"/>
24106 <colspec colwidth="6*" align="center"/>
24107 <colspec colwidth="6*" align="center"/>
24108 <colspec colwidth="6*" align="right"/>
24109 <tbody>
24110 <row>
24111 <entry><option>delivery_date_remove</option></entry>
24112 <entry>Use: <emphasis>main</emphasis></entry>
24113 <entry>Type: <emphasis>boolean</emphasis></entry>
24114 <entry>Default: <emphasis>true</emphasis></entry>
24115 </row>
24116 </tbody>
24117 </tgroup>
24118 </informaltable>
24119 <para>
24120 <indexterm role="concept">
24121 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
24122 </indexterm>
24123 Exim&#x2019;s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
24124 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
24125 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
24126 should not be present in incoming messages, and this option causes them to be
24127 removed at the time the message is received, to avoid any problems that might
24128 occur when a delivered message is subsequently sent on to some other recipient.
24129 </para>
24130 <para>
24131 <indexterm role="option">
24132 <primary><option>disable_fsync</option></primary>
24133 </indexterm>
24134 </para>
24135 <informaltable frame="all">
24136 <tgroup cols="4" colsep="0" rowsep="0">
24137 <colspec colwidth="8*" align="left"/>
24138 <colspec colwidth="6*" align="center"/>
24139 <colspec colwidth="6*" align="center"/>
24140 <colspec colwidth="6*" align="right"/>
24141 <tbody>
24142 <row>
24143 <entry><option>disable_fsync</option></entry>
24144 <entry>Use: <emphasis>main</emphasis></entry>
24145 <entry>Type: <emphasis>boolean</emphasis></entry>
24146 <entry>Default: <emphasis>false</emphasis></entry>
24147 </row>
24148 </tbody>
24149 </tgroup>
24150 </informaltable>
24151 <para>
24152 <indexterm role="concept">
24153 <primary><function>fsync()</function>, disabling</primary>
24154 </indexterm>
24155 This option is available only if Exim was built with the compile-time option
24156 ENABLE_DISABLE_FSYNC. When this is not set, a reference to <option>disable_fsync</option> in
24157 a runtime configuration generates an <quote>unknown option</quote> error. You should not
24158 build Exim with ENABLE_DISABLE_FSYNC or set <option>disable_fsync</option> unless you
24159 really, really, really understand what you are doing. <emphasis>No pre-compiled
24160 distributions of Exim should ever make this option available.</emphasis>
24161 </para>
24162 <para>
24163 When <option>disable_fsync</option> is set true, Exim no longer calls <function>fsync()</function> to force
24164 updated files&#x2019; data to be written to disc before continuing. Unexpected events
24165 such as crashes and power outages may cause data to be lost or scrambled.
24166 Here be Dragons. <emphasis role="bold">Beware.</emphasis>
24167 </para>
24168 <para>
24169 <indexterm role="option">
24170 <primary><option>disable_ipv6</option></primary>
24171 </indexterm>
24172 </para>
24173 <informaltable frame="all">
24174 <tgroup cols="4" colsep="0" rowsep="0">
24175 <colspec colwidth="8*" align="left"/>
24176 <colspec colwidth="6*" align="center"/>
24177 <colspec colwidth="6*" align="center"/>
24178 <colspec colwidth="6*" align="right"/>
24179 <tbody>
24180 <row>
24181 <entry><option>disable_ipv6</option></entry>
24182 <entry>Use: <emphasis>main</emphasis></entry>
24183 <entry>Type: <emphasis>boolean</emphasis></entry>
24184 <entry>Default: <emphasis>false</emphasis></entry>
24185 </row>
24186 </tbody>
24187 </tgroup>
24188 </informaltable>
24189 <para>
24190 <indexterm role="concept">
24191 <primary>IPv6</primary>
24192 <secondary>disabling</secondary>
24193 </indexterm>
24194 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
24195 activities take place. AAAA records are never looked up, and any IPv6 addresses
24196 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
24197 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
24198 to handle IPv6 literal addresses.
24199 </para>
24200 <para>
24201 <indexterm role="option">
24202 <primary><option>dkim_verify_signers</option></primary>
24203 </indexterm>
24204 </para>
24205 <informaltable frame="all">
24206 <tgroup cols="4" colsep="0" rowsep="0">
24207 <colspec colwidth="8*" align="left"/>
24208 <colspec colwidth="6*" align="center"/>
24209 <colspec colwidth="6*" align="center"/>
24210 <colspec colwidth="6*" align="right"/>
24211 <tbody>
24212 <row>
24213 <entry><option>dkim_verify_signers</option></entry>
24214 <entry>Use: <emphasis>main</emphasis></entry>
24215 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24216 <entry>Default: <emphasis>$dkim_signers</emphasis></entry>
24217 </row>
24218 </tbody>
24219 </tgroup>
24220 </informaltable>
24221 <para>
24222 <indexterm role="concept">
24223 <primary>DKIM</primary>
24224 <secondary>controlling calls to the ACL</secondary>
24225 </indexterm>
24226 This option gives a list of DKIM domains for which the DKIM ACL is run.
24227 It is expanded after the message is received; by default it runs
24228 the ACL once for each signature in the message.
24229 See chapter <xref linkend="CHAPdkim"/>.
24230 </para>
24231 <para>
24232 <indexterm role="option">
24233 <primary><option>dns_again_means_nonexist</option></primary>
24234 </indexterm>
24235 </para>
24236 <informaltable frame="all">
24237 <tgroup cols="4" colsep="0" rowsep="0">
24238 <colspec colwidth="8*" align="left"/>
24239 <colspec colwidth="6*" align="center"/>
24240 <colspec colwidth="6*" align="center"/>
24241 <colspec colwidth="6*" align="right"/>
24242 <tbody>
24243 <row>
24244 <entry><option>dns_again_means_nonexist</option></entry>
24245 <entry>Use: <emphasis>main</emphasis></entry>
24246 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24247 <entry>Default: <emphasis>unset</emphasis></entry>
24248 </row>
24249 </tbody>
24250 </tgroup>
24251 </informaltable>
24252 <para>
24253 <indexterm role="concept">
24254 <primary>DNS</primary>
24255 <secondary><quote>try again</quote> response; overriding</secondary>
24256 </indexterm>
24257 DNS lookups give a <quote>try again</quote> response for the DNS errors
24258 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
24259 keep trying to deliver a message, or to give repeated temporary errors to
24260 incoming mail. Sometimes the effect is caused by a badly set up name server and
24261 may persist for a long time. If a domain which exhibits this problem matches
24262 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
24263 This option should be used with care. You can make it apply to reverse lookups
24264 by a setting such as this:
24265 </para>
24266 <literallayout class="monospaced">
24267 dns_again_means_nonexist = *.in-addr.arpa
24268 </literallayout>
24269 <para>
24270 This option applies to all DNS lookups that Exim does. It also applies when the
24271 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
24272 since these are most likely to be caused by DNS lookup problems. The
24273 <command>dnslookup</command> router has some options of its own for controlling what happens
24274 when lookups for MX or SRV records give temporary errors. These more specific
24275 options are applied after this global option.
24276 </para>
24277 <para>
24278 <indexterm role="option">
24279 <primary><option>dns_check_names_pattern</option></primary>
24280 </indexterm>
24281 </para>
24282 <informaltable frame="all">
24283 <tgroup cols="4" colsep="0" rowsep="0">
24284 <colspec colwidth="8*" align="left"/>
24285 <colspec colwidth="6*" align="center"/>
24286 <colspec colwidth="6*" align="center"/>
24287 <colspec colwidth="6*" align="right"/>
24288 <tbody>
24289 <row>
24290 <entry><option>dns_check_names_pattern</option></entry>
24291 <entry>Use: <emphasis>main</emphasis></entry>
24292 <entry>Type: <emphasis>string</emphasis></entry>
24293 <entry>Default: <emphasis>see below</emphasis></entry>
24294 </row>
24295 </tbody>
24296 </tgroup>
24297 </informaltable>
24298 <para>
24299 <indexterm role="concept">
24300 <primary>DNS</primary>
24301 <secondary>pre-check of name syntax</secondary>
24302 </indexterm>
24303 When this option is set to a non-empty string, it causes Exim to check domain
24304 names for characters that are not allowed in host names before handing them to
24305 the DNS resolver, because some resolvers give temporary errors for names that
24306 contain unusual characters. If a domain name contains any unwanted characters,
24307 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
24308 done by matching the domain name against a regular expression, which is the
24309 value of this option. The default pattern is
24310 </para>
24311 <literallayout class="monospaced">
24312 dns_check_names_pattern = \
24313   (?i)^(?&gt;(?(1)\.|())[^\W_](?&gt;[a-z0-9/-]*[^\W_])?)+$
24314 </literallayout>
24315 <para>
24316 which permits only letters, digits, slashes, and hyphens in components, but
24317 they must start and end with a letter or digit. Slashes are not, in fact,
24318 permitted in host names, but they are found in certain NS records (which can be
24319 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
24320 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
24321 empty string.
24322 </para>
24323 <para>
24324 <indexterm role="option">
24325 <primary><option>dns_csa_search_limit</option></primary>
24326 </indexterm>
24327 </para>
24328 <informaltable frame="all">
24329 <tgroup cols="4" colsep="0" rowsep="0">
24330 <colspec colwidth="8*" align="left"/>
24331 <colspec colwidth="6*" align="center"/>
24332 <colspec colwidth="6*" align="center"/>
24333 <colspec colwidth="6*" align="right"/>
24334 <tbody>
24335 <row>
24336 <entry><option>dns_csa_search_limit</option></entry>
24337 <entry>Use: <emphasis>main</emphasis></entry>
24338 <entry>Type: <emphasis>integer</emphasis></entry>
24339 <entry>Default: <emphasis>5</emphasis></entry>
24340 </row>
24341 </tbody>
24342 </tgroup>
24343 </informaltable>
24344 <para>
24345 This option controls the depth of parental searching for CSA SRV records in the
24346 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
24347 </para>
24348 <para>
24349 <indexterm role="option">
24350 <primary><option>dns_csa_use_reverse</option></primary>
24351 </indexterm>
24352 </para>
24353 <informaltable frame="all">
24354 <tgroup cols="4" colsep="0" rowsep="0">
24355 <colspec colwidth="8*" align="left"/>
24356 <colspec colwidth="6*" align="center"/>
24357 <colspec colwidth="6*" align="center"/>
24358 <colspec colwidth="6*" align="right"/>
24359 <tbody>
24360 <row>
24361 <entry><option>dns_csa_use_reverse</option></entry>
24362 <entry>Use: <emphasis>main</emphasis></entry>
24363 <entry>Type: <emphasis>boolean</emphasis></entry>
24364 <entry>Default: <emphasis>true</emphasis></entry>
24365 </row>
24366 </tbody>
24367 </tgroup>
24368 </informaltable>
24369 <para>
24370 This option controls whether or not an IP address, given as a CSA domain, is
24371 reversed and looked up in the reverse DNS, as described in more detail in
24372 section <xref linkend="SECTverifyCSA"/>.
24373 </para>
24374 <para>
24375 <indexterm role="option">
24376 <primary><option>dns_dnssec_ok</option></primary>
24377 </indexterm>
24378 </para>
24379 <informaltable frame="all">
24380 <tgroup cols="4" colsep="0" rowsep="0">
24381 <colspec colwidth="8*" align="left"/>
24382 <colspec colwidth="6*" align="center"/>
24383 <colspec colwidth="6*" align="center"/>
24384 <colspec colwidth="6*" align="right"/>
24385 <tbody>
24386 <row>
24387 <entry><option>dns_dnssec_ok</option></entry>
24388 <entry>Use: <emphasis>main</emphasis></entry>
24389 <entry>Type: <emphasis>integer</emphasis></entry>
24390 <entry>Default: <emphasis>-1</emphasis></entry>
24391 </row>
24392 </tbody>
24393 </tgroup>
24394 </informaltable>
24395 <para>
24396 <indexterm role="concept">
24397 <primary>DNS</primary>
24398 <secondary>resolver options</secondary>
24399 </indexterm>
24400 <indexterm role="concept">
24401 <primary>DNS</primary>
24402 <secondary>DNSSEC</secondary>
24403 </indexterm>
24404 If this option is set to a non-negative number then Exim will initialise the
24405 DNS resolver library to either use or not use DNSSEC, overriding the system
24406 default. A value of 0 coerces DNSSEC off, a value of 1 coerces DNSSEC on.
24407 </para>
24408 <para>
24409 If the resolver library does not support DNSSEC then this option has no effect.
24410 </para>
24411 <para>
24412 <indexterm role="option">
24413 <primary><option>dns_ipv4_lookup</option></primary>
24414 </indexterm>
24415 </para>
24416 <informaltable frame="all">
24417 <tgroup cols="4" colsep="0" rowsep="0">
24418 <colspec colwidth="8*" align="left"/>
24419 <colspec colwidth="6*" align="center"/>
24420 <colspec colwidth="6*" align="center"/>
24421 <colspec colwidth="6*" align="right"/>
24422 <tbody>
24423 <row>
24424 <entry><option>dns_ipv4_lookup</option></entry>
24425 <entry>Use: <emphasis>main</emphasis></entry>
24426 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24427 <entry>Default: <emphasis>unset</emphasis></entry>
24428 </row>
24429 </tbody>
24430 </tgroup>
24431 </informaltable>
24432 <para>
24433 <indexterm role="concept">
24434 <primary>IPv6</primary>
24435 <secondary>DNS lookup for AAAA records</secondary>
24436 </indexterm>
24437 <indexterm role="concept">
24438 <primary>DNS</primary>
24439 <secondary>IPv6 lookup for AAAA records</secondary>
24440 </indexterm>
24441 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
24442 looks for IPv6 address records (AAAA records) as well as IPv4 address records
24443 (A records) when trying to find IP addresses for hosts, unless the host&#x2019;s
24444 domain matches this list.
24445 </para>
24446 <para>
24447 This is a fudge to help with name servers that give big delays or otherwise do
24448 not work for the AAAA record type. In due course, when the world&#x2019;s name
24449 servers have all been upgraded, there should be no need for this option.
24450 </para>
24451 <para>
24452 <indexterm role="option">
24453 <primary><option>dns_retrans</option></primary>
24454 </indexterm>
24455 </para>
24456 <informaltable frame="all">
24457 <tgroup cols="4" colsep="0" rowsep="0">
24458 <colspec colwidth="8*" align="left"/>
24459 <colspec colwidth="6*" align="center"/>
24460 <colspec colwidth="6*" align="center"/>
24461 <colspec colwidth="6*" align="right"/>
24462 <tbody>
24463 <row>
24464 <entry><option>dns_retrans</option></entry>
24465 <entry>Use: <emphasis>main</emphasis></entry>
24466 <entry>Type: <emphasis>time</emphasis></entry>
24467 <entry>Default: <emphasis>0s</emphasis></entry>
24468 </row>
24469 </tbody>
24470 </tgroup>
24471 </informaltable>
24472 <para>
24473 <indexterm role="concept">
24474 <primary>DNS</primary>
24475 <secondary>resolver options</secondary>
24476 </indexterm>
24477 <indexterm role="concept">
24478 <primary>timeout</primary>
24479 <secondary>dns lookup</secondary>
24480 </indexterm>
24481 <indexterm role="concept">
24482 <primary>DNS</primary>
24483 <secondary>timeout</secondary>
24484 </indexterm>
24485 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
24486 retransmission and retry parameters for DNS lookups. Values of zero (the
24487 defaults) leave the system default settings unchanged. The first value is the
24488 time between retries, and the second is the number of retries. It isn&#x2019;t
24489 totally clear exactly how these settings affect the total time a DNS lookup may
24490 take. I haven&#x2019;t found any documentation about timeouts on DNS lookups; these
24491 parameter values are available in the external resolver interface structure,
24492 but nowhere does it seem to describe how they are used or what you might want
24493 to set in them.
24494 See also the <option>slow_lookup_log</option> option.
24495 </para>
24496 <para>
24497 <indexterm role="option">
24498 <primary><option>dns_retry</option></primary>
24499 </indexterm>
24500 </para>
24501 <informaltable frame="all">
24502 <tgroup cols="4" colsep="0" rowsep="0">
24503 <colspec colwidth="8*" align="left"/>
24504 <colspec colwidth="6*" align="center"/>
24505 <colspec colwidth="6*" align="center"/>
24506 <colspec colwidth="6*" align="right"/>
24507 <tbody>
24508 <row>
24509 <entry><option>dns_retry</option></entry>
24510 <entry>Use: <emphasis>main</emphasis></entry>
24511 <entry>Type: <emphasis>integer</emphasis></entry>
24512 <entry>Default: <emphasis>0</emphasis></entry>
24513 </row>
24514 </tbody>
24515 </tgroup>
24516 </informaltable>
24517 <para>
24518 See <option>dns_retrans</option> above.
24519 </para>
24520 <para>
24521 <indexterm role="option">
24522 <primary><option>dns_trust_aa</option></primary>
24523 </indexterm>
24524 </para>
24525 <informaltable frame="all">
24526 <tgroup cols="4" colsep="0" rowsep="0">
24527 <colspec colwidth="8*" align="left"/>
24528 <colspec colwidth="6*" align="center"/>
24529 <colspec colwidth="6*" align="center"/>
24530 <colspec colwidth="6*" align="right"/>
24531 <tbody>
24532 <row>
24533 <entry><option>dns_trust_aa</option></entry>
24534 <entry>Use: <emphasis>main</emphasis></entry>
24535 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24536 <entry>Default: <emphasis>unset</emphasis></entry>
24537 </row>
24538 </tbody>
24539 </tgroup>
24540 </informaltable>
24541 <para>
24542 <indexterm role="concept">
24543 <primary>DNS</primary>
24544 <secondary>resolver options</secondary>
24545 </indexterm>
24546 <indexterm role="concept">
24547 <primary>DNS</primary>
24548 <secondary>DNSSEC</secondary>
24549 </indexterm>
24550 If this option is set then lookup results marked with the AA bit
24551 (Authoritative Answer) are trusted the same way as if they were
24552 DNSSEC-verified. The authority section&#x2019;s name of the answer must
24553 match with this expanded domain list.
24554 </para>
24555 <para>
24556 Use this option only if you talk directly to a resolver that is
24557 authoritative for some zones and does not set the AD (Authentic Data)
24558 bit in the answer. Some DNS servers may have an configuration option to
24559 mark the answers from their own zones as verified (they set the AD bit).
24560 Others do not have this option. It is considered as poor practice using
24561 a resolver that is an authoritative server for some zones.
24562 </para>
24563 <para>
24564 Use this option only if you really have to (e.g. if you want
24565 to use DANE for remote delivery to a server that is listed in the DNS
24566 zones that your resolver is authoritative for).
24567 </para>
24568 <para>
24569 If the DNS answer packet has the AA bit set and contains resource record
24570 in the answer section, the name of the first NS record appearing in the
24571 authority section is compared against the list. If the answer packet is
24572 authoritative but the answer section is empty, the name of the first SOA
24573 record in the authoritative section is used instead.
24574 </para>
24575 <para>
24576 <indexterm role="concept">
24577 <primary>DNS</primary>
24578 <secondary>resolver options</secondary>
24579 </indexterm>
24580 <indexterm role="option">
24581 <primary><option>dns_use_edns0</option></primary>
24582 </indexterm>
24583 </para>
24584 <informaltable frame="all">
24585 <tgroup cols="4" colsep="0" rowsep="0">
24586 <colspec colwidth="8*" align="left"/>
24587 <colspec colwidth="6*" align="center"/>
24588 <colspec colwidth="6*" align="center"/>
24589 <colspec colwidth="6*" align="right"/>
24590 <tbody>
24591 <row>
24592 <entry><option>dns_use_edns0</option></entry>
24593 <entry>Use: <emphasis>main</emphasis></entry>
24594 <entry>Type: <emphasis>integer</emphasis></entry>
24595 <entry>Default: <emphasis>-1</emphasis></entry>
24596 </row>
24597 </tbody>
24598 </tgroup>
24599 </informaltable>
24600 <para>
24601 <indexterm role="concept">
24602 <primary>DNS</primary>
24603 <secondary>resolver options</secondary>
24604 </indexterm>
24605 <indexterm role="concept">
24606 <primary>DNS</primary>
24607 <secondary>EDNS0</secondary>
24608 </indexterm>
24609 If this option is set to a non-negative number then Exim will initialise the
24610 DNS resolver library to either use or not use EDNS0 extensions, overriding
24611 the system default. A value of 0 coerces EDNS0 off, a value of 1 coerces EDNS0
24612 on.
24613 </para>
24614 <para>
24615 If the resolver library does not support EDNS0 then this option has no effect.
24616 </para>
24617 <para>
24618 <indexterm role="option">
24619 <primary><option>drop_cr</option></primary>
24620 </indexterm>
24621 </para>
24622 <informaltable frame="all">
24623 <tgroup cols="4" colsep="0" rowsep="0">
24624 <colspec colwidth="8*" align="left"/>
24625 <colspec colwidth="6*" align="center"/>
24626 <colspec colwidth="6*" align="center"/>
24627 <colspec colwidth="6*" align="right"/>
24628 <tbody>
24629 <row>
24630 <entry><option>drop_cr</option></entry>
24631 <entry>Use: <emphasis>main</emphasis></entry>
24632 <entry>Type: <emphasis>boolean</emphasis></entry>
24633 <entry>Default: <emphasis>false</emphasis></entry>
24634 </row>
24635 </tbody>
24636 </tgroup>
24637 </informaltable>
24638 <para>
24639 This is an obsolete option that is now a no-op. It used to affect the way Exim
24640 handled CR and LF characters in incoming messages. What happens now is
24641 described in section <xref linkend="SECTlineendings"/>.
24642 </para>
24643 <para>
24644 <indexterm role="option">
24645 <primary><option>dsn_advertise_hosts</option></primary>
24646 </indexterm>
24647 </para>
24648 <informaltable frame="all">
24649 <tgroup cols="4" colsep="0" rowsep="0">
24650 <colspec colwidth="8*" align="left"/>
24651 <colspec colwidth="6*" align="center"/>
24652 <colspec colwidth="6*" align="center"/>
24653 <colspec colwidth="6*" align="right"/>
24654 <tbody>
24655 <row>
24656 <entry><option>dsn_advertise_hosts</option></entry>
24657 <entry>Use: <emphasis>main</emphasis></entry>
24658 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24659 <entry>Default: <emphasis>unset</emphasis></entry>
24660 </row>
24661 </tbody>
24662 </tgroup>
24663 </informaltable>
24664 <para>
24665 <indexterm role="concept">
24666 <primary>bounce messages</primary>
24667 <secondary>success</secondary>
24668 </indexterm>
24669 <indexterm role="concept">
24670 <primary>DSN</primary>
24671 <secondary>success</secondary>
24672 </indexterm>
24673 <indexterm role="concept">
24674 <primary>Delivery Status Notification</primary>
24675 <secondary>success</secondary>
24676 </indexterm>
24677 DSN extensions (RFC3461) will be advertised in the EHLO message to,
24678 and accepted from, these hosts.
24679 Hosts may use the NOTIFY and ENVID options on RCPT TO commands,
24680 and RET and ORCPT options on MAIL FROM commands.
24681 A NOTIFY=SUCCESS option requests success-DSN messages.
24682 A NOTIFY= option with no argument requests that no delay or failure DSNs
24683 are sent.
24684 </para>
24685 <para>
24686 <indexterm role="option">
24687 <primary><option>dsn_from</option></primary>
24688 </indexterm>
24689 </para>
24690 <informaltable frame="all">
24691 <tgroup cols="4" colsep="0" rowsep="0">
24692 <colspec colwidth="8*" align="left"/>
24693 <colspec colwidth="6*" align="center"/>
24694 <colspec colwidth="6*" align="center"/>
24695 <colspec colwidth="6*" align="right"/>
24696 <tbody>
24697 <row>
24698 <entry><option>dsn_from</option></entry>
24699 <entry>Use: <emphasis>main</emphasis></entry>
24700 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24701 <entry>Default: <emphasis>see below</emphasis></entry>
24702 </row>
24703 </tbody>
24704 </tgroup>
24705 </informaltable>
24706 <para>
24707 <indexterm role="concept">
24708 <primary><emphasis>From:</emphasis> header line</primary>
24709 <secondary>in bounces</secondary>
24710 </indexterm>
24711 <indexterm role="concept">
24712 <primary>bounce messages</primary>
24713 <secondary><emphasis>From:</emphasis> line, specifying</secondary>
24714 </indexterm>
24715 This option can be used to vary the contents of <emphasis>From:</emphasis> header lines in
24716 bounces and other automatically generated messages (<quote>Delivery Status
24717 Notifications</quote> &ndash; hence the name of the option). The default setting is:
24718 </para>
24719 <literallayout class="monospaced">
24720 dsn_from = Mail Delivery System &lt;Mailer-Daemon@$qualify_domain&gt;
24721 </literallayout>
24722 <para>
24723 The value is expanded every time it is needed. If the expansion fails, a
24724 panic is logged, and the default value is used.
24725 </para>
24726 <para>
24727 <indexterm role="option">
24728 <primary><option>envelope_to_remove</option></primary>
24729 </indexterm>
24730 </para>
24731 <informaltable frame="all">
24732 <tgroup cols="4" colsep="0" rowsep="0">
24733 <colspec colwidth="8*" align="left"/>
24734 <colspec colwidth="6*" align="center"/>
24735 <colspec colwidth="6*" align="center"/>
24736 <colspec colwidth="6*" align="right"/>
24737 <tbody>
24738 <row>
24739 <entry><option>envelope_to_remove</option></entry>
24740 <entry>Use: <emphasis>main</emphasis></entry>
24741 <entry>Type: <emphasis>boolean</emphasis></entry>
24742 <entry>Default: <emphasis>true</emphasis></entry>
24743 </row>
24744 </tbody>
24745 </tgroup>
24746 </informaltable>
24747 <para>
24748 <indexterm role="concept">
24749 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
24750 </indexterm>
24751 Exim&#x2019;s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
24752 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
24753 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
24754 message&#x2019;s envelope that caused the delivery to happen. Such headers should not
24755 be present in incoming messages, and this option causes them to be removed at
24756 the time the message is received, to avoid any problems that might occur when a
24757 delivered message is subsequently sent on to some other recipient.
24758 </para>
24759 <para>
24760 <indexterm role="option">
24761 <primary><option>errors_copy</option></primary>
24762 </indexterm>
24763 </para>
24764 <informaltable frame="all">
24765 <tgroup cols="4" colsep="0" rowsep="0">
24766 <colspec colwidth="8*" align="left"/>
24767 <colspec colwidth="6*" align="center"/>
24768 <colspec colwidth="6*" align="center"/>
24769 <colspec colwidth="6*" align="right"/>
24770 <tbody>
24771 <row>
24772 <entry><option>errors_copy</option></entry>
24773 <entry>Use: <emphasis>main</emphasis></entry>
24774 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
24775 <entry>Default: <emphasis>unset</emphasis></entry>
24776 </row>
24777 </tbody>
24778 </tgroup>
24779 </informaltable>
24780 <para>
24781 <indexterm role="concept">
24782 <primary>bounce message</primary>
24783 <secondary>copy to other address</secondary>
24784 </indexterm>
24785 <indexterm role="concept">
24786 <primary>copy of bounce message</primary>
24787 </indexterm>
24788 Setting this option causes Exim to send bcc copies of bounce messages that it
24789 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
24790 coming from elsewhere. The value of the option is a colon-separated list of
24791 items. Each item consists of a pattern, terminated by white space, followed by
24792 a comma-separated list of email addresses. If a pattern contains spaces, it
24793 must be enclosed in double quotes.
24794 </para>
24795 <para>
24796 Each pattern is processed in the same way as a single item in an address list
24797 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
24798 the bounce message, the message is copied to the addresses on the list. The
24799 items are scanned in order, and once a matching one is found, no further items
24800 are examined. For example:
24801 </para>
24802 <literallayout class="monospaced">
24803 errors_copy = spqr@mydomain   postmaster@mydomain.example :\
24804               rqps@mydomain   hostmaster@mydomain.example,\
24805                               postmaster@mydomain.example
24806 </literallayout>
24807 <para>
24808 <indexterm role="variable">
24809 <primary><varname>$domain</varname></primary>
24810 </indexterm>
24811 <indexterm role="variable">
24812 <primary><varname>$local_part</varname></primary>
24813 </indexterm>
24814 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
24815 and <varname>$domain</varname> are set from the original recipient of the error message, and if
24816 there was any wildcard matching in the pattern, the expansion
24817 <indexterm role="concept">
24818 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
24819 <secondary>in <option>errors_copy</option></secondary>
24820 </indexterm>
24821 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
24822 </para>
24823 <para>
24824 <indexterm role="option">
24825 <primary><option>errors_reply_to</option></primary>
24826 </indexterm>
24827 </para>
24828 <informaltable frame="all">
24829 <tgroup cols="4" colsep="0" rowsep="0">
24830 <colspec colwidth="8*" align="left"/>
24831 <colspec colwidth="6*" align="center"/>
24832 <colspec colwidth="6*" align="center"/>
24833 <colspec colwidth="6*" align="right"/>
24834 <tbody>
24835 <row>
24836 <entry><option>errors_reply_to</option></entry>
24837 <entry>Use: <emphasis>main</emphasis></entry>
24838 <entry>Type: <emphasis>string</emphasis></entry>
24839 <entry>Default: <emphasis>unset</emphasis></entry>
24840 </row>
24841 </tbody>
24842 </tgroup>
24843 </informaltable>
24844 <para>
24845 <indexterm role="concept">
24846 <primary>bounce message</primary>
24847 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
24848 </indexterm>
24849 By default, Exim&#x2019;s bounce and delivery warning messages contain the header line
24850 </para>
24851 <literallayout>
24852 <literal>From: Mail Delivery System &lt;Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>&gt;</literal>
24853 </literallayout>
24854 <para>
24855 <indexterm role="option">
24856 <primary><option>quota_warn_message</option></primary>
24857 </indexterm>
24858 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
24859 A warning message that is generated by the <option>quota_warn_message</option> option in an
24860 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
24861 overrides the default.
24862 </para>
24863 <para>
24864 Experience shows that people reply to bounce messages. If the
24865 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
24866 and warning messages. For example:
24867 </para>
24868 <literallayout class="monospaced">
24869 errors_reply_to = postmaster@my.domain.example
24870 </literallayout>
24871 <para>
24872 The value of the option is not expanded. It must specify a valid RFC 2822
24873 address. However, if a warning message that is generated by the
24874 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
24875 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
24876 not used.
24877 </para>
24878 <para revisionflag="changed">
24879 <indexterm role="option">
24880 <primary><option>event_action</option></primary>
24881 </indexterm>
24882 </para>
24883 <informaltable frame="all" revisionflag="changed">
24884 <tgroup cols="4" colsep="0" rowsep="0">
24885 <colspec colwidth="8*" align="left"/>
24886 <colspec colwidth="6*" align="center"/>
24887 <colspec colwidth="6*" align="center"/>
24888 <colspec colwidth="6*" align="right"/>
24889 <tbody>
24890 <row>
24891 <entry><option>event_action</option></entry>
24892 <entry>Use: <emphasis>main</emphasis></entry>
24893 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24894 <entry>Default: <emphasis>unset</emphasis></entry>
24895 </row>
24896 </tbody>
24897 </tgroup>
24898 </informaltable>
24899 <para revisionflag="changed">
24900 <indexterm role="concept">
24901 <primary>events</primary>
24902 </indexterm>
24903 This option declares a string to be expanded for Exim&#x2019;s events mechanism.
24904 For details see <xref linkend="CHAPevents"/>.
24905 </para>
24906 <para>
24907 <indexterm role="option">
24908 <primary><option>exim_group</option></primary>
24909 </indexterm>
24910 </para>
24911 <informaltable frame="all">
24912 <tgroup cols="4" colsep="0" rowsep="0">
24913 <colspec colwidth="8*" align="left"/>
24914 <colspec colwidth="6*" align="center"/>
24915 <colspec colwidth="6*" align="center"/>
24916 <colspec colwidth="6*" align="right"/>
24917 <tbody>
24918 <row>
24919 <entry><option>exim_group</option></entry>
24920 <entry>Use: <emphasis>main</emphasis></entry>
24921 <entry>Type: <emphasis>string</emphasis></entry>
24922 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
24923 </row>
24924 </tbody>
24925 </tgroup>
24926 </informaltable>
24927 <para>
24928 <indexterm role="concept">
24929 <primary>gid (group id)</primary>
24930 <secondary>Exim&#x2019;s own</secondary>
24931 </indexterm>
24932 <indexterm role="concept">
24933 <primary>Exim group</primary>
24934 </indexterm>
24935 This option changes the gid under which Exim runs when it gives up root
24936 privilege. The default value is compiled into the binary. The value of this
24937 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
24938 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
24939 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
24940 security issues.
24941 </para>
24942 <para>
24943 <indexterm role="option">
24944 <primary><option>exim_path</option></primary>
24945 </indexterm>
24946 </para>
24947 <informaltable frame="all">
24948 <tgroup cols="4" colsep="0" rowsep="0">
24949 <colspec colwidth="8*" align="left"/>
24950 <colspec colwidth="6*" align="center"/>
24951 <colspec colwidth="6*" align="center"/>
24952 <colspec colwidth="6*" align="right"/>
24953 <tbody>
24954 <row>
24955 <entry><option>exim_path</option></entry>
24956 <entry>Use: <emphasis>main</emphasis></entry>
24957 <entry>Type: <emphasis>string</emphasis></entry>
24958 <entry>Default: <emphasis>see below</emphasis></entry>
24959 </row>
24960 </tbody>
24961 </tgroup>
24962 </informaltable>
24963 <para>
24964 <indexterm role="concept">
24965 <primary>Exim binary, path name</primary>
24966 </indexterm>
24967 This option specifies the path name of the Exim binary, which is used when Exim
24968 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
24969 the directory configured at compile time by the BIN_DIRECTORY setting. It
24970 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
24971 other place.
24972 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
24973 you will break those Exim utilities that scan the configuration file to find
24974 where the binary is. (They then use the <option>-bP</option> option to extract option
24975 settings such as the value of <option>spool_directory</option>.)
24976 </para>
24977 <para>
24978 <indexterm role="option">
24979 <primary><option>exim_user</option></primary>
24980 </indexterm>
24981 </para>
24982 <informaltable frame="all">
24983 <tgroup cols="4" colsep="0" rowsep="0">
24984 <colspec colwidth="8*" align="left"/>
24985 <colspec colwidth="6*" align="center"/>
24986 <colspec colwidth="6*" align="center"/>
24987 <colspec colwidth="6*" align="right"/>
24988 <tbody>
24989 <row>
24990 <entry><option>exim_user</option></entry>
24991 <entry>Use: <emphasis>main</emphasis></entry>
24992 <entry>Type: <emphasis>string</emphasis></entry>
24993 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
24994 </row>
24995 </tbody>
24996 </tgroup>
24997 </informaltable>
24998 <para>
24999 <indexterm role="concept">
25000 <primary>uid (user id)</primary>
25001 <secondary>Exim&#x2019;s own</secondary>
25002 </indexterm>
25003 <indexterm role="concept">
25004 <primary>Exim user</primary>
25005 </indexterm>
25006 This option changes the uid under which Exim runs when it gives up root
25007 privilege. The default value is compiled into the binary. Ownership of the run
25008 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
25009 options is checked against the values in the binary, not what is set here.
25010 </para>
25011 <para>
25012 Unless it consists entirely of digits, the string is looked up using
25013 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
25014 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
25015 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
25016 </para>
25017 <para>
25018 <indexterm role="option">
25019 <primary><option>extra_local_interfaces</option></primary>
25020 </indexterm>
25021 </para>
25022 <informaltable frame="all">
25023 <tgroup cols="4" colsep="0" rowsep="0">
25024 <colspec colwidth="8*" align="left"/>
25025 <colspec colwidth="6*" align="center"/>
25026 <colspec colwidth="6*" align="center"/>
25027 <colspec colwidth="6*" align="right"/>
25028 <tbody>
25029 <row>
25030 <entry><option>extra_local_interfaces</option></entry>
25031 <entry>Use: <emphasis>main</emphasis></entry>
25032 <entry>Type: <emphasis>string list</emphasis></entry>
25033 <entry>Default: <emphasis>unset</emphasis></entry>
25034 </row>
25035 </tbody>
25036 </tgroup>
25037 </informaltable>
25038 <para>
25039 This option defines network interfaces that are to be considered local when
25040 routing, but which are not used for listening by the daemon. See section
25041 <xref linkend="SECTreclocipadd"/> for details.
25042 </para>
25043 <para>
25044 <indexterm role="option">
25045 <primary><option>extract_addresses_remove_arguments</option></primary>
25046 </indexterm>
25047 </para>
25048 <informaltable frame="all">
25049 <tgroup cols="4" colsep="0" rowsep="0">
25050 <colspec colwidth="8*" align="left"/>
25051 <colspec colwidth="6*" align="center"/>
25052 <colspec colwidth="6*" align="center"/>
25053 <colspec colwidth="6*" align="right"/>
25054 <tbody>
25055 <row>
25056 <entry><option>extract_addresses_remove_arguments</option></entry>
25057 <entry>Use: <emphasis>main</emphasis></entry>
25058 <entry>Type: <emphasis>boolean</emphasis></entry>
25059 <entry>Default: <emphasis>true</emphasis></entry>
25060 </row>
25061 </tbody>
25062 </tgroup>
25063 </informaltable>
25064 <para>
25065 <indexterm role="option">
25066 <primary><option>-t</option></primary>
25067 </indexterm>
25068 <indexterm role="concept">
25069 <primary>command line</primary>
25070 <secondary>addresses with <option>-t</option></secondary>
25071 </indexterm>
25072 <indexterm role="concept">
25073 <primary>Sendmail compatibility</primary>
25074 <secondary><option>-t</option> option</secondary>
25075 </indexterm>
25076 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
25077 are present on the command line when the <option>-t</option> option is used to build an
25078 envelope from a message&#x2019;s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
25079 line addresses are removed from the recipients list. This is also how Smail
25080 behaves. However, other Sendmail documentation (the O&#x2019;Reilly book) states that
25081 command line addresses are added to those obtained from the header lines. When
25082 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
25083 argument headers. If it is set false, Exim adds rather than removes argument
25084 addresses.
25085 </para>
25086 <para>
25087 <indexterm role="option">
25088 <primary><option>finduser_retries</option></primary>
25089 </indexterm>
25090 </para>
25091 <informaltable frame="all">
25092 <tgroup cols="4" colsep="0" rowsep="0">
25093 <colspec colwidth="8*" align="left"/>
25094 <colspec colwidth="6*" align="center"/>
25095 <colspec colwidth="6*" align="center"/>
25096 <colspec colwidth="6*" align="right"/>
25097 <tbody>
25098 <row>
25099 <entry><option>finduser_retries</option></entry>
25100 <entry>Use: <emphasis>main</emphasis></entry>
25101 <entry>Type: <emphasis>integer</emphasis></entry>
25102 <entry>Default: <emphasis>0</emphasis></entry>
25103 </row>
25104 </tbody>
25105 </tgroup>
25106 </informaltable>
25107 <para>
25108 <indexterm role="concept">
25109 <primary>NIS, retrying user lookups</primary>
25110 </indexterm>
25111 On systems running NIS or other schemes in which user and group information is
25112 distributed from a remote system, there can be times when <function>getpwnam()</function> and
25113 related functions fail, even when given valid data, because things time out.
25114 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
25115 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
25116 many extra times to find a user or a group, waiting for one second between
25117 retries.
25118 </para>
25119 <para>
25120 <indexterm role="concept">
25121 <primary><filename>/etc/passwd</filename></primary>
25122 <secondary>multiple reading of</secondary>
25123 </indexterm>
25124 You should not set this option greater than zero if your user information is in
25125 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
25126 search the file multiple times for non-existent users, and also cause delay.
25127 </para>
25128 <para>
25129 <indexterm role="option">
25130 <primary><option>freeze_tell</option></primary>
25131 </indexterm>
25132 </para>
25133 <informaltable frame="all">
25134 <tgroup cols="4" colsep="0" rowsep="0">
25135 <colspec colwidth="8*" align="left"/>
25136 <colspec colwidth="6*" align="center"/>
25137 <colspec colwidth="6*" align="center"/>
25138 <colspec colwidth="6*" align="right"/>
25139 <tbody>
25140 <row>
25141 <entry><option>freeze_tell</option></entry>
25142 <entry>Use: <emphasis>main</emphasis></entry>
25143 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
25144 <entry>Default: <emphasis>unset</emphasis></entry>
25145 </row>
25146 </tbody>
25147 </tgroup>
25148 </informaltable>
25149 <para>
25150 <indexterm role="concept">
25151 <primary>freezing messages</primary>
25152 <secondary>sending a message when freezing</secondary>
25153 </indexterm>
25154 On encountering certain errors, or when configured to do so in a system filter,
25155 ACL, or special router, Exim freezes a message. This means that no further
25156 delivery attempts take place until an administrator thaws the message, or the
25157 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
25158 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
25159 warning message whenever it freezes something, unless the message it is
25160 freezing is a locally-generated bounce message. (Without this exception there
25161 is the possibility of looping.) The warning message is sent to the addresses
25162 supplied as the comma-separated value of this option. If several of the
25163 message&#x2019;s addresses cause freezing, only a single message is sent. If the
25164 freezing was automatic, the reason(s) for freezing can be found in the message
25165 log. If you configure freezing in a filter or ACL, you must arrange for any
25166 logging that you require.
25167 </para>
25168 <para>
25169 <indexterm role="option">
25170 <primary><option>gecos_name</option></primary>
25171 </indexterm>
25172 </para>
25173 <informaltable frame="all">
25174 <tgroup cols="4" colsep="0" rowsep="0">
25175 <colspec colwidth="8*" align="left"/>
25176 <colspec colwidth="6*" align="center"/>
25177 <colspec colwidth="6*" align="center"/>
25178 <colspec colwidth="6*" align="right"/>
25179 <tbody>
25180 <row>
25181 <entry><option>gecos_name</option></entry>
25182 <entry>Use: <emphasis>main</emphasis></entry>
25183 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25184 <entry>Default: <emphasis>unset</emphasis></entry>
25185 </row>
25186 </tbody>
25187 </tgroup>
25188 </informaltable>
25189 <para>
25190 <indexterm role="concept">
25191 <primary>HP-UX</primary>
25192 </indexterm>
25193 <indexterm role="concept">
25194 <primary><quote>gecos</quote> field, parsing</primary>
25195 </indexterm>
25196 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
25197 password file to hold other information in addition to users&#x2019; real names. Exim
25198 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
25199 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
25200 of the field are used unchanged, except that, if an ampersand is encountered,
25201 it is replaced by the user&#x2019;s login name with the first character forced to
25202 upper case, since this is a convention that is observed on many systems.
25203 </para>
25204 <para>
25205 When these options are set, <option>gecos_pattern</option> is treated as a regular
25206 expression that is to be applied to the field (again with &amp; replaced by the
25207 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
25208 user&#x2019;s name.
25209 </para>
25210 <para>
25211 <indexterm role="concept">
25212 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
25213 <secondary>in <option>gecos_name</option></secondary>
25214 </indexterm>
25215 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
25216 pick up sub-fields that were matched by the pattern. In HP-UX, where the user&#x2019;s
25217 name terminates at the first comma, the following can be used:
25218 </para>
25219 <literallayout class="monospaced">
25220 gecos_pattern = ([^,]*)
25221 gecos_name = $1
25222 </literallayout>
25223 <para>
25224 <indexterm role="option">
25225 <primary><option>gecos_pattern</option></primary>
25226 </indexterm>
25227 </para>
25228 <informaltable frame="all">
25229 <tgroup cols="4" colsep="0" rowsep="0">
25230 <colspec colwidth="8*" align="left"/>
25231 <colspec colwidth="6*" align="center"/>
25232 <colspec colwidth="6*" align="center"/>
25233 <colspec colwidth="6*" align="right"/>
25234 <tbody>
25235 <row>
25236 <entry><option>gecos_pattern</option></entry>
25237 <entry>Use: <emphasis>main</emphasis></entry>
25238 <entry>Type: <emphasis>string</emphasis></entry>
25239 <entry>Default: <emphasis>unset</emphasis></entry>
25240 </row>
25241 </tbody>
25242 </tgroup>
25243 </informaltable>
25244 <para>
25245 See <option>gecos_name</option> above.
25246 </para>
25247 <para>
25248 <indexterm role="option">
25249 <primary><option>gnutls_compat_mode</option></primary>
25250 </indexterm>
25251 </para>
25252 <informaltable frame="all">
25253 <tgroup cols="4" colsep="0" rowsep="0">
25254 <colspec colwidth="8*" align="left"/>
25255 <colspec colwidth="6*" align="center"/>
25256 <colspec colwidth="6*" align="center"/>
25257 <colspec colwidth="6*" align="right"/>
25258 <tbody>
25259 <row>
25260 <entry><option>gnutls_compat_mode</option></entry>
25261 <entry>Use: <emphasis>main</emphasis></entry>
25262 <entry>Type: <emphasis>boolean</emphasis></entry>
25263 <entry>Default: <emphasis>unset</emphasis></entry>
25264 </row>
25265 </tbody>
25266 </tgroup>
25267 </informaltable>
25268 <para>
25269 This option controls whether GnuTLS is used in compatibility mode in an Exim
25270 server. This reduces security slightly, but improves interworking with older
25271 implementations of TLS.
25272 </para>
25273 <para>
25274 option gnutls_allow_auto_pkcs11 main boolean unset
25275 This option will let GnuTLS (2.12.0 or later) autoload PKCS11 modules with
25276 the p11-kit configuration files in <filename>/etc/pkcs11/modules/</filename>.
25277 </para>
25278 <para>
25279 See
25280 <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>
25281 for documentation.
25282 </para>
25283 <para>
25284 <indexterm role="option">
25285 <primary><option>headers_charset</option></primary>
25286 </indexterm>
25287 </para>
25288 <informaltable frame="all">
25289 <tgroup cols="4" colsep="0" rowsep="0">
25290 <colspec colwidth="8*" align="left"/>
25291 <colspec colwidth="6*" align="center"/>
25292 <colspec colwidth="6*" align="center"/>
25293 <colspec colwidth="6*" align="right"/>
25294 <tbody>
25295 <row>
25296 <entry><option>headers_charset</option></entry>
25297 <entry>Use: <emphasis>main</emphasis></entry>
25298 <entry>Type: <emphasis>string</emphasis></entry>
25299 <entry>Default: <emphasis>see below</emphasis></entry>
25300 </row>
25301 </tbody>
25302 </tgroup>
25303 </informaltable>
25304 <para>
25305 This option sets a default character set for translating from encoded MIME
25306 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
25307 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
25308 ultimate default is ISO-8859-1. For more details see the description of header
25309 insertions in section <xref linkend="SECTexpansionitems"/>.
25310 </para>
25311 <para>
25312 <indexterm role="option">
25313 <primary><option>header_maxsize</option></primary>
25314 </indexterm>
25315 </para>
25316 <informaltable frame="all">
25317 <tgroup cols="4" colsep="0" rowsep="0">
25318 <colspec colwidth="8*" align="left"/>
25319 <colspec colwidth="6*" align="center"/>
25320 <colspec colwidth="6*" align="center"/>
25321 <colspec colwidth="6*" align="right"/>
25322 <tbody>
25323 <row>
25324 <entry><option>header_maxsize</option></entry>
25325 <entry>Use: <emphasis>main</emphasis></entry>
25326 <entry>Type: <emphasis>integer</emphasis></entry>
25327 <entry>Default: <emphasis>see below</emphasis></entry>
25328 </row>
25329 </tbody>
25330 </tgroup>
25331 </informaltable>
25332 <para>
25333 <indexterm role="concept">
25334 <primary>header section</primary>
25335 <secondary>maximum size of</secondary>
25336 </indexterm>
25337 <indexterm role="concept">
25338 <primary>limit</primary>
25339 <secondary>size of message header section</secondary>
25340 </indexterm>
25341 This option controls the overall maximum size of a message&#x2019;s header
25342 section. The default is the value of HEADER_MAXSIZE in
25343 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
25344 sections are rejected.
25345 </para>
25346 <para>
25347 <indexterm role="option">
25348 <primary><option>header_line_maxsize</option></primary>
25349 </indexterm>
25350 </para>
25351 <informaltable frame="all">
25352 <tgroup cols="4" colsep="0" rowsep="0">
25353 <colspec colwidth="8*" align="left"/>
25354 <colspec colwidth="6*" align="center"/>
25355 <colspec colwidth="6*" align="center"/>
25356 <colspec colwidth="6*" align="right"/>
25357 <tbody>
25358 <row>
25359 <entry><option>header_line_maxsize</option></entry>
25360 <entry>Use: <emphasis>main</emphasis></entry>
25361 <entry>Type: <emphasis>integer</emphasis></entry>
25362 <entry>Default: <emphasis>0</emphasis></entry>
25363 </row>
25364 </tbody>
25365 </tgroup>
25366 </informaltable>
25367 <para>
25368 <indexterm role="concept">
25369 <primary>header lines</primary>
25370 <secondary>maximum size of</secondary>
25371 </indexterm>
25372 <indexterm role="concept">
25373 <primary>limit</primary>
25374 <secondary>size of one header line</secondary>
25375 </indexterm>
25376 This option limits the length of any individual header line in a message, after
25377 all the continuations have been joined together. Messages with individual
25378 header lines that are longer than the limit are rejected. The default value of
25379 zero means <quote>no limit</quote>.
25380 </para>
25381 <para>
25382 <indexterm role="option">
25383 <primary><option>helo_accept_junk_hosts</option></primary>
25384 </indexterm>
25385 </para>
25386 <informaltable frame="all">
25387 <tgroup cols="4" colsep="0" rowsep="0">
25388 <colspec colwidth="8*" align="left"/>
25389 <colspec colwidth="6*" align="center"/>
25390 <colspec colwidth="6*" align="center"/>
25391 <colspec colwidth="6*" align="right"/>
25392 <tbody>
25393 <row>
25394 <entry><option>helo_accept_junk_hosts</option></entry>
25395 <entry>Use: <emphasis>main</emphasis></entry>
25396 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25397 <entry>Default: <emphasis>unset</emphasis></entry>
25398 </row>
25399 </tbody>
25400 </tgroup>
25401 </informaltable>
25402 <para>
25403 <indexterm role="concept">
25404 <primary>HELO</primary>
25405 <secondary>accepting junk data</secondary>
25406 </indexterm>
25407 <indexterm role="concept">
25408 <primary>EHLO</primary>
25409 <secondary>accepting junk data</secondary>
25410 </indexterm>
25411 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
25412 mail, and gives an error response for invalid data. Unfortunately, there are
25413 some SMTP clients that send syntactic junk. They can be accommodated by setting
25414 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
25415 if you want to do semantic checking.
25416 See also <option>helo_allow_chars</option> for a way of extending the permitted character
25417 set.
25418 </para>
25419 <para>
25420 <indexterm role="option">
25421 <primary><option>helo_allow_chars</option></primary>
25422 </indexterm>
25423 </para>
25424 <informaltable frame="all">
25425 <tgroup cols="4" colsep="0" rowsep="0">
25426 <colspec colwidth="8*" align="left"/>
25427 <colspec colwidth="6*" align="center"/>
25428 <colspec colwidth="6*" align="center"/>
25429 <colspec colwidth="6*" align="right"/>
25430 <tbody>
25431 <row>
25432 <entry><option>helo_allow_chars</option></entry>
25433 <entry>Use: <emphasis>main</emphasis></entry>
25434 <entry>Type: <emphasis>string</emphasis></entry>
25435 <entry>Default: <emphasis>unset</emphasis></entry>
25436 </row>
25437 </tbody>
25438 </tgroup>
25439 </informaltable>
25440 <para>
25441 <indexterm role="concept">
25442 <primary>HELO</primary>
25443 <secondary>underscores in</secondary>
25444 </indexterm>
25445 <indexterm role="concept">
25446 <primary>EHLO</primary>
25447 <secondary>underscores in</secondary>
25448 </indexterm>
25449 <indexterm role="concept">
25450 <primary>underscore in EHLO/HELO</primary>
25451 </indexterm>
25452 This option can be set to a string of rogue characters that are permitted in
25453 all EHLO and HELO names in addition to the standard letters, digits,
25454 hyphens, and dots. If you really must allow underscores, you can set
25455 </para>
25456 <literallayout class="monospaced">
25457 helo_allow_chars = _
25458 </literallayout>
25459 <para>
25460 Note that the value is one string, not a list.
25461 </para>
25462 <para>
25463 <indexterm role="option">
25464 <primary><option>helo_lookup_domains</option></primary>
25465 </indexterm>
25466 </para>
25467 <informaltable frame="all">
25468 <tgroup cols="4" colsep="0" rowsep="0">
25469 <colspec colwidth="8*" align="left"/>
25470 <colspec colwidth="6*" align="center"/>
25471 <colspec colwidth="6*" align="center"/>
25472 <colspec colwidth="6*" align="right"/>
25473 <tbody>
25474 <row>
25475 <entry><option>helo_lookup_domains</option></entry>
25476 <entry>Use: <emphasis>main</emphasis></entry>
25477 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25478 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
25479 </row>
25480 </tbody>
25481 </tgroup>
25482 </informaltable>
25483 <para>
25484 <indexterm role="concept">
25485 <primary>HELO</primary>
25486 <secondary>forcing reverse lookup</secondary>
25487 </indexterm>
25488 <indexterm role="concept">
25489 <primary>EHLO</primary>
25490 <secondary>forcing reverse lookup</secondary>
25491 </indexterm>
25492 If the domain given by a client in a HELO or EHLO command matches this
25493 list, a reverse lookup is done in order to establish the host&#x2019;s true name. The
25494 default forces a lookup if the client host gives the server&#x2019;s name or any of
25495 its IP addresses (in brackets), something that broken clients have been seen to
25496 do.
25497 </para>
25498 <para>
25499 <indexterm role="option">
25500 <primary><option>helo_try_verify_hosts</option></primary>
25501 </indexterm>
25502 </para>
25503 <informaltable frame="all">
25504 <tgroup cols="4" colsep="0" rowsep="0">
25505 <colspec colwidth="8*" align="left"/>
25506 <colspec colwidth="6*" align="center"/>
25507 <colspec colwidth="6*" align="center"/>
25508 <colspec colwidth="6*" align="right"/>
25509 <tbody>
25510 <row>
25511 <entry><option>helo_try_verify_hosts</option></entry>
25512 <entry>Use: <emphasis>main</emphasis></entry>
25513 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25514 <entry>Default: <emphasis>unset</emphasis></entry>
25515 </row>
25516 </tbody>
25517 </tgroup>
25518 </informaltable>
25519 <para>
25520 <indexterm role="concept">
25521 <primary>HELO verifying</primary>
25522 <secondary>optional</secondary>
25523 </indexterm>
25524 <indexterm role="concept">
25525 <primary>EHLO</primary>
25526 <secondary>verifying, optional</secondary>
25527 </indexterm>
25528 By default, Exim just checks the syntax of HELO and EHLO commands (see
25529 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
25530 to do more extensive checking of the data supplied by these commands. The ACL
25531 condition <literal>verify = helo</literal> is provided to make this possible.
25532 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
25533 to force the check to occur. From release 4.53 onwards, this is no longer
25534 necessary. If the check has not been done before <literal>verify = helo</literal> is
25535 encountered, it is done at that time. Consequently, this option is obsolete.
25536 Its specification is retained here for backwards compatibility.
25537 </para>
25538 <para>
25539 When an EHLO or HELO command is received, if the calling host matches
25540 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
25541 EHLO command either:
25542 </para>
25543 <itemizedlist>
25544 <listitem>
25545 <para>
25546 is an IP literal matching the calling address of the host, or
25547 </para>
25548 </listitem>
25549 <listitem>
25550 <para>
25551 <indexterm role="concept">
25552 <primary>DNS</primary>
25553 <secondary>reverse lookup</secondary>
25554 </indexterm>
25555 <indexterm role="concept">
25556 <primary>reverse DNS lookup</primary>
25557 </indexterm>
25558 matches the host name that Exim obtains by doing a reverse lookup of the
25559 calling host address, or
25560 </para>
25561 </listitem>
25562 <listitem>
25563 <para>
25564 when looked up in DNS yields the calling host address.
25565 </para>
25566 </listitem>
25567 </itemizedlist>
25568 <para>
25569 However, the EHLO or HELO command is not rejected if any of the checks
25570 fail. Processing continues, but the result of the check is remembered, and can
25571 be detected later in an ACL by the <literal>verify = helo</literal> condition.
25572 </para>
25573 <para>
25574 If DNS was used for successful verification, the variable
25575 <indexterm role="concept">
25576 <primary>DNS</primary>
25577 <secondary>DNSSEC</secondary>
25578 </indexterm>
25579 <varname>$helo_verify_dnssec</varname> records the DNSSEC status of the lookups.
25580 </para>
25581 <para>
25582 <indexterm role="option">
25583 <primary><option>helo_verify_hosts</option></primary>
25584 </indexterm>
25585 </para>
25586 <informaltable frame="all">
25587 <tgroup cols="4" colsep="0" rowsep="0">
25588 <colspec colwidth="8*" align="left"/>
25589 <colspec colwidth="6*" align="center"/>
25590 <colspec colwidth="6*" align="center"/>
25591 <colspec colwidth="6*" align="right"/>
25592 <tbody>
25593 <row>
25594 <entry><option>helo_verify_hosts</option></entry>
25595 <entry>Use: <emphasis>main</emphasis></entry>
25596 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25597 <entry>Default: <emphasis>unset</emphasis></entry>
25598 </row>
25599 </tbody>
25600 </tgroup>
25601 </informaltable>
25602 <para>
25603 <indexterm role="concept">
25604 <primary>HELO verifying</primary>
25605 <secondary>mandatory</secondary>
25606 </indexterm>
25607 <indexterm role="concept">
25608 <primary>EHLO</primary>
25609 <secondary>verifying, mandatory</secondary>
25610 </indexterm>
25611 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
25612 backwards compatibility. For hosts that match this option, Exim checks the host
25613 name given in the HELO or EHLO in the same way as for
25614 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
25615 rejected with a 550 error, and entries are written to the main and reject logs.
25616 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
25617 error.
25618 </para>
25619 <para>
25620 <indexterm role="option">
25621 <primary><option>hold_domains</option></primary>
25622 </indexterm>
25623 </para>
25624 <informaltable frame="all">
25625 <tgroup cols="4" colsep="0" rowsep="0">
25626 <colspec colwidth="8*" align="left"/>
25627 <colspec colwidth="6*" align="center"/>
25628 <colspec colwidth="6*" align="center"/>
25629 <colspec colwidth="6*" align="right"/>
25630 <tbody>
25631 <row>
25632 <entry><option>hold_domains</option></entry>
25633 <entry>Use: <emphasis>main</emphasis></entry>
25634 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25635 <entry>Default: <emphasis>unset</emphasis></entry>
25636 </row>
25637 </tbody>
25638 </tgroup>
25639 </informaltable>
25640 <para>
25641 <indexterm role="concept">
25642 <primary>domain</primary>
25643 <secondary>delaying delivery</secondary>
25644 </indexterm>
25645 <indexterm role="concept">
25646 <primary>delivery</primary>
25647 <secondary>delaying certain domains</secondary>
25648 </indexterm>
25649 This option allows mail for particular domains to be held on the queue
25650 manually. The option is overridden if a message delivery is forced with the
25651 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
25652 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
25653 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
25654 it is deferred every time the message is looked at.
25655 </para>
25656 <para>
25657 This option is intended as a temporary operational measure for delaying the
25658 delivery of mail while some problem is being sorted out, or some new
25659 configuration tested. If you just want to delay the processing of some
25660 domains until a queue run occurs, you should use <option>queue_domains</option> or
25661 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
25662 </para>
25663 <para>
25664 A setting of <option>hold_domains</option> does not override Exim&#x2019;s code for removing
25665 messages from the queue if they have been there longer than the longest retry
25666 time in any retry rule. If you want to hold messages for longer than the normal
25667 retry times, insert a dummy retry rule with a long retry time.
25668 </para>
25669 <para>
25670 <indexterm role="option">
25671 <primary><option>host_lookup</option></primary>
25672 </indexterm>
25673 </para>
25674 <informaltable frame="all">
25675 <tgroup cols="4" colsep="0" rowsep="0">
25676 <colspec colwidth="8*" align="left"/>
25677 <colspec colwidth="6*" align="center"/>
25678 <colspec colwidth="6*" align="center"/>
25679 <colspec colwidth="6*" align="right"/>
25680 <tbody>
25681 <row>
25682 <entry><option>host_lookup</option></entry>
25683 <entry>Use: <emphasis>main</emphasis></entry>
25684 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25685 <entry>Default: <emphasis>unset</emphasis></entry>
25686 </row>
25687 </tbody>
25688 </tgroup>
25689 </informaltable>
25690 <para>
25691 <indexterm role="concept">
25692 <primary>host name</primary>
25693 <secondary>lookup, forcing</secondary>
25694 </indexterm>
25695 Exim does not look up the name of a calling host from its IP address unless it
25696 is required to compare against some host list, or the host matches
25697 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
25698 option (which normally contains IP addresses rather than host names). The
25699 default configuration file contains
25700 </para>
25701 <literallayout class="monospaced">
25702 host_lookup = *
25703 </literallayout>
25704 <para>
25705 which causes a lookup to happen for all hosts. If the expense of these lookups
25706 is felt to be too great, the setting can be changed or removed.
25707 </para>
25708 <para>
25709 After a successful reverse lookup, Exim does a forward lookup on the name it
25710 has obtained, to verify that it yields the IP address that it started with. If
25711 this check fails, Exim behaves as if the name lookup failed.
25712 </para>
25713 <para>
25714 <indexterm role="variable">
25715 <primary><varname>$host_lookup_failed</varname></primary>
25716 </indexterm>
25717 <indexterm role="variable">
25718 <primary><varname>$sender_host_name</varname></primary>
25719 </indexterm>
25720 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
25721 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
25722 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and
25723 <literal>verify = reverse_host_lookup</literal> in ACLs.
25724 </para>
25725 <para>
25726 <indexterm role="option">
25727 <primary><option>host_lookup_order</option></primary>
25728 </indexterm>
25729 </para>
25730 <informaltable frame="all">
25731 <tgroup cols="4" colsep="0" rowsep="0">
25732 <colspec colwidth="8*" align="left"/>
25733 <colspec colwidth="6*" align="center"/>
25734 <colspec colwidth="6*" align="center"/>
25735 <colspec colwidth="6*" align="right"/>
25736 <tbody>
25737 <row>
25738 <entry><option>host_lookup_order</option></entry>
25739 <entry>Use: <emphasis>main</emphasis></entry>
25740 <entry>Type: <emphasis>string list</emphasis></entry>
25741 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
25742 </row>
25743 </tbody>
25744 </tgroup>
25745 </informaltable>
25746 <para>
25747 This option specifies the order of different lookup methods when Exim is trying
25748 to find a host name from an IP address. The default is to do a DNS lookup
25749 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
25750 if that fails. You can change the order of these lookups, or omit one entirely,
25751 if you want.
25752 </para>
25753 <para>
25754 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
25755 multiple PTR records in the DNS and the IP address is not listed in
25756 <filename>/etc/hosts</filename>. Different operating systems give different results in this
25757 case. That is why the default tries a DNS lookup first.
25758 </para>
25759 <para>
25760 <indexterm role="option">
25761 <primary><option>host_reject_connection</option></primary>
25762 </indexterm>
25763 </para>
25764 <informaltable frame="all">
25765 <tgroup cols="4" colsep="0" rowsep="0">
25766 <colspec colwidth="8*" align="left"/>
25767 <colspec colwidth="6*" align="center"/>
25768 <colspec colwidth="6*" align="center"/>
25769 <colspec colwidth="6*" align="right"/>
25770 <tbody>
25771 <row>
25772 <entry><option>host_reject_connection</option></entry>
25773 <entry>Use: <emphasis>main</emphasis></entry>
25774 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25775 <entry>Default: <emphasis>unset</emphasis></entry>
25776 </row>
25777 </tbody>
25778 </tgroup>
25779 </informaltable>
25780 <para>
25781 <indexterm role="concept">
25782 <primary>host</primary>
25783 <secondary>rejecting connections from</secondary>
25784 </indexterm>
25785 If this option is set, incoming SMTP calls from the hosts listed are rejected
25786 as soon as the connection is made.
25787 This option is obsolete, and retained only for backward compatibility, because
25788 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
25789 connections immediately.
25790 </para>
25791 <para>
25792 The ability to give an immediate rejection (either by this option or using an
25793 ACL) is provided for use in unusual cases. Many hosts will just try again,
25794 sometimes without much delay. Normally, it is better to use an ACL to reject
25795 incoming messages at a later stage, such as after RCPT commands. See
25796 chapter <xref linkend="CHAPACL"/>.
25797 </para>
25798 <para>
25799 <indexterm role="option">
25800 <primary><option>hosts_connection_nolog</option></primary>
25801 </indexterm>
25802 </para>
25803 <informaltable frame="all">
25804 <tgroup cols="4" colsep="0" rowsep="0">
25805 <colspec colwidth="8*" align="left"/>
25806 <colspec colwidth="6*" align="center"/>
25807 <colspec colwidth="6*" align="center"/>
25808 <colspec colwidth="6*" align="right"/>
25809 <tbody>
25810 <row>
25811 <entry><option>hosts_connection_nolog</option></entry>
25812 <entry>Use: <emphasis>main</emphasis></entry>
25813 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25814 <entry>Default: <emphasis>unset</emphasis></entry>
25815 </row>
25816 </tbody>
25817 </tgroup>
25818 </informaltable>
25819 <para>
25820 <indexterm role="concept">
25821 <primary>host</primary>
25822 <secondary>not logging connections from</secondary>
25823 </indexterm>
25824 This option defines a list of hosts for which connection logging does not
25825 happen, even though the <option>smtp_connection</option> log selector is set. For example,
25826 you might want not to log SMTP connections from local processes, or from
25827 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
25828 the daemon; you should therefore strive to restrict its value to a short inline
25829 list of IP addresses and networks. To disable logging SMTP connections from
25830 local processes, you must create a host list with an empty item. For example:
25831 </para>
25832 <literallayout class="monospaced">
25833 hosts_connection_nolog = :
25834 </literallayout>
25835 <para>
25836 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
25837 </para>
25838 <para revisionflag="changed">
25839 <indexterm role="option">
25840 <primary><option>hosts_proxy</option></primary>
25841 </indexterm>
25842 </para>
25843 <informaltable frame="all" revisionflag="changed">
25844 <tgroup cols="4" colsep="0" rowsep="0">
25845 <colspec colwidth="8*" align="left"/>
25846 <colspec colwidth="6*" align="center"/>
25847 <colspec colwidth="6*" align="center"/>
25848 <colspec colwidth="6*" align="right"/>
25849 <tbody>
25850 <row>
25851 <entry><option>hosts_proxy</option></entry>
25852 <entry>Use: <emphasis>main</emphasis></entry>
25853 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25854 <entry>Default: <emphasis>unset</emphasis></entry>
25855 </row>
25856 </tbody>
25857 </tgroup>
25858 </informaltable>
25859 <para revisionflag="changed">
25860 <indexterm role="concept">
25861 <primary>proxy</primary>
25862 <secondary>proxy protocol</secondary>
25863 </indexterm>
25864 This option enables use of Proxy Protocol proxies for incoming
25865 connections.  For details see <xref linkend="SECTproxyInbound"/>.
25866 </para>
25867 <para>
25868 <indexterm role="option">
25869 <primary><option>hosts_treat_as_local</option></primary>
25870 </indexterm>
25871 </para>
25872 <informaltable frame="all">
25873 <tgroup cols="4" colsep="0" rowsep="0">
25874 <colspec colwidth="8*" align="left"/>
25875 <colspec colwidth="6*" align="center"/>
25876 <colspec colwidth="6*" align="center"/>
25877 <colspec colwidth="6*" align="right"/>
25878 <tbody>
25879 <row>
25880 <entry><option>hosts_treat_as_local</option></entry>
25881 <entry>Use: <emphasis>main</emphasis></entry>
25882 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25883 <entry>Default: <emphasis>unset</emphasis></entry>
25884 </row>
25885 </tbody>
25886 </tgroup>
25887 </informaltable>
25888 <para>
25889 <indexterm role="concept">
25890 <primary>local host</primary>
25891 <secondary>domains treated as</secondary>
25892 </indexterm>
25893 <indexterm role="concept">
25894 <primary>host</primary>
25895 <secondary>treated as local</secondary>
25896 </indexterm>
25897 If this option is set, any host names that match the domain list are treated as
25898 if they were the local host when Exim is scanning host lists obtained from MX
25899 records
25900 or other sources. Note that the value of this option is a domain list, not a
25901 host list, because it is always used to check host names, not IP addresses.
25902 </para>
25903 <para>
25904 This option also applies when Exim is matching the special items
25905 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
25906 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
25907 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
25908 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
25909 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
25910 interfaces and recognizing the local host.
25911 </para>
25912 <para>
25913 <indexterm role="option">
25914 <primary><option>ibase_servers</option></primary>
25915 </indexterm>
25916 </para>
25917 <informaltable frame="all">
25918 <tgroup cols="4" colsep="0" rowsep="0">
25919 <colspec colwidth="8*" align="left"/>
25920 <colspec colwidth="6*" align="center"/>
25921 <colspec colwidth="6*" align="center"/>
25922 <colspec colwidth="6*" align="right"/>
25923 <tbody>
25924 <row>
25925 <entry><option>ibase_servers</option></entry>
25926 <entry>Use: <emphasis>main</emphasis></entry>
25927 <entry>Type: <emphasis>string list</emphasis></entry>
25928 <entry>Default: <emphasis>unset</emphasis></entry>
25929 </row>
25930 </tbody>
25931 </tgroup>
25932 </informaltable>
25933 <para>
25934 <indexterm role="concept">
25935 <primary>InterBase</primary>
25936 <secondary>server list</secondary>
25937 </indexterm>
25938 This option provides a list of InterBase servers and associated connection data,
25939 to be used in conjunction with <command>ibase</command> lookups (see section <xref linkend="SECID72"/>).
25940 The option is available only if Exim has been built with InterBase support.
25941 </para>
25942 <para>
25943 <indexterm role="option">
25944 <primary><option>ignore_bounce_errors_after</option></primary>
25945 </indexterm>
25946 </para>
25947 <informaltable frame="all">
25948 <tgroup cols="4" colsep="0" rowsep="0">
25949 <colspec colwidth="8*" align="left"/>
25950 <colspec colwidth="6*" align="center"/>
25951 <colspec colwidth="6*" align="center"/>
25952 <colspec colwidth="6*" align="right"/>
25953 <tbody>
25954 <row>
25955 <entry><option>ignore_bounce_errors_after</option></entry>
25956 <entry>Use: <emphasis>main</emphasis></entry>
25957 <entry>Type: <emphasis>time</emphasis></entry>
25958 <entry>Default: <emphasis>10w</emphasis></entry>
25959 </row>
25960 </tbody>
25961 </tgroup>
25962 </informaltable>
25963 <para>
25964 <indexterm role="concept">
25965 <primary>bounce message</primary>
25966 <secondary>discarding</secondary>
25967 </indexterm>
25968 <indexterm role="concept">
25969 <primary>discarding bounce message</primary>
25970 </indexterm>
25971 This option affects the processing of bounce messages that cannot be delivered,
25972 that is, those that suffer a permanent delivery failure. (Bounce messages that
25973 suffer temporary delivery failures are of course retried in the usual way.)
25974 </para>
25975 <para>
25976 After a permanent delivery failure, bounce messages are frozen,
25977 because there is no sender to whom they can be returned. When a frozen bounce
25978 message has been on the queue for more than the given time, it is unfrozen at
25979 the next queue run, and a further delivery is attempted. If delivery fails
25980 again, the bounce message is discarded. This makes it possible to keep failed
25981 bounce messages around for a shorter time than the normal maximum retry time
25982 for frozen messages. For example,
25983 </para>
25984 <literallayout class="monospaced">
25985 ignore_bounce_errors_after = 12h
25986 </literallayout>
25987 <para>
25988 retries failed bounce message deliveries after 12 hours, discarding any further
25989 failures. If the value of this option is set to a zero time period, bounce
25990 failures are discarded immediately. Setting a very long time (as in the default
25991 value) has the effect of disabling this option. For ways of automatically
25992 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
25993 <option>timeout_frozen_after</option>.
25994 </para>
25995 <para>
25996 <indexterm role="option">
25997 <primary><option>ignore_fromline_hosts</option></primary>
25998 </indexterm>
25999 </para>
26000 <informaltable frame="all">
26001 <tgroup cols="4" colsep="0" rowsep="0">
26002 <colspec colwidth="8*" align="left"/>
26003 <colspec colwidth="6*" align="center"/>
26004 <colspec colwidth="6*" align="center"/>
26005 <colspec colwidth="6*" align="right"/>
26006 <tbody>
26007 <row>
26008 <entry><option>ignore_fromline_hosts</option></entry>
26009 <entry>Use: <emphasis>main</emphasis></entry>
26010 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26011 <entry>Default: <emphasis>unset</emphasis></entry>
26012 </row>
26013 </tbody>
26014 </tgroup>
26015 </informaltable>
26016 <para>
26017 <indexterm role="concept">
26018 <primary><quote>From</quote> line</primary>
26019 </indexterm>
26020 <indexterm role="concept">
26021 <primary>UUCP</primary>
26022 <secondary><quote>From</quote> line</secondary>
26023 </indexterm>
26024 Some broken SMTP clients insist on sending a UUCP-like <quote>From&nbsp;</quote> line before
26025 the headers of a message. By default this is treated as the start of the
26026 message&#x2019;s body, which means that any following headers are not recognized as
26027 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
26028 match those hosts that insist on sending it. If the sender is actually a local
26029 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
26030 <option>ignore_fromline_local</option> must be set to achieve this effect.
26031 </para>
26032 <para>
26033 <indexterm role="option">
26034 <primary><option>ignore_fromline_local</option></primary>
26035 </indexterm>
26036 </para>
26037 <informaltable frame="all">
26038 <tgroup cols="4" colsep="0" rowsep="0">
26039 <colspec colwidth="8*" align="left"/>
26040 <colspec colwidth="6*" align="center"/>
26041 <colspec colwidth="6*" align="center"/>
26042 <colspec colwidth="6*" align="right"/>
26043 <tbody>
26044 <row>
26045 <entry><option>ignore_fromline_local</option></entry>
26046 <entry>Use: <emphasis>main</emphasis></entry>
26047 <entry>Type: <emphasis>boolean</emphasis></entry>
26048 <entry>Default: <emphasis>false</emphasis></entry>
26049 </row>
26050 </tbody>
26051 </tgroup>
26052 </informaltable>
26053 <para>
26054 See <option>ignore_fromline_hosts</option> above.
26055 </para>
26056 <para revisionflag="changed">
26057 <indexterm role="option">
26058 <primary><option>keep_environment</option></primary>
26059 </indexterm>
26060 </para>
26061 <informaltable frame="all" revisionflag="changed">
26062 <tgroup cols="4" colsep="0" rowsep="0">
26063 <colspec colwidth="8*" align="left"/>
26064 <colspec colwidth="6*" align="center"/>
26065 <colspec colwidth="6*" align="center"/>
26066 <colspec colwidth="6*" align="right"/>
26067 <tbody>
26068 <row>
26069 <entry><option>keep_environment</option></entry>
26070 <entry>Use: <emphasis>main</emphasis></entry>
26071 <entry>Type: <emphasis>string list</emphasis></entry>
26072 <entry>Default: <emphasis>unset</emphasis></entry>
26073 </row>
26074 </tbody>
26075 </tgroup>
26076 </informaltable>
26077 <para revisionflag="changed">
26078 <indexterm role="concept">
26079 <primary>environment</primary>
26080 <secondary>values from</secondary>
26081 </indexterm>
26082 This option contains a string list of environment variables to keep.
26083 You have to trust these variables or you have to be sure that
26084 these variables do not impose any security risk. Keep in mind that
26085 during the startup phase Exim is running with an effective UID 0 in most
26086 installations. As the default value is an empty list, the default
26087 environment for using libraries, running embedded Perl code, or running
26088 external binaries is empty, and does not not even contain PATH or HOME.
26089 </para>
26090 <para revisionflag="changed">
26091 Actually the list is interpreted as a list of patterns
26092 (<xref linkend="SECTlistexpand"/>), except that it is not expanded first.
26093 </para>
26094 <para revisionflag="changed">
26095 WARNING: Macro substitution is still done first, so having a macro
26096 FOO and having FOO_HOME in your <option>keep_environment</option> option may have
26097 unexpected results. You may work around this using a regular expression
26098 that does not match the macro name: ^[F]OO_HOME$.
26099 </para>
26100 <para revisionflag="changed">
26101 Current versions of Exim issue a warning during startup if you do not mention
26102 <option>keep_environment</option> in your runtime configuration file and if your
26103 current environment is not empty. Future versions may not issue that warning
26104 anymore.
26105 </para>
26106 <para revisionflag="changed">
26107 See the <option>add_environment</option> main config option for a way to set
26108 environment variables to a fixed value.  The environment for <command>pipe</command>
26109 transports is handled separately, see section <xref linkend="SECTpipeenv"/> for
26110 details.
26111 </para>
26112 <para>
26113 <indexterm role="option">
26114 <primary><option>keep_malformed</option></primary>
26115 </indexterm>
26116 </para>
26117 <informaltable frame="all">
26118 <tgroup cols="4" colsep="0" rowsep="0">
26119 <colspec colwidth="8*" align="left"/>
26120 <colspec colwidth="6*" align="center"/>
26121 <colspec colwidth="6*" align="center"/>
26122 <colspec colwidth="6*" align="right"/>
26123 <tbody>
26124 <row>
26125 <entry><option>keep_malformed</option></entry>
26126 <entry>Use: <emphasis>main</emphasis></entry>
26127 <entry>Type: <emphasis>time</emphasis></entry>
26128 <entry>Default: <emphasis>4d</emphasis></entry>
26129 </row>
26130 </tbody>
26131 </tgroup>
26132 </informaltable>
26133 <para>
26134 This option specifies the length of time to keep messages whose spool files
26135 have been corrupted in some way. This should, of course, never happen. At the
26136 next attempt to deliver such a message, it gets removed. The incident is
26137 logged.
26138 </para>
26139 <para>
26140 <indexterm role="option">
26141 <primary><option>ldap_ca_cert_dir</option></primary>
26142 </indexterm>
26143 </para>
26144 <informaltable frame="all">
26145 <tgroup cols="4" colsep="0" rowsep="0">
26146 <colspec colwidth="8*" align="left"/>
26147 <colspec colwidth="6*" align="center"/>
26148 <colspec colwidth="6*" align="center"/>
26149 <colspec colwidth="6*" align="right"/>
26150 <tbody>
26151 <row>
26152 <entry><option>ldap_ca_cert_dir</option></entry>
26153 <entry>Use: <emphasis>main</emphasis></entry>
26154 <entry>Type: <emphasis>string</emphasis></entry>
26155 <entry>Default: <emphasis>unset</emphasis></entry>
26156 </row>
26157 </tbody>
26158 </tgroup>
26159 </informaltable>
26160 <para>
26161 <indexterm role="concept">
26162 <primary>LDAP</primary>
26163 <secondary>,</secondary>
26164 </indexterm>
26165 <indexterm role="concept">
26166 <primary>certificate</primary>
26167 <secondary>directory for LDAP</secondary>
26168 </indexterm>
26169 This option indicates which directory contains CA certificates for verifying
26170 a TLS certificate presented by an LDAP server.
26171 While Exim does not provide a default value, your SSL library may.
26172 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
26173 and constrained to be a directory.
26174 </para>
26175 <para>
26176 <indexterm role="option">
26177 <primary><option>ldap_ca_cert_file</option></primary>
26178 </indexterm>
26179 </para>
26180 <informaltable frame="all">
26181 <tgroup cols="4" colsep="0" rowsep="0">
26182 <colspec colwidth="8*" align="left"/>
26183 <colspec colwidth="6*" align="center"/>
26184 <colspec colwidth="6*" align="center"/>
26185 <colspec colwidth="6*" align="right"/>
26186 <tbody>
26187 <row>
26188 <entry><option>ldap_ca_cert_file</option></entry>
26189 <entry>Use: <emphasis>main</emphasis></entry>
26190 <entry>Type: <emphasis>string</emphasis></entry>
26191 <entry>Default: <emphasis>unset</emphasis></entry>
26192 </row>
26193 </tbody>
26194 </tgroup>
26195 </informaltable>
26196 <para>
26197 <indexterm role="concept">
26198 <primary>LDAP</primary>
26199 <secondary>,</secondary>
26200 </indexterm>
26201 <indexterm role="concept">
26202 <primary>certificate</primary>
26203 <secondary>file for LDAP</secondary>
26204 </indexterm>
26205 This option indicates which file contains CA certificates for verifying
26206 a TLS certificate presented by an LDAP server.
26207 While Exim does not provide a default value, your SSL library may.
26208 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
26209 and constrained to be a file.
26210 </para>
26211 <para>
26212 <indexterm role="option">
26213 <primary><option>ldap_cert_file</option></primary>
26214 </indexterm>
26215 </para>
26216 <informaltable frame="all">
26217 <tgroup cols="4" colsep="0" rowsep="0">
26218 <colspec colwidth="8*" align="left"/>
26219 <colspec colwidth="6*" align="center"/>
26220 <colspec colwidth="6*" align="center"/>
26221 <colspec colwidth="6*" align="right"/>
26222 <tbody>
26223 <row>
26224 <entry><option>ldap_cert_file</option></entry>
26225 <entry>Use: <emphasis>main</emphasis></entry>
26226 <entry>Type: <emphasis>string</emphasis></entry>
26227 <entry>Default: <emphasis>unset</emphasis></entry>
26228 </row>
26229 </tbody>
26230 </tgroup>
26231 </informaltable>
26232 <para>
26233 <indexterm role="concept">
26234 <primary>LDAP</primary>
26235 <secondary>TLS client certificate file</secondary>
26236 </indexterm>
26237 <indexterm role="concept">
26238 <primary>certificate</primary>
26239 <secondary>file for LDAP</secondary>
26240 </indexterm>
26241 This option indicates which file contains an TLS client certificate which
26242 Exim should present to the LDAP server during TLS negotiation.
26243 Should be used together with <option>ldap_cert_key</option>.
26244 </para>
26245 <para>
26246 <indexterm role="option">
26247 <primary><option>ldap_cert_key</option></primary>
26248 </indexterm>
26249 </para>
26250 <informaltable frame="all">
26251 <tgroup cols="4" colsep="0" rowsep="0">
26252 <colspec colwidth="8*" align="left"/>
26253 <colspec colwidth="6*" align="center"/>
26254 <colspec colwidth="6*" align="center"/>
26255 <colspec colwidth="6*" align="right"/>
26256 <tbody>
26257 <row>
26258 <entry><option>ldap_cert_key</option></entry>
26259 <entry>Use: <emphasis>main</emphasis></entry>
26260 <entry>Type: <emphasis>string</emphasis></entry>
26261 <entry>Default: <emphasis>unset</emphasis></entry>
26262 </row>
26263 </tbody>
26264 </tgroup>
26265 </informaltable>
26266 <para>
26267 <indexterm role="concept">
26268 <primary>LDAP</primary>
26269 <secondary>TLS client key file</secondary>
26270 </indexterm>
26271 <indexterm role="concept">
26272 <primary>certificate</primary>
26273 <secondary>key for LDAP</secondary>
26274 </indexterm>
26275 This option indicates which file contains the secret/private key to use
26276 to prove identity to the LDAP server during TLS negotiation.
26277 Should be used together with <option>ldap_cert_file</option>, which contains the
26278 identity to be proven.
26279 </para>
26280 <para>
26281 <indexterm role="option">
26282 <primary><option>ldap_cipher_suite</option></primary>
26283 </indexterm>
26284 </para>
26285 <informaltable frame="all">
26286 <tgroup cols="4" colsep="0" rowsep="0">
26287 <colspec colwidth="8*" align="left"/>
26288 <colspec colwidth="6*" align="center"/>
26289 <colspec colwidth="6*" align="center"/>
26290 <colspec colwidth="6*" align="right"/>
26291 <tbody>
26292 <row>
26293 <entry><option>ldap_cipher_suite</option></entry>
26294 <entry>Use: <emphasis>main</emphasis></entry>
26295 <entry>Type: <emphasis>string</emphasis></entry>
26296 <entry>Default: <emphasis>unset</emphasis></entry>
26297 </row>
26298 </tbody>
26299 </tgroup>
26300 </informaltable>
26301 <para>
26302 <indexterm role="concept">
26303 <primary>LDAP</primary>
26304 <secondary>TLS cipher suite</secondary>
26305 </indexterm>
26306 This controls the TLS cipher-suite negotiation during TLS negotiation with
26307 the LDAP server.  See <xref linkend="SECTreqciphssl"/> for more details of the format of
26308 cipher-suite options with OpenSSL (as used by LDAP client libraries).
26309 </para>
26310 <para>
26311 <indexterm role="option">
26312 <primary><option>ldap_default_servers</option></primary>
26313 </indexterm>
26314 </para>
26315 <informaltable frame="all">
26316 <tgroup cols="4" colsep="0" rowsep="0">
26317 <colspec colwidth="8*" align="left"/>
26318 <colspec colwidth="6*" align="center"/>
26319 <colspec colwidth="6*" align="center"/>
26320 <colspec colwidth="6*" align="right"/>
26321 <tbody>
26322 <row>
26323 <entry><option>ldap_default_servers</option></entry>
26324 <entry>Use: <emphasis>main</emphasis></entry>
26325 <entry>Type: <emphasis>string list</emphasis></entry>
26326 <entry>Default: <emphasis>unset</emphasis></entry>
26327 </row>
26328 </tbody>
26329 </tgroup>
26330 </informaltable>
26331 <para>
26332 <indexterm role="concept">
26333 <primary>LDAP</primary>
26334 <secondary>default servers</secondary>
26335 </indexterm>
26336 This option provides a list of LDAP servers which are tried in turn when an
26337 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
26338 details of LDAP queries. This option is available only when Exim has been built
26339 with LDAP support.
26340 </para>
26341 <para>
26342 <indexterm role="option">
26343 <primary><option>ldap_require_cert</option></primary>
26344 </indexterm>
26345 </para>
26346 <informaltable frame="all">
26347 <tgroup cols="4" colsep="0" rowsep="0">
26348 <colspec colwidth="8*" align="left"/>
26349 <colspec colwidth="6*" align="center"/>
26350 <colspec colwidth="6*" align="center"/>
26351 <colspec colwidth="6*" align="right"/>
26352 <tbody>
26353 <row>
26354 <entry><option>ldap_require_cert</option></entry>
26355 <entry>Use: <emphasis>main</emphasis></entry>
26356 <entry>Type: <emphasis>string</emphasis></entry>
26357 <entry>Default: <emphasis>unset.</emphasis></entry>
26358 </row>
26359 </tbody>
26360 </tgroup>
26361 </informaltable>
26362 <para>
26363 <indexterm role="concept">
26364 <primary>LDAP</primary>
26365 <secondary>policy for LDAP server TLS cert presentation</secondary>
26366 </indexterm>
26367 This should be one of the values "hard", "demand", "allow", "try" or "never".
26368 A value other than one of these is interpreted as "never".
26369 See the entry "TLS_REQCERT" in your system man page for ldap.conf(5).
26370 Although Exim does not set a default, the LDAP library probably defaults
26371 to hard/demand.
26372 </para>
26373 <para>
26374 <indexterm role="option">
26375 <primary><option>ldap_start_tls</option></primary>
26376 </indexterm>
26377 </para>
26378 <informaltable frame="all">
26379 <tgroup cols="4" colsep="0" rowsep="0">
26380 <colspec colwidth="8*" align="left"/>
26381 <colspec colwidth="6*" align="center"/>
26382 <colspec colwidth="6*" align="center"/>
26383 <colspec colwidth="6*" align="right"/>
26384 <tbody>
26385 <row>
26386 <entry><option>ldap_start_tls</option></entry>
26387 <entry>Use: <emphasis>main</emphasis></entry>
26388 <entry>Type: <emphasis>boolean</emphasis></entry>
26389 <entry>Default: <emphasis>false</emphasis></entry>
26390 </row>
26391 </tbody>
26392 </tgroup>
26393 </informaltable>
26394 <para>
26395 <indexterm role="concept">
26396 <primary>LDAP</primary>
26397 <secondary>whether or not to negotiate TLS</secondary>
26398 </indexterm>
26399 If set, Exim will attempt to negotiate TLS with the LDAP server when
26400 connecting on a regular LDAP port.  This is the LDAP equivalent of SMTP&#x2019;s
26401 "STARTTLS".  This is distinct from using "ldaps", which is the LDAP form
26402 of SSL-on-connect.
26403 In the event of failure to negotiate TLS, the action taken is controlled
26404 by <option>ldap_require_cert</option>.
26405 </para>
26406 <para>
26407 <indexterm role="option">
26408 <primary><option>ldap_version</option></primary>
26409 </indexterm>
26410 </para>
26411 <informaltable frame="all">
26412 <tgroup cols="4" colsep="0" rowsep="0">
26413 <colspec colwidth="8*" align="left"/>
26414 <colspec colwidth="6*" align="center"/>
26415 <colspec colwidth="6*" align="center"/>
26416 <colspec colwidth="6*" align="right"/>
26417 <tbody>
26418 <row>
26419 <entry><option>ldap_version</option></entry>
26420 <entry>Use: <emphasis>main</emphasis></entry>
26421 <entry>Type: <emphasis>integer</emphasis></entry>
26422 <entry>Default: <emphasis>unset</emphasis></entry>
26423 </row>
26424 </tbody>
26425 </tgroup>
26426 </informaltable>
26427 <para>
26428 <indexterm role="concept">
26429 <primary>LDAP</primary>
26430 <secondary>protocol version, forcing</secondary>
26431 </indexterm>
26432 This option can be used to force Exim to set a specific protocol version for
26433 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
26434 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
26435 the LDAP headers; otherwise it is 2. This option is available only when Exim
26436 has been built with LDAP support.
26437 </para>
26438 <para>
26439 <indexterm role="option">
26440 <primary><option>local_from_check</option></primary>
26441 </indexterm>
26442 </para>
26443 <informaltable frame="all">
26444 <tgroup cols="4" colsep="0" rowsep="0">
26445 <colspec colwidth="8*" align="left"/>
26446 <colspec colwidth="6*" align="center"/>
26447 <colspec colwidth="6*" align="center"/>
26448 <colspec colwidth="6*" align="right"/>
26449 <tbody>
26450 <row>
26451 <entry><option>local_from_check</option></entry>
26452 <entry>Use: <emphasis>main</emphasis></entry>
26453 <entry>Type: <emphasis>boolean</emphasis></entry>
26454 <entry>Default: <emphasis>true</emphasis></entry>
26455 </row>
26456 </tbody>
26457 </tgroup>
26458 </informaltable>
26459 <para>
26460 <indexterm role="concept">
26461 <primary><emphasis>Sender:</emphasis> header line</primary>
26462 <secondary>disabling addition of</secondary>
26463 </indexterm>
26464 <indexterm role="concept">
26465 <primary><emphasis>From:</emphasis> header line</primary>
26466 <secondary>disabling checking of</secondary>
26467 </indexterm>
26468 When a message is submitted locally (that is, not over a TCP/IP connection) by
26469 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
26470 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
26471 the domain specified by <option>qualify_domain</option>.
26472 </para>
26473 <para>
26474 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
26475 locally submitted message is automatically qualified by Exim, unless the
26476 <option>-bnq</option> command line option is used.
26477 </para>
26478 <para>
26479 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
26480 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
26481 <emphasis>Sender:</emphasis> header with an address constructed from the calling user&#x2019;s login
26482 and the default qualify domain.
26483 </para>
26484 <para>
26485 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
26486 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
26487 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
26488 <option>local_sender_retain</option> to be true.
26489 </para>
26490 <para>
26491 <indexterm role="concept">
26492 <primary>envelope sender</primary>
26493 </indexterm>
26494 These options affect only the header lines in the message. The envelope sender
26495 is still forced to be the login id at the qualify domain unless
26496 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
26497 </para>
26498 <para>
26499 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
26500 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
26501 has more details about <emphasis>Sender:</emphasis> processing.
26502 </para>
26503 <para>
26504 <indexterm role="option">
26505 <primary><option>local_from_prefix</option></primary>
26506 </indexterm>
26507 </para>
26508 <informaltable frame="all">
26509 <tgroup cols="4" colsep="0" rowsep="0">
26510 <colspec colwidth="8*" align="left"/>
26511 <colspec colwidth="6*" align="center"/>
26512 <colspec colwidth="6*" align="center"/>
26513 <colspec colwidth="6*" align="right"/>
26514 <tbody>
26515 <row>
26516 <entry><option>local_from_prefix</option></entry>
26517 <entry>Use: <emphasis>main</emphasis></entry>
26518 <entry>Type: <emphasis>string</emphasis></entry>
26519 <entry>Default: <emphasis>unset</emphasis></entry>
26520 </row>
26521 </tbody>
26522 </tgroup>
26523 </informaltable>
26524 <para>
26525 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
26526 matching the login id (see <option>local_from_check</option> above), it can be configured to
26527 ignore certain prefixes and suffixes in the local part of the address. This is
26528 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
26529 appropriate lists, in the same form as the <option>local_part_prefix</option> and
26530 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
26531 example, if
26532 </para>
26533 <literallayout class="monospaced">
26534 local_from_prefix = *-
26535 </literallayout>
26536 <para>
26537 is set, a <emphasis>From:</emphasis> line containing
26538 </para>
26539 <literallayout class="monospaced">
26540 From: anything-user@your.domain.example
26541 </literallayout>
26542 <para>
26543 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
26544 matches the actual sender address that is constructed from the login name and
26545 qualify domain.
26546 </para>
26547 <para>
26548 <indexterm role="option">
26549 <primary><option>local_from_suffix</option></primary>
26550 </indexterm>
26551 </para>
26552 <informaltable frame="all">
26553 <tgroup cols="4" colsep="0" rowsep="0">
26554 <colspec colwidth="8*" align="left"/>
26555 <colspec colwidth="6*" align="center"/>
26556 <colspec colwidth="6*" align="center"/>
26557 <colspec colwidth="6*" align="right"/>
26558 <tbody>
26559 <row>
26560 <entry><option>local_from_suffix</option></entry>
26561 <entry>Use: <emphasis>main</emphasis></entry>
26562 <entry>Type: <emphasis>string</emphasis></entry>
26563 <entry>Default: <emphasis>unset</emphasis></entry>
26564 </row>
26565 </tbody>
26566 </tgroup>
26567 </informaltable>
26568 <para>
26569 See <option>local_from_prefix</option> above.
26570 </para>
26571 <para>
26572 <indexterm role="option">
26573 <primary><option>local_interfaces</option></primary>
26574 </indexterm>
26575 </para>
26576 <informaltable frame="all">
26577 <tgroup cols="4" colsep="0" rowsep="0">
26578 <colspec colwidth="8*" align="left"/>
26579 <colspec colwidth="6*" align="center"/>
26580 <colspec colwidth="6*" align="center"/>
26581 <colspec colwidth="6*" align="right"/>
26582 <tbody>
26583 <row>
26584 <entry><option>local_interfaces</option></entry>
26585 <entry>Use: <emphasis>main</emphasis></entry>
26586 <entry>Type: <emphasis>string list</emphasis></entry>
26587 <entry>Default: <emphasis>see below</emphasis></entry>
26588 </row>
26589 </tbody>
26590 </tgroup>
26591 </informaltable>
26592 <para>
26593 This option controls which network interfaces are used by the daemon for
26594 listening; they are also used to identify the local host when routing. Chapter
26595 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
26596 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
26597 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
26598 <option>local_interfaces</option> is
26599 </para>
26600 <literallayout class="monospaced">
26601 local_interfaces = 0.0.0.0
26602 </literallayout>
26603 <para>
26604 when Exim is built without IPv6 support; otherwise it is
26605 </para>
26606 <literallayout class="monospaced">
26607 local_interfaces = &lt;; ::0 ; 0.0.0.0
26608 </literallayout>
26609 <para>
26610 <indexterm role="option">
26611 <primary><option>local_scan_timeout</option></primary>
26612 </indexterm>
26613 </para>
26614 <informaltable frame="all">
26615 <tgroup cols="4" colsep="0" rowsep="0">
26616 <colspec colwidth="8*" align="left"/>
26617 <colspec colwidth="6*" align="center"/>
26618 <colspec colwidth="6*" align="center"/>
26619 <colspec colwidth="6*" align="right"/>
26620 <tbody>
26621 <row>
26622 <entry><option>local_scan_timeout</option></entry>
26623 <entry>Use: <emphasis>main</emphasis></entry>
26624 <entry>Type: <emphasis>time</emphasis></entry>
26625 <entry>Default: <emphasis>5m</emphasis></entry>
26626 </row>
26627 </tbody>
26628 </tgroup>
26629 </informaltable>
26630 <para>
26631 <indexterm role="concept">
26632 <primary>timeout</primary>
26633 <secondary>for <function>local_scan()</function> function</secondary>
26634 </indexterm>
26635 <indexterm role="concept">
26636 <primary><function>local_scan()</function> function</primary>
26637 <secondary>timeout</secondary>
26638 </indexterm>
26639 This timeout applies to the <function>local_scan()</function> function (see chapter
26640 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
26641 the incoming message is rejected with a temporary error if it is an SMTP
26642 message. For a non-SMTP message, the message is dropped and Exim ends with a
26643 non-zero code. The incident is logged on the main and reject logs.
26644 </para>
26645 <para>
26646 <indexterm role="option">
26647 <primary><option>local_sender_retain</option></primary>
26648 </indexterm>
26649 </para>
26650 <informaltable frame="all">
26651 <tgroup cols="4" colsep="0" rowsep="0">
26652 <colspec colwidth="8*" align="left"/>
26653 <colspec colwidth="6*" align="center"/>
26654 <colspec colwidth="6*" align="center"/>
26655 <colspec colwidth="6*" align="right"/>
26656 <tbody>
26657 <row>
26658 <entry><option>local_sender_retain</option></entry>
26659 <entry>Use: <emphasis>main</emphasis></entry>
26660 <entry>Type: <emphasis>boolean</emphasis></entry>
26661 <entry>Default: <emphasis>false</emphasis></entry>
26662 </row>
26663 </tbody>
26664 </tgroup>
26665 </informaltable>
26666 <para>
26667 <indexterm role="concept">
26668 <primary><emphasis>Sender:</emphasis> header line</primary>
26669 <secondary>retaining from local submission</secondary>
26670 </indexterm>
26671 When a message is submitted locally (that is, not over a TCP/IP connection) by
26672 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
26673 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
26674 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
26675 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
26676 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
26677 </para>
26678 <para>
26679 <indexterm role="option">
26680 <primary><option>localhost_number</option></primary>
26681 </indexterm>
26682 </para>
26683 <informaltable frame="all">
26684 <tgroup cols="4" colsep="0" rowsep="0">
26685 <colspec colwidth="8*" align="left"/>
26686 <colspec colwidth="6*" align="center"/>
26687 <colspec colwidth="6*" align="center"/>
26688 <colspec colwidth="6*" align="right"/>
26689 <tbody>
26690 <row>
26691 <entry><option>localhost_number</option></entry>
26692 <entry>Use: <emphasis>main</emphasis></entry>
26693 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26694 <entry>Default: <emphasis>unset</emphasis></entry>
26695 </row>
26696 </tbody>
26697 </tgroup>
26698 </informaltable>
26699 <para>
26700 <indexterm role="concept">
26701 <primary>host</primary>
26702 <secondary>locally unique number for</secondary>
26703 </indexterm>
26704 <indexterm role="concept">
26705 <primary>message ids</primary>
26706 <secondary>with multiple hosts</secondary>
26707 </indexterm>
26708 <indexterm role="variable">
26709 <primary><varname>$localhost_number</varname></primary>
26710 </indexterm>
26711 Exim&#x2019;s message ids are normally unique only within the local host. If
26712 uniqueness among a set of hosts is required, each host must set a different
26713 value for the <option>localhost_number</option> option. The string is expanded immediately
26714 after reading the configuration file (so that a number can be computed from the
26715 host name, for example) and the result of the expansion must be a number in the
26716 range 0&ndash;16 (or 0&ndash;10 on operating systems with case-insensitive file
26717 systems). This is available in subsequent string expansions via the variable
26718 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
26719 characters of the message id, instead of just being a fractional part of the
26720 time, are computed from the time and the local host number as described in
26721 section <xref linkend="SECTmessiden"/>.
26722 </para>
26723 <para>
26724 <indexterm role="option">
26725 <primary><option>log_file_path</option></primary>
26726 </indexterm>
26727 </para>
26728 <informaltable frame="all">
26729 <tgroup cols="4" colsep="0" rowsep="0">
26730 <colspec colwidth="8*" align="left"/>
26731 <colspec colwidth="6*" align="center"/>
26732 <colspec colwidth="6*" align="center"/>
26733 <colspec colwidth="6*" align="right"/>
26734 <tbody>
26735 <row>
26736 <entry><option>log_file_path</option></entry>
26737 <entry>Use: <emphasis>main</emphasis></entry>
26738 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
26739 <entry>Default: <emphasis>set at compile time</emphasis></entry>
26740 </row>
26741 </tbody>
26742 </tgroup>
26743 </informaltable>
26744 <para>
26745 <indexterm role="concept">
26746 <primary>log</primary>
26747 <secondary>file path for</secondary>
26748 </indexterm>
26749 This option sets the path which is used to determine the names of Exim&#x2019;s log
26750 files, or indicates that logging is to be to syslog, or both. It is expanded
26751 when Exim is entered, so it can, for example, contain a reference to the host
26752 name. If no specific path is set for the log files at compile or run time,
26753 or if the option is unset at run time (i.e.  <literal>log_file_path = </literal>)
26754 they are written in a sub-directory called <filename>log</filename> in Exim&#x2019;s spool directory.
26755 Chapter <xref linkend="CHAPlog"/> contains further details about Exim&#x2019;s logging, and
26756 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
26757 used. If this string is fixed at your installation (contains no expansion
26758 variables) it is recommended that you do not set this option in the
26759 configuration file, but instead supply the path using LOG_FILE_PATH in
26760 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
26761 early on &ndash; in particular, failure to read the configuration file.
26762 </para>
26763 <para>
26764 <indexterm role="option">
26765 <primary><option>log_selector</option></primary>
26766 </indexterm>
26767 </para>
26768 <informaltable frame="all">
26769 <tgroup cols="4" colsep="0" rowsep="0">
26770 <colspec colwidth="8*" align="left"/>
26771 <colspec colwidth="6*" align="center"/>
26772 <colspec colwidth="6*" align="center"/>
26773 <colspec colwidth="6*" align="right"/>
26774 <tbody>
26775 <row>
26776 <entry><option>log_selector</option></entry>
26777 <entry>Use: <emphasis>main</emphasis></entry>
26778 <entry>Type: <emphasis>string</emphasis></entry>
26779 <entry>Default: <emphasis>unset</emphasis></entry>
26780 </row>
26781 </tbody>
26782 </tgroup>
26783 </informaltable>
26784 <para>
26785 <indexterm role="concept">
26786 <primary>log</primary>
26787 <secondary>selectors</secondary>
26788 </indexterm>
26789 This option can be used to reduce or increase the number of things that Exim
26790 writes to its log files. Its argument is made up of names preceded by plus or
26791 minus characters. For example:
26792 </para>
26793 <literallayout class="monospaced">
26794 log_selector = +arguments -retry_defer
26795 </literallayout>
26796 <para>
26797 A list of possible names and what they control is given in the chapter on
26798 logging, in section <xref linkend="SECTlogselector"/>.
26799 </para>
26800 <para>
26801 <indexterm role="option">
26802 <primary><option>log_timezone</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>log_timezone</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>log</primary>
26824 <secondary>timezone for entries</secondary>
26825 </indexterm>
26826 <indexterm role="variable">
26827 <primary><varname>$tod_log</varname></primary>
26828 </indexterm>
26829 <indexterm role="variable">
26830 <primary><varname>$tod_zone</varname></primary>
26831 </indexterm>
26832 By default, the timestamps on log lines are in local time without the
26833 timezone. This means that if your timezone changes twice a year, the timestamps
26834 in log lines are ambiguous for an hour when the clocks go back. One way of
26835 avoiding this problem is to set the timezone to UTC. An alternative is to set
26836 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
26837 timestamps in log lines. Turning on this option can add quite a lot to the size
26838 of log files because each line is extended by 6 characters. Note that the
26839 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
26840 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
26841 </para>
26842 <para>
26843 <indexterm role="option">
26844 <primary><option>lookup_open_max</option></primary>
26845 </indexterm>
26846 </para>
26847 <informaltable frame="all">
26848 <tgroup cols="4" colsep="0" rowsep="0">
26849 <colspec colwidth="8*" align="left"/>
26850 <colspec colwidth="6*" align="center"/>
26851 <colspec colwidth="6*" align="center"/>
26852 <colspec colwidth="6*" align="right"/>
26853 <tbody>
26854 <row>
26855 <entry><option>lookup_open_max</option></entry>
26856 <entry>Use: <emphasis>main</emphasis></entry>
26857 <entry>Type: <emphasis>integer</emphasis></entry>
26858 <entry>Default: <emphasis>25</emphasis></entry>
26859 </row>
26860 </tbody>
26861 </tgroup>
26862 </informaltable>
26863 <para>
26864 <indexterm role="concept">
26865 <primary>too many open files</primary>
26866 </indexterm>
26867 <indexterm role="concept">
26868 <primary>open files, too many</primary>
26869 </indexterm>
26870 <indexterm role="concept">
26871 <primary>file</primary>
26872 <secondary>too many open</secondary>
26873 </indexterm>
26874 <indexterm role="concept">
26875 <primary>lookup</primary>
26876 <secondary>maximum open files</secondary>
26877 </indexterm>
26878 <indexterm role="concept">
26879 <primary>limit</primary>
26880 <secondary>open files for lookups</secondary>
26881 </indexterm>
26882 This option limits the number of simultaneously open files for single-key
26883 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
26884 Exim normally keeps these files open during routing, because often the same
26885 file is required several times. If the limit is reached, Exim closes the least
26886 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
26887 actually opens two files for each logical DBM database, though it still counts
26888 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
26889 open files</quote> errors with NDBM, you need to reduce the value of
26890 <option>lookup_open_max</option>.
26891 </para>
26892 <para>
26893 <indexterm role="option">
26894 <primary><option>max_username_length</option></primary>
26895 </indexterm>
26896 </para>
26897 <informaltable frame="all">
26898 <tgroup cols="4" colsep="0" rowsep="0">
26899 <colspec colwidth="8*" align="left"/>
26900 <colspec colwidth="6*" align="center"/>
26901 <colspec colwidth="6*" align="center"/>
26902 <colspec colwidth="6*" align="right"/>
26903 <tbody>
26904 <row>
26905 <entry><option>max_username_length</option></entry>
26906 <entry>Use: <emphasis>main</emphasis></entry>
26907 <entry>Type: <emphasis>integer</emphasis></entry>
26908 <entry>Default: <emphasis>0</emphasis></entry>
26909 </row>
26910 </tbody>
26911 </tgroup>
26912 </informaltable>
26913 <para>
26914 <indexterm role="concept">
26915 <primary>length of login name</primary>
26916 </indexterm>
26917 <indexterm role="concept">
26918 <primary>user name</primary>
26919 <secondary>maximum length</secondary>
26920 </indexterm>
26921 <indexterm role="concept">
26922 <primary>limit</primary>
26923 <secondary>user name length</secondary>
26924 </indexterm>
26925 Some operating systems are broken in that they truncate long arguments to
26926 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
26927 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
26928 an argument that is longer behaves as if <function>getpwnam()</function> failed.
26929 </para>
26930 <para>
26931 <indexterm role="option">
26932 <primary><option>message_body_newlines</option></primary>
26933 </indexterm>
26934 </para>
26935 <informaltable frame="all">
26936 <tgroup cols="4" colsep="0" rowsep="0">
26937 <colspec colwidth="8*" align="left"/>
26938 <colspec colwidth="6*" align="center"/>
26939 <colspec colwidth="6*" align="center"/>
26940 <colspec colwidth="6*" align="right"/>
26941 <tbody>
26942 <row>
26943 <entry><option>message_body_newlines</option></entry>
26944 <entry>Use: <emphasis>main</emphasis></entry>
26945 <entry>Type: <emphasis>bool</emphasis></entry>
26946 <entry>Default: <emphasis>false</emphasis></entry>
26947 </row>
26948 </tbody>
26949 </tgroup>
26950 </informaltable>
26951 <para>
26952 <indexterm role="concept">
26953 <primary>message body</primary>
26954 <secondary>newlines in variables</secondary>
26955 </indexterm>
26956 <indexterm role="concept">
26957 <primary>newline</primary>
26958 <secondary>in message body variables</secondary>
26959 </indexterm>
26960 <indexterm role="variable">
26961 <primary><varname>$message_body</varname></primary>
26962 </indexterm>
26963 <indexterm role="variable">
26964 <primary><varname>$message_body_end</varname></primary>
26965 </indexterm>
26966 By default, newlines in the message body are replaced by spaces when setting
26967 the <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables. If this
26968 option is set true, this no longer happens.
26969 </para>
26970 <para>
26971 <indexterm role="option">
26972 <primary><option>message_body_visible</option></primary>
26973 </indexterm>
26974 </para>
26975 <informaltable frame="all">
26976 <tgroup cols="4" colsep="0" rowsep="0">
26977 <colspec colwidth="8*" align="left"/>
26978 <colspec colwidth="6*" align="center"/>
26979 <colspec colwidth="6*" align="center"/>
26980 <colspec colwidth="6*" align="right"/>
26981 <tbody>
26982 <row>
26983 <entry><option>message_body_visible</option></entry>
26984 <entry>Use: <emphasis>main</emphasis></entry>
26985 <entry>Type: <emphasis>integer</emphasis></entry>
26986 <entry>Default: <emphasis>500</emphasis></entry>
26987 </row>
26988 </tbody>
26989 </tgroup>
26990 </informaltable>
26991 <para>
26992 <indexterm role="concept">
26993 <primary>body of message</primary>
26994 <secondary>visible size</secondary>
26995 </indexterm>
26996 <indexterm role="concept">
26997 <primary>message body</primary>
26998 <secondary>visible size</secondary>
26999 </indexterm>
27000 <indexterm role="variable">
27001 <primary><varname>$message_body</varname></primary>
27002 </indexterm>
27003 <indexterm role="variable">
27004 <primary><varname>$message_body_end</varname></primary>
27005 </indexterm>
27006 This option specifies how much of a message&#x2019;s body is to be included in the
27007 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
27008 </para>
27009 <para>
27010 <indexterm role="option">
27011 <primary><option>message_id_header_domain</option></primary>
27012 </indexterm>
27013 </para>
27014 <informaltable frame="all">
27015 <tgroup cols="4" colsep="0" rowsep="0">
27016 <colspec colwidth="8*" align="left"/>
27017 <colspec colwidth="6*" align="center"/>
27018 <colspec colwidth="6*" align="center"/>
27019 <colspec colwidth="6*" align="right"/>
27020 <tbody>
27021 <row>
27022 <entry><option>message_id_header_domain</option></entry>
27023 <entry>Use: <emphasis>main</emphasis></entry>
27024 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27025 <entry>Default: <emphasis>unset</emphasis></entry>
27026 </row>
27027 </tbody>
27028 </tgroup>
27029 </informaltable>
27030 <para>
27031 <indexterm role="concept">
27032 <primary><emphasis>Message-ID:</emphasis> header line</primary>
27033 </indexterm>
27034 If this option is set, the string is expanded and used as the right hand side
27035 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
27036 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
27037 means <quote>not received over TCP/IP.</quote>
27038 Otherwise, the primary host name is used.
27039 Only letters, digits, dot and hyphen are accepted; any other characters are
27040 replaced by hyphens. If the expansion is forced to fail, or if the result is an
27041 empty string, the option is ignored.
27042 </para>
27043 <para>
27044 <indexterm role="option">
27045 <primary><option>message_id_header_text</option></primary>
27046 </indexterm>
27047 </para>
27048 <informaltable frame="all">
27049 <tgroup cols="4" colsep="0" rowsep="0">
27050 <colspec colwidth="8*" align="left"/>
27051 <colspec colwidth="6*" align="center"/>
27052 <colspec colwidth="6*" align="center"/>
27053 <colspec colwidth="6*" align="right"/>
27054 <tbody>
27055 <row>
27056 <entry><option>message_id_header_text</option></entry>
27057 <entry>Use: <emphasis>main</emphasis></entry>
27058 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27059 <entry>Default: <emphasis>unset</emphasis></entry>
27060 </row>
27061 </tbody>
27062 </tgroup>
27063 </informaltable>
27064 <para>
27065 If this variable is set, the string is expanded and used to augment the text of
27066 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
27067 message does not have one. The text of this header is required by RFC 2822 to
27068 take the form of an address. By default, Exim uses its internal message id as
27069 the local part, and the primary host name as the domain. If this option is set,
27070 it is expanded, and provided the expansion is not forced to fail, and does not
27071 yield an empty string, the result is inserted into the header immediately
27072 before the @, separated from the internal message id by a dot. Any characters
27073 that are illegal in an address are automatically converted into hyphens. This
27074 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
27075 colons will become hyphens.
27076 </para>
27077 <para>
27078 <indexterm role="option">
27079 <primary><option>message_logs</option></primary>
27080 </indexterm>
27081 </para>
27082 <informaltable frame="all">
27083 <tgroup cols="4" colsep="0" rowsep="0">
27084 <colspec colwidth="8*" align="left"/>
27085 <colspec colwidth="6*" align="center"/>
27086 <colspec colwidth="6*" align="center"/>
27087 <colspec colwidth="6*" align="right"/>
27088 <tbody>
27089 <row>
27090 <entry><option>message_logs</option></entry>
27091 <entry>Use: <emphasis>main</emphasis></entry>
27092 <entry>Type: <emphasis>boolean</emphasis></entry>
27093 <entry>Default: <emphasis>true</emphasis></entry>
27094 </row>
27095 </tbody>
27096 </tgroup>
27097 </informaltable>
27098 <para>
27099 <indexterm role="concept">
27100 <primary>message logs</primary>
27101 <secondary>disabling</secondary>
27102 </indexterm>
27103 <indexterm role="concept">
27104 <primary>log</primary>
27105 <secondary>message log; disabling</secondary>
27106 </indexterm>
27107 If this option is turned off, per-message log files are not created in the
27108 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
27109 Exim, by reducing the number of files involved in handling a message from a
27110 minimum of four (header spool file, body spool file, delivery journal, and
27111 per-message log) to three. The other major I/O activity is Exim&#x2019;s main log,
27112 which is not affected by this option.
27113 </para>
27114 <para>
27115 <indexterm role="option">
27116 <primary><option>message_size_limit</option></primary>
27117 </indexterm>
27118 </para>
27119 <informaltable frame="all">
27120 <tgroup cols="4" colsep="0" rowsep="0">
27121 <colspec colwidth="8*" align="left"/>
27122 <colspec colwidth="6*" align="center"/>
27123 <colspec colwidth="6*" align="center"/>
27124 <colspec colwidth="6*" align="right"/>
27125 <tbody>
27126 <row>
27127 <entry><option>message_size_limit</option></entry>
27128 <entry>Use: <emphasis>main</emphasis></entry>
27129 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27130 <entry>Default: <emphasis>50M</emphasis></entry>
27131 </row>
27132 </tbody>
27133 </tgroup>
27134 </informaltable>
27135 <para>
27136 <indexterm role="concept">
27137 <primary>message</primary>
27138 <secondary>size limit</secondary>
27139 </indexterm>
27140 <indexterm role="concept">
27141 <primary>limit</primary>
27142 <secondary>message size</secondary>
27143 </indexterm>
27144 <indexterm role="concept">
27145 <primary>size</primary>
27146 <secondary>of message, limit</secondary>
27147 </indexterm>
27148 This option limits the maximum size of message that Exim will process. The
27149 value is expanded for each incoming connection so, for example, it can be made
27150 to depend on the IP address of the remote host for messages arriving via
27151 TCP/IP. After expansion, the value must be a sequence of decimal digits,
27152 optionally followed by K or M.
27153 </para>
27154 <para>
27155 <emphasis role="bold">Note</emphasis>: This limit cannot be made to depend on a message&#x2019;s sender or any
27156 other properties of an individual message, because it has to be advertised in
27157 the server&#x2019;s response to EHLO. String expansion failure causes a temporary
27158 error. A value of zero means no limit, but its use is not recommended. See also
27159 <option>bounce_return_size_limit</option>.
27160 </para>
27161 <para>
27162 Incoming SMTP messages are failed with a 552 error if the limit is
27163 exceeded; locally-generated messages either get a stderr message or a delivery
27164 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
27165 an oversized message is logged in both the main and the reject logs. See also
27166 the generic transport option <option>message_size_limit</option>, which limits the size of
27167 message that an individual transport can process.
27168 </para>
27169 <para>
27170 If you use a virus-scanner and set this option to to a value larger than the
27171 maximum size that your virus-scanner is configured to support, you may get
27172 failures triggered by large mails.  The right size to configure for the
27173 virus-scanner depends upon what data is passed and the options in use but it&#x2019;s
27174 probably safest to just set it to a little larger than this value.  E.g., with a
27175 default Exim message size of 50M and a default ClamAV StreamMaxLength of 10M,
27176 some problems may result.
27177 </para>
27178 <para>
27179 A value of 0 will disable size limit checking; Exim will still advertise the
27180 SIZE extension in an EHLO response, but without a limit, so as to permit
27181 SMTP clients to still indicate the message size along with the MAIL verb.
27182 </para>
27183 <para>
27184 <indexterm role="option">
27185 <primary><option>move_frozen_messages</option></primary>
27186 </indexterm>
27187 </para>
27188 <informaltable frame="all">
27189 <tgroup cols="4" colsep="0" rowsep="0">
27190 <colspec colwidth="8*" align="left"/>
27191 <colspec colwidth="6*" align="center"/>
27192 <colspec colwidth="6*" align="center"/>
27193 <colspec colwidth="6*" align="right"/>
27194 <tbody>
27195 <row>
27196 <entry><option>move_frozen_messages</option></entry>
27197 <entry>Use: <emphasis>main</emphasis></entry>
27198 <entry>Type: <emphasis>boolean</emphasis></entry>
27199 <entry>Default: <emphasis>false</emphasis></entry>
27200 </row>
27201 </tbody>
27202 </tgroup>
27203 </informaltable>
27204 <para>
27205 <indexterm role="concept">
27206 <primary>frozen messages</primary>
27207 <secondary>moving</secondary>
27208 </indexterm>
27209 This option, which is available only if Exim has been built with the setting
27210 </para>
27211 <literallayout class="monospaced">
27212 SUPPORT_MOVE_FROZEN_MESSAGES=yes
27213 </literallayout>
27214 <para>
27215 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
27216 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
27217 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
27218 standard utilities for handling such moved messages, and they do not show up in
27219 lists generated by <option>-bp</option> or by the Exim monitor.
27220 </para>
27221 <para>
27222 <indexterm role="option">
27223 <primary><option>mua_wrapper</option></primary>
27224 </indexterm>
27225 </para>
27226 <informaltable frame="all">
27227 <tgroup cols="4" colsep="0" rowsep="0">
27228 <colspec colwidth="8*" align="left"/>
27229 <colspec colwidth="6*" align="center"/>
27230 <colspec colwidth="6*" align="center"/>
27231 <colspec colwidth="6*" align="right"/>
27232 <tbody>
27233 <row>
27234 <entry><option>mua_wrapper</option></entry>
27235 <entry>Use: <emphasis>main</emphasis></entry>
27236 <entry>Type: <emphasis>boolean</emphasis></entry>
27237 <entry>Default: <emphasis>false</emphasis></entry>
27238 </row>
27239 </tbody>
27240 </tgroup>
27241 </informaltable>
27242 <para>
27243 Setting this option true causes Exim to run in a very restrictive mode in which
27244 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
27245 contains a full description of this facility.
27246 </para>
27247 <para>
27248 <indexterm role="option">
27249 <primary><option>mysql_servers</option></primary>
27250 </indexterm>
27251 </para>
27252 <informaltable frame="all">
27253 <tgroup cols="4" colsep="0" rowsep="0">
27254 <colspec colwidth="8*" align="left"/>
27255 <colspec colwidth="6*" align="center"/>
27256 <colspec colwidth="6*" align="center"/>
27257 <colspec colwidth="6*" align="right"/>
27258 <tbody>
27259 <row>
27260 <entry><option>mysql_servers</option></entry>
27261 <entry>Use: <emphasis>main</emphasis></entry>
27262 <entry>Type: <emphasis>string list</emphasis></entry>
27263 <entry>Default: <emphasis>unset</emphasis></entry>
27264 </row>
27265 </tbody>
27266 </tgroup>
27267 </informaltable>
27268 <para>
27269 <indexterm role="concept">
27270 <primary>MySQL</primary>
27271 <secondary>server list</secondary>
27272 </indexterm>
27273 This option provides a list of MySQL servers and associated connection data, to
27274 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECID72"/>). The
27275 option is available only if Exim has been built with MySQL support.
27276 </para>
27277 <para>
27278 <indexterm role="option">
27279 <primary><option>never_users</option></primary>
27280 </indexterm>
27281 </para>
27282 <informaltable frame="all">
27283 <tgroup cols="4" colsep="0" rowsep="0">
27284 <colspec colwidth="8*" align="left"/>
27285 <colspec colwidth="6*" align="center"/>
27286 <colspec colwidth="6*" align="center"/>
27287 <colspec colwidth="6*" align="right"/>
27288 <tbody>
27289 <row>
27290 <entry><option>never_users</option></entry>
27291 <entry>Use: <emphasis>main</emphasis></entry>
27292 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
27293 <entry>Default: <emphasis>unset</emphasis></entry>
27294 </row>
27295 </tbody>
27296 </tgroup>
27297 </informaltable>
27298 <para>
27299 This option is expanded just once, at the start of Exim&#x2019;s processing. Local
27300 message deliveries are normally run in processes that are setuid to the
27301 recipient, and remote deliveries are normally run under Exim&#x2019;s own uid and gid.
27302 It is usually desirable to prevent any deliveries from running as root, as a
27303 safety precaution.
27304 </para>
27305 <para>
27306 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
27307 list of users that must not be used for local deliveries. This list is fixed in
27308 the binary and cannot be overridden by the configuration file. By default, it
27309 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
27310 can be used to add more users to the fixed list.
27311 </para>
27312 <para>
27313 If a message is to be delivered as one of the users on the fixed list or the
27314 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
27315 example is
27316 </para>
27317 <literallayout class="monospaced">
27318 never_users = root:daemon:bin
27319 </literallayout>
27320 <para>
27321 Including root is redundant if it is also on the fixed list, but it does no
27322 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
27323 transport driver.
27324 </para>
27325 <para>
27326 <indexterm role="option">
27327 <primary><option>openssl_options</option></primary>
27328 </indexterm>
27329 </para>
27330 <informaltable frame="all">
27331 <tgroup cols="4" colsep="0" rowsep="0">
27332 <colspec colwidth="8*" align="left"/>
27333 <colspec colwidth="6*" align="center"/>
27334 <colspec colwidth="6*" align="center"/>
27335 <colspec colwidth="6*" align="right"/>
27336 <tbody>
27337 <row>
27338 <entry><option>openssl_options</option></entry>
27339 <entry>Use: <emphasis>main</emphasis></entry>
27340 <entry>Type: <emphasis>string list</emphasis></entry>
27341 <entry>Default: <emphasis>+no_sslv2 +single_dh_use</emphasis></entry>
27342 </row>
27343 </tbody>
27344 </tgroup>
27345 </informaltable>
27346 <para>
27347 <indexterm role="concept">
27348 <primary>OpenSSL </primary>
27349 <secondary>compatibility</secondary>
27350 </indexterm>
27351 This option allows an administrator to adjust the SSL options applied
27352 by OpenSSL to connections.  It is given as a space-separated list of items,
27353 each one to be +added or -subtracted from the current value.
27354 </para>
27355 <para>
27356 This option is only available if Exim is built against OpenSSL.  The values
27357 available for this option vary according to the age of your OpenSSL install.
27358 The <quote>all</quote> value controls a subset of flags which are available, typically
27359 the bug workaround options.  The <emphasis>SSL_CTX_set_options</emphasis> man page will
27360 list the values known on your system and Exim should support all the
27361 <quote>bug workaround</quote> options and many of the <quote>modifying</quote> options.  The Exim
27362 names lose the leading <quote>SSL_OP_</quote> and are lower-cased.
27363 </para>
27364 <para>
27365 Note that adjusting the options can have severe impact upon the security of
27366 SSL as used by Exim.  It is possible to disable safety checks and shoot
27367 yourself in the foot in various unpleasant ways.  This option should not be
27368 adjusted lightly.  An unrecognised item will be detected at startup, by
27369 invoking Exim with the <option>-bV</option> flag.
27370 </para>
27371 <para>
27372 The option affects Exim operating both as a server and as a client.
27373 </para>
27374 <para>
27375 Historical note: prior to release 4.80, Exim defaulted this value to
27376 "+dont_insert_empty_fragments", which may still be needed for compatibility
27377 with some clients, but which lowers security by increasing exposure to
27378 some now infamous attacks.
27379 </para>
27380 <para>
27381 Examples:
27382 </para>
27383 <literallayout class="monospaced">
27384 # Make both old MS and old Eudora happy:
27385 openssl_options = -all +microsoft_big_sslv3_buffer \
27386                        +dont_insert_empty_fragments
27387
27388 # Disable older protocol versions:
27389 openssl_options = +no_sslv2 +no_sslv3
27390 </literallayout>
27391 <para>
27392 Possible options may include:
27393 </para>
27394 <itemizedlist>
27395 <listitem>
27396 <para>
27397 <literal>all</literal>
27398 </para>
27399 </listitem>
27400 <listitem>
27401 <para>
27402 <literal>allow_unsafe_legacy_renegotiation</literal>
27403 </para>
27404 </listitem>
27405 <listitem>
27406 <para>
27407 <literal>cipher_server_preference</literal>
27408 </para>
27409 </listitem>
27410 <listitem>
27411 <para>
27412 <literal>dont_insert_empty_fragments</literal>
27413 </para>
27414 </listitem>
27415 <listitem>
27416 <para>
27417 <literal>ephemeral_rsa</literal>
27418 </para>
27419 </listitem>
27420 <listitem>
27421 <para>
27422 <literal>legacy_server_connect</literal>
27423 </para>
27424 </listitem>
27425 <listitem>
27426 <para>
27427 <literal>microsoft_big_sslv3_buffer</literal>
27428 </para>
27429 </listitem>
27430 <listitem>
27431 <para>
27432 <literal>microsoft_sess_id_bug</literal>
27433 </para>
27434 </listitem>
27435 <listitem>
27436 <para>
27437 <literal>msie_sslv2_rsa_padding</literal>
27438 </para>
27439 </listitem>
27440 <listitem>
27441 <para>
27442 <literal>netscape_challenge_bug</literal>
27443 </para>
27444 </listitem>
27445 <listitem>
27446 <para>
27447 <literal>netscape_reuse_cipher_change_bug</literal>
27448 </para>
27449 </listitem>
27450 <listitem>
27451 <para>
27452 <literal>no_compression</literal>
27453 </para>
27454 </listitem>
27455 <listitem>
27456 <para>
27457 <literal>no_session_resumption_on_renegotiation</literal>
27458 </para>
27459 </listitem>
27460 <listitem>
27461 <para>
27462 <literal>no_sslv2</literal>
27463 </para>
27464 </listitem>
27465 <listitem>
27466 <para>
27467 <literal>no_sslv3</literal>
27468 </para>
27469 </listitem>
27470 <listitem>
27471 <para>
27472 <literal>no_ticket</literal>
27473 </para>
27474 </listitem>
27475 <listitem>
27476 <para>
27477 <literal>no_tlsv1</literal>
27478 </para>
27479 </listitem>
27480 <listitem>
27481 <para>
27482 <literal>no_tlsv1_1</literal>
27483 </para>
27484 </listitem>
27485 <listitem>
27486 <para>
27487 <literal>no_tlsv1_2</literal>
27488 </para>
27489 </listitem>
27490 <listitem>
27491 <para>
27492 <literal>safari_ecdhe_ecdsa_bug</literal>
27493 </para>
27494 </listitem>
27495 <listitem>
27496 <para>
27497 <literal>single_dh_use</literal>
27498 </para>
27499 </listitem>
27500 <listitem>
27501 <para>
27502 <literal>single_ecdh_use</literal>
27503 </para>
27504 </listitem>
27505 <listitem>
27506 <para>
27507 <literal>ssleay_080_client_dh_bug</literal>
27508 </para>
27509 </listitem>
27510 <listitem>
27511 <para>
27512 <literal>sslref2_reuse_cert_type_bug</literal>
27513 </para>
27514 </listitem>
27515 <listitem>
27516 <para>
27517 <literal>tls_block_padding_bug</literal>
27518 </para>
27519 </listitem>
27520 <listitem>
27521 <para>
27522 <literal>tls_d5_bug</literal>
27523 </para>
27524 </listitem>
27525 <listitem>
27526 <para>
27527 <literal>tls_rollback_bug</literal>
27528 </para>
27529 </listitem>
27530 </itemizedlist>
27531 <para>
27532 As an aside, the <literal>safari_ecdhe_ecdsa_bug</literal> item is a misnomer and affects
27533 all clients connecting using the MacOS SecureTransport TLS facility prior
27534 to MacOS 10.8.4, including email clients.  If you see old MacOS clients failing
27535 to negotiate TLS then this option value might help, provided that your OpenSSL
27536 release is new enough to contain this work-around.  This may be a situation
27537 where you have to upgrade OpenSSL to get buggy clients working.
27538 </para>
27539 <para>
27540 <indexterm role="option">
27541 <primary><option>oracle_servers</option></primary>
27542 </indexterm>
27543 </para>
27544 <informaltable frame="all">
27545 <tgroup cols="4" colsep="0" rowsep="0">
27546 <colspec colwidth="8*" align="left"/>
27547 <colspec colwidth="6*" align="center"/>
27548 <colspec colwidth="6*" align="center"/>
27549 <colspec colwidth="6*" align="right"/>
27550 <tbody>
27551 <row>
27552 <entry><option>oracle_servers</option></entry>
27553 <entry>Use: <emphasis>main</emphasis></entry>
27554 <entry>Type: <emphasis>string list</emphasis></entry>
27555 <entry>Default: <emphasis>unset</emphasis></entry>
27556 </row>
27557 </tbody>
27558 </tgroup>
27559 </informaltable>
27560 <para>
27561 <indexterm role="concept">
27562 <primary>Oracle</primary>
27563 <secondary>server list</secondary>
27564 </indexterm>
27565 This option provides a list of Oracle servers and associated connection data,
27566 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECID72"/>).
27567 The option is available only if Exim has been built with Oracle support.
27568 </para>
27569 <para>
27570 <indexterm role="option">
27571 <primary><option>percent_hack_domains</option></primary>
27572 </indexterm>
27573 </para>
27574 <informaltable frame="all">
27575 <tgroup cols="4" colsep="0" rowsep="0">
27576 <colspec colwidth="8*" align="left"/>
27577 <colspec colwidth="6*" align="center"/>
27578 <colspec colwidth="6*" align="center"/>
27579 <colspec colwidth="6*" align="right"/>
27580 <tbody>
27581 <row>
27582 <entry><option>percent_hack_domains</option></entry>
27583 <entry>Use: <emphasis>main</emphasis></entry>
27584 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27585 <entry>Default: <emphasis>unset</emphasis></entry>
27586 </row>
27587 </tbody>
27588 </tgroup>
27589 </informaltable>
27590 <para>
27591 <indexterm role="concept">
27592 <primary><quote>percent hack</quote></primary>
27593 </indexterm>
27594 <indexterm role="concept">
27595 <primary>source routing</primary>
27596 <secondary>in email address</secondary>
27597 </indexterm>
27598 <indexterm role="concept">
27599 <primary>address</primary>
27600 <secondary>source-routed</secondary>
27601 </indexterm>
27602 The <quote>percent hack</quote> is the convention whereby a local part containing a
27603 percent sign is re-interpreted as a new email address, with the percent
27604 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
27605 also applied to RFC 2822 addresses that begin with an @ character. If this
27606 option is set, Exim implements the percent facility for those domains listed,
27607 but no others. This happens before an incoming SMTP address is tested against
27608 an ACL.
27609 </para>
27610 <para>
27611 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
27612 trying to get round relaying restrictions. For this reason, it is best avoided
27613 if at all possible. Unfortunately, a number of less security-conscious MTAs
27614 implement it unconditionally. If you are running Exim on a gateway host, and
27615 routing mail through to internal MTAs without processing the local parts, it is
27616 a good idea to reject recipient addresses with percent characters in their
27617 local parts. Exim&#x2019;s default configuration does this.
27618 </para>
27619 <para>
27620 <indexterm role="option">
27621 <primary><option>perl_at_start</option></primary>
27622 </indexterm>
27623 </para>
27624 <informaltable frame="all">
27625 <tgroup cols="4" colsep="0" rowsep="0">
27626 <colspec colwidth="8*" align="left"/>
27627 <colspec colwidth="6*" align="center"/>
27628 <colspec colwidth="6*" align="center"/>
27629 <colspec colwidth="6*" align="right"/>
27630 <tbody>
27631 <row>
27632 <entry><option>perl_at_start</option></entry>
27633 <entry>Use: <emphasis>main</emphasis></entry>
27634 <entry>Type: <emphasis>boolean</emphasis></entry>
27635 <entry>Default: <emphasis>false</emphasis></entry>
27636 </row>
27637 </tbody>
27638 </tgroup>
27639 </informaltable>
27640 <para>
27641 This option is available only when Exim is built with an embedded Perl
27642 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
27643 </para>
27644 <para>
27645 <indexterm role="option">
27646 <primary><option>perl_startup</option></primary>
27647 </indexterm>
27648 </para>
27649 <informaltable frame="all">
27650 <tgroup cols="4" colsep="0" rowsep="0">
27651 <colspec colwidth="8*" align="left"/>
27652 <colspec colwidth="6*" align="center"/>
27653 <colspec colwidth="6*" align="center"/>
27654 <colspec colwidth="6*" align="right"/>
27655 <tbody>
27656 <row>
27657 <entry><option>perl_startup</option></entry>
27658 <entry>Use: <emphasis>main</emphasis></entry>
27659 <entry>Type: <emphasis>string</emphasis></entry>
27660 <entry>Default: <emphasis>unset</emphasis></entry>
27661 </row>
27662 </tbody>
27663 </tgroup>
27664 </informaltable>
27665 <para>
27666 This option is available only when Exim is built with an embedded Perl
27667 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
27668 </para>
27669 <para>
27670 <indexterm role="option">
27671 <primary><option>pgsql_servers</option></primary>
27672 </indexterm>
27673 </para>
27674 <informaltable frame="all">
27675 <tgroup cols="4" colsep="0" rowsep="0">
27676 <colspec colwidth="8*" align="left"/>
27677 <colspec colwidth="6*" align="center"/>
27678 <colspec colwidth="6*" align="center"/>
27679 <colspec colwidth="6*" align="right"/>
27680 <tbody>
27681 <row>
27682 <entry><option>pgsql_servers</option></entry>
27683 <entry>Use: <emphasis>main</emphasis></entry>
27684 <entry>Type: <emphasis>string list</emphasis></entry>
27685 <entry>Default: <emphasis>unset</emphasis></entry>
27686 </row>
27687 </tbody>
27688 </tgroup>
27689 </informaltable>
27690 <para>
27691 <indexterm role="concept">
27692 <primary>PostgreSQL lookup type</primary>
27693 <secondary>server list</secondary>
27694 </indexterm>
27695 This option provides a list of PostgreSQL servers and associated connection
27696 data, to be used in conjunction with <command>pgsql</command> lookups (see section
27697 <xref linkend="SECID72"/>). The option is available only if Exim has been built with
27698 PostgreSQL support.
27699 </para>
27700 <para>
27701 <indexterm role="option">
27702 <primary><option>pid_file_path</option></primary>
27703 </indexterm>
27704 </para>
27705 <informaltable frame="all">
27706 <tgroup cols="4" colsep="0" rowsep="0">
27707 <colspec colwidth="8*" align="left"/>
27708 <colspec colwidth="6*" align="center"/>
27709 <colspec colwidth="6*" align="center"/>
27710 <colspec colwidth="6*" align="right"/>
27711 <tbody>
27712 <row>
27713 <entry><option>pid_file_path</option></entry>
27714 <entry>Use: <emphasis>main</emphasis></entry>
27715 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27716 <entry>Default: <emphasis>set at compile time</emphasis></entry>
27717 </row>
27718 </tbody>
27719 </tgroup>
27720 </informaltable>
27721 <para>
27722 <indexterm role="concept">
27723 <primary>daemon</primary>
27724 <secondary>pid file path</secondary>
27725 </indexterm>
27726 <indexterm role="concept">
27727 <primary>pid file, path for</primary>
27728 </indexterm>
27729 This option sets the name of the file to which the Exim daemon writes its
27730 process id. The string is expanded, so it can contain, for example, references
27731 to the host name:
27732 </para>
27733 <literallayout class="monospaced">
27734 pid_file_path = /var/log/$primary_hostname/exim.pid
27735 </literallayout>
27736 <para>
27737 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim&#x2019;s
27738 spool directory.
27739 The value set by the option can be overridden by the <option>-oP</option> command line
27740 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
27741 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
27742 </para>
27743 <para>
27744 <indexterm role="option">
27745 <primary><option>pipelining_advertise_hosts</option></primary>
27746 </indexterm>
27747 </para>
27748 <informaltable frame="all">
27749 <tgroup cols="4" colsep="0" rowsep="0">
27750 <colspec colwidth="8*" align="left"/>
27751 <colspec colwidth="6*" align="center"/>
27752 <colspec colwidth="6*" align="center"/>
27753 <colspec colwidth="6*" align="right"/>
27754 <tbody>
27755 <row>
27756 <entry><option>pipelining_advertise_hosts</option></entry>
27757 <entry>Use: <emphasis>main</emphasis></entry>
27758 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27759 <entry>Default: <emphasis>*</emphasis></entry>
27760 </row>
27761 </tbody>
27762 </tgroup>
27763 </informaltable>
27764 <para>
27765 <indexterm role="concept">
27766 <primary>PIPELINING</primary>
27767 <secondary>suppressing advertising</secondary>
27768 </indexterm>
27769 This option can be used to suppress the advertisement of the SMTP
27770 PIPELINING extension to specific hosts. See also the <emphasis role="bold">no_pipelining</emphasis>
27771 control in section <xref linkend="SECTcontrols"/>. When PIPELINING is not advertised and
27772 <option>smtp_enforce_sync</option> is true, an Exim server enforces strict synchronization
27773 for each SMTP command and response. When PIPELINING is advertised, Exim assumes
27774 that clients will use it; <quote>out of order</quote> commands that are <quote>expected</quote> do
27775 not count as protocol errors (see <option>smtp_max_synprot_errors</option>).
27776 </para>
27777 <para>
27778 <indexterm role="option">
27779 <primary><option>prdr_enable</option></primary>
27780 </indexterm>
27781 </para>
27782 <informaltable frame="all">
27783 <tgroup cols="4" colsep="0" rowsep="0">
27784 <colspec colwidth="8*" align="left"/>
27785 <colspec colwidth="6*" align="center"/>
27786 <colspec colwidth="6*" align="center"/>
27787 <colspec colwidth="6*" align="right"/>
27788 <tbody>
27789 <row>
27790 <entry><option>prdr_enable</option></entry>
27791 <entry>Use: <emphasis>main</emphasis></entry>
27792 <entry>Type: <emphasis>boolean</emphasis></entry>
27793 <entry>Default: <emphasis>false</emphasis></entry>
27794 </row>
27795 </tbody>
27796 </tgroup>
27797 </informaltable>
27798 <para>
27799 <indexterm role="concept">
27800 <primary>PRDR</primary>
27801 <secondary>enabling on server</secondary>
27802 </indexterm>
27803 This option can be used to enable the Per-Recipient Data Response extension
27804 to SMTP, defined by Eric Hall.
27805 If the option is set, PRDR is advertised by Exim when operating as a server.
27806 If the client requests PRDR, and more than one recipient, for a message
27807 an additional ACL is called for each recipient after the message content
27808 is received.  See section <xref linkend="SECTPRDRACL"/>.
27809 </para>
27810 <para>
27811 <indexterm role="option">
27812 <primary><option>preserve_message_logs</option></primary>
27813 </indexterm>
27814 </para>
27815 <informaltable frame="all">
27816 <tgroup cols="4" colsep="0" rowsep="0">
27817 <colspec colwidth="8*" align="left"/>
27818 <colspec colwidth="6*" align="center"/>
27819 <colspec colwidth="6*" align="center"/>
27820 <colspec colwidth="6*" align="right"/>
27821 <tbody>
27822 <row>
27823 <entry><option>preserve_message_logs</option></entry>
27824 <entry>Use: <emphasis>main</emphasis></entry>
27825 <entry>Type: <emphasis>boolean</emphasis></entry>
27826 <entry>Default: <emphasis>false</emphasis></entry>
27827 </row>
27828 </tbody>
27829 </tgroup>
27830 </informaltable>
27831 <para>
27832 <indexterm role="concept">
27833 <primary>message logs</primary>
27834 <secondary>preserving</secondary>
27835 </indexterm>
27836 If this option is set, message log files are not deleted when messages are
27837 completed. Instead, they are moved to a sub-directory of the spool directory
27838 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
27839 purposes. This is a dangerous option to set on systems with any appreciable
27840 volume of mail. Use with care!
27841 </para>
27842 <para>
27843 <indexterm role="option">
27844 <primary><option>primary_hostname</option></primary>
27845 </indexterm>
27846 </para>
27847 <informaltable frame="all">
27848 <tgroup cols="4" colsep="0" rowsep="0">
27849 <colspec colwidth="8*" align="left"/>
27850 <colspec colwidth="6*" align="center"/>
27851 <colspec colwidth="6*" align="center"/>
27852 <colspec colwidth="6*" align="right"/>
27853 <tbody>
27854 <row>
27855 <entry><option>primary_hostname</option></entry>
27856 <entry>Use: <emphasis>main</emphasis></entry>
27857 <entry>Type: <emphasis>string</emphasis></entry>
27858 <entry>Default: <emphasis>see below</emphasis></entry>
27859 </row>
27860 </tbody>
27861 </tgroup>
27862 </informaltable>
27863 <para>
27864 <indexterm role="concept">
27865 <primary>name</primary>
27866 <secondary>of local host</secondary>
27867 </indexterm>
27868 <indexterm role="concept">
27869 <primary>host</primary>
27870 <secondary>name of local</secondary>
27871 </indexterm>
27872 <indexterm role="concept">
27873 <primary>local host</primary>
27874 <secondary>name of</secondary>
27875 </indexterm>
27876 <indexterm role="variable">
27877 <primary><varname>$primary_hostname</varname></primary>
27878 </indexterm>
27879 This specifies the name of the current host. It is used in the default EHLO or
27880 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
27881 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
27882 The value is also used by default in some SMTP response messages from an Exim
27883 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
27884 </para>
27885 <para>
27886 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
27887 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
27888 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
27889 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
27890 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
27891 explicitly by this option, or defaulted.
27892 </para>
27893 <para>
27894 <indexterm role="option">
27895 <primary><option>print_topbitchars</option></primary>
27896 </indexterm>
27897 </para>
27898 <informaltable frame="all">
27899 <tgroup cols="4" colsep="0" rowsep="0">
27900 <colspec colwidth="8*" align="left"/>
27901 <colspec colwidth="6*" align="center"/>
27902 <colspec colwidth="6*" align="center"/>
27903 <colspec colwidth="6*" align="right"/>
27904 <tbody>
27905 <row>
27906 <entry><option>print_topbitchars</option></entry>
27907 <entry>Use: <emphasis>main</emphasis></entry>
27908 <entry>Type: <emphasis>boolean</emphasis></entry>
27909 <entry>Default: <emphasis>false</emphasis></entry>
27910 </row>
27911 </tbody>
27912 </tgroup>
27913 </informaltable>
27914 <para>
27915 <indexterm role="concept">
27916 <primary>printing characters</primary>
27917 </indexterm>
27918 <indexterm role="concept">
27919 <primary>8-bit characters</primary>
27920 </indexterm>
27921 By default, Exim considers only those characters whose codes lie in the range
27922 32&ndash;126 to be printing characters. In a number of circumstances (for example,
27923 when writing log entries) non-printing characters are converted into escape
27924 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
27925 is set, code values of 128 and above are also considered to be printing
27926 characters.
27927 </para>
27928 <para>
27929 This option also affects the header syntax checks performed by the
27930 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
27931 the user&#x2019;s full name when constructing From: and Sender: addresses (as
27932 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
27933 Exim to generate eight bit message headers that do not conform to the
27934 standards.
27935 </para>
27936 <para>
27937 <indexterm role="option">
27938 <primary><option>process_log_path</option></primary>
27939 </indexterm>
27940 </para>
27941 <informaltable frame="all">
27942 <tgroup cols="4" colsep="0" rowsep="0">
27943 <colspec colwidth="8*" align="left"/>
27944 <colspec colwidth="6*" align="center"/>
27945 <colspec colwidth="6*" align="center"/>
27946 <colspec colwidth="6*" align="right"/>
27947 <tbody>
27948 <row>
27949 <entry><option>process_log_path</option></entry>
27950 <entry>Use: <emphasis>main</emphasis></entry>
27951 <entry>Type: <emphasis>string</emphasis></entry>
27952 <entry>Default: <emphasis>unset</emphasis></entry>
27953 </row>
27954 </tbody>
27955 </tgroup>
27956 </informaltable>
27957 <para>
27958 <indexterm role="concept">
27959 <primary>process log path</primary>
27960 </indexterm>
27961 <indexterm role="concept">
27962 <primary>log</primary>
27963 <secondary>process log</secondary>
27964 </indexterm>
27965 <indexterm role="concept">
27966 <primary><emphasis>exiwhat</emphasis></primary>
27967 </indexterm>
27968 This option sets the name of the file to which an Exim process writes its
27969 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
27970 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
27971 in Exim&#x2019;s spool directory is used. The ability to specify the name explicitly
27972 can be useful in environments where two different Exims are running, using
27973 different spool directories.
27974 </para>
27975 <para>
27976 <indexterm role="option">
27977 <primary><option>prod_requires_admin</option></primary>
27978 </indexterm>
27979 </para>
27980 <informaltable frame="all">
27981 <tgroup cols="4" colsep="0" rowsep="0">
27982 <colspec colwidth="8*" align="left"/>
27983 <colspec colwidth="6*" align="center"/>
27984 <colspec colwidth="6*" align="center"/>
27985 <colspec colwidth="6*" align="right"/>
27986 <tbody>
27987 <row>
27988 <entry><option>prod_requires_admin</option></entry>
27989 <entry>Use: <emphasis>main</emphasis></entry>
27990 <entry>Type: <emphasis>boolean</emphasis></entry>
27991 <entry>Default: <emphasis>true</emphasis></entry>
27992 </row>
27993 </tbody>
27994 </tgroup>
27995 </informaltable>
27996 <para>
27997 <indexterm role="option">
27998 <primary><option>-M</option></primary>
27999 </indexterm>
28000 <indexterm role="option">
28001 <primary><option>-R</option></primary>
28002 </indexterm>
28003 <indexterm role="option">
28004 <primary><option>-q</option></primary>
28005 </indexterm>
28006 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
28007 admin user unless <option>prod_requires_admin</option> is set false. See also
28008 <option>queue_list_requires_admin</option>.
28009 </para>
28010 <para>
28011 <indexterm role="option">
28012 <primary><option>qualify_domain</option></primary>
28013 </indexterm>
28014 </para>
28015 <informaltable frame="all">
28016 <tgroup cols="4" colsep="0" rowsep="0">
28017 <colspec colwidth="8*" align="left"/>
28018 <colspec colwidth="6*" align="center"/>
28019 <colspec colwidth="6*" align="center"/>
28020 <colspec colwidth="6*" align="right"/>
28021 <tbody>
28022 <row>
28023 <entry><option>qualify_domain</option></entry>
28024 <entry>Use: <emphasis>main</emphasis></entry>
28025 <entry>Type: <emphasis>string</emphasis></entry>
28026 <entry>Default: <emphasis>see below</emphasis></entry>
28027 </row>
28028 </tbody>
28029 </tgroup>
28030 </informaltable>
28031 <para>
28032 <indexterm role="concept">
28033 <primary>domain</primary>
28034 <secondary>for qualifying addresses</secondary>
28035 </indexterm>
28036 <indexterm role="concept">
28037 <primary>address</primary>
28038 <secondary>qualification</secondary>
28039 </indexterm>
28040 This option specifies the domain name that is added to any envelope sender
28041 addresses that do not have a domain qualification. It also applies to
28042 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
28043 are accepted by default only for locally-generated messages. Qualification is
28044 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
28045 locally-generated messages, unless the <option>-bnq</option> command line option is used.
28046 </para>
28047 <para>
28048 Messages from external sources must always contain fully qualified addresses,
28049 unless the sending host matches <option>sender_unqualified_hosts</option> or
28050 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
28051 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
28052 necessary. Internally, Exim always works with fully qualified envelope
28053 addresses. If <option>qualify_domain</option> is not set, it defaults to the
28054 <option>primary_hostname</option> value.
28055 </para>
28056 <para>
28057 <indexterm role="option">
28058 <primary><option>qualify_recipient</option></primary>
28059 </indexterm>
28060 </para>
28061 <informaltable frame="all">
28062 <tgroup cols="4" colsep="0" rowsep="0">
28063 <colspec colwidth="8*" align="left"/>
28064 <colspec colwidth="6*" align="center"/>
28065 <colspec colwidth="6*" align="center"/>
28066 <colspec colwidth="6*" align="right"/>
28067 <tbody>
28068 <row>
28069 <entry><option>qualify_recipient</option></entry>
28070 <entry>Use: <emphasis>main</emphasis></entry>
28071 <entry>Type: <emphasis>string</emphasis></entry>
28072 <entry>Default: <emphasis>see below</emphasis></entry>
28073 </row>
28074 </tbody>
28075 </tgroup>
28076 </informaltable>
28077 <para>
28078 This option allows you to specify a different domain for qualifying recipient
28079 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
28080 </para>
28081 <para>
28082 <indexterm role="option">
28083 <primary><option>queue_domains</option></primary>
28084 </indexterm>
28085 </para>
28086 <informaltable frame="all">
28087 <tgroup cols="4" colsep="0" rowsep="0">
28088 <colspec colwidth="8*" align="left"/>
28089 <colspec colwidth="6*" align="center"/>
28090 <colspec colwidth="6*" align="center"/>
28091 <colspec colwidth="6*" align="right"/>
28092 <tbody>
28093 <row>
28094 <entry><option>queue_domains</option></entry>
28095 <entry>Use: <emphasis>main</emphasis></entry>
28096 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
28097 <entry>Default: <emphasis>unset</emphasis></entry>
28098 </row>
28099 </tbody>
28100 </tgroup>
28101 </informaltable>
28102 <para>
28103 <indexterm role="concept">
28104 <primary>domain</primary>
28105 <secondary>specifying non-immediate delivery</secondary>
28106 </indexterm>
28107 <indexterm role="concept">
28108 <primary>queueing incoming messages</primary>
28109 </indexterm>
28110 <indexterm role="concept">
28111 <primary>message</primary>
28112 <secondary>queueing certain domains</secondary>
28113 </indexterm>
28114 This option lists domains for which immediate delivery is not required.
28115 A delivery process is started whenever a message is received, but only those
28116 domains that do not match are processed. All other deliveries wait until the
28117 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
28118 </para>
28119 <para>
28120 <indexterm role="option">
28121 <primary><option>queue_list_requires_admin</option></primary>
28122 </indexterm>
28123 </para>
28124 <informaltable frame="all">
28125 <tgroup cols="4" colsep="0" rowsep="0">
28126 <colspec colwidth="8*" align="left"/>
28127 <colspec colwidth="6*" align="center"/>
28128 <colspec colwidth="6*" align="center"/>
28129 <colspec colwidth="6*" align="right"/>
28130 <tbody>
28131 <row>
28132 <entry><option>queue_list_requires_admin</option></entry>
28133 <entry>Use: <emphasis>main</emphasis></entry>
28134 <entry>Type: <emphasis>boolean</emphasis></entry>
28135 <entry>Default: <emphasis>true</emphasis></entry>
28136 </row>
28137 </tbody>
28138 </tgroup>
28139 </informaltable>
28140 <para>
28141 <indexterm role="option">
28142 <primary><option>-bp</option></primary>
28143 </indexterm>
28144 The <option>-bp</option> command-line option, which lists the messages that are on the
28145 queue, requires the caller to be an admin user unless
28146 <option>queue_list_requires_admin</option> is set false. See also <option>prod_requires_admin</option>.
28147 </para>
28148 <para>
28149 <indexterm role="option">
28150 <primary><option>queue_only</option></primary>
28151 </indexterm>
28152 </para>
28153 <informaltable frame="all">
28154 <tgroup cols="4" colsep="0" rowsep="0">
28155 <colspec colwidth="8*" align="left"/>
28156 <colspec colwidth="6*" align="center"/>
28157 <colspec colwidth="6*" align="center"/>
28158 <colspec colwidth="6*" align="right"/>
28159 <tbody>
28160 <row>
28161 <entry><option>queue_only</option></entry>
28162 <entry>Use: <emphasis>main</emphasis></entry>
28163 <entry>Type: <emphasis>boolean</emphasis></entry>
28164 <entry>Default: <emphasis>false</emphasis></entry>
28165 </row>
28166 </tbody>
28167 </tgroup>
28168 </informaltable>
28169 <para>
28170 <indexterm role="concept">
28171 <primary>queueing incoming messages</primary>
28172 </indexterm>
28173 <indexterm role="concept">
28174 <primary>message</primary>
28175 <secondary>queueing unconditionally</secondary>
28176 </indexterm>
28177 If <option>queue_only</option> is set, a delivery process is not automatically started
28178 whenever a message is received. Instead, the message waits on the queue for the
28179 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
28180 delivered immediately when certain conditions (such as heavy load) occur.
28181 </para>
28182 <para>
28183 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
28184 and <option>-odi</option> command line options override <option>queue_only</option> unless
28185 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
28186 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
28187 </para>
28188 <para>
28189 <indexterm role="option">
28190 <primary><option>queue_only_file</option></primary>
28191 </indexterm>
28192 </para>
28193 <informaltable frame="all">
28194 <tgroup cols="4" colsep="0" rowsep="0">
28195 <colspec colwidth="8*" align="left"/>
28196 <colspec colwidth="6*" align="center"/>
28197 <colspec colwidth="6*" align="center"/>
28198 <colspec colwidth="6*" align="right"/>
28199 <tbody>
28200 <row>
28201 <entry><option>queue_only_file</option></entry>
28202 <entry>Use: <emphasis>main</emphasis></entry>
28203 <entry>Type: <emphasis>string</emphasis></entry>
28204 <entry>Default: <emphasis>unset</emphasis></entry>
28205 </row>
28206 </tbody>
28207 </tgroup>
28208 </informaltable>
28209 <para>
28210 <indexterm role="concept">
28211 <primary>queueing incoming messages</primary>
28212 </indexterm>
28213 <indexterm role="concept">
28214 <primary>message</primary>
28215 <secondary>queueing by file existence</secondary>
28216 </indexterm>
28217 This option can be set to a colon-separated list of absolute path names, each
28218 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
28219 it tests for the existence of each listed path using a call to <function>stat()</function>. For
28220 each path that exists, the corresponding queueing option is set.
28221 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
28222 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
28223 </para>
28224 <literallayout class="monospaced">
28225 queue_only_file = smtp/some/file
28226 </literallayout>
28227 <para>
28228 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
28229 <filename>/some/file</filename> exists.
28230 </para>
28231 <para>
28232 <indexterm role="option">
28233 <primary><option>queue_only_load</option></primary>
28234 </indexterm>
28235 </para>
28236 <informaltable frame="all">
28237 <tgroup cols="4" colsep="0" rowsep="0">
28238 <colspec colwidth="8*" align="left"/>
28239 <colspec colwidth="6*" align="center"/>
28240 <colspec colwidth="6*" align="center"/>
28241 <colspec colwidth="6*" align="right"/>
28242 <tbody>
28243 <row>
28244 <entry><option>queue_only_load</option></entry>
28245 <entry>Use: <emphasis>main</emphasis></entry>
28246 <entry>Type: <emphasis>fixed-point</emphasis></entry>
28247 <entry>Default: <emphasis>unset</emphasis></entry>
28248 </row>
28249 </tbody>
28250 </tgroup>
28251 </informaltable>
28252 <para>
28253 <indexterm role="concept">
28254 <primary>load average</primary>
28255 </indexterm>
28256 <indexterm role="concept">
28257 <primary>queueing incoming messages</primary>
28258 </indexterm>
28259 <indexterm role="concept">
28260 <primary>message</primary>
28261 <secondary>queueing by load</secondary>
28262 </indexterm>
28263 If the system load average is higher than this value, incoming messages from
28264 all sources are queued, and no automatic deliveries are started. If this
28265 happens during local or remote SMTP input, all subsequent messages received on
28266 the same SMTP connection are queued by default, whatever happens to the load in
28267 the meantime, but this can be changed by setting <option>queue_only_load_latch</option>
28268 false.
28269 </para>
28270 <para>
28271 Deliveries will subsequently be performed by queue runner processes. This
28272 option has no effect on ancient operating systems on which Exim cannot
28273 determine the load average. See also <option>deliver_queue_load_max</option> and
28274 <option>smtp_load_reserve</option>.
28275 </para>
28276 <para>
28277 <indexterm role="option">
28278 <primary><option>queue_only_load_latch</option></primary>
28279 </indexterm>
28280 </para>
28281 <informaltable frame="all">
28282 <tgroup cols="4" colsep="0" rowsep="0">
28283 <colspec colwidth="8*" align="left"/>
28284 <colspec colwidth="6*" align="center"/>
28285 <colspec colwidth="6*" align="center"/>
28286 <colspec colwidth="6*" align="right"/>
28287 <tbody>
28288 <row>
28289 <entry><option>queue_only_load_latch</option></entry>
28290 <entry>Use: <emphasis>main</emphasis></entry>
28291 <entry>Type: <emphasis>boolean</emphasis></entry>
28292 <entry>Default: <emphasis>true</emphasis></entry>
28293 </row>
28294 </tbody>
28295 </tgroup>
28296 </informaltable>
28297 <para>
28298 <indexterm role="concept">
28299 <primary>load average</primary>
28300 <secondary>re-evaluating per message</secondary>
28301 </indexterm>
28302 When this option is true (the default), once one message has been queued
28303 because the load average is higher than the value set by <option>queue_only_load</option>,
28304 all subsequent messages received on the same SMTP connection are also queued.
28305 This is a deliberate choice; even though the load average may fall below the
28306 threshold, it doesn&#x2019;t seem right to deliver later messages on the same
28307 connection when not delivering earlier ones. However, there are special
28308 circumstances such as very long-lived connections from scanning appliances
28309 where this is not the best strategy. In such cases, <option>queue_only_load_latch</option>
28310 should be set false. This causes the value of the load average to be
28311 re-evaluated for each message.
28312 </para>
28313 <para>
28314 <indexterm role="option">
28315 <primary><option>queue_only_override</option></primary>
28316 </indexterm>
28317 </para>
28318 <informaltable frame="all">
28319 <tgroup cols="4" colsep="0" rowsep="0">
28320 <colspec colwidth="8*" align="left"/>
28321 <colspec colwidth="6*" align="center"/>
28322 <colspec colwidth="6*" align="center"/>
28323 <colspec colwidth="6*" align="right"/>
28324 <tbody>
28325 <row>
28326 <entry><option>queue_only_override</option></entry>
28327 <entry>Use: <emphasis>main</emphasis></entry>
28328 <entry>Type: <emphasis>boolean</emphasis></entry>
28329 <entry>Default: <emphasis>true</emphasis></entry>
28330 </row>
28331 </tbody>
28332 </tgroup>
28333 </informaltable>
28334 <para>
28335 <indexterm role="concept">
28336 <primary>queueing incoming messages</primary>
28337 </indexterm>
28338 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
28339 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
28340 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
28341 to override; they are accepted, but ignored.
28342 </para>
28343 <para>
28344 <indexterm role="option">
28345 <primary><option>queue_run_in_order</option></primary>
28346 </indexterm>
28347 </para>
28348 <informaltable frame="all">
28349 <tgroup cols="4" colsep="0" rowsep="0">
28350 <colspec colwidth="8*" align="left"/>
28351 <colspec colwidth="6*" align="center"/>
28352 <colspec colwidth="6*" align="center"/>
28353 <colspec colwidth="6*" align="right"/>
28354 <tbody>
28355 <row>
28356 <entry><option>queue_run_in_order</option></entry>
28357 <entry>Use: <emphasis>main</emphasis></entry>
28358 <entry>Type: <emphasis>boolean</emphasis></entry>
28359 <entry>Default: <emphasis>false</emphasis></entry>
28360 </row>
28361 </tbody>
28362 </tgroup>
28363 </informaltable>
28364 <para>
28365 <indexterm role="concept">
28366 <primary>queue runner</primary>
28367 <secondary>processing messages in order</secondary>
28368 </indexterm>
28369 If this option is set, queue runs happen in order of message arrival instead of
28370 in an arbitrary order. For this to happen, a complete list of the entire queue
28371 must be set up before the deliveries start. When the queue is all held in a
28372 single directory (the default), a single list is created for both the ordered
28373 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
28374 single list is not created when <option>queue_run_in_order</option> is false. In this case,
28375 the sub-directories are processed one at a time (in a random order), and this
28376 avoids setting up one huge list for the whole queue. Thus, setting
28377 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
28378 when the queue is large, because of the extra work in setting up the single,
28379 large list. In most situations, <option>queue_run_in_order</option> should not be set.
28380 </para>
28381 <para>
28382 <indexterm role="option">
28383 <primary><option>queue_run_max</option></primary>
28384 </indexterm>
28385 </para>
28386 <informaltable frame="all">
28387 <tgroup cols="4" colsep="0" rowsep="0">
28388 <colspec colwidth="8*" align="left"/>
28389 <colspec colwidth="6*" align="center"/>
28390 <colspec colwidth="6*" align="center"/>
28391 <colspec colwidth="6*" align="right"/>
28392 <tbody>
28393 <row>
28394 <entry><option>queue_run_max</option></entry>
28395 <entry>Use: <emphasis>main</emphasis></entry>
28396 <entry>Type: <emphasis>integer</emphasis></entry>
28397 <entry>Default: <emphasis>5</emphasis></entry>
28398 </row>
28399 </tbody>
28400 </tgroup>
28401 </informaltable>
28402 <para>
28403 <indexterm role="concept">
28404 <primary>queue runner</primary>
28405 <secondary>maximum number of</secondary>
28406 </indexterm>
28407 This controls the maximum number of queue runner processes that an Exim daemon
28408 can run simultaneously. This does not mean that it starts them all at once,
28409 but rather that if the maximum number are still running when the time comes to
28410 start another one, it refrains from starting another one. This can happen with
28411 very large queues and/or very sluggish deliveries. This option does not,
28412 however, interlock with other processes, so additional queue runners can be
28413 started by other means, or by killing and restarting the daemon.
28414 </para>
28415 <para>
28416 Setting this option to zero does not suppress queue runs; rather, it disables
28417 the limit, allowing any number of simultaneous queue runner processes to be
28418 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
28419 the daemon&#x2019;s command line.
28420 </para>
28421 <para>
28422 <indexterm role="option">
28423 <primary><option>queue_smtp_domains</option></primary>
28424 </indexterm>
28425 </para>
28426 <informaltable frame="all">
28427 <tgroup cols="4" colsep="0" rowsep="0">
28428 <colspec colwidth="8*" align="left"/>
28429 <colspec colwidth="6*" align="center"/>
28430 <colspec colwidth="6*" align="center"/>
28431 <colspec colwidth="6*" align="right"/>
28432 <tbody>
28433 <row>
28434 <entry><option>queue_smtp_domains</option></entry>
28435 <entry>Use: <emphasis>main</emphasis></entry>
28436 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
28437 <entry>Default: <emphasis>unset</emphasis></entry>
28438 </row>
28439 </tbody>
28440 </tgroup>
28441 </informaltable>
28442 <para>
28443 <indexterm role="concept">
28444 <primary>queueing incoming messages</primary>
28445 </indexterm>
28446 <indexterm role="concept">
28447 <primary>message</primary>
28448 <secondary>queueing remote deliveries</secondary>
28449 </indexterm>
28450 When this option is set, a delivery process is started whenever a message is
28451 received, routing is performed, and local deliveries take place.
28452 However, if any SMTP deliveries are required for domains that match
28453 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
28454 message waits on the queue for the next queue run. Since routing of the message
28455 has taken place, Exim knows to which remote hosts it must be delivered, and so
28456 when the queue run happens, multiple messages for the same host are delivered
28457 over a single SMTP connection. The <option>-odqs</option> command line option causes all
28458 SMTP deliveries to be queued in this way, and is equivalent to setting
28459 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
28460 <option>queue_domains</option>.
28461 </para>
28462 <para>
28463 <indexterm role="option">
28464 <primary><option>receive_timeout</option></primary>
28465 </indexterm>
28466 </para>
28467 <informaltable frame="all">
28468 <tgroup cols="4" colsep="0" rowsep="0">
28469 <colspec colwidth="8*" align="left"/>
28470 <colspec colwidth="6*" align="center"/>
28471 <colspec colwidth="6*" align="center"/>
28472 <colspec colwidth="6*" align="right"/>
28473 <tbody>
28474 <row>
28475 <entry><option>receive_timeout</option></entry>
28476 <entry>Use: <emphasis>main</emphasis></entry>
28477 <entry>Type: <emphasis>time</emphasis></entry>
28478 <entry>Default: <emphasis>0s</emphasis></entry>
28479 </row>
28480 </tbody>
28481 </tgroup>
28482 </informaltable>
28483 <para>
28484 <indexterm role="concept">
28485 <primary>timeout</primary>
28486 <secondary>for non-SMTP input</secondary>
28487 </indexterm>
28488 This option sets the timeout for accepting a non-SMTP message, that is, the
28489 maximum time that Exim waits when reading a message on the standard input. If
28490 the value is zero, it will wait for ever. This setting is overridden by the
28491 <option>-or</option> command line option. The timeout for incoming SMTP messages is
28492 controlled by <option>smtp_receive_timeout</option>.
28493 </para>
28494 <para>
28495 <indexterm role="option">
28496 <primary><option>received_header_text</option></primary>
28497 </indexterm>
28498 </para>
28499 <informaltable frame="all">
28500 <tgroup cols="4" colsep="0" rowsep="0">
28501 <colspec colwidth="8*" align="left"/>
28502 <colspec colwidth="6*" align="center"/>
28503 <colspec colwidth="6*" align="center"/>
28504 <colspec colwidth="6*" align="right"/>
28505 <tbody>
28506 <row>
28507 <entry><option>received_header_text</option></entry>
28508 <entry>Use: <emphasis>main</emphasis></entry>
28509 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28510 <entry>Default: <emphasis>see below</emphasis></entry>
28511 </row>
28512 </tbody>
28513 </tgroup>
28514 </informaltable>
28515 <para>
28516 <indexterm role="concept">
28517 <primary>customizing</primary>
28518 <secondary><emphasis>Received:</emphasis> header</secondary>
28519 </indexterm>
28520 <indexterm role="concept">
28521 <primary><emphasis>Received:</emphasis> header line</primary>
28522 <secondary>customizing</secondary>
28523 </indexterm>
28524 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
28525 added to each message, except for the timestamp, which is automatically added
28526 on at the end (preceded by a semicolon). The string is expanded each time it is
28527 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
28528 added to the message. Otherwise, the string should start with the text
28529 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
28530 header lines. The default setting is:
28531 </para>
28532 <literallayout class="monospaced">
28533 received_header_text = Received: \
28534   ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
28535   {${if def:sender_ident \
28536   {from ${quote_local_part:$sender_ident} }}\
28537   ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
28538   by $primary_hostname \
28539   ${if def:received_protocol {with $received_protocol}} \
28540   ${if def:tls_in_cipher {($tls_in_cipher)\n\t}}\
28541   (Exim $version_number)\n\t\
28542   ${if def:sender_address \
28543   {(envelope-from &lt;$sender_address&gt;)\n\t}}\
28544   id $message_exim_id\
28545   ${if def:received_for {\n\tfor $received_for}}
28546 </literallayout>
28547 <para>
28548 The reference to the TLS cipher is omitted when Exim is built without TLS
28549 support. The use of conditional expansions ensures that this works for both
28550 locally generated messages and messages received from remote hosts, giving
28551 header lines such as the following:
28552 </para>
28553 <literallayout class="monospaced">
28554 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
28555 by marley.carol.example with esmtp (Exim 4.00)
28556 (envelope-from &lt;bob@carol.example&gt;)
28557 id 16IOWa-00019l-00
28558 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
28559 Received: by scrooge.carol.example with local (Exim 4.00)
28560 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
28561 </literallayout>
28562 <para>
28563 Until the body of the message has been received, the timestamp is the time when
28564 the message started to be received. Once the body has arrived, and all policy
28565 checks have taken place, the timestamp is updated to the time at which the
28566 message was accepted.
28567 </para>
28568 <para>
28569 <indexterm role="option">
28570 <primary><option>received_headers_max</option></primary>
28571 </indexterm>
28572 </para>
28573 <informaltable frame="all">
28574 <tgroup cols="4" colsep="0" rowsep="0">
28575 <colspec colwidth="8*" align="left"/>
28576 <colspec colwidth="6*" align="center"/>
28577 <colspec colwidth="6*" align="center"/>
28578 <colspec colwidth="6*" align="right"/>
28579 <tbody>
28580 <row>
28581 <entry><option>received_headers_max</option></entry>
28582 <entry>Use: <emphasis>main</emphasis></entry>
28583 <entry>Type: <emphasis>integer</emphasis></entry>
28584 <entry>Default: <emphasis>30</emphasis></entry>
28585 </row>
28586 </tbody>
28587 </tgroup>
28588 </informaltable>
28589 <para>
28590 <indexterm role="concept">
28591 <primary>loop</primary>
28592 <secondary>prevention</secondary>
28593 </indexterm>
28594 <indexterm role="concept">
28595 <primary>mail loop prevention</primary>
28596 </indexterm>
28597 <indexterm role="concept">
28598 <primary><emphasis>Received:</emphasis> header line</primary>
28599 <secondary>counting</secondary>
28600 </indexterm>
28601 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
28602 counted, and if it is greater than this parameter, a mail loop is assumed to
28603 have occurred, the delivery is abandoned, and an error message is generated.
28604 This applies to both local and remote deliveries.
28605 </para>
28606 <para>
28607 <indexterm role="option">
28608 <primary><option>recipient_unqualified_hosts</option></primary>
28609 </indexterm>
28610 </para>
28611 <informaltable frame="all">
28612 <tgroup cols="4" colsep="0" rowsep="0">
28613 <colspec colwidth="8*" align="left"/>
28614 <colspec colwidth="6*" align="center"/>
28615 <colspec colwidth="6*" align="center"/>
28616 <colspec colwidth="6*" align="right"/>
28617 <tbody>
28618 <row>
28619 <entry><option>recipient_unqualified_hosts</option></entry>
28620 <entry>Use: <emphasis>main</emphasis></entry>
28621 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28622 <entry>Default: <emphasis>unset</emphasis></entry>
28623 </row>
28624 </tbody>
28625 </tgroup>
28626 </informaltable>
28627 <para>
28628 <indexterm role="concept">
28629 <primary>unqualified addresses</primary>
28630 </indexterm>
28631 <indexterm role="concept">
28632 <primary>host</primary>
28633 <secondary>unqualified addresses from</secondary>
28634 </indexterm>
28635 This option lists those hosts from which Exim is prepared to accept unqualified
28636 recipient addresses in message envelopes. The addresses are made fully
28637 qualified by the addition of the <option>qualify_recipient</option> value. This option also
28638 affects message header lines. Exim does not reject unqualified recipient
28639 addresses in headers, but it qualifies them only if the message came from a
28640 host that matches <option>recipient_unqualified_hosts</option>,
28641 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
28642 option was not set.
28643 </para>
28644 <para>
28645 <indexterm role="option">
28646 <primary><option>recipients_max</option></primary>
28647 </indexterm>
28648 </para>
28649 <informaltable frame="all">
28650 <tgroup cols="4" colsep="0" rowsep="0">
28651 <colspec colwidth="8*" align="left"/>
28652 <colspec colwidth="6*" align="center"/>
28653 <colspec colwidth="6*" align="center"/>
28654 <colspec colwidth="6*" align="right"/>
28655 <tbody>
28656 <row>
28657 <entry><option>recipients_max</option></entry>
28658 <entry>Use: <emphasis>main</emphasis></entry>
28659 <entry>Type: <emphasis>integer</emphasis></entry>
28660 <entry>Default: <emphasis>0</emphasis></entry>
28661 </row>
28662 </tbody>
28663 </tgroup>
28664 </informaltable>
28665 <para>
28666 <indexterm role="concept">
28667 <primary>limit</primary>
28668 <secondary>number of recipients</secondary>
28669 </indexterm>
28670 <indexterm role="concept">
28671 <primary>recipient</primary>
28672 <secondary>maximum number</secondary>
28673 </indexterm>
28674 If this option is set greater than zero, it specifies the maximum number of
28675 original recipients for any message. Additional recipients that are generated
28676 by aliasing or forwarding do not count. SMTP messages get a 452 response for
28677 all recipients over the limit; earlier recipients are delivered as normal.
28678 Non-SMTP messages with too many recipients are failed, and no deliveries are
28679 done.
28680 </para>
28681 <para>
28682 <indexterm role="concept">
28683 <primary>RCPT</primary>
28684 <secondary>maximum number of incoming</secondary>
28685 </indexterm>
28686 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
28687 RCPT commands in a single message.
28688 </para>
28689 <para>
28690 <indexterm role="option">
28691 <primary><option>recipients_max_reject</option></primary>
28692 </indexterm>
28693 </para>
28694 <informaltable frame="all">
28695 <tgroup cols="4" colsep="0" rowsep="0">
28696 <colspec colwidth="8*" align="left"/>
28697 <colspec colwidth="6*" align="center"/>
28698 <colspec colwidth="6*" align="center"/>
28699 <colspec colwidth="6*" align="right"/>
28700 <tbody>
28701 <row>
28702 <entry><option>recipients_max_reject</option></entry>
28703 <entry>Use: <emphasis>main</emphasis></entry>
28704 <entry>Type: <emphasis>boolean</emphasis></entry>
28705 <entry>Default: <emphasis>false</emphasis></entry>
28706 </row>
28707 </tbody>
28708 </tgroup>
28709 </informaltable>
28710 <para>
28711 If this option is set true, Exim rejects SMTP messages containing too many
28712 recipients by giving 552 errors to the surplus RCPT commands, and a 554
28713 error to the eventual DATA command. Otherwise (the default) it gives a 452
28714 error to the surplus RCPT commands and accepts the message on behalf of the
28715 initial set of recipients. The remote server should then re-send the message
28716 for the remaining recipients at a later time.
28717 </para>
28718 <para>
28719 <indexterm role="option">
28720 <primary><option>remote_max_parallel</option></primary>
28721 </indexterm>
28722 </para>
28723 <informaltable frame="all">
28724 <tgroup cols="4" colsep="0" rowsep="0">
28725 <colspec colwidth="8*" align="left"/>
28726 <colspec colwidth="6*" align="center"/>
28727 <colspec colwidth="6*" align="center"/>
28728 <colspec colwidth="6*" align="right"/>
28729 <tbody>
28730 <row>
28731 <entry><option>remote_max_parallel</option></entry>
28732 <entry>Use: <emphasis>main</emphasis></entry>
28733 <entry>Type: <emphasis>integer</emphasis></entry>
28734 <entry>Default: <emphasis>2</emphasis></entry>
28735 </row>
28736 </tbody>
28737 </tgroup>
28738 </informaltable>
28739 <para>
28740 <indexterm role="concept">
28741 <primary>delivery</primary>
28742 <secondary>parallelism for remote</secondary>
28743 </indexterm>
28744 This option controls parallel delivery of one message to a number of remote
28745 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
28746 does all the remote deliveries for a message one by one. Otherwise, if a single
28747 message has to be delivered to more than one remote host, or if several copies
28748 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
28749 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
28750 deliveries are required, the maximum number of processes are started, and as
28751 each one finishes, another is begun. The order of starting processes is the
28752 same as if sequential delivery were being done, and can be controlled by the
28753 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
28754 with debugging turned on, the debugging output from each delivery process is
28755 tagged with its process id.
28756 </para>
28757 <para>
28758 This option controls only the maximum number of parallel deliveries for one
28759 message in one Exim delivery process. Because Exim has no central queue
28760 manager, there is no way of controlling the total number of simultaneous
28761 deliveries if the configuration allows a delivery attempt as soon as a message
28762 is received.
28763 </para>
28764 <para>
28765 <indexterm role="concept">
28766 <primary>number of deliveries</primary>
28767 </indexterm>
28768 <indexterm role="concept">
28769 <primary>delivery</primary>
28770 <secondary>maximum number of</secondary>
28771 </indexterm>
28772 If you want to control the total number of deliveries on the system, you
28773 need to set the <option>queue_only</option> option. This ensures that all incoming messages
28774 are added to the queue without starting a delivery process. Then set up an Exim
28775 daemon to start queue runner processes at appropriate intervals (probably
28776 fairly often, for example, every minute), and limit the total number of queue
28777 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
28778 delivers only one message at a time, the maximum number of deliveries that can
28779 then take place at once is <option>queue_run_max</option> multiplied by
28780 <option>remote_max_parallel</option>.
28781 </para>
28782 <para>
28783 If it is purely remote deliveries you want to control, use
28784 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
28785 doing the SMTP routing before queueing, so that several messages for the same
28786 host will eventually get delivered down the same connection.
28787 </para>
28788 <para>
28789 <indexterm role="option">
28790 <primary><option>remote_sort_domains</option></primary>
28791 </indexterm>
28792 </para>
28793 <informaltable frame="all">
28794 <tgroup cols="4" colsep="0" rowsep="0">
28795 <colspec colwidth="8*" align="left"/>
28796 <colspec colwidth="6*" align="center"/>
28797 <colspec colwidth="6*" align="center"/>
28798 <colspec colwidth="6*" align="right"/>
28799 <tbody>
28800 <row>
28801 <entry><option>remote_sort_domains</option></entry>
28802 <entry>Use: <emphasis>main</emphasis></entry>
28803 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
28804 <entry>Default: <emphasis>unset</emphasis></entry>
28805 </row>
28806 </tbody>
28807 </tgroup>
28808 </informaltable>
28809 <para>
28810 <indexterm role="concept">
28811 <primary>sorting remote deliveries</primary>
28812 </indexterm>
28813 <indexterm role="concept">
28814 <primary>delivery</primary>
28815 <secondary>sorting remote</secondary>
28816 </indexterm>
28817 When there are a number of remote deliveries for a message, they are sorted by
28818 domain into the order given by this list. For example,
28819 </para>
28820 <literallayout class="monospaced">
28821 remote_sort_domains = *.cam.ac.uk:*.uk
28822 </literallayout>
28823 <para>
28824 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
28825 then to those in the <option>uk</option> domain, then to any others.
28826 </para>
28827 <para>
28828 <indexterm role="option">
28829 <primary><option>retry_data_expire</option></primary>
28830 </indexterm>
28831 </para>
28832 <informaltable frame="all">
28833 <tgroup cols="4" colsep="0" rowsep="0">
28834 <colspec colwidth="8*" align="left"/>
28835 <colspec colwidth="6*" align="center"/>
28836 <colspec colwidth="6*" align="center"/>
28837 <colspec colwidth="6*" align="right"/>
28838 <tbody>
28839 <row>
28840 <entry><option>retry_data_expire</option></entry>
28841 <entry>Use: <emphasis>main</emphasis></entry>
28842 <entry>Type: <emphasis>time</emphasis></entry>
28843 <entry>Default: <emphasis>7d</emphasis></entry>
28844 </row>
28845 </tbody>
28846 </tgroup>
28847 </informaltable>
28848 <para>
28849 <indexterm role="concept">
28850 <primary>hints database</primary>
28851 <secondary>data expiry</secondary>
28852 </indexterm>
28853 This option sets a <quote>use before</quote> time on retry information in Exim&#x2019;s hints
28854 database. Any older retry data is ignored. This means that, for example, once a
28855 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
28856 past failures.
28857 </para>
28858 <para>
28859 <indexterm role="option">
28860 <primary><option>retry_interval_max</option></primary>
28861 </indexterm>
28862 </para>
28863 <informaltable frame="all">
28864 <tgroup cols="4" colsep="0" rowsep="0">
28865 <colspec colwidth="8*" align="left"/>
28866 <colspec colwidth="6*" align="center"/>
28867 <colspec colwidth="6*" align="center"/>
28868 <colspec colwidth="6*" align="right"/>
28869 <tbody>
28870 <row>
28871 <entry><option>retry_interval_max</option></entry>
28872 <entry>Use: <emphasis>main</emphasis></entry>
28873 <entry>Type: <emphasis>time</emphasis></entry>
28874 <entry>Default: <emphasis>24h</emphasis></entry>
28875 </row>
28876 </tbody>
28877 </tgroup>
28878 </informaltable>
28879 <para>
28880 <indexterm role="concept">
28881 <primary>retry</primary>
28882 <secondary>limit on interval</secondary>
28883 </indexterm>
28884 <indexterm role="concept">
28885 <primary>limit</primary>
28886 <secondary>on retry interval</secondary>
28887 </indexterm>
28888 Chapter <xref linkend="CHAPretry"/> describes Exim&#x2019;s mechanisms for controlling the
28889 intervals between delivery attempts for messages that cannot be delivered
28890 straight away. This option sets an overall limit to the length of time between
28891 retries. It cannot be set greater than 24 hours; any attempt to do so forces
28892 the default value.
28893 </para>
28894 <para>
28895 <indexterm role="option">
28896 <primary><option>return_path_remove</option></primary>
28897 </indexterm>
28898 </para>
28899 <informaltable frame="all">
28900 <tgroup cols="4" colsep="0" rowsep="0">
28901 <colspec colwidth="8*" align="left"/>
28902 <colspec colwidth="6*" align="center"/>
28903 <colspec colwidth="6*" align="center"/>
28904 <colspec colwidth="6*" align="right"/>
28905 <tbody>
28906 <row>
28907 <entry><option>return_path_remove</option></entry>
28908 <entry>Use: <emphasis>main</emphasis></entry>
28909 <entry>Type: <emphasis>boolean</emphasis></entry>
28910 <entry>Default: <emphasis>true</emphasis></entry>
28911 </row>
28912 </tbody>
28913 </tgroup>
28914 </informaltable>
28915 <para>
28916 <indexterm role="concept">
28917 <primary><emphasis>Return-path:</emphasis> header line</primary>
28918 <secondary>removing</secondary>
28919 </indexterm>
28920 RFC 2821, section 4.4, states that an SMTP server must insert a
28921 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
28922 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
28923 MAIL command. This description implies that this header should not be present
28924 in an incoming message. If <option>return_path_remove</option> is true, any existing
28925 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
28926 received. Exim&#x2019;s transports have options for adding <emphasis>Return-path:</emphasis> headers at
28927 the time of delivery. They are normally used only for final local deliveries.
28928 </para>
28929 <para>
28930 <indexterm role="option">
28931 <primary><option>return_size_limit</option></primary>
28932 </indexterm>
28933 </para>
28934 <informaltable frame="all">
28935 <tgroup cols="4" colsep="0" rowsep="0">
28936 <colspec colwidth="8*" align="left"/>
28937 <colspec colwidth="6*" align="center"/>
28938 <colspec colwidth="6*" align="center"/>
28939 <colspec colwidth="6*" align="right"/>
28940 <tbody>
28941 <row>
28942 <entry><option>return_size_limit</option></entry>
28943 <entry>Use: <emphasis>main</emphasis></entry>
28944 <entry>Type: <emphasis>integer</emphasis></entry>
28945 <entry>Default: <emphasis>100K</emphasis></entry>
28946 </row>
28947 </tbody>
28948 </tgroup>
28949 </informaltable>
28950 <para>
28951 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
28952 </para>
28953 <para>
28954 <indexterm role="option">
28955 <primary><option>rfc1413_hosts</option></primary>
28956 </indexterm>
28957 </para>
28958 <informaltable frame="all">
28959 <tgroup cols="4" colsep="0" rowsep="0">
28960 <colspec colwidth="8*" align="left"/>
28961 <colspec colwidth="6*" align="center"/>
28962 <colspec colwidth="6*" align="center"/>
28963 <colspec colwidth="6*" align="right"/>
28964 <tbody>
28965 <row>
28966 <entry><option>rfc1413_hosts</option></entry>
28967 <entry>Use: <emphasis>main</emphasis></entry>
28968 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28969 <entry>Default: <emphasis>@[]</emphasis></entry>
28970 </row>
28971 </tbody>
28972 </tgroup>
28973 </informaltable>
28974 <para>
28975 <indexterm role="concept">
28976 <primary>RFC 1413</primary>
28977 </indexterm>
28978 <indexterm role="concept">
28979 <primary>host</primary>
28980 <secondary>for RFC 1413 calls</secondary>
28981 </indexterm>
28982 RFC 1413 identification calls are made to any client host which matches
28983 an item in the list.
28984 The default value specifies just this host, being any local interface
28985 for the system.
28986 </para>
28987 <para>
28988 <indexterm role="option">
28989 <primary><option>rfc1413_query_timeout</option></primary>
28990 </indexterm>
28991 </para>
28992 <informaltable frame="all">
28993 <tgroup cols="4" colsep="0" rowsep="0">
28994 <colspec colwidth="8*" align="left"/>
28995 <colspec colwidth="6*" align="center"/>
28996 <colspec colwidth="6*" align="center"/>
28997 <colspec colwidth="6*" align="right"/>
28998 <tbody>
28999 <row>
29000 <entry><option>rfc1413_query_timeout</option></entry>
29001 <entry>Use: <emphasis>main</emphasis></entry>
29002 <entry>Type: <emphasis>time</emphasis></entry>
29003 <entry>Default: <emphasis>0s</emphasis></entry>
29004 </row>
29005 </tbody>
29006 </tgroup>
29007 </informaltable>
29008 <para>
29009 <indexterm role="concept">
29010 <primary>RFC 1413</primary>
29011 <secondary>query timeout</secondary>
29012 </indexterm>
29013 <indexterm role="concept">
29014 <primary>timeout</primary>
29015 <secondary>for RFC 1413 call</secondary>
29016 </indexterm>
29017 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
29018 no RFC 1413 calls are ever made.
29019 </para>
29020 <para>
29021 <indexterm role="option">
29022 <primary><option>sender_unqualified_hosts</option></primary>
29023 </indexterm>
29024 </para>
29025 <informaltable frame="all">
29026 <tgroup cols="4" colsep="0" rowsep="0">
29027 <colspec colwidth="8*" align="left"/>
29028 <colspec colwidth="6*" align="center"/>
29029 <colspec colwidth="6*" align="center"/>
29030 <colspec colwidth="6*" align="right"/>
29031 <tbody>
29032 <row>
29033 <entry><option>sender_unqualified_hosts</option></entry>
29034 <entry>Use: <emphasis>main</emphasis></entry>
29035 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29036 <entry>Default: <emphasis>unset</emphasis></entry>
29037 </row>
29038 </tbody>
29039 </tgroup>
29040 </informaltable>
29041 <para>
29042 <indexterm role="concept">
29043 <primary>unqualified addresses</primary>
29044 </indexterm>
29045 <indexterm role="concept">
29046 <primary>host</primary>
29047 <secondary>unqualified addresses from</secondary>
29048 </indexterm>
29049 This option lists those hosts from which Exim is prepared to accept unqualified
29050 sender addresses. The addresses are made fully qualified by the addition of
29051 <option>qualify_domain</option>. This option also affects message header lines. Exim does
29052 not reject unqualified addresses in headers that contain sender addresses, but
29053 it qualifies them only if the message came from a host that matches
29054 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
29055 using TCP/IP), and the <option>-bnq</option> option was not set.
29056 </para>
29057 <para>
29058 <indexterm role="option">
29059 <primary><option>set_environment</option></primary>
29060 </indexterm>
29061 </para>
29062 <informaltable frame="all">
29063 <tgroup cols="4" colsep="0" rowsep="0">
29064 <colspec colwidth="8*" align="left"/>
29065 <colspec colwidth="6*" align="center"/>
29066 <colspec colwidth="6*" align="center"/>
29067 <colspec colwidth="6*" align="right"/>
29068 <tbody>
29069 <row>
29070 <entry><option>set_environment</option></entry>
29071 <entry>Use: <emphasis>main</emphasis></entry>
29072 <entry>Type: <emphasis>string list</emphasis></entry>
29073 <entry>Default: <emphasis>empty</emphasis></entry>
29074 </row>
29075 </tbody>
29076 </tgroup>
29077 </informaltable>
29078 <para>
29079 <indexterm role="concept">
29080 <primary>environment</primary>
29081 </indexterm>
29082 This option allows to set individual environment variables that the
29083 currently linked libraries and programs in child processes use. The
29084 default list is empty,
29085 </para>
29086 <para>
29087 <indexterm role="option">
29088 <primary><option>slow_lookup_log</option></primary>
29089 </indexterm>
29090 </para>
29091 <informaltable frame="all">
29092 <tgroup cols="4" colsep="0" rowsep="0">
29093 <colspec colwidth="8*" align="left"/>
29094 <colspec colwidth="6*" align="center"/>
29095 <colspec colwidth="6*" align="center"/>
29096 <colspec colwidth="6*" align="right"/>
29097 <tbody>
29098 <row>
29099 <entry><option>slow_lookup_log</option></entry>
29100 <entry>Use: <emphasis>main</emphasis></entry>
29101 <entry>Type: <emphasis>integer</emphasis></entry>
29102 <entry>Default: <emphasis>0</emphasis></entry>
29103 </row>
29104 </tbody>
29105 </tgroup>
29106 </informaltable>
29107 <para>
29108 <indexterm role="concept">
29109 <primary>logging</primary>
29110 <secondary>slow lookups</secondary>
29111 </indexterm>
29112 <indexterm role="concept">
29113 <primary>dns</primary>
29114 <secondary>logging slow lookups</secondary>
29115 </indexterm>
29116 This option controls logging of slow lookups.
29117 If the value is nonzero it is taken as a number of milliseconds
29118 and lookups taking longer than this are logged.
29119 Currently this applies only to DNS lookups.
29120 </para>
29121 <para>
29122 <indexterm role="option">
29123 <primary><option>smtp_accept_keepalive</option></primary>
29124 </indexterm>
29125 </para>
29126 <informaltable frame="all">
29127 <tgroup cols="4" colsep="0" rowsep="0">
29128 <colspec colwidth="8*" align="left"/>
29129 <colspec colwidth="6*" align="center"/>
29130 <colspec colwidth="6*" align="center"/>
29131 <colspec colwidth="6*" align="right"/>
29132 <tbody>
29133 <row>
29134 <entry><option>smtp_accept_keepalive</option></entry>
29135 <entry>Use: <emphasis>main</emphasis></entry>
29136 <entry>Type: <emphasis>boolean</emphasis></entry>
29137 <entry>Default: <emphasis>true</emphasis></entry>
29138 </row>
29139 </tbody>
29140 </tgroup>
29141 </informaltable>
29142 <para>
29143 <indexterm role="concept">
29144 <primary>keepalive</primary>
29145 <secondary>on incoming connection</secondary>
29146 </indexterm>
29147 This option controls the setting of the SO_KEEPALIVE option on incoming
29148 TCP/IP socket connections. When set, it causes the kernel to probe idle
29149 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
29150 other end of the connection should send an acknowledgment if the connection is
29151 still okay or a reset if the connection has been aborted. The reason for doing
29152 this is that it has the beneficial effect of freeing up certain types of
29153 connection that can get stuck when the remote host is disconnected without
29154 tidying up the TCP/IP call properly. The keepalive mechanism takes several
29155 hours to detect unreachable hosts.
29156 </para>
29157 <para>
29158 <indexterm role="option">
29159 <primary><option>smtp_accept_max</option></primary>
29160 </indexterm>
29161 </para>
29162 <informaltable frame="all">
29163 <tgroup cols="4" colsep="0" rowsep="0">
29164 <colspec colwidth="8*" align="left"/>
29165 <colspec colwidth="6*" align="center"/>
29166 <colspec colwidth="6*" align="center"/>
29167 <colspec colwidth="6*" align="right"/>
29168 <tbody>
29169 <row>
29170 <entry><option>smtp_accept_max</option></entry>
29171 <entry>Use: <emphasis>main</emphasis></entry>
29172 <entry>Type: <emphasis>integer</emphasis></entry>
29173 <entry>Default: <emphasis>20</emphasis></entry>
29174 </row>
29175 </tbody>
29176 </tgroup>
29177 </informaltable>
29178 <para>
29179 <indexterm role="concept">
29180 <primary>limit</primary>
29181 <secondary>incoming SMTP connections</secondary>
29182 </indexterm>
29183 <indexterm role="concept">
29184 <primary>SMTP</primary>
29185 <secondary>incoming connection count</secondary>
29186 </indexterm>
29187 <indexterm role="concept">
29188 <primary>inetd</primary>
29189 </indexterm>
29190 This option specifies the maximum number of simultaneous incoming SMTP calls
29191 that Exim will accept. It applies only to the listening daemon; there is no
29192 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
29193 value is set to zero, no limit is applied. However, it is required to be
29194 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
29195 set. See also <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option>.
29196 </para>
29197 <para>
29198 A new SMTP connection is immediately rejected if the <option>smtp_accept_max</option> limit
29199 has been reached. If not, Exim first checks <option>smtp_accept_max_per_host</option>. If
29200 that limit has not been reached for the client host, <option>smtp_accept_reserve</option>
29201 and <option>smtp_load_reserve</option> are then checked before accepting the connection.
29202 </para>
29203 <para>
29204 <indexterm role="option">
29205 <primary><option>smtp_accept_max_nonmail</option></primary>
29206 </indexterm>
29207 </para>
29208 <informaltable frame="all">
29209 <tgroup cols="4" colsep="0" rowsep="0">
29210 <colspec colwidth="8*" align="left"/>
29211 <colspec colwidth="6*" align="center"/>
29212 <colspec colwidth="6*" align="center"/>
29213 <colspec colwidth="6*" align="right"/>
29214 <tbody>
29215 <row>
29216 <entry><option>smtp_accept_max_nonmail</option></entry>
29217 <entry>Use: <emphasis>main</emphasis></entry>
29218 <entry>Type: <emphasis>integer</emphasis></entry>
29219 <entry>Default: <emphasis>10</emphasis></entry>
29220 </row>
29221 </tbody>
29222 </tgroup>
29223 </informaltable>
29224 <para>
29225 <indexterm role="concept">
29226 <primary>limit</primary>
29227 <secondary>non-mail SMTP commands</secondary>
29228 </indexterm>
29229 <indexterm role="concept">
29230 <primary>SMTP</primary>
29231 <secondary>limiting non-mail commands</secondary>
29232 </indexterm>
29233 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
29234 the connection if there are too many. This option defines <quote>too many</quote>. The
29235 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
29236 client looping sending EHLO, for example. The check is applied only if the
29237 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
29238 </para>
29239 <para>
29240 When a new message is expected, one occurrence of RSET is not counted. This
29241 allows a client to send one RSET between messages (this is not necessary,
29242 but some clients do it). Exim also allows one uncounted occurrence of HELO
29243 or EHLO, and one occurrence of STARTTLS between messages. After
29244 starting up a TLS session, another EHLO is expected, and so it too is not
29245 counted. The first occurrence of AUTH in a connection, or immediately
29246 following STARTTLS is not counted. Otherwise, all commands other than
29247 MAIL, RCPT, DATA, and QUIT are counted.
29248 </para>
29249 <para>
29250 <indexterm role="option">
29251 <primary><option>smtp_accept_max_nonmail_hosts</option></primary>
29252 </indexterm>
29253 </para>
29254 <informaltable frame="all">
29255 <tgroup cols="4" colsep="0" rowsep="0">
29256 <colspec colwidth="8*" align="left"/>
29257 <colspec colwidth="6*" align="center"/>
29258 <colspec colwidth="6*" align="center"/>
29259 <colspec colwidth="6*" align="right"/>
29260 <tbody>
29261 <row>
29262 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
29263 <entry>Use: <emphasis>main</emphasis></entry>
29264 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29265 <entry>Default: <emphasis>*</emphasis></entry>
29266 </row>
29267 </tbody>
29268 </tgroup>
29269 </informaltable>
29270 <para>
29271 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
29272 check by setting this option. The default value makes it apply to all hosts. By
29273 changing the value, you can exclude any badly-behaved hosts that you have to
29274 live with.
29275 </para>
29276 <para>
29277 <indexterm role="option">
29278 <primary><option>smtp_accept_max_per_connection</option></primary>
29279 </indexterm>
29280 </para>
29281 <informaltable frame="all">
29282 <tgroup cols="4" colsep="0" rowsep="0">
29283 <colspec colwidth="8*" align="left"/>
29284 <colspec colwidth="6*" align="center"/>
29285 <colspec colwidth="6*" align="center"/>
29286 <colspec colwidth="6*" align="right"/>
29287 <tbody>
29288 <row>
29289 <entry><option>smtp_accept_max_per_connection</option></entry>
29290 <entry>Use: <emphasis>main</emphasis></entry>
29291 <entry>Type: <emphasis>integer</emphasis></entry>
29292 <entry>Default: <emphasis>1000</emphasis></entry>
29293 </row>
29294 </tbody>
29295 </tgroup>
29296 </informaltable>
29297 <para>
29298 <indexterm role="concept">
29299 <primary>SMTP</primary>
29300 <secondary>limiting incoming message count</secondary>
29301 </indexterm>
29302 <indexterm role="concept">
29303 <primary>limit</primary>
29304 <secondary>messages per SMTP connection</secondary>
29305 </indexterm>
29306 The value of this option limits the number of MAIL commands that Exim is
29307 prepared to accept over a single SMTP connection, whether or not each command
29308 results in the transfer of a message. After the limit is reached, a 421
29309 response is given to subsequent MAIL commands. This limit is a safety
29310 precaution against a client that goes mad (incidents of this type have been
29311 seen).
29312 </para>
29313 <para>
29314 <indexterm role="option">
29315 <primary><option>smtp_accept_max_per_host</option></primary>
29316 </indexterm>
29317 </para>
29318 <informaltable frame="all">
29319 <tgroup cols="4" colsep="0" rowsep="0">
29320 <colspec colwidth="8*" align="left"/>
29321 <colspec colwidth="6*" align="center"/>
29322 <colspec colwidth="6*" align="center"/>
29323 <colspec colwidth="6*" align="right"/>
29324 <tbody>
29325 <row>
29326 <entry><option>smtp_accept_max_per_host</option></entry>
29327 <entry>Use: <emphasis>main</emphasis></entry>
29328 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29329 <entry>Default: <emphasis>unset</emphasis></entry>
29330 </row>
29331 </tbody>
29332 </tgroup>
29333 </informaltable>
29334 <para>
29335 <indexterm role="concept">
29336 <primary>limit</primary>
29337 <secondary>SMTP connections from one host</secondary>
29338 </indexterm>
29339 <indexterm role="concept">
29340 <primary>host</primary>
29341 <secondary>limiting SMTP connections from</secondary>
29342 </indexterm>
29343 This option restricts the number of simultaneous IP connections from a single
29344 host (strictly, from a single IP address) to the Exim daemon. The option is
29345 expanded, to enable different limits to be applied to different hosts by
29346 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
29347 connection attempts from the same host are rejected with error code 421. This
29348 is entirely independent of <option>smtp_accept_reserve</option>. The option&#x2019;s default value
29349 of zero imposes no limit. If this option is set greater than zero, it is
29350 required that <option>smtp_accept_max</option> be non-zero.
29351 </para>
29352 <para>
29353 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
29354 constructions that take an appreciable amount of time. The expansion and test
29355 happen in the main daemon loop, in order to reject additional connections
29356 without forking additional processes (otherwise a denial-of-service attack
29357 could cause a vast number or processes to be created). While the daemon is
29358 doing this processing, it cannot accept any other incoming connections.
29359 </para>
29360 <para>
29361 <indexterm role="option">
29362 <primary><option>smtp_accept_queue</option></primary>
29363 </indexterm>
29364 </para>
29365 <informaltable frame="all">
29366 <tgroup cols="4" colsep="0" rowsep="0">
29367 <colspec colwidth="8*" align="left"/>
29368 <colspec colwidth="6*" align="center"/>
29369 <colspec colwidth="6*" align="center"/>
29370 <colspec colwidth="6*" align="right"/>
29371 <tbody>
29372 <row>
29373 <entry><option>smtp_accept_queue</option></entry>
29374 <entry>Use: <emphasis>main</emphasis></entry>
29375 <entry>Type: <emphasis>integer</emphasis></entry>
29376 <entry>Default: <emphasis>0</emphasis></entry>
29377 </row>
29378 </tbody>
29379 </tgroup>
29380 </informaltable>
29381 <para>
29382 <indexterm role="concept">
29383 <primary>SMTP</primary>
29384 <secondary>incoming connection count</secondary>
29385 </indexterm>
29386 <indexterm role="concept">
29387 <primary>queueing incoming messages</primary>
29388 </indexterm>
29389 <indexterm role="concept">
29390 <primary>message</primary>
29391 <secondary>queueing by SMTP connection count</secondary>
29392 </indexterm>
29393 If the number of simultaneous incoming SMTP connections being handled via the
29394 listening daemon exceeds this value, messages received by SMTP are just placed
29395 on the queue; no delivery processes are started automatically. The count is
29396 fixed at the start of an SMTP connection. It cannot be updated in the
29397 subprocess that receives messages, and so the queueing or not queueing applies
29398 to all messages received in the same connection.
29399 </para>
29400 <para>
29401 A value of zero implies no limit, and clearly any non-zero value is useful only
29402 if it is less than the <option>smtp_accept_max</option> value (unless that is zero). See
29403 also <option>queue_only</option>, <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the
29404 various <option>-od</option><emphasis>x</emphasis> command line options.
29405 </para>
29406 <para>
29407 <indexterm role="option">
29408 <primary><option>smtp_accept_queue_per_connection</option></primary>
29409 </indexterm>
29410 </para>
29411 <informaltable frame="all">
29412 <tgroup cols="4" colsep="0" rowsep="0">
29413 <colspec colwidth="8*" align="left"/>
29414 <colspec colwidth="6*" align="center"/>
29415 <colspec colwidth="6*" align="center"/>
29416 <colspec colwidth="6*" align="right"/>
29417 <tbody>
29418 <row>
29419 <entry><option>smtp_accept_queue_per_connection</option></entry>
29420 <entry>Use: <emphasis>main</emphasis></entry>
29421 <entry>Type: <emphasis>integer</emphasis></entry>
29422 <entry>Default: <emphasis>10</emphasis></entry>
29423 </row>
29424 </tbody>
29425 </tgroup>
29426 </informaltable>
29427 <para>
29428 <indexterm role="concept">
29429 <primary>queueing incoming messages</primary>
29430 </indexterm>
29431 <indexterm role="concept">
29432 <primary>message</primary>
29433 <secondary>queueing by message count</secondary>
29434 </indexterm>
29435 This option limits the number of delivery processes that Exim starts
29436 automatically when receiving messages via SMTP, whether via the daemon or by
29437 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
29438 and the number of messages received in a single SMTP session exceeds this
29439 number, subsequent messages are placed on the queue, but no delivery processes
29440 are started. This helps to limit the number of Exim processes when a server
29441 restarts after downtime and there is a lot of mail waiting for it on other
29442 systems. On large systems, the default should probably be increased, and on
29443 dial-in client systems it should probably be set to zero (that is, disabled).
29444 </para>
29445 <para>
29446 <indexterm role="option">
29447 <primary><option>smtp_accept_reserve</option></primary>
29448 </indexterm>
29449 </para>
29450 <informaltable frame="all">
29451 <tgroup cols="4" colsep="0" rowsep="0">
29452 <colspec colwidth="8*" align="left"/>
29453 <colspec colwidth="6*" align="center"/>
29454 <colspec colwidth="6*" align="center"/>
29455 <colspec colwidth="6*" align="right"/>
29456 <tbody>
29457 <row>
29458 <entry><option>smtp_accept_reserve</option></entry>
29459 <entry>Use: <emphasis>main</emphasis></entry>
29460 <entry>Type: <emphasis>integer</emphasis></entry>
29461 <entry>Default: <emphasis>0</emphasis></entry>
29462 </row>
29463 </tbody>
29464 </tgroup>
29465 </informaltable>
29466 <para>
29467 <indexterm role="concept">
29468 <primary>SMTP</primary>
29469 <secondary>incoming call count</secondary>
29470 </indexterm>
29471 <indexterm role="concept">
29472 <primary>host</primary>
29473 <secondary>reserved</secondary>
29474 </indexterm>
29475 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
29476 number of SMTP connections that are reserved for connections from the hosts
29477 that are specified in <option>smtp_reserve_hosts</option>. The value set in
29478 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
29479 restricted to this number of connections; the option specifies a minimum number
29480 of connection slots for them, not a maximum. It is a guarantee that this group
29481 of hosts can always get at least <option>smtp_accept_reserve</option> connections. However,
29482 the limit specified by <option>smtp_accept_max_per_host</option> is still applied to each
29483 individual host.
29484 </para>
29485 <para>
29486 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
29487 set to 5, once there are 45 active connections (from any hosts), new
29488 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>,
29489 provided the other criteria for acceptance are met.
29490 </para>
29491 <para>
29492 <indexterm role="option">
29493 <primary><option>smtp_active_hostname</option></primary>
29494 </indexterm>
29495 </para>
29496 <informaltable frame="all">
29497 <tgroup cols="4" colsep="0" rowsep="0">
29498 <colspec colwidth="8*" align="left"/>
29499 <colspec colwidth="6*" align="center"/>
29500 <colspec colwidth="6*" align="center"/>
29501 <colspec colwidth="6*" align="right"/>
29502 <tbody>
29503 <row>
29504 <entry><option>smtp_active_hostname</option></entry>
29505 <entry>Use: <emphasis>main</emphasis></entry>
29506 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29507 <entry>Default: <emphasis>unset</emphasis></entry>
29508 </row>
29509 </tbody>
29510 </tgroup>
29511 </informaltable>
29512 <para>
29513 <indexterm role="concept">
29514 <primary>host</primary>
29515 <secondary>name in SMTP responses</secondary>
29516 </indexterm>
29517 <indexterm role="concept">
29518 <primary>SMTP</primary>
29519 <secondary>host name in responses</secondary>
29520 </indexterm>
29521 <indexterm role="variable">
29522 <primary><varname>$primary_hostname</varname></primary>
29523 </indexterm>
29524 This option is provided for multi-homed servers that want to masquerade as
29525 several different hosts. At the start of an incoming SMTP connection, its value
29526 is expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
29527 responses. For example, it is used as domain name in the response to an
29528 incoming HELO or EHLO command.
29529 </para>
29530 <para>
29531 <indexterm role="variable">
29532 <primary><varname>$smtp_active_hostname</varname></primary>
29533 </indexterm>
29534 The active hostname is placed in the <varname>$smtp_active_hostname</varname> variable, which
29535 is saved with any messages that are received. It is therefore available for use
29536 in routers and transports when the message is later delivered.
29537 </para>
29538 <para>
29539 If this option is unset, or if its expansion is forced to fail, or if the
29540 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
29541 used. Other expansion failures cause a message to be written to the main and
29542 panic logs, and the SMTP command receives a temporary error. Typically, the
29543 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
29544 For example:
29545 </para>
29546 <literallayout class="monospaced">
29547 smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\
29548   {cox.mydomain}{box.mydomain}}
29549 </literallayout>
29550 <para>
29551 Although <varname>$smtp_active_hostname</varname> is primarily concerned with incoming
29552 messages, it is also used as the default for HELO commands in callout
29553 verification if there is no remote transport from which to obtain a
29554 <option>helo_data</option> value.
29555 </para>
29556 <para>
29557 <indexterm role="option">
29558 <primary><option>smtp_banner</option></primary>
29559 </indexterm>
29560 </para>
29561 <informaltable frame="all">
29562 <tgroup cols="4" colsep="0" rowsep="0">
29563 <colspec colwidth="8*" align="left"/>
29564 <colspec colwidth="6*" align="center"/>
29565 <colspec colwidth="6*" align="center"/>
29566 <colspec colwidth="6*" align="right"/>
29567 <tbody>
29568 <row>
29569 <entry><option>smtp_banner</option></entry>
29570 <entry>Use: <emphasis>main</emphasis></entry>
29571 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29572 <entry>Default: <emphasis>see below</emphasis></entry>
29573 </row>
29574 </tbody>
29575 </tgroup>
29576 </informaltable>
29577 <para>
29578 <indexterm role="concept">
29579 <primary>SMTP</primary>
29580 <secondary>welcome banner</secondary>
29581 </indexterm>
29582 <indexterm role="concept">
29583 <primary>banner for SMTP</primary>
29584 </indexterm>
29585 <indexterm role="concept">
29586 <primary>welcome banner for SMTP</primary>
29587 </indexterm>
29588 <indexterm role="concept">
29589 <primary>customizing</primary>
29590 <secondary>SMTP banner</secondary>
29591 </indexterm>
29592 This string, which is expanded every time it is used, is output as the initial
29593 positive response to an SMTP connection. The default setting is:
29594 </para>
29595 <literallayout class="monospaced">
29596 smtp_banner = $smtp_active_hostname ESMTP Exim \
29597   $version_number $tod_full
29598 </literallayout>
29599 <para>
29600 Failure to expand the string causes a panic error. If you want to create a
29601 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
29602 appropriate points, but not at the end. Note that the 220 code is not included
29603 in this string. Exim adds it automatically (several times in the case of a
29604 multiline response).
29605 </para>
29606 <para>
29607 <indexterm role="option">
29608 <primary><option>smtp_check_spool_space</option></primary>
29609 </indexterm>
29610 </para>
29611 <informaltable frame="all">
29612 <tgroup cols="4" colsep="0" rowsep="0">
29613 <colspec colwidth="8*" align="left"/>
29614 <colspec colwidth="6*" align="center"/>
29615 <colspec colwidth="6*" align="center"/>
29616 <colspec colwidth="6*" align="right"/>
29617 <tbody>
29618 <row>
29619 <entry><option>smtp_check_spool_space</option></entry>
29620 <entry>Use: <emphasis>main</emphasis></entry>
29621 <entry>Type: <emphasis>boolean</emphasis></entry>
29622 <entry>Default: <emphasis>true</emphasis></entry>
29623 </row>
29624 </tbody>
29625 </tgroup>
29626 </informaltable>
29627 <para>
29628 <indexterm role="concept">
29629 <primary>checking disk space</primary>
29630 </indexterm>
29631 <indexterm role="concept">
29632 <primary>disk space, checking</primary>
29633 </indexterm>
29634 <indexterm role="concept">
29635 <primary>spool directory</primary>
29636 <secondary>checking space</secondary>
29637 </indexterm>
29638 When this option is set, if an incoming SMTP session encounters the SIZE
29639 option on a MAIL command, it checks that there is enough space in the
29640 spool directory&#x2019;s partition to accept a message of that size, while still
29641 leaving free the amount specified by <option>check_spool_space</option> (even if that value
29642 is zero). If there isn&#x2019;t enough space, a temporary error code is returned.
29643 </para>
29644 <para>
29645 <indexterm role="option">
29646 <primary><option>smtp_connect_backlog</option></primary>
29647 </indexterm>
29648 </para>
29649 <informaltable frame="all">
29650 <tgroup cols="4" colsep="0" rowsep="0">
29651 <colspec colwidth="8*" align="left"/>
29652 <colspec colwidth="6*" align="center"/>
29653 <colspec colwidth="6*" align="center"/>
29654 <colspec colwidth="6*" align="right"/>
29655 <tbody>
29656 <row>
29657 <entry><option>smtp_connect_backlog</option></entry>
29658 <entry>Use: <emphasis>main</emphasis></entry>
29659 <entry>Type: <emphasis>integer</emphasis></entry>
29660 <entry>Default: <emphasis>20</emphasis></entry>
29661 </row>
29662 </tbody>
29663 </tgroup>
29664 </informaltable>
29665 <para>
29666 <indexterm role="concept">
29667 <primary>connection backlog</primary>
29668 </indexterm>
29669 <indexterm role="concept">
29670 <primary>SMTP</primary>
29671 <secondary>connection backlog</secondary>
29672 </indexterm>
29673 <indexterm role="concept">
29674 <primary>backlog of connections</primary>
29675 </indexterm>
29676 This option specifies a maximum number of waiting SMTP connections. Exim passes
29677 this value to the TCP/IP system when it sets up its listener. Once this number
29678 of connections are waiting for the daemon&#x2019;s attention, subsequent connection
29679 attempts are refused at the TCP/IP level. At least, that is what the manuals
29680 say; in some circumstances such connection attempts have been observed to time
29681 out instead. For large systems it is probably a good idea to increase the
29682 value (to 50, say). It also gives some protection against denial-of-service
29683 attacks by SYN flooding.
29684 </para>
29685 <para>
29686 <indexterm role="option">
29687 <primary><option>smtp_enforce_sync</option></primary>
29688 </indexterm>
29689 </para>
29690 <informaltable frame="all">
29691 <tgroup cols="4" colsep="0" rowsep="0">
29692 <colspec colwidth="8*" align="left"/>
29693 <colspec colwidth="6*" align="center"/>
29694 <colspec colwidth="6*" align="center"/>
29695 <colspec colwidth="6*" align="right"/>
29696 <tbody>
29697 <row>
29698 <entry><option>smtp_enforce_sync</option></entry>
29699 <entry>Use: <emphasis>main</emphasis></entry>
29700 <entry>Type: <emphasis>boolean</emphasis></entry>
29701 <entry>Default: <emphasis>true</emphasis></entry>
29702 </row>
29703 </tbody>
29704 </tgroup>
29705 </informaltable>
29706 <para>
29707 <indexterm role="concept">
29708 <primary>SMTP</primary>
29709 <secondary>synchronization checking</secondary>
29710 </indexterm>
29711 <indexterm role="concept">
29712 <primary>synchronization checking in SMTP</primary>
29713 </indexterm>
29714 The SMTP protocol specification requires the client to wait for a response from
29715 the server at certain points in the dialogue. Without PIPELINING these
29716 synchronization points are after every command; with PIPELINING they are
29717 fewer, but they still exist.
29718 </para>
29719 <para>
29720 Some spamming sites send out a complete set of SMTP commands without waiting
29721 for any response. Exim protects against this by rejecting a message if the
29722 client has sent further input when it should not have. The error response <quote>554
29723 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
29724 for this error cannot be perfect because of transmission delays (unexpected
29725 input may be on its way but not yet received when Exim checks). However, it
29726 does detect many instances.
29727 </para>
29728 <para>
29729 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
29730 If you want to disable the check selectively (for example, only for certain
29731 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
29732 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
29733 </para>
29734 <para>
29735 <indexterm role="option">
29736 <primary><option>smtp_etrn_command</option></primary>
29737 </indexterm>
29738 </para>
29739 <informaltable frame="all">
29740 <tgroup cols="4" colsep="0" rowsep="0">
29741 <colspec colwidth="8*" align="left"/>
29742 <colspec colwidth="6*" align="center"/>
29743 <colspec colwidth="6*" align="center"/>
29744 <colspec colwidth="6*" align="right"/>
29745 <tbody>
29746 <row>
29747 <entry><option>smtp_etrn_command</option></entry>
29748 <entry>Use: <emphasis>main</emphasis></entry>
29749 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29750 <entry>Default: <emphasis>unset</emphasis></entry>
29751 </row>
29752 </tbody>
29753 </tgroup>
29754 </informaltable>
29755 <para>
29756 <indexterm role="concept">
29757 <primary>ETRN</primary>
29758 <secondary>command to be run</secondary>
29759 </indexterm>
29760 <indexterm role="variable">
29761 <primary><varname>$domain</varname></primary>
29762 </indexterm>
29763 If this option is set, the given command is run whenever an SMTP ETRN
29764 command is received from a host that is permitted to issue such commands (see
29765 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
29766 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
29767 argument of the ETRN command, and no syntax checking is done on it. For
29768 example:
29769 </para>
29770 <literallayout class="monospaced">
29771 smtp_etrn_command = /etc/etrn_command $domain \
29772                     $sender_host_address
29773 </literallayout>
29774 <para>
29775 A new process is created to run the command, but Exim does not wait for it to
29776 complete. Consequently, its status cannot be checked. If the command cannot be
29777 run, a line is written to the panic log, but the ETRN caller still receives
29778 a 250 success response. Exim is normally running under its own uid when
29779 receiving SMTP, so it is not possible for it to change the uid before running
29780 the command.
29781 </para>
29782 <para>
29783 <indexterm role="option">
29784 <primary><option>smtp_etrn_serialize</option></primary>
29785 </indexterm>
29786 </para>
29787 <informaltable frame="all">
29788 <tgroup cols="4" colsep="0" rowsep="0">
29789 <colspec colwidth="8*" align="left"/>
29790 <colspec colwidth="6*" align="center"/>
29791 <colspec colwidth="6*" align="center"/>
29792 <colspec colwidth="6*" align="right"/>
29793 <tbody>
29794 <row>
29795 <entry><option>smtp_etrn_serialize</option></entry>
29796 <entry>Use: <emphasis>main</emphasis></entry>
29797 <entry>Type: <emphasis>boolean</emphasis></entry>
29798 <entry>Default: <emphasis>true</emphasis></entry>
29799 </row>
29800 </tbody>
29801 </tgroup>
29802 </informaltable>
29803 <para>
29804 <indexterm role="concept">
29805 <primary>ETRN</primary>
29806 <secondary>serializing</secondary>
29807 </indexterm>
29808 When this option is set, it prevents the simultaneous execution of more than
29809 one identical command as a result of ETRN in an SMTP connection. See
29810 section <xref linkend="SECTETRN"/> for details.
29811 </para>
29812 <para>
29813 <indexterm role="option">
29814 <primary><option>smtp_load_reserve</option></primary>
29815 </indexterm>
29816 </para>
29817 <informaltable frame="all">
29818 <tgroup cols="4" colsep="0" rowsep="0">
29819 <colspec colwidth="8*" align="left"/>
29820 <colspec colwidth="6*" align="center"/>
29821 <colspec colwidth="6*" align="center"/>
29822 <colspec colwidth="6*" align="right"/>
29823 <tbody>
29824 <row>
29825 <entry><option>smtp_load_reserve</option></entry>
29826 <entry>Use: <emphasis>main</emphasis></entry>
29827 <entry>Type: <emphasis>fixed-point</emphasis></entry>
29828 <entry>Default: <emphasis>unset</emphasis></entry>
29829 </row>
29830 </tbody>
29831 </tgroup>
29832 </informaltable>
29833 <para>
29834 <indexterm role="concept">
29835 <primary>load average</primary>
29836 </indexterm>
29837 If the system load average ever gets higher than this, incoming SMTP calls are
29838 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
29839 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
29840 the load is over the limit. The option has no effect on ancient operating
29841 systems on which Exim cannot determine the load average. See also
29842 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
29843 </para>
29844 <para>
29845 <indexterm role="option">
29846 <primary><option>smtp_max_synprot_errors</option></primary>
29847 </indexterm>
29848 </para>
29849 <informaltable frame="all">
29850 <tgroup cols="4" colsep="0" rowsep="0">
29851 <colspec colwidth="8*" align="left"/>
29852 <colspec colwidth="6*" align="center"/>
29853 <colspec colwidth="6*" align="center"/>
29854 <colspec colwidth="6*" align="right"/>
29855 <tbody>
29856 <row>
29857 <entry><option>smtp_max_synprot_errors</option></entry>
29858 <entry>Use: <emphasis>main</emphasis></entry>
29859 <entry>Type: <emphasis>integer</emphasis></entry>
29860 <entry>Default: <emphasis>3</emphasis></entry>
29861 </row>
29862 </tbody>
29863 </tgroup>
29864 </informaltable>
29865 <para>
29866 <indexterm role="concept">
29867 <primary>SMTP</primary>
29868 <secondary>limiting syntax and protocol errors</secondary>
29869 </indexterm>
29870 <indexterm role="concept">
29871 <primary>limit</primary>
29872 <secondary>SMTP syntax and protocol errors</secondary>
29873 </indexterm>
29874 Exim rejects SMTP commands that contain syntax or protocol errors. In
29875 particular, a syntactically invalid email address, as in this command:
29876 </para>
29877 <literallayout class="monospaced">
29878 RCPT TO:&lt;abc xyz@a.b.c&gt;
29879 </literallayout>
29880 <para>
29881 causes immediate rejection of the command, before any other tests are done.
29882 (The ACL cannot be run if there is no valid address to set up for it.) An
29883 example of a protocol error is receiving RCPT before MAIL. If there are
29884 too many syntax or protocol errors in one SMTP session, the connection is
29885 dropped. The limit is set by this option.
29886 </para>
29887 <para>
29888 <indexterm role="concept">
29889 <primary>PIPELINING</primary>
29890 <secondary>expected errors</secondary>
29891 </indexterm>
29892 When the PIPELINING extension to SMTP is in use, some protocol errors are
29893 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
29894 Exim assumes that PIPELINING will be used if it advertises it (see
29895 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
29896 not count towards the limit.
29897 </para>
29898 <para>
29899 <indexterm role="option">
29900 <primary><option>smtp_max_unknown_commands</option></primary>
29901 </indexterm>
29902 </para>
29903 <informaltable frame="all">
29904 <tgroup cols="4" colsep="0" rowsep="0">
29905 <colspec colwidth="8*" align="left"/>
29906 <colspec colwidth="6*" align="center"/>
29907 <colspec colwidth="6*" align="center"/>
29908 <colspec colwidth="6*" align="right"/>
29909 <tbody>
29910 <row>
29911 <entry><option>smtp_max_unknown_commands</option></entry>
29912 <entry>Use: <emphasis>main</emphasis></entry>
29913 <entry>Type: <emphasis>integer</emphasis></entry>
29914 <entry>Default: <emphasis>3</emphasis></entry>
29915 </row>
29916 </tbody>
29917 </tgroup>
29918 </informaltable>
29919 <para>
29920 <indexterm role="concept">
29921 <primary>SMTP</primary>
29922 <secondary>limiting unknown commands</secondary>
29923 </indexterm>
29924 <indexterm role="concept">
29925 <primary>limit</primary>
29926 <secondary>unknown SMTP commands</secondary>
29927 </indexterm>
29928 If there are too many unrecognized commands in an incoming SMTP session, an
29929 Exim server drops the connection. This is a defence against some kinds of abuse
29930 that subvert web
29931 clients
29932 into making connections to SMTP ports; in these circumstances, a number of
29933 non-SMTP command lines are sent first.
29934 </para>
29935 <para>
29936 <indexterm role="option">
29937 <primary><option>smtp_ratelimit_hosts</option></primary>
29938 </indexterm>
29939 </para>
29940 <informaltable frame="all">
29941 <tgroup cols="4" colsep="0" rowsep="0">
29942 <colspec colwidth="8*" align="left"/>
29943 <colspec colwidth="6*" align="center"/>
29944 <colspec colwidth="6*" align="center"/>
29945 <colspec colwidth="6*" align="right"/>
29946 <tbody>
29947 <row>
29948 <entry><option>smtp_ratelimit_hosts</option></entry>
29949 <entry>Use: <emphasis>main</emphasis></entry>
29950 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29951 <entry>Default: <emphasis>unset</emphasis></entry>
29952 </row>
29953 </tbody>
29954 </tgroup>
29955 </informaltable>
29956 <para>
29957 <indexterm role="concept">
29958 <primary>SMTP</primary>
29959 <secondary>rate limiting</secondary>
29960 </indexterm>
29961 <indexterm role="concept">
29962 <primary>limit</primary>
29963 <secondary>rate of message arrival</secondary>
29964 </indexterm>
29965 <indexterm role="concept">
29966 <primary>RCPT</primary>
29967 <secondary>rate limiting</secondary>
29968 </indexterm>
29969 Some sites find it helpful to be able to limit the rate at which certain hosts
29970 can send them messages, and the rate at which an individual message can specify
29971 recipients.
29972 </para>
29973 <para>
29974 Exim has two rate-limiting facilities. This section describes the older
29975 facility, which can limit rates within a single connection. The newer
29976 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
29977 <xref linkend="SECTratelimiting"/> for details of the newer facility.
29978 </para>
29979 <para>
29980 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
29981 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
29982 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
29983 respectively. Each option, if set, must contain a set of four comma-separated
29984 values:
29985 </para>
29986 <itemizedlist>
29987 <listitem>
29988 <para>
29989 A threshold, before which there is no rate limiting.
29990 </para>
29991 </listitem>
29992 <listitem>
29993 <para>
29994 An initial time delay. Unlike other times in Exim, numbers with decimal
29995 fractional parts are allowed here.
29996 </para>
29997 </listitem>
29998 <listitem>
29999 <para>
30000 A factor by which to increase the delay each time.
30001 </para>
30002 </listitem>
30003 <listitem>
30004 <para>
30005 A maximum value for the delay. This should normally be less than 5 minutes,
30006 because after that time, the client is liable to timeout the SMTP command.
30007 </para>
30008 </listitem>
30009 </itemizedlist>
30010 <para>
30011 For example, these settings have been used successfully at the site which
30012 first suggested this feature, for controlling mail from their customers:
30013 </para>
30014 <literallayout class="monospaced">
30015 smtp_ratelimit_mail = 2,0.5s,1.05,4m
30016 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
30017 </literallayout>
30018 <para>
30019 The first setting specifies delays that are applied to MAIL commands after
30020 two have been received over a single connection. The initial delay is 0.5
30021 seconds, increasing by a factor of 1.05 each time. The second setting applies
30022 delays to RCPT commands when more than four occur in a single message.
30023 </para>
30024 <para>
30025 <indexterm role="option">
30026 <primary><option>smtp_ratelimit_mail</option></primary>
30027 </indexterm>
30028 </para>
30029 <informaltable frame="all">
30030 <tgroup cols="4" colsep="0" rowsep="0">
30031 <colspec colwidth="8*" align="left"/>
30032 <colspec colwidth="6*" align="center"/>
30033 <colspec colwidth="6*" align="center"/>
30034 <colspec colwidth="6*" align="right"/>
30035 <tbody>
30036 <row>
30037 <entry><option>smtp_ratelimit_mail</option></entry>
30038 <entry>Use: <emphasis>main</emphasis></entry>
30039 <entry>Type: <emphasis>string</emphasis></entry>
30040 <entry>Default: <emphasis>unset</emphasis></entry>
30041 </row>
30042 </tbody>
30043 </tgroup>
30044 </informaltable>
30045 <para>
30046 See <option>smtp_ratelimit_hosts</option> above.
30047 </para>
30048 <para>
30049 <indexterm role="option">
30050 <primary><option>smtp_ratelimit_rcpt</option></primary>
30051 </indexterm>
30052 </para>
30053 <informaltable frame="all">
30054 <tgroup cols="4" colsep="0" rowsep="0">
30055 <colspec colwidth="8*" align="left"/>
30056 <colspec colwidth="6*" align="center"/>
30057 <colspec colwidth="6*" align="center"/>
30058 <colspec colwidth="6*" align="right"/>
30059 <tbody>
30060 <row>
30061 <entry><option>smtp_ratelimit_rcpt</option></entry>
30062 <entry>Use: <emphasis>main</emphasis></entry>
30063 <entry>Type: <emphasis>string</emphasis></entry>
30064 <entry>Default: <emphasis>unset</emphasis></entry>
30065 </row>
30066 </tbody>
30067 </tgroup>
30068 </informaltable>
30069 <para>
30070 See <option>smtp_ratelimit_hosts</option> above.
30071 </para>
30072 <para>
30073 <indexterm role="option">
30074 <primary><option>smtp_receive_timeout</option></primary>
30075 </indexterm>
30076 </para>
30077 <informaltable frame="all">
30078 <tgroup cols="4" colsep="0" rowsep="0">
30079 <colspec colwidth="8*" align="left"/>
30080 <colspec colwidth="6*" align="center"/>
30081 <colspec colwidth="6*" align="center"/>
30082 <colspec colwidth="6*" align="right"/>
30083 <tbody>
30084 <row>
30085 <entry><option>smtp_receive_timeout</option></entry>
30086 <entry>Use: <emphasis>main</emphasis></entry>
30087 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
30088 <entry>Default: <emphasis>5m</emphasis></entry>
30089 </row>
30090 </tbody>
30091 </tgroup>
30092 </informaltable>
30093 <para>
30094 <indexterm role="concept">
30095 <primary>timeout</primary>
30096 <secondary>for SMTP input</secondary>
30097 </indexterm>
30098 <indexterm role="concept">
30099 <primary>SMTP</primary>
30100 <secondary>input timeout</secondary>
30101 </indexterm>
30102 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
30103 input, including batch SMTP. If a line of input (either an SMTP command or a
30104 data line) is not received within this time, the SMTP connection is dropped and
30105 the message is abandoned.
30106 A line is written to the log containing one of the following messages:
30107 </para>
30108 <literallayout class="monospaced">
30109 SMTP command timeout on connection from...
30110 SMTP data timeout on connection from...
30111 </literallayout>
30112 <para>
30113 The former means that Exim was expecting to read an SMTP command; the latter
30114 means that it was in the DATA phase, reading the contents of a message.
30115 </para>
30116 <para>
30117 If the first character of the option is a <quote>$</quote> the option is
30118 expanded before use and may depend on
30119 <varname>$sender_host_name</varname>, <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.
30120 </para>
30121 <para>
30122 <indexterm role="option">
30123 <primary><option>-os</option></primary>
30124 </indexterm>
30125 The value set by this option can be overridden by the
30126 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
30127 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
30128 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
30129 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
30130 </para>
30131 <para>
30132 <indexterm role="option">
30133 <primary><option>smtp_reserve_hosts</option></primary>
30134 </indexterm>
30135 </para>
30136 <informaltable frame="all">
30137 <tgroup cols="4" colsep="0" rowsep="0">
30138 <colspec colwidth="8*" align="left"/>
30139 <colspec colwidth="6*" align="center"/>
30140 <colspec colwidth="6*" align="center"/>
30141 <colspec colwidth="6*" align="right"/>
30142 <tbody>
30143 <row>
30144 <entry><option>smtp_reserve_hosts</option></entry>
30145 <entry>Use: <emphasis>main</emphasis></entry>
30146 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30147 <entry>Default: <emphasis>unset</emphasis></entry>
30148 </row>
30149 </tbody>
30150 </tgroup>
30151 </informaltable>
30152 <para>
30153 This option defines hosts for which SMTP connections are reserved; see
30154 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
30155 </para>
30156 <para>
30157 <indexterm role="option">
30158 <primary><option>smtp_return_error_details</option></primary>
30159 </indexterm>
30160 </para>
30161 <informaltable frame="all">
30162 <tgroup cols="4" colsep="0" rowsep="0">
30163 <colspec colwidth="8*" align="left"/>
30164 <colspec colwidth="6*" align="center"/>
30165 <colspec colwidth="6*" align="center"/>
30166 <colspec colwidth="6*" align="right"/>
30167 <tbody>
30168 <row>
30169 <entry><option>smtp_return_error_details</option></entry>
30170 <entry>Use: <emphasis>main</emphasis></entry>
30171 <entry>Type: <emphasis>boolean</emphasis></entry>
30172 <entry>Default: <emphasis>false</emphasis></entry>
30173 </row>
30174 </tbody>
30175 </tgroup>
30176 </informaltable>
30177 <para>
30178 <indexterm role="concept">
30179 <primary>SMTP</primary>
30180 <secondary>details policy failures</secondary>
30181 </indexterm>
30182 <indexterm role="concept">
30183 <primary>policy control</primary>
30184 <secondary>rejection, returning details</secondary>
30185 </indexterm>
30186 In the default state, Exim uses bland messages such as
30187 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
30188 reasons. Many sysadmins like this because it gives away little information
30189 to spammers. However, some other sysadmins who are applying strict checking
30190 policies want to give out much fuller information about failures. Setting
30191 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
30192 example, instead of <quote>Administrative prohibition</quote>, it might give:
30193 </para>
30194 <literallayout class="monospaced">
30195 550-Rejected after DATA: '&gt;' missing at end of address:
30196 550 failing address in "From" header is: &lt;user@dom.ain
30197 </literallayout>
30198 <para revisionflag="changed">
30199 <indexterm role="option">
30200 <primary><option>smtputf8_advertise_hosts</option></primary>
30201 </indexterm>
30202 </para>
30203 <informaltable frame="all" revisionflag="changed">
30204 <tgroup cols="4" colsep="0" rowsep="0">
30205 <colspec colwidth="8*" align="left"/>
30206 <colspec colwidth="6*" align="center"/>
30207 <colspec colwidth="6*" align="center"/>
30208 <colspec colwidth="6*" align="right"/>
30209 <tbody>
30210 <row>
30211 <entry><option>smtputf8_advertise_hosts</option></entry>
30212 <entry>Use: <emphasis>main</emphasis></entry>
30213 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30214 <entry>Default: <emphasis>*</emphasis></entry>
30215 </row>
30216 </tbody>
30217 </tgroup>
30218 </informaltable>
30219 <para revisionflag="changed">
30220 <indexterm role="concept">
30221 <primary>SMTPUTF8</primary>
30222 <secondary>advertising</secondary>
30223 </indexterm>
30224 When Exim is built with support for internationalised mail names,
30225 the availability therof is advertised in
30226 response to EHLO only to those client hosts that match this option. See
30227 chapter <xref linkend="CHAPi18n"/> for details of Exim&#x2019;s support for internationalisation.
30228 </para>
30229 <para>
30230 <indexterm role="option">
30231 <primary><option>spamd_address</option></primary>
30232 </indexterm>
30233 </para>
30234 <informaltable frame="all">
30235 <tgroup cols="4" colsep="0" rowsep="0">
30236 <colspec colwidth="8*" align="left"/>
30237 <colspec colwidth="6*" align="center"/>
30238 <colspec colwidth="6*" align="center"/>
30239 <colspec colwidth="6*" align="right"/>
30240 <tbody>
30241 <row>
30242 <entry><option>spamd_address</option></entry>
30243 <entry>Use: <emphasis>main</emphasis></entry>
30244 <entry>Type: <emphasis>string</emphasis></entry>
30245 <entry>Default: <emphasis>see below</emphasis></entry>
30246 </row>
30247 </tbody>
30248 </tgroup>
30249 </informaltable>
30250 <para>
30251 This option is available when Exim is compiled with the content-scanning
30252 extension. It specifies how Exim connects to SpamAssassin&#x2019;s <option>spamd</option> daemon.
30253 The default value is
30254 </para>
30255 <literallayout class="monospaced">
30256 127.0.0.1 783
30257 </literallayout>
30258 <para>
30259 See section <xref linkend="SECTscanspamass"/> for more details.
30260 </para>
30261 <para>
30262 <indexterm role="option">
30263 <primary><option>split_spool_directory</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>split_spool_directory</option></entry>
30275 <entry>Use: <emphasis>main</emphasis></entry>
30276 <entry>Type: <emphasis>boolean</emphasis></entry>
30277 <entry>Default: <emphasis>false</emphasis></entry>
30278 </row>
30279 </tbody>
30280 </tgroup>
30281 </informaltable>
30282 <para>
30283 <indexterm role="concept">
30284 <primary>multiple spool directories</primary>
30285 </indexterm>
30286 <indexterm role="concept">
30287 <primary>spool directory</primary>
30288 <secondary>split</secondary>
30289 </indexterm>
30290 <indexterm role="concept">
30291 <primary>directories, multiple</primary>
30292 </indexterm>
30293 If this option is set, it causes Exim to split its input directory into 62
30294 subdirectories, each with a single alphanumeric character as its name. The
30295 sixth character of the message id is used to allocate messages to
30296 subdirectories; this is the least significant base-62 digit of the time of
30297 arrival of the message.
30298 </para>
30299 <para>
30300 Splitting up the spool in this way may provide better performance on systems
30301 where there are long mail queues, by reducing the number of files in any one
30302 directory. The msglog directory is also split up in a similar way to the input
30303 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
30304 are still placed in the single directory <filename>msglog.OLD</filename>.
30305 </para>
30306 <para>
30307 It is not necessary to take any special action for existing messages when
30308 changing <option>split_spool_directory</option>. Exim notices messages that are in the
30309 <quote>wrong</quote> place, and continues to process them. If the option is turned off
30310 after a period of being on, the subdirectories will eventually empty and be
30311 automatically deleted.
30312 </para>
30313 <para>
30314 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
30315 changes. Instead of creating a list of all messages in the queue, and then
30316 trying to deliver each one in turn, it constructs a list of those in one
30317 sub-directory and tries to deliver them, before moving on to the next
30318 sub-directory. The sub-directories are processed in a random order. This
30319 spreads out the scanning of the input directories, and uses less memory. It is
30320 particularly beneficial when there are lots of messages on the queue. However,
30321 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
30322 entire queue has to be scanned and sorted before any deliveries can start.
30323 </para>
30324 <para>
30325 <indexterm role="option">
30326 <primary><option>spool_directory</option></primary>
30327 </indexterm>
30328 </para>
30329 <informaltable frame="all">
30330 <tgroup cols="4" colsep="0" rowsep="0">
30331 <colspec colwidth="8*" align="left"/>
30332 <colspec colwidth="6*" align="center"/>
30333 <colspec colwidth="6*" align="center"/>
30334 <colspec colwidth="6*" align="right"/>
30335 <tbody>
30336 <row>
30337 <entry><option>spool_directory</option></entry>
30338 <entry>Use: <emphasis>main</emphasis></entry>
30339 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30340 <entry>Default: <emphasis>set at compile time</emphasis></entry>
30341 </row>
30342 </tbody>
30343 </tgroup>
30344 </informaltable>
30345 <para>
30346 <indexterm role="concept">
30347 <primary>spool directory</primary>
30348 <secondary>path to</secondary>
30349 </indexterm>
30350 This defines the directory in which Exim keeps its spool, that is, the messages
30351 it is waiting to deliver. The default value is taken from the compile-time
30352 configuration setting, if there is one. If not, this option must be set. The
30353 string is expanded, so it can contain, for example, a reference to
30354 <varname>$primary_hostname</varname>.
30355 </para>
30356 <para>
30357 If the spool directory name is fixed on your installation, it is recommended
30358 that you set it at build time rather than from this option, particularly if the
30359 log files are being written to the spool directory (see <option>log_file_path</option>).
30360 Otherwise log files cannot be used for errors that are detected early on, such
30361 as failures in the configuration file.
30362 </para>
30363 <para>
30364 By using this option to override the compiled-in path, it is possible to run
30365 tests of Exim without using the standard spool.
30366 </para>
30367 <para>
30368 <indexterm role="option">
30369 <primary><option>sqlite_lock_timeout</option></primary>
30370 </indexterm>
30371 </para>
30372 <informaltable frame="all">
30373 <tgroup cols="4" colsep="0" rowsep="0">
30374 <colspec colwidth="8*" align="left"/>
30375 <colspec colwidth="6*" align="center"/>
30376 <colspec colwidth="6*" align="center"/>
30377 <colspec colwidth="6*" align="right"/>
30378 <tbody>
30379 <row>
30380 <entry><option>sqlite_lock_timeout</option></entry>
30381 <entry>Use: <emphasis>main</emphasis></entry>
30382 <entry>Type: <emphasis>time</emphasis></entry>
30383 <entry>Default: <emphasis>5s</emphasis></entry>
30384 </row>
30385 </tbody>
30386 </tgroup>
30387 </informaltable>
30388 <para>
30389 <indexterm role="concept">
30390 <primary>sqlite lookup type</primary>
30391 <secondary>lock timeout</secondary>
30392 </indexterm>
30393 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
30394 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
30395 </para>
30396 <para>
30397 <indexterm role="option">
30398 <primary><option>strict_acl_vars</option></primary>
30399 </indexterm>
30400 </para>
30401 <informaltable frame="all">
30402 <tgroup cols="4" colsep="0" rowsep="0">
30403 <colspec colwidth="8*" align="left"/>
30404 <colspec colwidth="6*" align="center"/>
30405 <colspec colwidth="6*" align="center"/>
30406 <colspec colwidth="6*" align="right"/>
30407 <tbody>
30408 <row>
30409 <entry><option>strict_acl_vars</option></entry>
30410 <entry>Use: <emphasis>main</emphasis></entry>
30411 <entry>Type: <emphasis>boolean</emphasis></entry>
30412 <entry>Default: <emphasis>false</emphasis></entry>
30413 </row>
30414 </tbody>
30415 </tgroup>
30416 </informaltable>
30417 <para>
30418 <indexterm role="concept">
30419 <primary>access control lists (ACLs)</primary>
30420 <secondary>variables, handling unset</secondary>
30421 </indexterm>
30422 This option controls what happens if a syntactically valid but undefined ACL
30423 variable is referenced. If it is false (the default), an empty string
30424 is substituted; if it is true, an error is generated. See section
30425 <xref linkend="SECTaclvariables"/> for details of ACL variables.
30426 </para>
30427 <para>
30428 <indexterm role="option">
30429 <primary><option>strip_excess_angle_brackets</option></primary>
30430 </indexterm>
30431 </para>
30432 <informaltable frame="all">
30433 <tgroup cols="4" colsep="0" rowsep="0">
30434 <colspec colwidth="8*" align="left"/>
30435 <colspec colwidth="6*" align="center"/>
30436 <colspec colwidth="6*" align="center"/>
30437 <colspec colwidth="6*" align="right"/>
30438 <tbody>
30439 <row>
30440 <entry><option>strip_excess_angle_brackets</option></entry>
30441 <entry>Use: <emphasis>main</emphasis></entry>
30442 <entry>Type: <emphasis>boolean</emphasis></entry>
30443 <entry>Default: <emphasis>false</emphasis></entry>
30444 </row>
30445 </tbody>
30446 </tgroup>
30447 </informaltable>
30448 <para>
30449 <indexterm role="concept">
30450 <primary>angle brackets, excess</primary>
30451 </indexterm>
30452 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
30453 items in addresses are stripped. For example, <emphasis>&lt;&lt;xxx@a.b.c.d&gt;&gt;</emphasis> is
30454 treated as <emphasis>&lt;xxx@a.b.c.d&gt;</emphasis>. If this is in the envelope and the message is
30455 passed on to another MTA, the excess angle brackets are not passed on. If this
30456 option is not set, multiple pairs of angle brackets cause a syntax error.
30457 </para>
30458 <para>
30459 <indexterm role="option">
30460 <primary><option>strip_trailing_dot</option></primary>
30461 </indexterm>
30462 </para>
30463 <informaltable frame="all">
30464 <tgroup cols="4" colsep="0" rowsep="0">
30465 <colspec colwidth="8*" align="left"/>
30466 <colspec colwidth="6*" align="center"/>
30467 <colspec colwidth="6*" align="center"/>
30468 <colspec colwidth="6*" align="right"/>
30469 <tbody>
30470 <row>
30471 <entry><option>strip_trailing_dot</option></entry>
30472 <entry>Use: <emphasis>main</emphasis></entry>
30473 <entry>Type: <emphasis>boolean</emphasis></entry>
30474 <entry>Default: <emphasis>false</emphasis></entry>
30475 </row>
30476 </tbody>
30477 </tgroup>
30478 </informaltable>
30479 <para>
30480 <indexterm role="concept">
30481 <primary>trailing dot on domain</primary>
30482 </indexterm>
30483 <indexterm role="concept">
30484 <primary>dot</primary>
30485 <secondary>trailing on domain</secondary>
30486 </indexterm>
30487 If this option is set, a trailing dot at the end of a domain in an address is
30488 ignored. If this is in the envelope and the message is passed on to another
30489 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
30490 domain causes a syntax error.
30491 However, addresses in header lines are checked only when an ACL requests header
30492 syntax checking.
30493 </para>
30494 <para>
30495 <indexterm role="option">
30496 <primary><option>syslog_duplication</option></primary>
30497 </indexterm>
30498 </para>
30499 <informaltable frame="all">
30500 <tgroup cols="4" colsep="0" rowsep="0">
30501 <colspec colwidth="8*" align="left"/>
30502 <colspec colwidth="6*" align="center"/>
30503 <colspec colwidth="6*" align="center"/>
30504 <colspec colwidth="6*" align="right"/>
30505 <tbody>
30506 <row>
30507 <entry><option>syslog_duplication</option></entry>
30508 <entry>Use: <emphasis>main</emphasis></entry>
30509 <entry>Type: <emphasis>boolean</emphasis></entry>
30510 <entry>Default: <emphasis>true</emphasis></entry>
30511 </row>
30512 </tbody>
30513 </tgroup>
30514 </informaltable>
30515 <para>
30516 <indexterm role="concept">
30517 <primary>syslog</primary>
30518 <secondary>duplicate log lines; suppressing</secondary>
30519 </indexterm>
30520 When Exim is logging to syslog, it writes the log lines for its three
30521 separate logs at different syslog priorities so that they can in principle
30522 be separated on the logging hosts. Some installations do not require this
30523 separation, and in those cases, the duplication of certain log lines is a
30524 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
30525 particular log line is written to syslog. For lines that normally go to
30526 both the main log and the reject log, the reject log version (possibly
30527 containing message header lines) is written, at LOG_NOTICE priority.
30528 Lines that normally go to both the main and the panic log are written at
30529 the LOG_ALERT priority.
30530 </para>
30531 <para>
30532 <indexterm role="option">
30533 <primary><option>syslog_facility</option></primary>
30534 </indexterm>
30535 </para>
30536 <informaltable frame="all">
30537 <tgroup cols="4" colsep="0" rowsep="0">
30538 <colspec colwidth="8*" align="left"/>
30539 <colspec colwidth="6*" align="center"/>
30540 <colspec colwidth="6*" align="center"/>
30541 <colspec colwidth="6*" align="right"/>
30542 <tbody>
30543 <row>
30544 <entry><option>syslog_facility</option></entry>
30545 <entry>Use: <emphasis>main</emphasis></entry>
30546 <entry>Type: <emphasis>string</emphasis></entry>
30547 <entry>Default: <emphasis>unset</emphasis></entry>
30548 </row>
30549 </tbody>
30550 </tgroup>
30551 </informaltable>
30552 <para>
30553 <indexterm role="concept">
30554 <primary>syslog</primary>
30555 <secondary>facility; setting</secondary>
30556 </indexterm>
30557 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
30558 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
30559 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
30560 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
30561 details of Exim&#x2019;s logging.
30562 </para>
30563 <para>
30564 <indexterm role="option">
30565 <primary><option>syslog_processname</option></primary>
30566 </indexterm>
30567 </para>
30568 <informaltable frame="all">
30569 <tgroup cols="4" colsep="0" rowsep="0">
30570 <colspec colwidth="8*" align="left"/>
30571 <colspec colwidth="6*" align="center"/>
30572 <colspec colwidth="6*" align="center"/>
30573 <colspec colwidth="6*" align="right"/>
30574 <tbody>
30575 <row>
30576 <entry><option>syslog_processname</option></entry>
30577 <entry>Use: <emphasis>main</emphasis></entry>
30578 <entry>Type: <emphasis>string</emphasis></entry>
30579 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
30580 </row>
30581 </tbody>
30582 </tgroup>
30583 </informaltable>
30584 <para>
30585 <indexterm role="concept">
30586 <primary>syslog</primary>
30587 <secondary>process name; setting</secondary>
30588 </indexterm>
30589 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
30590 syslog. The value must be no longer than 32 characters. See chapter
30591 <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
30592 </para>
30593 <para>
30594 <indexterm role="option">
30595 <primary><option>syslog_timestamp</option></primary>
30596 </indexterm>
30597 </para>
30598 <informaltable frame="all">
30599 <tgroup cols="4" colsep="0" rowsep="0">
30600 <colspec colwidth="8*" align="left"/>
30601 <colspec colwidth="6*" align="center"/>
30602 <colspec colwidth="6*" align="center"/>
30603 <colspec colwidth="6*" align="right"/>
30604 <tbody>
30605 <row>
30606 <entry><option>syslog_timestamp</option></entry>
30607 <entry>Use: <emphasis>main</emphasis></entry>
30608 <entry>Type: <emphasis>boolean</emphasis></entry>
30609 <entry>Default: <emphasis>true</emphasis></entry>
30610 </row>
30611 </tbody>
30612 </tgroup>
30613 </informaltable>
30614 <para>
30615 <indexterm role="concept">
30616 <primary>syslog</primary>
30617 <secondary>timestamps</secondary>
30618 </indexterm>
30619 If <option>syslog_timestamp</option> is set false, the timestamps on Exim&#x2019;s log lines are
30620 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
30621 details of Exim&#x2019;s logging.
30622 </para>
30623 <para>
30624 <indexterm role="option">
30625 <primary><option>system_filter</option></primary>
30626 </indexterm>
30627 </para>
30628 <informaltable frame="all">
30629 <tgroup cols="4" colsep="0" rowsep="0">
30630 <colspec colwidth="8*" align="left"/>
30631 <colspec colwidth="6*" align="center"/>
30632 <colspec colwidth="6*" align="center"/>
30633 <colspec colwidth="6*" align="right"/>
30634 <tbody>
30635 <row>
30636 <entry><option>system_filter</option></entry>
30637 <entry>Use: <emphasis>main</emphasis></entry>
30638 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30639 <entry>Default: <emphasis>unset</emphasis></entry>
30640 </row>
30641 </tbody>
30642 </tgroup>
30643 </informaltable>
30644 <para>
30645 <indexterm role="concept">
30646 <primary>filter</primary>
30647 <secondary>system filter</secondary>
30648 </indexterm>
30649 <indexterm role="concept">
30650 <primary>system filter</primary>
30651 <secondary>specifying</secondary>
30652 </indexterm>
30653 <indexterm role="concept">
30654 <primary>Sieve filter</primary>
30655 <secondary>not available for system filter</secondary>
30656 </indexterm>
30657 This option specifies an Exim filter file that is applied to all messages at
30658 the start of each delivery attempt, before any routing is done. System filters
30659 must be Exim filters; they cannot be Sieve filters. If the system filter
30660 generates any deliveries to files or pipes, or any new mail messages, the
30661 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
30662 which transports are to be used. Details of this facility are given in chapter
30663 <xref linkend="CHAPsystemfilter"/>.
30664 </para>
30665 <para>
30666 <indexterm role="option">
30667 <primary><option>system_filter_directory_transport</option></primary>
30668 </indexterm>
30669 </para>
30670 <informaltable frame="all">
30671 <tgroup cols="4" colsep="0" rowsep="0">
30672 <colspec colwidth="8*" align="left"/>
30673 <colspec colwidth="6*" align="center"/>
30674 <colspec colwidth="6*" align="center"/>
30675 <colspec colwidth="6*" align="right"/>
30676 <tbody>
30677 <row>
30678 <entry><option>system_filter_directory_transport</option></entry>
30679 <entry>Use: <emphasis>main</emphasis></entry>
30680 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30681 <entry>Default: <emphasis>unset</emphasis></entry>
30682 </row>
30683 </tbody>
30684 </tgroup>
30685 </informaltable>
30686 <para>
30687 <indexterm role="variable">
30688 <primary><varname>$address_file</varname></primary>
30689 </indexterm>
30690 This sets the name of the transport driver that is to be used when the
30691 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
30692 implying delivery of each message into a separate file in some directory.
30693 During the delivery, the variable <varname>$address_file</varname> contains the path name.
30694 </para>
30695 <para>
30696 <indexterm role="option">
30697 <primary><option>system_filter_file_transport</option></primary>
30698 </indexterm>
30699 </para>
30700 <informaltable frame="all">
30701 <tgroup cols="4" colsep="0" rowsep="0">
30702 <colspec colwidth="8*" align="left"/>
30703 <colspec colwidth="6*" align="center"/>
30704 <colspec colwidth="6*" align="center"/>
30705 <colspec colwidth="6*" align="right"/>
30706 <tbody>
30707 <row>
30708 <entry><option>system_filter_file_transport</option></entry>
30709 <entry>Use: <emphasis>main</emphasis></entry>
30710 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30711 <entry>Default: <emphasis>unset</emphasis></entry>
30712 </row>
30713 </tbody>
30714 </tgroup>
30715 </informaltable>
30716 <para>
30717 <indexterm role="concept">
30718 <primary>file</primary>
30719 <secondary>transport for system filter</secondary>
30720 </indexterm>
30721 This sets the name of the transport driver that is to be used when the <option>save</option>
30722 command in a system message filter specifies a path not ending in <quote>/</quote>. During
30723 the delivery, the variable <varname>$address_file</varname> contains the path name.
30724 </para>
30725 <para>
30726 <indexterm role="option">
30727 <primary><option>system_filter_group</option></primary>
30728 </indexterm>
30729 </para>
30730 <informaltable frame="all">
30731 <tgroup cols="4" colsep="0" rowsep="0">
30732 <colspec colwidth="8*" align="left"/>
30733 <colspec colwidth="6*" align="center"/>
30734 <colspec colwidth="6*" align="center"/>
30735 <colspec colwidth="6*" align="right"/>
30736 <tbody>
30737 <row>
30738 <entry><option>system_filter_group</option></entry>
30739 <entry>Use: <emphasis>main</emphasis></entry>
30740 <entry>Type: <emphasis>string</emphasis></entry>
30741 <entry>Default: <emphasis>unset</emphasis></entry>
30742 </row>
30743 </tbody>
30744 </tgroup>
30745 </informaltable>
30746 <para>
30747 <indexterm role="concept">
30748 <primary>gid (group id)</primary>
30749 <secondary>system filter</secondary>
30750 </indexterm>
30751 This option is used only when <option>system_filter_user</option> is also set. It sets the
30752 gid under which the system filter is run, overriding any gid that is associated
30753 with the user. The value may be numerical or symbolic.
30754 </para>
30755 <para>
30756 <indexterm role="option">
30757 <primary><option>system_filter_pipe_transport</option></primary>
30758 </indexterm>
30759 </para>
30760 <informaltable frame="all">
30761 <tgroup cols="4" colsep="0" rowsep="0">
30762 <colspec colwidth="8*" align="left"/>
30763 <colspec colwidth="6*" align="center"/>
30764 <colspec colwidth="6*" align="center"/>
30765 <colspec colwidth="6*" align="right"/>
30766 <tbody>
30767 <row>
30768 <entry><option>system_filter_pipe_transport</option></entry>
30769 <entry>Use: <emphasis>main</emphasis></entry>
30770 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30771 <entry>Default: <emphasis>unset</emphasis></entry>
30772 </row>
30773 </tbody>
30774 </tgroup>
30775 </informaltable>
30776 <para>
30777 <indexterm role="concept">
30778 <primary><command>pipe</command> transport</primary>
30779 <secondary>for system filter</secondary>
30780 </indexterm>
30781 <indexterm role="variable">
30782 <primary><varname>$address_pipe</varname></primary>
30783 </indexterm>
30784 This specifies the transport driver that is to be used when a <option>pipe</option> command
30785 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
30786 contains the pipe command.
30787 </para>
30788 <para>
30789 <indexterm role="option">
30790 <primary><option>system_filter_reply_transport</option></primary>
30791 </indexterm>
30792 </para>
30793 <informaltable frame="all">
30794 <tgroup cols="4" colsep="0" rowsep="0">
30795 <colspec colwidth="8*" align="left"/>
30796 <colspec colwidth="6*" align="center"/>
30797 <colspec colwidth="6*" align="center"/>
30798 <colspec colwidth="6*" align="right"/>
30799 <tbody>
30800 <row>
30801 <entry><option>system_filter_reply_transport</option></entry>
30802 <entry>Use: <emphasis>main</emphasis></entry>
30803 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30804 <entry>Default: <emphasis>unset</emphasis></entry>
30805 </row>
30806 </tbody>
30807 </tgroup>
30808 </informaltable>
30809 <para>
30810 <indexterm role="concept">
30811 <primary><command>autoreply</command> transport</primary>
30812 <secondary>for system filter</secondary>
30813 </indexterm>
30814 This specifies the transport driver that is to be used when a <option>mail</option> command
30815 is used in a system filter.
30816 </para>
30817 <para>
30818 <indexterm role="option">
30819 <primary><option>system_filter_user</option></primary>
30820 </indexterm>
30821 </para>
30822 <informaltable frame="all">
30823 <tgroup cols="4" colsep="0" rowsep="0">
30824 <colspec colwidth="8*" align="left"/>
30825 <colspec colwidth="6*" align="center"/>
30826 <colspec colwidth="6*" align="center"/>
30827 <colspec colwidth="6*" align="right"/>
30828 <tbody>
30829 <row>
30830 <entry><option>system_filter_user</option></entry>
30831 <entry>Use: <emphasis>main</emphasis></entry>
30832 <entry>Type: <emphasis>string</emphasis></entry>
30833 <entry>Default: <emphasis>unset</emphasis></entry>
30834 </row>
30835 </tbody>
30836 </tgroup>
30837 </informaltable>
30838 <para>
30839 <indexterm role="concept">
30840 <primary>uid (user id)</primary>
30841 <secondary>system filter</secondary>
30842 </indexterm>
30843 If this option is set to root, the system filter is run in the main Exim
30844 delivery process, as root.  Otherwise, the system filter runs in a separate
30845 process, as the given user, defaulting to the Exim run-time user.
30846 Unless the string consists entirely of digits, it
30847 is looked up in the password data. Failure to find the named user causes a
30848 configuration error. The gid is either taken from the password data, or
30849 specified by <option>system_filter_group</option>. When the uid is specified numerically,
30850 <option>system_filter_group</option> is required to be set.
30851 </para>
30852 <para>
30853 If the system filter generates any pipe, file, or reply deliveries, the uid
30854 under which the filter is run is used when transporting them, unless a
30855 transport option overrides.
30856 </para>
30857 <para>
30858 <indexterm role="option">
30859 <primary><option>tcp_nodelay</option></primary>
30860 </indexterm>
30861 </para>
30862 <informaltable frame="all">
30863 <tgroup cols="4" colsep="0" rowsep="0">
30864 <colspec colwidth="8*" align="left"/>
30865 <colspec colwidth="6*" align="center"/>
30866 <colspec colwidth="6*" align="center"/>
30867 <colspec colwidth="6*" align="right"/>
30868 <tbody>
30869 <row>
30870 <entry><option>tcp_nodelay</option></entry>
30871 <entry>Use: <emphasis>main</emphasis></entry>
30872 <entry>Type: <emphasis>boolean</emphasis></entry>
30873 <entry>Default: <emphasis>true</emphasis></entry>
30874 </row>
30875 </tbody>
30876 </tgroup>
30877 </informaltable>
30878 <para>
30879 <indexterm role="concept">
30880 <primary>daemon</primary>
30881 <secondary>TCP_NODELAY on sockets</secondary>
30882 </indexterm>
30883 <indexterm role="concept">
30884 <primary>Nagle algorithm</primary>
30885 </indexterm>
30886 <indexterm role="concept">
30887 <primary>TCP_NODELAY on listening sockets</primary>
30888 </indexterm>
30889 If this option is set false, it stops the Exim daemon setting the
30890 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
30891 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
30892 performance in interactive (character-by-character) situations. Turning it off
30893 should improve Exim&#x2019;s performance a bit, so that is what happens by default.
30894 However, it appears that some broken clients cannot cope, and time out. Hence
30895 this option. It affects only those sockets that are set up for listening by the
30896 daemon. Sockets created by the smtp transport for delivering mail always set
30897 TCP_NODELAY.
30898 </para>
30899 <para>
30900 <indexterm role="option">
30901 <primary><option>timeout_frozen_after</option></primary>
30902 </indexterm>
30903 </para>
30904 <informaltable frame="all">
30905 <tgroup cols="4" colsep="0" rowsep="0">
30906 <colspec colwidth="8*" align="left"/>
30907 <colspec colwidth="6*" align="center"/>
30908 <colspec colwidth="6*" align="center"/>
30909 <colspec colwidth="6*" align="right"/>
30910 <tbody>
30911 <row>
30912 <entry><option>timeout_frozen_after</option></entry>
30913 <entry>Use: <emphasis>main</emphasis></entry>
30914 <entry>Type: <emphasis>time</emphasis></entry>
30915 <entry>Default: <emphasis>0s</emphasis></entry>
30916 </row>
30917 </tbody>
30918 </tgroup>
30919 </informaltable>
30920 <para>
30921 <indexterm role="concept">
30922 <primary>frozen messages</primary>
30923 <secondary>timing out</secondary>
30924 </indexterm>
30925 <indexterm role="concept">
30926 <primary>timeout</primary>
30927 <secondary>frozen messages</secondary>
30928 </indexterm>
30929 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
30930 message of any kind that has been on the queue for longer than the given time
30931 is automatically cancelled at the next queue run. If the frozen message is a
30932 bounce message, it is just discarded; otherwise, a bounce is sent to the
30933 sender, in a similar manner to cancellation by the <option>-Mg</option> command line option.
30934 If you want to timeout frozen bounce messages earlier than other kinds of
30935 frozen message, see <option>ignore_bounce_errors_after</option>.
30936 </para>
30937 <para>
30938 <emphasis role="bold">Note:</emphasis> the default value of zero means no timeouts; with this setting,
30939 frozen messages remain on the queue forever (except for any frozen bounce
30940 messages that are released by <option>ignore_bounce_errors_after</option>).
30941 </para>
30942 <para>
30943 <indexterm role="option">
30944 <primary><option>timezone</option></primary>
30945 </indexterm>
30946 </para>
30947 <informaltable frame="all">
30948 <tgroup cols="4" colsep="0" rowsep="0">
30949 <colspec colwidth="8*" align="left"/>
30950 <colspec colwidth="6*" align="center"/>
30951 <colspec colwidth="6*" align="center"/>
30952 <colspec colwidth="6*" align="right"/>
30953 <tbody>
30954 <row>
30955 <entry><option>timezone</option></entry>
30956 <entry>Use: <emphasis>main</emphasis></entry>
30957 <entry>Type: <emphasis>string</emphasis></entry>
30958 <entry>Default: <emphasis>unset</emphasis></entry>
30959 </row>
30960 </tbody>
30961 </tgroup>
30962 </informaltable>
30963 <para>
30964 <indexterm role="concept">
30965 <primary>timezone, setting</primary>
30966 </indexterm>
30967 <indexterm role="concept">
30968 <primary>environment</primary>
30969 <secondary>values from</secondary>
30970 </indexterm>
30971 The value of <option>timezone</option> is used to set the environment variable TZ while
30972 running Exim (if it is different on entry). This ensures that all timestamps
30973 created by Exim are in the required timezone. If you want all your timestamps
30974 to be in UTC (aka GMT) you should set
30975 </para>
30976 <literallayout class="monospaced">
30977 timezone = UTC
30978 </literallayout>
30979 <para>
30980 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
30981 or, if that is not set, from the value of the TZ environment variable when Exim
30982 is built. If <option>timezone</option> is set to the empty string, either at build or run
30983 time, any existing TZ variable is removed from the environment when Exim
30984 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
30985 unfortunately not all, operating systems.
30986 </para>
30987 <para revisionflag="changed">
30988 <indexterm role="option">
30989 <primary><option>tls_advertise_hosts</option></primary>
30990 </indexterm>
30991 </para>
30992 <informaltable frame="all" revisionflag="changed">
30993 <tgroup cols="4" colsep="0" rowsep="0">
30994 <colspec colwidth="8*" align="left"/>
30995 <colspec colwidth="6*" align="center"/>
30996 <colspec colwidth="6*" align="center"/>
30997 <colspec colwidth="6*" align="right"/>
30998 <tbody>
30999 <row>
31000 <entry><option>tls_advertise_hosts</option></entry>
31001 <entry>Use: <emphasis>main</emphasis></entry>
31002 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
31003 <entry>Default: <emphasis>*</emphasis></entry>
31004 </row>
31005 </tbody>
31006 </tgroup>
31007 </informaltable>
31008 <para>
31009 <indexterm role="concept">
31010 <primary>TLS</primary>
31011 <secondary>advertising</secondary>
31012 </indexterm>
31013 <indexterm role="concept">
31014 <primary>encryption</primary>
31015 <secondary>on SMTP connection</secondary>
31016 </indexterm>
31017 <indexterm role="concept">
31018 <primary>SMTP</primary>
31019 <secondary>encrypted connection</secondary>
31020 </indexterm>
31021 When Exim is built with support for TLS encrypted connections, the availability
31022 of the STARTTLS command to set up an encrypted session is advertised in
31023 response to EHLO only to those client hosts that match this option. See
31024 chapter <xref linkend="CHAPTLS"/> for details of Exim&#x2019;s support for TLS.
31025 </para>
31026 <para revisionflag="changed">
31027 Note that the default value requires that a certificate be supplied
31028 using the <option>tls_certificate</option> option.  If no certificate is available then
31029 the <option>tls_advertise_hosts</option> option should be set empty.
31030 </para>
31031 <para>
31032 <indexterm role="option">
31033 <primary><option>tls_certificate</option></primary>
31034 </indexterm>
31035 </para>
31036 <informaltable frame="all">
31037 <tgroup cols="4" colsep="0" rowsep="0">
31038 <colspec colwidth="8*" align="left"/>
31039 <colspec colwidth="6*" align="center"/>
31040 <colspec colwidth="6*" align="center"/>
31041 <colspec colwidth="6*" align="right"/>
31042 <tbody>
31043 <row>
31044 <entry><option>tls_certificate</option></entry>
31045 <entry>Use: <emphasis>main</emphasis></entry>
31046 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31047 <entry>Default: <emphasis>unset</emphasis></entry>
31048 </row>
31049 </tbody>
31050 </tgroup>
31051 </informaltable>
31052 <para>
31053 <indexterm role="concept">
31054 <primary>TLS</primary>
31055 <secondary>server certificate; location of</secondary>
31056 </indexterm>
31057 <indexterm role="concept">
31058 <primary>certificate</primary>
31059 <secondary>server, location of</secondary>
31060 </indexterm>
31061 The value of this option is expanded, and must then be the absolute path to a
31062 file which contains the server&#x2019;s certificates. The server&#x2019;s private key is also
31063 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
31064 <xref linkend="CHAPTLS"/> for further details.
31065 </para>
31066 <para>
31067 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
31068 receiving incoming messages as a server. If you want to supply certificates for
31069 use when sending messages as a client, you must set the <option>tls_certificate</option>
31070 option in the relevant <command>smtp</command> transport.
31071 </para>
31072 <para>
31073 If the option contains <varname>$tls_out_sni</varname> and Exim is built against OpenSSL, then
31074 if the OpenSSL build supports TLS extensions and the TLS client sends the
31075 Server Name Indication extension, then this option and others documented in
31076 <xref linkend="SECTtlssni"/> will be re-expanded.
31077 </para>
31078 <para>
31079 <indexterm role="option">
31080 <primary><option>tls_crl</option></primary>
31081 </indexterm>
31082 </para>
31083 <informaltable frame="all">
31084 <tgroup cols="4" colsep="0" rowsep="0">
31085 <colspec colwidth="8*" align="left"/>
31086 <colspec colwidth="6*" align="center"/>
31087 <colspec colwidth="6*" align="center"/>
31088 <colspec colwidth="6*" align="right"/>
31089 <tbody>
31090 <row>
31091 <entry><option>tls_crl</option></entry>
31092 <entry>Use: <emphasis>main</emphasis></entry>
31093 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31094 <entry>Default: <emphasis>unset</emphasis></entry>
31095 </row>
31096 </tbody>
31097 </tgroup>
31098 </informaltable>
31099 <para>
31100 <indexterm role="concept">
31101 <primary>TLS</primary>
31102 <secondary>server certificate revocation list</secondary>
31103 </indexterm>
31104 <indexterm role="concept">
31105 <primary>certificate</primary>
31106 <secondary>revocation list for server</secondary>
31107 </indexterm>
31108 This option specifies a certificate revocation list. The expanded value must
31109 be the name of a file that contains a CRL in PEM format.
31110 </para>
31111 <para>
31112 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
31113 </para>
31114 <para>
31115 <indexterm role="option">
31116 <primary><option>tls_dh_max_bits</option></primary>
31117 </indexterm>
31118 </para>
31119 <informaltable frame="all">
31120 <tgroup cols="4" colsep="0" rowsep="0">
31121 <colspec colwidth="8*" align="left"/>
31122 <colspec colwidth="6*" align="center"/>
31123 <colspec colwidth="6*" align="center"/>
31124 <colspec colwidth="6*" align="right"/>
31125 <tbody>
31126 <row>
31127 <entry><option>tls_dh_max_bits</option></entry>
31128 <entry>Use: <emphasis>main</emphasis></entry>
31129 <entry>Type: <emphasis>integer</emphasis></entry>
31130 <entry>Default: <emphasis>2236</emphasis></entry>
31131 </row>
31132 </tbody>
31133 </tgroup>
31134 </informaltable>
31135 <para>
31136 <indexterm role="concept">
31137 <primary>TLS</primary>
31138 <secondary>D-H bit count</secondary>
31139 </indexterm>
31140 The number of bits used for Diffie-Hellman key-exchange may be suggested by
31141 the chosen TLS library.  That value might prove to be too high for
31142 interoperability.  This option provides a maximum clamp on the value
31143 suggested, trading off security for interoperability.
31144 </para>
31145 <para>
31146 The value must be at least 1024.
31147 </para>
31148 <para>
31149 The value 2236 was chosen because, at time of adding the option, it was the
31150 hard-coded maximum value supported by the NSS cryptographic library, as used
31151 by Thunderbird, while GnuTLS was suggesting 2432 bits as normal.
31152 </para>
31153 <para>
31154 If you prefer more security and are willing to break some clients, raise this
31155 number.
31156 </para>
31157 <para>
31158 Note that the value passed to GnuTLS for *generating* a new prime may be a
31159 little less than this figure, because GnuTLS is inexact and may produce a
31160 larger prime than requested.
31161 </para>
31162 <para>
31163 <indexterm role="option">
31164 <primary><option>tls_dhparam</option></primary>
31165 </indexterm>
31166 </para>
31167 <informaltable frame="all">
31168 <tgroup cols="4" colsep="0" rowsep="0">
31169 <colspec colwidth="8*" align="left"/>
31170 <colspec colwidth="6*" align="center"/>
31171 <colspec colwidth="6*" align="center"/>
31172 <colspec colwidth="6*" align="right"/>
31173 <tbody>
31174 <row>
31175 <entry><option>tls_dhparam</option></entry>
31176 <entry>Use: <emphasis>main</emphasis></entry>
31177 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31178 <entry>Default: <emphasis>unset</emphasis></entry>
31179 </row>
31180 </tbody>
31181 </tgroup>
31182 </informaltable>
31183 <para>
31184 <indexterm role="concept">
31185 <primary>TLS</primary>
31186 <secondary>D-H parameters for server</secondary>
31187 </indexterm>
31188 The value of this option is expanded and indicates the source of DH parameters
31189 to be used by Exim.
31190 </para>
31191 <para>
31192 If it is a filename starting with a <literal>/</literal>, then it names a file from which DH
31193 parameters should be loaded.  If the file exists, it should hold a PEM-encoded
31194 PKCS#3 representation of the DH prime.  If the file does not exist, for
31195 OpenSSL it is an error.  For GnuTLS, Exim will attempt to create the file and
31196 fill it with a generated DH prime.  For OpenSSL, if the DH bit-count from
31197 loading the file is greater than <option>tls_dh_max_bits</option> then it will be ignored,
31198 and treated as though the <option>tls_dhparam</option> were set to "none".
31199 </para>
31200 <para>
31201 If this option expands to the string "none", then no DH parameters will be
31202 loaded by Exim.
31203 </para>
31204 <para>
31205 If this option expands to the string "historic" and Exim is using GnuTLS, then
31206 Exim will attempt to load a file from inside the spool directory.  If the file
31207 does not exist, Exim will attempt to create it.
31208 See section <xref linkend="SECTgnutlsparam"/> for further details.
31209 </para>
31210 <para>
31211 If Exim is using OpenSSL and this option is empty or unset, then Exim will load
31212 a default DH prime; the default is the 2048 bit prime described in section
31213 2.2 of RFC 5114, "2048-bit MODP Group with 224-bit Prime Order Subgroup", which
31214 in IKE is assigned number 23.
31215 </para>
31216 <para>
31217 Otherwise, the option must expand to the name used by Exim for any of a number
31218 of DH primes specified in RFC 2409, RFC 3526 and RFC 5114.  As names, Exim uses
31219 "ike" followed by the number used by IKE, of "default" which corresponds to
31220 "ike23".
31221 </para>
31222 <para>
31223 The available primes are:
31224 <literal>ike1</literal>, <literal>ike2</literal>, <literal>ike5</literal>,
31225 <literal>ike14</literal>, <literal>ike15</literal>, <literal>ike16</literal>, <literal>ike17</literal>, <literal>ike18</literal>,
31226 <literal>ike22</literal>, <literal>ike23</literal> (aka <literal>default</literal>) and <literal>ike24</literal>.
31227 </para>
31228 <para>
31229 Some of these will be too small to be accepted by clients.
31230 Some may be too large to be accepted by clients.
31231 </para>
31232 <para>
31233 The TLS protocol does not negotiate an acceptable size for this; clients tend
31234 to hard-drop connections if what is offered by the server is unacceptable,
31235 whether too large or too small, and there&#x2019;s no provision for the client to
31236 tell the server what these constraints are.  Thus, as a server operator, you
31237 need to make an educated guess as to what is most likely to work for your
31238 userbase.
31239 </para>
31240 <para>
31241 Some known size constraints suggest that a bit-size in the range 2048 to 2236
31242 is most likely to maximise interoperability.  The upper bound comes from
31243 applications using the Mozilla Network Security Services (NSS) library, which
31244 used to set its <literal>DH_MAX_P_BITS</literal> upper-bound to 2236.  This affects many
31245 mail user agents (MUAs). The lower bound comes from Debian installs of Exim4
31246 prior to the 4.80 release, as Debian used to patch Exim to raise the minimum
31247 acceptable bound from 1024 to 2048.
31248 </para>
31249 <para>
31250 <indexterm role="option">
31251 <primary><option>tls_eccurve</option></primary>
31252 </indexterm>
31253 </para>
31254 <informaltable frame="all">
31255 <tgroup cols="4" colsep="0" rowsep="0">
31256 <colspec colwidth="8*" align="left"/>
31257 <colspec colwidth="6*" align="center"/>
31258 <colspec colwidth="6*" align="center"/>
31259 <colspec colwidth="6*" align="right"/>
31260 <tbody>
31261 <row>
31262 <entry><option>tls_eccurve</option></entry>
31263 <entry>Use: <emphasis>main</emphasis></entry>
31264 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31265 <entry>Default: <emphasis>prime256v1</emphasis></entry>
31266 </row>
31267 </tbody>
31268 </tgroup>
31269 </informaltable>
31270 <para>
31271 <indexterm role="concept">
31272 <primary>TLS</primary>
31273 <secondary>EC cryptography</secondary>
31274 </indexterm>
31275 If built with a recent-enough version of OpenSSL,
31276 this option selects a EC curve for use by Exim.
31277 </para>
31278 <para>
31279 Curve names of the form <emphasis>prime256v1</emphasis> are accepted.
31280 For even more-recent library versions, names of the form <emphasis>P-512</emphasis>
31281 are also accepted, plus the special value <emphasis>auto</emphasis>
31282 which tells the library to choose.
31283 </para>
31284 <para>
31285 If the option is set to an empty string, no EC curves will be enabled.
31286 </para>
31287 <para>
31288 <indexterm role="option">
31289 <primary><option>tls_ocsp_file</option></primary>
31290 </indexterm>
31291 </para>
31292 <informaltable frame="all">
31293 <tgroup cols="4" colsep="0" rowsep="0">
31294 <colspec colwidth="8*" align="left"/>
31295 <colspec colwidth="6*" align="center"/>
31296 <colspec colwidth="6*" align="center"/>
31297 <colspec colwidth="6*" align="right"/>
31298 <tbody>
31299 <row>
31300 <entry><option>tls_ocsp_file</option></entry>
31301 <entry>Use: <emphasis>main</emphasis></entry>
31302 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31303 <entry>Default: <emphasis>unset</emphasis></entry>
31304 </row>
31305 </tbody>
31306 </tgroup>
31307 </informaltable>
31308 <para>
31309 <indexterm role="concept">
31310 <primary>TLS</primary>
31311 <secondary>certificate status</secondary>
31312 </indexterm>
31313 <indexterm role="concept">
31314 <primary>TLS</primary>
31315 <secondary>OCSP proof file</secondary>
31316 </indexterm>
31317 This option
31318 must if set expand to the absolute path to a file which contains a current
31319 status proof for the server&#x2019;s certificate, as obtained from the
31320 Certificate Authority.
31321 </para>
31322 <para revisionflag="changed">
31323 Usable for GnuTLS 3.4.4 or 3.3.17 or OpenSSL 1.1.0 (or later).
31324 </para>
31325 <para>
31326 <indexterm role="option">
31327 <primary><option>tls_on_connect_ports</option></primary>
31328 </indexterm>
31329 </para>
31330 <informaltable frame="all">
31331 <tgroup cols="4" colsep="0" rowsep="0">
31332 <colspec colwidth="8*" align="left"/>
31333 <colspec colwidth="6*" align="center"/>
31334 <colspec colwidth="6*" align="center"/>
31335 <colspec colwidth="6*" align="right"/>
31336 <tbody>
31337 <row>
31338 <entry><option>tls_on_connect_ports</option></entry>
31339 <entry>Use: <emphasis>main</emphasis></entry>
31340 <entry>Type: <emphasis>string list</emphasis></entry>
31341 <entry>Default: <emphasis>unset</emphasis></entry>
31342 </row>
31343 </tbody>
31344 </tgroup>
31345 </informaltable>
31346 <para>
31347 <indexterm role="concept">
31348 <primary>SSMTP</primary>
31349 </indexterm>
31350 <indexterm role="concept">
31351 <primary>SMTPS</primary>
31352 </indexterm>
31353 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
31354 operate the obsolete SSMTP (SMTPS) protocol, where a TLS session is immediately
31355 set up without waiting for the client to issue a STARTTLS command. For
31356 further details, see section <xref linkend="SECTsupobssmt"/>.
31357 </para>
31358 <para>
31359 <indexterm role="option">
31360 <primary><option>tls_privatekey</option></primary>
31361 </indexterm>
31362 </para>
31363 <informaltable frame="all">
31364 <tgroup cols="4" colsep="0" rowsep="0">
31365 <colspec colwidth="8*" align="left"/>
31366 <colspec colwidth="6*" align="center"/>
31367 <colspec colwidth="6*" align="center"/>
31368 <colspec colwidth="6*" align="right"/>
31369 <tbody>
31370 <row>
31371 <entry><option>tls_privatekey</option></entry>
31372 <entry>Use: <emphasis>main</emphasis></entry>
31373 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31374 <entry>Default: <emphasis>unset</emphasis></entry>
31375 </row>
31376 </tbody>
31377 </tgroup>
31378 </informaltable>
31379 <para>
31380 <indexterm role="concept">
31381 <primary>TLS</primary>
31382 <secondary>server private key; location of</secondary>
31383 </indexterm>
31384 The value of this option is expanded, and must then be the absolute path to a
31385 file which contains the server&#x2019;s private key. If this option is unset, or if
31386 the expansion is forced to fail, or the result is an empty string, the private
31387 key is assumed to be in the same file as the server&#x2019;s certificates. See chapter
31388 <xref linkend="CHAPTLS"/> for further details.
31389 </para>
31390 <para>
31391 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
31392 </para>
31393 <para>
31394 <indexterm role="option">
31395 <primary><option>tls_remember_esmtp</option></primary>
31396 </indexterm>
31397 </para>
31398 <informaltable frame="all">
31399 <tgroup cols="4" colsep="0" rowsep="0">
31400 <colspec colwidth="8*" align="left"/>
31401 <colspec colwidth="6*" align="center"/>
31402 <colspec colwidth="6*" align="center"/>
31403 <colspec colwidth="6*" align="right"/>
31404 <tbody>
31405 <row>
31406 <entry><option>tls_remember_esmtp</option></entry>
31407 <entry>Use: <emphasis>main</emphasis></entry>
31408 <entry>Type: <emphasis>boolean</emphasis></entry>
31409 <entry>Default: <emphasis>false</emphasis></entry>
31410 </row>
31411 </tbody>
31412 </tgroup>
31413 </informaltable>
31414 <para>
31415 <indexterm role="concept">
31416 <primary>TLS</primary>
31417 <secondary>esmtp state; remembering</secondary>
31418 </indexterm>
31419 <indexterm role="concept">
31420 <primary>TLS</primary>
31421 <secondary>broken clients</secondary>
31422 </indexterm>
31423 If this option is set true, Exim violates the RFCs by remembering that it is in
31424 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
31425 support for broken clients that fail to send a new EHLO after starting a
31426 TLS session.
31427 </para>
31428 <para>
31429 <indexterm role="option">
31430 <primary><option>tls_require_ciphers</option></primary>
31431 </indexterm>
31432 </para>
31433 <informaltable frame="all">
31434 <tgroup cols="4" colsep="0" rowsep="0">
31435 <colspec colwidth="8*" align="left"/>
31436 <colspec colwidth="6*" align="center"/>
31437 <colspec colwidth="6*" align="center"/>
31438 <colspec colwidth="6*" align="right"/>
31439 <tbody>
31440 <row>
31441 <entry><option>tls_require_ciphers</option></entry>
31442 <entry>Use: <emphasis>main</emphasis></entry>
31443 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31444 <entry>Default: <emphasis>unset</emphasis></entry>
31445 </row>
31446 </tbody>
31447 </tgroup>
31448 </informaltable>
31449 <para>
31450 <indexterm role="concept">
31451 <primary>TLS</primary>
31452 <secondary>requiring specific ciphers</secondary>
31453 </indexterm>
31454 <indexterm role="concept">
31455 <primary>cipher</primary>
31456 <secondary>requiring specific</secondary>
31457 </indexterm>
31458 This option controls which ciphers can be used for incoming TLS connections.
31459 The <command>smtp</command> transport has an option of the same name for controlling outgoing
31460 connections. This option is expanded for each connection, so can be varied for
31461 different clients if required. The value of this option must be a list of
31462 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
31463 in somewhat different ways. If GnuTLS is being used, the client controls the
31464 preference order of the available ciphers. Details are given in sections
31465 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
31466 </para>
31467 <para>
31468 <indexterm role="option">
31469 <primary><option>tls_try_verify_hosts</option></primary>
31470 </indexterm>
31471 </para>
31472 <informaltable frame="all">
31473 <tgroup cols="4" colsep="0" rowsep="0">
31474 <colspec colwidth="8*" align="left"/>
31475 <colspec colwidth="6*" align="center"/>
31476 <colspec colwidth="6*" align="center"/>
31477 <colspec colwidth="6*" align="right"/>
31478 <tbody>
31479 <row>
31480 <entry><option>tls_try_verify_hosts</option></entry>
31481 <entry>Use: <emphasis>main</emphasis></entry>
31482 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
31483 <entry>Default: <emphasis>unset</emphasis></entry>
31484 </row>
31485 </tbody>
31486 </tgroup>
31487 </informaltable>
31488 <para>
31489 <indexterm role="concept">
31490 <primary>TLS</primary>
31491 <secondary>client certificate verification</secondary>
31492 </indexterm>
31493 <indexterm role="concept">
31494 <primary>certificate</primary>
31495 <secondary>verification of client</secondary>
31496 </indexterm>
31497 See <option>tls_verify_hosts</option> below.
31498 </para>
31499 <para>
31500 <indexterm role="option">
31501 <primary><option>tls_verify_certificates</option></primary>
31502 </indexterm>
31503 </para>
31504 <informaltable frame="all">
31505 <tgroup cols="4" colsep="0" rowsep="0">
31506 <colspec colwidth="8*" align="left"/>
31507 <colspec colwidth="6*" align="center"/>
31508 <colspec colwidth="6*" align="center"/>
31509 <colspec colwidth="6*" align="right"/>
31510 <tbody>
31511 <row>
31512 <entry><option>tls_verify_certificates</option></entry>
31513 <entry>Use: <emphasis>main</emphasis></entry>
31514 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31515 <entry>Default: <emphasis>system</emphasis></entry>
31516 </row>
31517 </tbody>
31518 </tgroup>
31519 </informaltable>
31520 <para>
31521 <indexterm role="concept">
31522 <primary>TLS</primary>
31523 <secondary>client certificate verification</secondary>
31524 </indexterm>
31525 <indexterm role="concept">
31526 <primary>certificate</primary>
31527 <secondary>verification of client</secondary>
31528 </indexterm>
31529 The value of this option is expanded, and must then be either the
31530 word "system"
31531 or the absolute path to
31532 a file or directory containing permitted certificates for clients that
31533 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>.
31534 </para>
31535 <para>
31536 The "system" value for the option will use a
31537 system default location compiled into the SSL library.
31538 This is not available for GnuTLS versions preceding 3.0.20,
31539 and will be taken as empty; an explicit location
31540 must be specified.
31541 </para>
31542 <para>
31543 The use of a directory for the option value is not available for GnuTLS versions
31544 preceding 3.3.6 and a single file must be used.
31545 </para>
31546 <para>
31547 With OpenSSL the certificates specified
31548 explicitly
31549 either by file or directory
31550 are added to those given by the system default location.
31551 </para>
31552 <para>
31553 These certificates should be for the certificate authorities trusted, rather
31554 than the public cert of individual clients.  With both OpenSSL and GnuTLS, if
31555 the value is a file then the certificates are sent by Exim as a server to
31556 connecting clients, defining the list of accepted certificate authorities.
31557 Thus the values defined should be considered public data.  To avoid this,
31558 use the explicit directory version.
31559 </para>
31560 <para>
31561 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
31562 </para>
31563 <para>
31564 A forced expansion failure or setting to an empty string is equivalent to
31565 being unset.
31566 </para>
31567 <para>
31568 <indexterm role="option">
31569 <primary><option>tls_verify_hosts</option></primary>
31570 </indexterm>
31571 </para>
31572 <informaltable frame="all">
31573 <tgroup cols="4" colsep="0" rowsep="0">
31574 <colspec colwidth="8*" align="left"/>
31575 <colspec colwidth="6*" align="center"/>
31576 <colspec colwidth="6*" align="center"/>
31577 <colspec colwidth="6*" align="right"/>
31578 <tbody>
31579 <row>
31580 <entry><option>tls_verify_hosts</option></entry>
31581 <entry>Use: <emphasis>main</emphasis></entry>
31582 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
31583 <entry>Default: <emphasis>unset</emphasis></entry>
31584 </row>
31585 </tbody>
31586 </tgroup>
31587 </informaltable>
31588 <para>
31589 <indexterm role="concept">
31590 <primary>TLS</primary>
31591 <secondary>client certificate verification</secondary>
31592 </indexterm>
31593 <indexterm role="concept">
31594 <primary>certificate</primary>
31595 <secondary>verification of client</secondary>
31596 </indexterm>
31597 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
31598 certificates from clients. The expected certificates are defined by
31599 <option>tls_verify_certificates</option>, which must be set. A configuration error occurs if
31600 either <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> is set and
31601 <option>tls_verify_certificates</option> is not set.
31602 </para>
31603 <para>
31604 Any client that matches <option>tls_verify_hosts</option> is constrained by
31605 <option>tls_verify_certificates</option>. When the client initiates a TLS session, it must
31606 present one of the listed certificates. If it does not, the connection is
31607 aborted. <emphasis role="bold">Warning</emphasis>: Including a host in <option>tls_verify_hosts</option> does not require
31608 the host to use TLS. It can still send SMTP commands through unencrypted
31609 connections. Forcing a client to use TLS has to be done separately using an
31610 ACL to reject inappropriate commands when the connection is not encrypted.
31611 </para>
31612 <para>
31613 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
31614 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
31615 certificate and checks it against <option>tls_verify_certificates</option>, but does not
31616 abort the connection if there is no certificate or if it does not match. This
31617 state can be detected in an ACL, which makes it possible to implement policies
31618 such as <quote>accept for relay only if a verified certificate has been received,
31619 but accept for local delivery if encrypted, even without a verified
31620 certificate</quote>.
31621 </para>
31622 <para>
31623 Client hosts that match neither of these lists are not asked to present
31624 certificates.
31625 </para>
31626 <para>
31627 <indexterm role="option">
31628 <primary><option>trusted_groups</option></primary>
31629 </indexterm>
31630 </para>
31631 <informaltable frame="all">
31632 <tgroup cols="4" colsep="0" rowsep="0">
31633 <colspec colwidth="8*" align="left"/>
31634 <colspec colwidth="6*" align="center"/>
31635 <colspec colwidth="6*" align="center"/>
31636 <colspec colwidth="6*" align="right"/>
31637 <tbody>
31638 <row>
31639 <entry><option>trusted_groups</option></entry>
31640 <entry>Use: <emphasis>main</emphasis></entry>
31641 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
31642 <entry>Default: <emphasis>unset</emphasis></entry>
31643 </row>
31644 </tbody>
31645 </tgroup>
31646 </informaltable>
31647 <para>
31648 <indexterm role="concept">
31649 <primary>trusted groups</primary>
31650 </indexterm>
31651 <indexterm role="concept">
31652 <primary>groups</primary>
31653 <secondary>trusted</secondary>
31654 </indexterm>
31655 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
31656 option is set, any process that is running in one of the listed groups, or
31657 which has one of them as a supplementary group, is trusted. The groups can be
31658 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
31659 details of what trusted callers are permitted to do. If neither
31660 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
31661 are trusted.
31662 </para>
31663 <para>
31664 <indexterm role="option">
31665 <primary><option>trusted_users</option></primary>
31666 </indexterm>
31667 </para>
31668 <informaltable frame="all">
31669 <tgroup cols="4" colsep="0" rowsep="0">
31670 <colspec colwidth="8*" align="left"/>
31671 <colspec colwidth="6*" align="center"/>
31672 <colspec colwidth="6*" align="center"/>
31673 <colspec colwidth="6*" align="right"/>
31674 <tbody>
31675 <row>
31676 <entry><option>trusted_users</option></entry>
31677 <entry>Use: <emphasis>main</emphasis></entry>
31678 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
31679 <entry>Default: <emphasis>unset</emphasis></entry>
31680 </row>
31681 </tbody>
31682 </tgroup>
31683 </informaltable>
31684 <para>
31685 <indexterm role="concept">
31686 <primary>trusted users</primary>
31687 </indexterm>
31688 <indexterm role="concept">
31689 <primary>user</primary>
31690 <secondary>trusted</secondary>
31691 </indexterm>
31692 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
31693 option is set, any process that is running as one of the listed users is
31694 trusted. The users can be specified numerically or by name. See section
31695 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
31696 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
31697 Exim user are trusted.
31698 </para>
31699 <para>
31700 <indexterm role="option">
31701 <primary><option>unknown_login</option></primary>
31702 </indexterm>
31703 </para>
31704 <informaltable frame="all">
31705 <tgroup cols="4" colsep="0" rowsep="0">
31706 <colspec colwidth="8*" align="left"/>
31707 <colspec colwidth="6*" align="center"/>
31708 <colspec colwidth="6*" align="center"/>
31709 <colspec colwidth="6*" align="right"/>
31710 <tbody>
31711 <row>
31712 <entry><option>unknown_login</option></entry>
31713 <entry>Use: <emphasis>main</emphasis></entry>
31714 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31715 <entry>Default: <emphasis>unset</emphasis></entry>
31716 </row>
31717 </tbody>
31718 </tgroup>
31719 </informaltable>
31720 <para>
31721 <indexterm role="concept">
31722 <primary>uid (user id)</primary>
31723 <secondary>unknown caller</secondary>
31724 </indexterm>
31725 <indexterm role="variable">
31726 <primary><varname>$caller_uid</varname></primary>
31727 </indexterm>
31728 This is a specialized feature for use in unusual configurations. By default, if
31729 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
31730 gives up. The <option>unknown_login</option> option can be used to set a login name to be
31731 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
31732 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
31733 is used for the user&#x2019;s real name (gecos field), unless this has been set by the
31734 <option>-F</option> option.
31735 </para>
31736 <para>
31737 <indexterm role="option">
31738 <primary><option>unknown_username</option></primary>
31739 </indexterm>
31740 </para>
31741 <informaltable frame="all">
31742 <tgroup cols="4" colsep="0" rowsep="0">
31743 <colspec colwidth="8*" align="left"/>
31744 <colspec colwidth="6*" align="center"/>
31745 <colspec colwidth="6*" align="center"/>
31746 <colspec colwidth="6*" align="right"/>
31747 <tbody>
31748 <row>
31749 <entry><option>unknown_username</option></entry>
31750 <entry>Use: <emphasis>main</emphasis></entry>
31751 <entry>Type: <emphasis>string</emphasis></entry>
31752 <entry>Default: <emphasis>unset</emphasis></entry>
31753 </row>
31754 </tbody>
31755 </tgroup>
31756 </informaltable>
31757 <para>
31758 See <option>unknown_login</option>.
31759 </para>
31760 <para>
31761 <indexterm role="option">
31762 <primary><option>untrusted_set_sender</option></primary>
31763 </indexterm>
31764 </para>
31765 <informaltable frame="all">
31766 <tgroup cols="4" colsep="0" rowsep="0">
31767 <colspec colwidth="8*" align="left"/>
31768 <colspec colwidth="6*" align="center"/>
31769 <colspec colwidth="6*" align="center"/>
31770 <colspec colwidth="6*" align="right"/>
31771 <tbody>
31772 <row>
31773 <entry><option>untrusted_set_sender</option></entry>
31774 <entry>Use: <emphasis>main</emphasis></entry>
31775 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
31776 <entry>Default: <emphasis>unset</emphasis></entry>
31777 </row>
31778 </tbody>
31779 </tgroup>
31780 </informaltable>
31781 <para>
31782 <indexterm role="concept">
31783 <primary>trusted users</primary>
31784 </indexterm>
31785 <indexterm role="concept">
31786 <primary>sender</primary>
31787 <secondary>setting by untrusted user</secondary>
31788 </indexterm>
31789 <indexterm role="concept">
31790 <primary>untrusted user setting sender</primary>
31791 </indexterm>
31792 <indexterm role="concept">
31793 <primary>user</primary>
31794 <secondary>untrusted setting sender</secondary>
31795 </indexterm>
31796 <indexterm role="concept">
31797 <primary>envelope sender</primary>
31798 </indexterm>
31799 When an untrusted user submits a message to Exim using the standard input, Exim
31800 normally creates an envelope sender address from the user&#x2019;s login and the
31801 default qualification domain. Data from the <option>-f</option> option (for setting envelope
31802 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
31803 is used) is ignored.
31804 </para>
31805 <para>
31806 However, untrusted users are permitted to set an empty envelope sender address,
31807 to declare that a message should never generate any bounces. For example:
31808 </para>
31809 <literallayout class="monospaced">
31810 exim -f '&lt;&gt;' user@domain.example
31811 </literallayout>
31812 <para>
31813 <indexterm role="variable">
31814 <primary><varname>$sender_ident</varname></primary>
31815 </indexterm>
31816 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
31817 other envelope sender addresses in a controlled way. When it is set, untrusted
31818 users are allowed to set envelope sender addresses that match any of the
31819 patterns in the list. Like all address lists, the string is expanded. The
31820 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
31821 users to setting senders that start with their login ids
31822 followed by a hyphen
31823 by a setting like this:
31824 </para>
31825 <literallayout class="monospaced">
31826 untrusted_set_sender = ^$sender_ident-
31827 </literallayout>
31828 <para>
31829 If you want to allow untrusted users to set envelope sender addresses without
31830 restriction, you can use
31831 </para>
31832 <literallayout class="monospaced">
31833 untrusted_set_sender = *
31834 </literallayout>
31835 <para>
31836 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
31837 only to the setting of the envelope sender. It does not permit untrusted users
31838 to use the other options which trusted user can use to override message
31839 parameters. Furthermore, it does not stop Exim from removing an existing
31840 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
31841 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
31842 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
31843 described in section <xref linkend="SECTthesenhea"/>.
31844 </para>
31845 <para>
31846 The log line for a message&#x2019;s arrival shows the envelope sender following
31847 <quote>&lt;=</quote>. For local messages, the user&#x2019;s login always follows, after <quote>U=</quote>. In
31848 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
31849 envelope sender address, the user&#x2019;s login is shown in parentheses after the
31850 sender address.
31851 </para>
31852 <para>
31853 <indexterm role="option">
31854 <primary><option>uucp_from_pattern</option></primary>
31855 </indexterm>
31856 </para>
31857 <informaltable frame="all">
31858 <tgroup cols="4" colsep="0" rowsep="0">
31859 <colspec colwidth="8*" align="left"/>
31860 <colspec colwidth="6*" align="center"/>
31861 <colspec colwidth="6*" align="center"/>
31862 <colspec colwidth="6*" align="right"/>
31863 <tbody>
31864 <row>
31865 <entry><option>uucp_from_pattern</option></entry>
31866 <entry>Use: <emphasis>main</emphasis></entry>
31867 <entry>Type: <emphasis>string</emphasis></entry>
31868 <entry>Default: <emphasis>see below</emphasis></entry>
31869 </row>
31870 </tbody>
31871 </tgroup>
31872 </informaltable>
31873 <para>
31874 <indexterm role="concept">
31875 <primary><quote>From</quote> line</primary>
31876 </indexterm>
31877 <indexterm role="concept">
31878 <primary>UUCP</primary>
31879 <secondary><quote>From</quote> line</secondary>
31880 </indexterm>
31881 Some applications that pass messages to an MTA via a command line interface use
31882 an initial line starting with <quote>From&nbsp;</quote> to pass the envelope sender. In
31883 particular, this is used by UUCP software. Exim recognizes such a line by means
31884 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
31885 matches, the sender address is constructed by expanding the contents of
31886 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
31887 default pattern recognizes lines in the following two forms:
31888 </para>
31889 <literallayout class="monospaced">
31890 From ph10 Fri Jan  5 12:35 GMT 1996
31891 From ph10 Fri, 7 Jan 97 14:00:00 GMT
31892 </literallayout>
31893 <para>
31894 The pattern can be seen by running
31895 </para>
31896 <literallayout class="monospaced">
31897 exim -bP uucp_from_pattern
31898 </literallayout>
31899 <para>
31900 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
31901 year in the second case. The first word after <quote>From&nbsp;</quote> is matched in the
31902 regular expression by a parenthesized subpattern. The default value for
31903 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
31904 (<quote>ph10</quote> in the example above) as the message&#x2019;s sender. See also
31905 <option>ignore_fromline_hosts</option>.
31906 </para>
31907 <para>
31908 <indexterm role="option">
31909 <primary><option>uucp_from_sender</option></primary>
31910 </indexterm>
31911 </para>
31912 <informaltable frame="all">
31913 <tgroup cols="4" colsep="0" rowsep="0">
31914 <colspec colwidth="8*" align="left"/>
31915 <colspec colwidth="6*" align="center"/>
31916 <colspec colwidth="6*" align="center"/>
31917 <colspec colwidth="6*" align="right"/>
31918 <tbody>
31919 <row>
31920 <entry><option>uucp_from_sender</option></entry>
31921 <entry>Use: <emphasis>main</emphasis></entry>
31922 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31923 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
31924 </row>
31925 </tbody>
31926 </tgroup>
31927 </informaltable>
31928 <para>
31929 See <option>uucp_from_pattern</option> above.
31930 </para>
31931 <para>
31932 <indexterm role="option">
31933 <primary><option>warn_message_file</option></primary>
31934 </indexterm>
31935 </para>
31936 <informaltable frame="all">
31937 <tgroup cols="4" colsep="0" rowsep="0">
31938 <colspec colwidth="8*" align="left"/>
31939 <colspec colwidth="6*" align="center"/>
31940 <colspec colwidth="6*" align="center"/>
31941 <colspec colwidth="6*" align="right"/>
31942 <tbody>
31943 <row>
31944 <entry><option>warn_message_file</option></entry>
31945 <entry>Use: <emphasis>main</emphasis></entry>
31946 <entry>Type: <emphasis>string</emphasis></entry>
31947 <entry>Default: <emphasis>unset</emphasis></entry>
31948 </row>
31949 </tbody>
31950 </tgroup>
31951 </informaltable>
31952 <para>
31953 <indexterm role="concept">
31954 <primary>warning of delay</primary>
31955 <secondary>customizing the message</secondary>
31956 </indexterm>
31957 <indexterm role="concept">
31958 <primary>customizing</primary>
31959 <secondary>warning message</secondary>
31960 </indexterm>
31961 This option defines a template file containing paragraphs of text to be used
31962 for constructing the warning message which is sent by Exim when a message has
31963 been on the queue for a specified amount of time, as specified by
31964 <option>delay_warning</option>. Details of the file&#x2019;s contents are given in chapter
31965 <xref linkend="CHAPemsgcust"/>. See also <option>bounce_message_file</option>.
31966 </para>
31967 <para>
31968 <indexterm role="option">
31969 <primary><option>write_rejectlog</option></primary>
31970 </indexterm>
31971 </para>
31972 <informaltable frame="all">
31973 <tgroup cols="4" colsep="0" rowsep="0">
31974 <colspec colwidth="8*" align="left"/>
31975 <colspec colwidth="6*" align="center"/>
31976 <colspec colwidth="6*" align="center"/>
31977 <colspec colwidth="6*" align="right"/>
31978 <tbody>
31979 <row>
31980 <entry><option>write_rejectlog</option></entry>
31981 <entry>Use: <emphasis>main</emphasis></entry>
31982 <entry>Type: <emphasis>boolean</emphasis></entry>
31983 <entry>Default: <emphasis>true</emphasis></entry>
31984 </row>
31985 </tbody>
31986 </tgroup>
31987 </informaltable>
31988 <para>
31989 <indexterm role="concept">
31990 <primary>reject log</primary>
31991 <secondary>disabling</secondary>
31992 </indexterm>
31993 If this option is set false, Exim no longer writes anything to the reject log.
31994 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
31995 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
31996 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
31997 </para>
31998 </section>
31999 </chapter>
32000
32001 <chapter id="CHAProutergeneric">
32002 <title>Generic options for routers</title>
32003 <para>
32004 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
32005 <primary>options</primary>
32006 <secondary>generic; for routers</secondary>
32007 </indexterm>
32008 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
32009 <primary>generic options</primary>
32010 <secondary>router</secondary>
32011 </indexterm>
32012 This chapter describes the generic options that apply to all routers.
32013 Those that are preconditions are marked with &Dagger; in the <quote>use</quote> field.
32014 </para>
32015 <para>
32016 For a general description of how a router operates, see sections
32017 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
32018 which the preconditions are tested. The order of expansion of the options that
32019 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
32020 <option>headers_remove</option>, <option>transport</option>.
32021 </para>
32022 <para>
32023 <indexterm role="option">
32024 <primary><option>address_data</option></primary>
32025 </indexterm>
32026 </para>
32027 <informaltable frame="all">
32028 <tgroup cols="4" colsep="0" rowsep="0">
32029 <colspec colwidth="8*" align="left"/>
32030 <colspec colwidth="6*" align="center"/>
32031 <colspec colwidth="6*" align="center"/>
32032 <colspec colwidth="6*" align="right"/>
32033 <tbody>
32034 <row>
32035 <entry><option>address_data</option></entry>
32036 <entry>Use: <emphasis>routers</emphasis></entry>
32037 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32038 <entry>Default: <emphasis>unset</emphasis></entry>
32039 </row>
32040 </tbody>
32041 </tgroup>
32042 </informaltable>
32043 <para>
32044 <indexterm role="concept">
32045 <primary>router</primary>
32046 <secondary>data attached to address</secondary>
32047 </indexterm>
32048 The string is expanded just before the router is run, that is, after all the
32049 precondition tests have succeeded. If the expansion is forced to fail, the
32050 router declines, the value of <option>address_data</option> remains unchanged, and the
32051 <option>more</option> option controls what happens next. Other expansion failures cause
32052 delivery of the address to be deferred.
32053 </para>
32054 <para>
32055 <indexterm role="variable">
32056 <primary><varname>$address_data</varname></primary>
32057 </indexterm>
32058 When the expansion succeeds, the value is retained with the address, and can be
32059 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
32060 routers, and the eventual transport.
32061 </para>
32062 <para>
32063 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
32064 that runs a user&#x2019;s filter file, the contents of <varname>$address_data</varname> are accessible
32065 in the filter. This is not normally a problem, because such data is usually
32066 either not confidential or it <quote>belongs</quote> to the current user, but if you do
32067 put confidential data into <varname>$address_data</varname> you need to remember this point.
32068 </para>
32069 <para>
32070 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
32071 with the address, though it can be changed by another <option>address_data</option> setting
32072 on a subsequent router. If a router generates child addresses, the value of
32073 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
32074 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
32075 </para>
32076 <para>
32077 The idea of <option>address_data</option> is that you can use it to look up a lot of data
32078 for the address once, and then pick out parts of the data later. For example,
32079 you could use a single LDAP lookup to return a string of the form
32080 </para>
32081 <literallayout class="monospaced">
32082 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
32083 </literallayout>
32084 <para>
32085 In the transport you could pick out the mailbox by a setting such as
32086 </para>
32087 <literallayout class="monospaced">
32088 file = ${extract{mailbox}{$address_data}}
32089 </literallayout>
32090 <para>
32091 This makes the configuration file less messy, and also reduces the number of
32092 lookups (though Exim does cache lookups).
32093 </para>
32094 <para>
32095 <indexterm role="variable">
32096 <primary><varname>$sender_address_data</varname></primary>
32097 </indexterm>
32098 <indexterm role="variable">
32099 <primary><varname>$address_data</varname></primary>
32100 </indexterm>
32101 The <option>address_data</option> facility is also useful as a means of passing information
32102 from one router to another, and from a router to a transport. In addition, if
32103 <varname>$address_data</varname> is set by a router when verifying a recipient address from an
32104 ACL, it remains available for use in the rest of the ACL statement. After
32105 verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
32106 </para>
32107 <para>
32108 <indexterm role="option">
32109 <primary><option>address_test</option></primary>
32110 </indexterm>
32111 </para>
32112 <informaltable frame="all">
32113 <tgroup cols="4" colsep="0" rowsep="0">
32114 <colspec colwidth="8*" align="left"/>
32115 <colspec colwidth="6*" align="center"/>
32116 <colspec colwidth="6*" align="center"/>
32117 <colspec colwidth="6*" align="right"/>
32118 <tbody>
32119 <row>
32120 <entry><option>address_test</option></entry>
32121 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32122 <entry>Type: <emphasis>boolean</emphasis></entry>
32123 <entry>Default: <emphasis>true</emphasis></entry>
32124 </row>
32125 </tbody>
32126 </tgroup>
32127 </informaltable>
32128 <para>
32129 <indexterm role="option">
32130 <primary><option>-bt</option></primary>
32131 </indexterm>
32132 <indexterm role="concept">
32133 <primary>router</primary>
32134 <secondary>skipping when address testing</secondary>
32135 </indexterm>
32136 If this option is set false, the router is skipped when routing is being tested
32137 by means of the <option>-bt</option> command line option. This can be a convenience when
32138 your first router sends messages to an external scanner, because it saves you
32139 having to set the <quote>already scanned</quote> indicator when testing real address
32140 routing.
32141 </para>
32142 <para>
32143 <indexterm role="option">
32144 <primary><option>cannot_route_message</option></primary>
32145 </indexterm>
32146 </para>
32147 <informaltable frame="all">
32148 <tgroup cols="4" colsep="0" rowsep="0">
32149 <colspec colwidth="8*" align="left"/>
32150 <colspec colwidth="6*" align="center"/>
32151 <colspec colwidth="6*" align="center"/>
32152 <colspec colwidth="6*" align="right"/>
32153 <tbody>
32154 <row>
32155 <entry><option>cannot_route_message</option></entry>
32156 <entry>Use: <emphasis>routers</emphasis></entry>
32157 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32158 <entry>Default: <emphasis>unset</emphasis></entry>
32159 </row>
32160 </tbody>
32161 </tgroup>
32162 </informaltable>
32163 <para>
32164 <indexterm role="concept">
32165 <primary>router</primary>
32166 <secondary>customizing <quote>cannot route</quote> message</secondary>
32167 </indexterm>
32168 <indexterm role="concept">
32169 <primary>customizing</primary>
32170 <secondary><quote>cannot route</quote> message</secondary>
32171 </indexterm>
32172 This option specifies a text message that is used when an address cannot be
32173 routed because Exim has run out of routers. The default message is
32174 <quote>Unrouteable address</quote>. This option is useful only on routers that have
32175 <option>more</option> set false, or on the very last router in a configuration, because the
32176 value that is used is taken from the last router that is considered. This
32177 includes a router that is skipped because its preconditions are not met, as
32178 well as a router that declines. For example, using the default configuration,
32179 you could put:
32180 </para>
32181 <literallayout class="monospaced">
32182 cannot_route_message = Remote domain not found in DNS
32183 </literallayout>
32184 <para>
32185 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
32186 and
32187 </para>
32188 <literallayout class="monospaced">
32189 cannot_route_message = Unknown local user
32190 </literallayout>
32191 <para>
32192 on the final router that checks for local users. If string expansion fails for
32193 this option, the default message is used. Unless the expansion failure was
32194 explicitly forced, a message about the failure is written to the main and panic
32195 logs, in addition to the normal message about the routing failure.
32196 </para>
32197 <para>
32198 <indexterm role="option">
32199 <primary><option>caseful_local_part</option></primary>
32200 </indexterm>
32201 </para>
32202 <informaltable frame="all">
32203 <tgroup cols="4" colsep="0" rowsep="0">
32204 <colspec colwidth="8*" align="left"/>
32205 <colspec colwidth="6*" align="center"/>
32206 <colspec colwidth="6*" align="center"/>
32207 <colspec colwidth="6*" align="right"/>
32208 <tbody>
32209 <row>
32210 <entry><option>caseful_local_part</option></entry>
32211 <entry>Use: <emphasis>routers</emphasis></entry>
32212 <entry>Type: <emphasis>boolean</emphasis></entry>
32213 <entry>Default: <emphasis>false</emphasis></entry>
32214 </row>
32215 </tbody>
32216 </tgroup>
32217 </informaltable>
32218 <para>
32219 <indexterm role="concept">
32220 <primary>case of local parts</primary>
32221 </indexterm>
32222 <indexterm role="concept">
32223 <primary>router</primary>
32224 <secondary>case of local parts</secondary>
32225 </indexterm>
32226 By default, routers handle the local parts of addresses in a case-insensitive
32227 manner, though the actual case is preserved for transmission with the message.
32228 If you want the case of letters to be significant in a router, you must set
32229 this option true. For individual router options that contain address or local
32230 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
32231 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
32232 more details.
32233 </para>
32234 <para>
32235 <indexterm role="variable">
32236 <primary><varname>$local_part</varname></primary>
32237 </indexterm>
32238 <indexterm role="variable">
32239 <primary><varname>$original_local_part</varname></primary>
32240 </indexterm>
32241 <indexterm role="variable">
32242 <primary><varname>$parent_local_part</varname></primary>
32243 </indexterm>
32244 The value of the <varname>$local_part</varname> variable is forced to lower case while a
32245 router is running unless <option>caseful_local_part</option> is set. When a router assigns
32246 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
32247 is the same as it was in the router. Similarly, when a router generates child
32248 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
32249 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
32250 </para>
32251 <para>
32252 This option applies to the processing of an address by a router. When a
32253 recipient address is being processed in an ACL, there is a separate <option>control</option>
32254 modifier that can be used to specify case-sensitive processing within the ACL
32255 (see section <xref linkend="SECTcontrols"/>).
32256 </para>
32257 <para>
32258 <indexterm role="option">
32259 <primary><option>check_local_user</option></primary>
32260 </indexterm>
32261 </para>
32262 <informaltable frame="all">
32263 <tgroup cols="4" colsep="0" rowsep="0">
32264 <colspec colwidth="8*" align="left"/>
32265 <colspec colwidth="6*" align="center"/>
32266 <colspec colwidth="6*" align="center"/>
32267 <colspec colwidth="6*" align="right"/>
32268 <tbody>
32269 <row>
32270 <entry><option>check_local_user</option></entry>
32271 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32272 <entry>Type: <emphasis>boolean</emphasis></entry>
32273 <entry>Default: <emphasis>false</emphasis></entry>
32274 </row>
32275 </tbody>
32276 </tgroup>
32277 </informaltable>
32278 <para>
32279 <indexterm role="concept">
32280 <primary>local user, checking in router</primary>
32281 </indexterm>
32282 <indexterm role="concept">
32283 <primary>router</primary>
32284 <secondary>checking for local user</secondary>
32285 </indexterm>
32286 <indexterm role="concept">
32287 <primary><filename>/etc/passwd</filename></primary>
32288 </indexterm>
32289 <indexterm role="variable">
32290 <primary><varname>$home</varname></primary>
32291 </indexterm>
32292 When this option is true, Exim checks that the local part of the recipient
32293 address (with affixes removed if relevant) is the name of an account on the
32294 local system. The check is done by calling the <function>getpwnam()</function> function rather
32295 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
32296 holding password data (such as NIS) are supported. If the local part is a local
32297 user, <varname>$home</varname> is set from the password data, and can be tested in other
32298 preconditions that are evaluated after this one (the order of evaluation is
32299 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
32300 overridden by <option>router_home_directory</option>. If the local part is not a local user,
32301 the router is skipped.
32302 </para>
32303 <para>
32304 If you want to check that the local part is either the name of a local user
32305 or matches something else, you cannot combine <option>check_local_user</option> with a
32306 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
32307 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
32308 setting to achieve this. For example:
32309 </para>
32310 <literallayout class="monospaced">
32311 local_parts = passwd;$local_part : lsearch;/etc/other/users
32312 </literallayout>
32313 <para>
32314 Note, however, that the side effects of <option>check_local_user</option> (such as setting
32315 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
32316 <option>local_parts</option> (or any other) precondition.
32317 </para>
32318 <para>
32319 <indexterm role="option">
32320 <primary><option>condition</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>condition</option></entry>
32332 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></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>router</primary>
32342 <secondary>customized precondition</secondary>
32343 </indexterm>
32344 This option specifies a general precondition test that has to succeed for the
32345 router to be called. The <option>condition</option> option is the last precondition to be
32346 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
32347 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
32348 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
32349 router is skipped, and the address is offered to the next one.
32350 </para>
32351 <para>
32352 If the result is any other value, the router is run (as this is the last
32353 precondition to be evaluated, all the other preconditions must be true).
32354 </para>
32355 <para>
32356 This option is unusual in that multiple <option>condition</option> options may be present.
32357 All <option>condition</option> options must succeed.
32358 </para>
32359 <para>
32360 The <option>condition</option> option provides a means of applying custom conditions to the
32361 running of routers. Note that in the case of a simple conditional expansion,
32362 the default expansion values are exactly what is wanted. For example:
32363 </para>
32364 <literallayout class="monospaced">
32365 condition = ${if &gt;{$message_age}{600}}
32366 </literallayout>
32367 <para>
32368 Because of the default behaviour of the string expansion, this is equivalent to
32369 </para>
32370 <literallayout class="monospaced">
32371 condition = ${if &gt;{$message_age}{600}{true}{}}
32372 </literallayout>
32373 <para>
32374 A multiple condition example, which succeeds:
32375 </para>
32376 <literallayout class="monospaced">
32377 condition = ${if &gt;{$message_age}{600}}
32378 condition = ${if !eq{${lc:$local_part}}{postmaster}}
32379 condition = foobar
32380 </literallayout>
32381 <para>
32382 If the expansion fails (other than forced failure) delivery is deferred. Some
32383 of the other precondition options are common special cases that could in fact
32384 be specified using <option>condition</option>.
32385 </para>
32386 <para>
32387 Historical note: We have <option>condition</option> on ACLs and on Routers.  Routers
32388 are far older, and use one set of semantics.  ACLs are newer and when
32389 they were created, the ACL <option>condition</option> process was given far stricter
32390 parse semantics.  The <option>bool{}</option> expansion condition uses the same rules as
32391 ACLs.  The <option>bool_lax{}</option> expansion condition uses the same rules as
32392 Routers.  More pointedly, the <option>bool_lax{}</option> was written to match the existing
32393 Router rules processing behavior.
32394 </para>
32395 <para>
32396 This is best illustrated in an example:
32397 </para>
32398 <literallayout class="monospaced">
32399 # If used in an ACL condition will fail with a syntax error, but
32400 # in a router condition any extra characters are treated as a string
32401
32402 $ exim -be '${if eq {${lc:GOOGLE.com}} {google.com}} {yes} {no}}'
32403 true {yes} {no}}
32404
32405 $ exim -be '${if eq {${lc:WHOIS.com}} {google.com}} {yes} {no}}'
32406  {yes} {no}}
32407 </literallayout>
32408 <para>
32409 In each example above, the <option>if</option> statement actually ends after
32410 <quote>{google.com}}</quote>.  Since no true or false braces were defined, the
32411 default <option>if</option> behavior is to return a boolean true or a null answer
32412 (which evaluates to false). The rest of the line is then treated as a
32413 string. So the first example resulted in the boolean answer <quote>true</quote>
32414 with the string <quote> {yes} {no}}</quote> appended to it. The second example
32415 resulted in the null output (indicating false) with the string
32416 <quote> {yes} {no}}</quote> appended to it.
32417 </para>
32418 <para>
32419 In fact you can put excess forward braces in too.  In the router
32420 <option>condition</option>, Exim&#x2019;s parser only looks for <quote>{</quote> symbols when they
32421 mean something, like after a <quote>$</quote> or when required as part of a
32422 conditional.  But otherwise <quote>{</quote> and <quote>}</quote> are treated as ordinary
32423 string characters.
32424 </para>
32425 <para>
32426 Thus, in a Router, the above expansion strings will both always evaluate
32427 true, as the result of expansion is a non-empty string which doesn&#x2019;t
32428 match an explicit false value.  This can be tricky to debug.  By
32429 contrast, in an ACL either of those strings will always result in an
32430 expansion error because the result doesn&#x2019;t look sufficiently boolean.
32431 </para>
32432 <para>
32433 <indexterm role="option">
32434 <primary><option>debug_print</option></primary>
32435 </indexterm>
32436 </para>
32437 <informaltable frame="all">
32438 <tgroup cols="4" colsep="0" rowsep="0">
32439 <colspec colwidth="8*" align="left"/>
32440 <colspec colwidth="6*" align="center"/>
32441 <colspec colwidth="6*" align="center"/>
32442 <colspec colwidth="6*" align="right"/>
32443 <tbody>
32444 <row>
32445 <entry><option>debug_print</option></entry>
32446 <entry>Use: <emphasis>routers</emphasis></entry>
32447 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32448 <entry>Default: <emphasis>unset</emphasis></entry>
32449 </row>
32450 </tbody>
32451 </tgroup>
32452 </informaltable>
32453 <para>
32454 <indexterm role="concept">
32455 <primary>testing</primary>
32456 <secondary>variables in drivers</secondary>
32457 </indexterm>
32458 If this option is set and debugging is enabled (see the <option>-d</option> command line
32459 option) or in address-testing mode (see the <option>-bt</option> command line option),
32460 the string is expanded and included in the debugging output.
32461 If expansion of the string fails, the error message is written to the debugging
32462 output, and Exim carries on processing.
32463 This option is provided to help with checking out the values of variables and
32464 so on when debugging router configurations. For example, if a <option>condition</option>
32465 option appears not to be working, <option>debug_print</option> can be used to output the
32466 variables it references. The output happens after checks for <option>domains</option>,
32467 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
32468 are tested. A newline is added to the text if it does not end with one.
32469 The variable <varname>$router_name</varname> contains the name of the router.
32470 </para>
32471 <para>
32472 <indexterm role="option">
32473 <primary><option>disable_logging</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>disable_logging</option></entry>
32485 <entry>Use: <emphasis>routers</emphasis></entry>
32486 <entry>Type: <emphasis>boolean</emphasis></entry>
32487 <entry>Default: <emphasis>false</emphasis></entry>
32488 </row>
32489 </tbody>
32490 </tgroup>
32491 </informaltable>
32492 <para>
32493 If this option is set true, nothing is logged for any routing errors
32494 or for any deliveries caused by this router. You should not set this option
32495 unless you really, really know what you are doing. See also the generic
32496 transport option of the same name.
32497 </para>
32498 <para>
32499 <indexterm role="option">
32500 <primary><option>dnssec_request_domains</option></primary>
32501 </indexterm>
32502 </para>
32503 <informaltable frame="all">
32504 <tgroup cols="4" colsep="0" rowsep="0">
32505 <colspec colwidth="8*" align="left"/>
32506 <colspec colwidth="6*" align="center"/>
32507 <colspec colwidth="6*" align="center"/>
32508 <colspec colwidth="6*" align="right"/>
32509 <tbody>
32510 <row>
32511 <entry><option>dnssec_request_domains</option></entry>
32512 <entry>Use: <emphasis>routers</emphasis></entry>
32513 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
32514 <entry>Default: <emphasis>unset</emphasis></entry>
32515 </row>
32516 </tbody>
32517 </tgroup>
32518 </informaltable>
32519 <para>
32520 <indexterm role="concept">
32521 <primary>MX record</primary>
32522 <secondary>security</secondary>
32523 </indexterm>
32524 <indexterm role="concept">
32525 <primary>DNSSEC</primary>
32526 <secondary>MX lookup</secondary>
32527 </indexterm>
32528 <indexterm role="concept">
32529 <primary>security</primary>
32530 <secondary>MX lookup</secondary>
32531 </indexterm>
32532 <indexterm role="concept">
32533 <primary>DNS</primary>
32534 <secondary>DNSSEC</secondary>
32535 </indexterm>
32536 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
32537 the dnssec request bit set.
32538 This applies to all of the SRV, MX, AAAA, A lookup sequence.
32539 </para>
32540 <para>
32541 <indexterm role="option">
32542 <primary><option>dnssec_require_domains</option></primary>
32543 </indexterm>
32544 </para>
32545 <informaltable frame="all">
32546 <tgroup cols="4" colsep="0" rowsep="0">
32547 <colspec colwidth="8*" align="left"/>
32548 <colspec colwidth="6*" align="center"/>
32549 <colspec colwidth="6*" align="center"/>
32550 <colspec colwidth="6*" align="right"/>
32551 <tbody>
32552 <row>
32553 <entry><option>dnssec_require_domains</option></entry>
32554 <entry>Use: <emphasis>routers</emphasis></entry>
32555 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
32556 <entry>Default: <emphasis>unset</emphasis></entry>
32557 </row>
32558 </tbody>
32559 </tgroup>
32560 </informaltable>
32561 <para>
32562 <indexterm role="concept">
32563 <primary>MX record</primary>
32564 <secondary>security</secondary>
32565 </indexterm>
32566 <indexterm role="concept">
32567 <primary>DNSSEC</primary>
32568 <secondary>MX lookup</secondary>
32569 </indexterm>
32570 <indexterm role="concept">
32571 <primary>security</primary>
32572 <secondary>MX lookup</secondary>
32573 </indexterm>
32574 <indexterm role="concept">
32575 <primary>DNS</primary>
32576 <secondary>DNSSEC</secondary>
32577 </indexterm>
32578 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
32579 the dnssec request bit set.  Any returns not having the Authenticated Data bit
32580 (AD bit) set will be ignored and logged as a host-lookup failure.
32581 This applies to all of the SRV, MX, AAAA, A lookup sequence.
32582 </para>
32583 <para>
32584 <indexterm role="option">
32585 <primary><option>domains</option></primary>
32586 </indexterm>
32587 </para>
32588 <informaltable frame="all">
32589 <tgroup cols="4" colsep="0" rowsep="0">
32590 <colspec colwidth="8*" align="left"/>
32591 <colspec colwidth="6*" align="center"/>
32592 <colspec colwidth="6*" align="center"/>
32593 <colspec colwidth="6*" align="right"/>
32594 <tbody>
32595 <row>
32596 <entry><option>domains</option></entry>
32597 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32598 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
32599 <entry>Default: <emphasis>unset</emphasis></entry>
32600 </row>
32601 </tbody>
32602 </tgroup>
32603 </informaltable>
32604 <para>
32605 <indexterm role="concept">
32606 <primary>router</primary>
32607 <secondary>restricting to specific domains</secondary>
32608 </indexterm>
32609 <indexterm role="variable">
32610 <primary><varname>$domain_data</varname></primary>
32611 </indexterm>
32612 If this option is set, the router is skipped unless the current domain matches
32613 the list. If the match is achieved by means of a file lookup, the data that the
32614 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
32615 expansions of the driver&#x2019;s private options. See section <xref linkend="SECTrouprecon"/> for
32616 a list of the order in which preconditions are evaluated.
32617 </para>
32618 <para>
32619 <indexterm role="option">
32620 <primary><option>driver</option></primary>
32621 </indexterm>
32622 </para>
32623 <informaltable frame="all">
32624 <tgroup cols="4" colsep="0" rowsep="0">
32625 <colspec colwidth="8*" align="left"/>
32626 <colspec colwidth="6*" align="center"/>
32627 <colspec colwidth="6*" align="center"/>
32628 <colspec colwidth="6*" align="right"/>
32629 <tbody>
32630 <row>
32631 <entry><option>driver</option></entry>
32632 <entry>Use: <emphasis>routers</emphasis></entry>
32633 <entry>Type: <emphasis>string</emphasis></entry>
32634 <entry>Default: <emphasis>unset</emphasis></entry>
32635 </row>
32636 </tbody>
32637 </tgroup>
32638 </informaltable>
32639 <para>
32640 This option must always be set. It specifies which of the available routers is
32641 to be used.
32642 </para>
32643 <para>
32644 <indexterm role="option">
32645 <primary><option>dsn_lasthop</option></primary>
32646 </indexterm>
32647 </para>
32648 <informaltable frame="all">
32649 <tgroup cols="4" colsep="0" rowsep="0">
32650 <colspec colwidth="8*" align="left"/>
32651 <colspec colwidth="6*" align="center"/>
32652 <colspec colwidth="6*" align="center"/>
32653 <colspec colwidth="6*" align="right"/>
32654 <tbody>
32655 <row>
32656 <entry><option>dsn_lasthop</option></entry>
32657 <entry>Use: <emphasis>routers</emphasis></entry>
32658 <entry>Type: <emphasis>boolean</emphasis></entry>
32659 <entry>Default: <emphasis>false</emphasis></entry>
32660 </row>
32661 </tbody>
32662 </tgroup>
32663 </informaltable>
32664 <para>
32665 <indexterm role="concept">
32666 <primary>DSN</primary>
32667 <secondary>success</secondary>
32668 </indexterm>
32669 <indexterm role="concept">
32670 <primary>Delivery Status Notification</primary>
32671 <secondary>success</secondary>
32672 </indexterm>
32673 If this option is set true, and extended DSN (RFC3461) processing is in effect,
32674 Exim will not pass on DSN requests to downstream DSN-aware hosts but will
32675 instead send a success DSN as if the next hop does not support DSN.
32676 Not effective on redirect routers.
32677 </para>
32678 <para>
32679 <indexterm role="option">
32680 <primary><option>errors_to</option></primary>
32681 </indexterm>
32682 </para>
32683 <informaltable frame="all">
32684 <tgroup cols="4" colsep="0" rowsep="0">
32685 <colspec colwidth="8*" align="left"/>
32686 <colspec colwidth="6*" align="center"/>
32687 <colspec colwidth="6*" align="center"/>
32688 <colspec colwidth="6*" align="right"/>
32689 <tbody>
32690 <row>
32691 <entry><option>errors_to</option></entry>
32692 <entry>Use: <emphasis>routers</emphasis></entry>
32693 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32694 <entry>Default: <emphasis>unset</emphasis></entry>
32695 </row>
32696 </tbody>
32697 </tgroup>
32698 </informaltable>
32699 <para>
32700 <indexterm role="concept">
32701 <primary>envelope sender</primary>
32702 </indexterm>
32703 <indexterm role="concept">
32704 <primary>router</primary>
32705 <secondary>changing address for errors</secondary>
32706 </indexterm>
32707 If a router successfully handles an address, it may assign the address to a
32708 transport for delivery or it may generate child addresses. In both cases, if
32709 there is a delivery problem during later processing, the resulting bounce
32710 message is sent to the address that results from expanding this string,
32711 provided that the address verifies successfully. The <option>errors_to</option> option is
32712 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
32713 </para>
32714 <para>
32715 The <option>errors_to</option> setting associated with an address can be overridden if it
32716 subsequently passes through other routers that have their own <option>errors_to</option>
32717 settings, or if the message is delivered by a transport with a <option>return_path</option>
32718 setting.
32719 </para>
32720 <para>
32721 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
32722 the expansion fails to verify, the errors address associated with the incoming
32723 address is used. At top level, this is the envelope sender. A non-forced
32724 expansion failure causes delivery to be deferred.
32725 </para>
32726 <para>
32727 If an address for which <option>errors_to</option> has been set ends up being delivered over
32728 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
32729 any bounces that are generated by other MTAs on the delivery route are also
32730 sent there. You can set <option>errors_to</option> to the empty string by either of these
32731 settings:
32732 </para>
32733 <literallayout class="monospaced">
32734 errors_to =
32735 errors_to = ""
32736 </literallayout>
32737 <para>
32738 An expansion item that yields an empty string has the same effect. If you do
32739 this, a locally detected delivery error for addresses processed by this router
32740 no longer gives rise to a bounce message; the error is discarded. If the
32741 address is delivered to a remote host, the return path is set to <literal>&lt;&gt;</literal>, unless
32742 overridden by the <option>return_path</option> option on the transport.
32743 </para>
32744 <para>
32745 <indexterm role="variable">
32746 <primary><varname>$address_data</varname></primary>
32747 </indexterm>
32748 If for some reason you want to discard local errors, but use a non-empty
32749 MAIL command for remote delivery, you can preserve the original return
32750 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
32751 setting <option>return_path</option>.
32752 </para>
32753 <para>
32754 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
32755 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
32756 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
32757 </para>
32758 <para>
32759 <indexterm role="option">
32760 <primary><option>expn</option></primary>
32761 </indexterm>
32762 </para>
32763 <informaltable frame="all">
32764 <tgroup cols="4" colsep="0" rowsep="0">
32765 <colspec colwidth="8*" align="left"/>
32766 <colspec colwidth="6*" align="center"/>
32767 <colspec colwidth="6*" align="center"/>
32768 <colspec colwidth="6*" align="right"/>
32769 <tbody>
32770 <row>
32771 <entry><option>expn</option></entry>
32772 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32773 <entry>Type: <emphasis>boolean</emphasis></entry>
32774 <entry>Default: <emphasis>true</emphasis></entry>
32775 </row>
32776 </tbody>
32777 </tgroup>
32778 </informaltable>
32779 <para>
32780 <indexterm role="concept">
32781 <primary>address</primary>
32782 <secondary>testing</secondary>
32783 </indexterm>
32784 <indexterm role="concept">
32785 <primary>testing</primary>
32786 <secondary>addresses</secondary>
32787 </indexterm>
32788 <indexterm role="concept">
32789 <primary>EXPN</primary>
32790 <secondary>router skipping</secondary>
32791 </indexterm>
32792 <indexterm role="concept">
32793 <primary>router</primary>
32794 <secondary>skipping for EXPN</secondary>
32795 </indexterm>
32796 If this option is turned off, the router is skipped when testing an address
32797 as a result of processing an SMTP EXPN command. You might, for example,
32798 want to turn it off on a router for users&#x2019; <filename>.forward</filename> files, while leaving it
32799 on for the system alias file.
32800 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
32801 are evaluated.
32802 </para>
32803 <para>
32804 The use of the SMTP EXPN command is controlled by an ACL (see chapter
32805 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
32806 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
32807 </para>
32808 <para>
32809 <indexterm role="option">
32810 <primary><option>fail_verify</option></primary>
32811 </indexterm>
32812 </para>
32813 <informaltable frame="all">
32814 <tgroup cols="4" colsep="0" rowsep="0">
32815 <colspec colwidth="8*" align="left"/>
32816 <colspec colwidth="6*" align="center"/>
32817 <colspec colwidth="6*" align="center"/>
32818 <colspec colwidth="6*" align="right"/>
32819 <tbody>
32820 <row>
32821 <entry><option>fail_verify</option></entry>
32822 <entry>Use: <emphasis>routers</emphasis></entry>
32823 <entry>Type: <emphasis>boolean</emphasis></entry>
32824 <entry>Default: <emphasis>false</emphasis></entry>
32825 </row>
32826 </tbody>
32827 </tgroup>
32828 </informaltable>
32829 <para>
32830 <indexterm role="concept">
32831 <primary>router</primary>
32832 <secondary>forcing verification failure</secondary>
32833 </indexterm>
32834 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
32835 <option>fail_verify_recipient</option> to the same value.
32836 </para>
32837 <para>
32838 <indexterm role="option">
32839 <primary><option>fail_verify_recipient</option></primary>
32840 </indexterm>
32841 </para>
32842 <informaltable frame="all">
32843 <tgroup cols="4" colsep="0" rowsep="0">
32844 <colspec colwidth="8*" align="left"/>
32845 <colspec colwidth="6*" align="center"/>
32846 <colspec colwidth="6*" align="center"/>
32847 <colspec colwidth="6*" align="right"/>
32848 <tbody>
32849 <row>
32850 <entry><option>fail_verify_recipient</option></entry>
32851 <entry>Use: <emphasis>routers</emphasis></entry>
32852 <entry>Type: <emphasis>boolean</emphasis></entry>
32853 <entry>Default: <emphasis>false</emphasis></entry>
32854 </row>
32855 </tbody>
32856 </tgroup>
32857 </informaltable>
32858 <para>
32859 If this option is true and an address is accepted by this router when
32860 verifying a recipient, verification fails.
32861 </para>
32862 <para>
32863 <indexterm role="option">
32864 <primary><option>fail_verify_sender</option></primary>
32865 </indexterm>
32866 </para>
32867 <informaltable frame="all">
32868 <tgroup cols="4" colsep="0" rowsep="0">
32869 <colspec colwidth="8*" align="left"/>
32870 <colspec colwidth="6*" align="center"/>
32871 <colspec colwidth="6*" align="center"/>
32872 <colspec colwidth="6*" align="right"/>
32873 <tbody>
32874 <row>
32875 <entry><option>fail_verify_sender</option></entry>
32876 <entry>Use: <emphasis>routers</emphasis></entry>
32877 <entry>Type: <emphasis>boolean</emphasis></entry>
32878 <entry>Default: <emphasis>false</emphasis></entry>
32879 </row>
32880 </tbody>
32881 </tgroup>
32882 </informaltable>
32883 <para>
32884 If this option is true and an address is accepted by this router when
32885 verifying a sender, verification fails.
32886 </para>
32887 <para>
32888 <indexterm role="option">
32889 <primary><option>fallback_hosts</option></primary>
32890 </indexterm>
32891 </para>
32892 <informaltable frame="all">
32893 <tgroup cols="4" colsep="0" rowsep="0">
32894 <colspec colwidth="8*" align="left"/>
32895 <colspec colwidth="6*" align="center"/>
32896 <colspec colwidth="6*" align="center"/>
32897 <colspec colwidth="6*" align="right"/>
32898 <tbody>
32899 <row>
32900 <entry><option>fallback_hosts</option></entry>
32901 <entry>Use: <emphasis>routers</emphasis></entry>
32902 <entry>Type: <emphasis>string list</emphasis></entry>
32903 <entry>Default: <emphasis>unset</emphasis></entry>
32904 </row>
32905 </tbody>
32906 </tgroup>
32907 </informaltable>
32908 <para>
32909 <indexterm role="concept">
32910 <primary>router</primary>
32911 <secondary>fallback hosts</secondary>
32912 </indexterm>
32913 <indexterm role="concept">
32914 <primary>fallback</primary>
32915 <secondary>hosts specified on router</secondary>
32916 </indexterm>
32917 String expansion is not applied to this option. The argument must be a
32918 colon-separated list of host names or IP addresses. The list separator can be
32919 changed (see section <xref linkend="SECTlistconstruct"/>), and a port can be specified with
32920 each name or address. In fact, the format of each item is exactly the same as
32921 defined for the list of hosts in a <command>manualroute</command> router (see section
32922 <xref linkend="SECTformatonehostitem"/>).
32923 </para>
32924 <para>
32925 If a router queues an address for a remote transport, this host list is
32926 associated with the address, and used instead of the transport&#x2019;s fallback host
32927 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
32928 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
32929 transport for further details.
32930 </para>
32931 <para>
32932 <indexterm role="option">
32933 <primary><option>group</option></primary>
32934 </indexterm>
32935 </para>
32936 <informaltable frame="all">
32937 <tgroup cols="4" colsep="0" rowsep="0">
32938 <colspec colwidth="8*" align="left"/>
32939 <colspec colwidth="6*" align="center"/>
32940 <colspec colwidth="6*" align="center"/>
32941 <colspec colwidth="6*" align="right"/>
32942 <tbody>
32943 <row>
32944 <entry><option>group</option></entry>
32945 <entry>Use: <emphasis>routers</emphasis></entry>
32946 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32947 <entry>Default: <emphasis>see below</emphasis></entry>
32948 </row>
32949 </tbody>
32950 </tgroup>
32951 </informaltable>
32952 <para>
32953 <indexterm role="concept">
32954 <primary>gid (group id)</primary>
32955 <secondary>local delivery</secondary>
32956 </indexterm>
32957 <indexterm role="concept">
32958 <primary>local transports</primary>
32959 <secondary>uid and gid</secondary>
32960 </indexterm>
32961 <indexterm role="concept">
32962 <primary>transport</primary>
32963 <secondary>local</secondary>
32964 </indexterm>
32965 <indexterm role="concept">
32966 <primary>router</primary>
32967 <secondary>setting group</secondary>
32968 </indexterm>
32969 When a router queues an address for a transport, and the transport does not
32970 specify a group, the group given here is used when running the delivery
32971 process.
32972 The group may be specified numerically or by name. If expansion fails, the
32973 error is logged and delivery is deferred.
32974 The default is unset, unless <option>check_local_user</option> is set, when the default
32975 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
32976 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
32977 </para>
32978 <para>
32979 <indexterm role="option">
32980 <primary><option>headers_add</option></primary>
32981 </indexterm>
32982 </para>
32983 <informaltable frame="all">
32984 <tgroup cols="4" colsep="0" rowsep="0">
32985 <colspec colwidth="8*" align="left"/>
32986 <colspec colwidth="6*" align="center"/>
32987 <colspec colwidth="6*" align="center"/>
32988 <colspec colwidth="6*" align="right"/>
32989 <tbody>
32990 <row>
32991 <entry><option>headers_add</option></entry>
32992 <entry>Use: <emphasis>routers</emphasis></entry>
32993 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
32994 <entry>Default: <emphasis>unset</emphasis></entry>
32995 </row>
32996 </tbody>
32997 </tgroup>
32998 </informaltable>
32999 <para>
33000 <indexterm role="concept">
33001 <primary>header lines</primary>
33002 <secondary>adding</secondary>
33003 </indexterm>
33004 <indexterm role="concept">
33005 <primary>router</primary>
33006 <secondary>adding header lines</secondary>
33007 </indexterm>
33008 This option specifies a list of text headers,
33009 newline-separated (by default, changeable in the usual way),
33010 that is associated with any addresses that are accepted by the router.
33011 Each item is separately expanded, at routing time.  However, this
33012 option has no effect when an address is just being verified. The way in which
33013 the text is used to add header lines at transport time is described in section
33014 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
33015 message is in the process of being transported. This means that references to
33016 header lines in string expansions in the transport&#x2019;s configuration do not
33017 <quote>see</quote> the added header lines.
33018 </para>
33019 <para>
33020 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
33021 <option>headers_remove</option> and <option>transport</option>. If an item is empty, or if
33022 an item expansion is forced to fail, the item has no effect. Other expansion
33023 failures are treated as configuration errors.
33024 </para>
33025 <para>
33026 Unlike most options, <option>headers_add</option> can be specified multiple times
33027 for a router; all listed headers are added.
33028 </para>
33029 <para>
33030 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
33031 router that has the <option>one_time</option> option set.
33032 </para>
33033 <para>
33034 <indexterm role="concept">
33035 <primary>duplicate addresses</primary>
33036 </indexterm>
33037 <indexterm role="option">
33038 <primary><option>unseen</option></primary>
33039 </indexterm>
33040 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
33041 additions are deleted when the address is passed on to subsequent routers.
33042 For a <option>redirect</option> router, if a generated address is the same as the incoming
33043 address, this can lead to duplicate addresses with different header
33044 modifications. Exim does not do duplicate deliveries (except, in certain
33045 circumstances, to pipes -- see section <xref linkend="SECTdupaddr"/>), but it is undefined
33046 which of the duplicates is discarded, so this ambiguous situation should be
33047 avoided. The <option>repeat_use</option> option of the <option>redirect</option> router may be of help.
33048 </para>
33049 <para>
33050 <indexterm role="option">
33051 <primary><option>headers_remove</option></primary>
33052 </indexterm>
33053 </para>
33054 <informaltable frame="all">
33055 <tgroup cols="4" colsep="0" rowsep="0">
33056 <colspec colwidth="8*" align="left"/>
33057 <colspec colwidth="6*" align="center"/>
33058 <colspec colwidth="6*" align="center"/>
33059 <colspec colwidth="6*" align="right"/>
33060 <tbody>
33061 <row>
33062 <entry><option>headers_remove</option></entry>
33063 <entry>Use: <emphasis>routers</emphasis></entry>
33064 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
33065 <entry>Default: <emphasis>unset</emphasis></entry>
33066 </row>
33067 </tbody>
33068 </tgroup>
33069 </informaltable>
33070 <para>
33071 <indexterm role="concept">
33072 <primary>header lines</primary>
33073 <secondary>removing</secondary>
33074 </indexterm>
33075 <indexterm role="concept">
33076 <primary>router</primary>
33077 <secondary>removing header lines</secondary>
33078 </indexterm>
33079 This option specifies a list of text headers,
33080 colon-separated (by default, changeable in the usual way),
33081 that is associated with any addresses that are accepted by the router.
33082 Each item is separately expanded, at routing time.  However, this
33083 option has no effect when an address is just being verified. The way in which
33084 the text is used to remove header lines at transport time is described in
33085 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
33086 the message is in the process of being transported. This means that references
33087 to header lines in string expansions in the transport&#x2019;s configuration still
33088 <quote>see</quote> the original header lines.
33089 </para>
33090 <para>
33091 The <option>headers_remove</option> option is expanded after <option>errors_to</option> and
33092 <option>headers_add</option>, but before <option>transport</option>. If an item expansion is forced to fail,
33093 the item has no effect. Other expansion failures are treated as configuration
33094 errors.
33095 </para>
33096 <para>
33097 Unlike most options, <option>headers_remove</option> can be specified multiple times
33098 for a router; all listed headers are removed.
33099 </para>
33100 <para>
33101 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
33102 router that has the <option>one_time</option> option set.
33103 </para>
33104 <para>
33105 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
33106 removal requests are deleted when the address is passed on to subsequent
33107 routers, and this can lead to problems with duplicates -- see the similar
33108 warning for <option>headers_add</option> above.
33109 </para>
33110 <para>
33111 <emphasis role="bold">Warning 3</emphasis>: Because of the separate expansion of the list items,
33112 items that contain a list separator must have it doubled.
33113 To avoid this, change the list separator (<xref linkend="SECTlistsepchange"/>).
33114 </para>
33115 <para>
33116 <indexterm role="option">
33117 <primary><option>ignore_target_hosts</option></primary>
33118 </indexterm>
33119 </para>
33120 <informaltable frame="all">
33121 <tgroup cols="4" colsep="0" rowsep="0">
33122 <colspec colwidth="8*" align="left"/>
33123 <colspec colwidth="6*" align="center"/>
33124 <colspec colwidth="6*" align="center"/>
33125 <colspec colwidth="6*" align="right"/>
33126 <tbody>
33127 <row>
33128 <entry><option>ignore_target_hosts</option></entry>
33129 <entry>Use: <emphasis>routers</emphasis></entry>
33130 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
33131 <entry>Default: <emphasis>unset</emphasis></entry>
33132 </row>
33133 </tbody>
33134 </tgroup>
33135 </informaltable>
33136 <para>
33137 <indexterm role="concept">
33138 <primary>IP address</primary>
33139 <secondary>discarding</secondary>
33140 </indexterm>
33141 <indexterm role="concept">
33142 <primary>router</primary>
33143 <secondary>discarding IP addresses</secondary>
33144 </indexterm>
33145 Although this option is a host list, it should normally contain IP address
33146 entries rather than names. If any host that is looked up by the router has an
33147 IP address that matches an item in this list, Exim behaves as if that IP
33148 address did not exist. This option allows you to cope with rogue DNS entries
33149 like
33150 </para>
33151 <literallayout class="monospaced">
33152 remote.domain.example.  A  127.0.0.1
33153 </literallayout>
33154 <para>
33155 by setting
33156 </para>
33157 <literallayout class="monospaced">
33158 ignore_target_hosts = 127.0.0.1
33159 </literallayout>
33160 <para>
33161 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
33162 discarded in this way, the router declines. In a conventional configuration, an
33163 attempt to mail to such a domain would normally provoke the <quote>unrouteable
33164 domain</quote> error, and an attempt to verify an address in the domain would fail.
33165 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
33166 router declines if presented with one of the listed addresses.
33167 </para>
33168 <para>
33169 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
33170 means of the first or the second of the following settings, respectively:
33171 </para>
33172 <literallayout class="monospaced">
33173 ignore_target_hosts = 0.0.0.0/0
33174 ignore_target_hosts = &lt;; 0::0/0
33175 </literallayout>
33176 <para>
33177 The pattern in the first line matches all IPv4 addresses, whereas the pattern
33178 in the second line matches all IPv6 addresses.
33179 </para>
33180 <para>
33181 This option may also be useful for ignoring link-local and site-local IPv6
33182 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
33183 is expanded before use as a list, it is possible to make it dependent on the
33184 domain that is being routed.
33185 </para>
33186 <para>
33187 <indexterm role="variable">
33188 <primary><varname>$host_address</varname></primary>
33189 </indexterm>
33190 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
33191 checked.
33192 </para>
33193 <para>
33194 <indexterm role="option">
33195 <primary><option>initgroups</option></primary>
33196 </indexterm>
33197 </para>
33198 <informaltable frame="all">
33199 <tgroup cols="4" colsep="0" rowsep="0">
33200 <colspec colwidth="8*" align="left"/>
33201 <colspec colwidth="6*" align="center"/>
33202 <colspec colwidth="6*" align="center"/>
33203 <colspec colwidth="6*" align="right"/>
33204 <tbody>
33205 <row>
33206 <entry><option>initgroups</option></entry>
33207 <entry>Use: <emphasis>routers</emphasis></entry>
33208 <entry>Type: <emphasis>boolean</emphasis></entry>
33209 <entry>Default: <emphasis>false</emphasis></entry>
33210 </row>
33211 </tbody>
33212 </tgroup>
33213 </informaltable>
33214 <para>
33215 <indexterm role="concept">
33216 <primary>additional groups</primary>
33217 </indexterm>
33218 <indexterm role="concept">
33219 <primary>groups</primary>
33220 <secondary>additional</secondary>
33221 </indexterm>
33222 <indexterm role="concept">
33223 <primary>local transports</primary>
33224 <secondary>uid and gid</secondary>
33225 </indexterm>
33226 <indexterm role="concept">
33227 <primary>transport</primary>
33228 <secondary>local</secondary>
33229 </indexterm>
33230 If the router queues an address for a transport, and this option is true, and
33231 the uid supplied by the router is not overridden by the transport, the
33232 <function>initgroups()</function> function is called when running the transport to ensure that
33233 any additional groups associated with the uid are set up. See also <option>group</option>
33234 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
33235 </para>
33236 <para>
33237 <indexterm role="option">
33238 <primary><option>local_part_prefix</option></primary>
33239 </indexterm>
33240 </para>
33241 <informaltable frame="all">
33242 <tgroup cols="4" colsep="0" rowsep="0">
33243 <colspec colwidth="8*" align="left"/>
33244 <colspec colwidth="6*" align="center"/>
33245 <colspec colwidth="6*" align="center"/>
33246 <colspec colwidth="6*" align="right"/>
33247 <tbody>
33248 <row>
33249 <entry><option>local_part_prefix</option></entry>
33250 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33251 <entry>Type: <emphasis>string list</emphasis></entry>
33252 <entry>Default: <emphasis>unset</emphasis></entry>
33253 </row>
33254 </tbody>
33255 </tgroup>
33256 </informaltable>
33257 <para>
33258 <indexterm role="concept">
33259 <primary>router</primary>
33260 <secondary>prefix for local part</secondary>
33261 </indexterm>
33262 <indexterm role="concept">
33263 <primary>prefix</primary>
33264 <secondary>for local part, used in router</secondary>
33265 </indexterm>
33266 If this option is set, the router is skipped unless the local part starts with
33267 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
33268 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
33269 evaluated.
33270 </para>
33271 <para>
33272 The list is scanned from left to right, and the first prefix that matches is
33273 used. A limited form of wildcard is available; if the prefix begins with an
33274 asterisk, it matches the longest possible sequence of arbitrary characters at
33275 the start of the local part. An asterisk should therefore always be followed by
33276 some character that does not occur in normal local parts.
33277 <indexterm role="concept">
33278 <primary>multiple mailboxes</primary>
33279 </indexterm>
33280 <indexterm role="concept">
33281 <primary>mailbox</primary>
33282 <secondary>multiple</secondary>
33283 </indexterm>
33284 Wildcarding can be used to set up multiple user mailboxes, as described in
33285 section <xref linkend="SECTmulbox"/>.
33286 </para>
33287 <para>
33288 <indexterm role="variable">
33289 <primary><varname>$local_part</varname></primary>
33290 </indexterm>
33291 <indexterm role="variable">
33292 <primary><varname>$local_part_prefix</varname></primary>
33293 </indexterm>
33294 During the testing of the <option>local_parts</option> option, and while the router is
33295 running, the prefix is removed from the local part, and is available in the
33296 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
33297 the router accepts the address, this remains true during subsequent delivery by
33298 a transport. In particular, the local part that is transmitted in the RCPT
33299 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
33300 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
33301 the relevant transport.
33302 </para>
33303 <para>
33304 When an address is being verified, <option>local_part_prefix</option> affects only the
33305 behaviour of the router. If the callout feature of verification is in use, this
33306 means that the full address, including the prefix, will be used during the
33307 callout.
33308 </para>
33309 <para>
33310 The prefix facility is commonly used to handle local parts of the form
33311 <option>owner-something</option>. Another common use is to support local parts of the form
33312 <option>real-username</option> to bypass a user&#x2019;s <filename>.forward</filename> file &ndash; helpful when trying
33313 to tell a user their forwarding is broken &ndash; by placing a router like this one
33314 immediately before the router that handles <filename>.forward</filename> files:
33315 </para>
33316 <literallayout class="monospaced">
33317 real_localuser:
33318   driver = accept
33319   local_part_prefix = real-
33320   check_local_user
33321   transport = local_delivery
33322 </literallayout>
33323 <para>
33324 For security, it would probably be a good idea to restrict the use of this
33325 router to locally-generated messages, using a condition such as this:
33326 </para>
33327 <literallayout class="monospaced">
33328   condition = ${if match {$sender_host_address}\
33329                          {\N^(|127\.0\.0\.1)$\N}}
33330 </literallayout>
33331 <para>
33332 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
33333 both conditions must be met if not optional. Care must be taken if wildcards
33334 are used in both a prefix and a suffix on the same router. Different
33335 separator characters must be used to avoid ambiguity.
33336 </para>
33337 <para>
33338 <indexterm role="option">
33339 <primary><option>local_part_prefix_optional</option></primary>
33340 </indexterm>
33341 </para>
33342 <informaltable frame="all">
33343 <tgroup cols="4" colsep="0" rowsep="0">
33344 <colspec colwidth="8*" align="left"/>
33345 <colspec colwidth="6*" align="center"/>
33346 <colspec colwidth="6*" align="center"/>
33347 <colspec colwidth="6*" align="right"/>
33348 <tbody>
33349 <row>
33350 <entry><option>local_part_prefix_optional</option></entry>
33351 <entry>Use: <emphasis>routers</emphasis></entry>
33352 <entry>Type: <emphasis>boolean</emphasis></entry>
33353 <entry>Default: <emphasis>false</emphasis></entry>
33354 </row>
33355 </tbody>
33356 </tgroup>
33357 </informaltable>
33358 <para>
33359 See <option>local_part_prefix</option> above.
33360 </para>
33361 <para>
33362 <indexterm role="option">
33363 <primary><option>local_part_suffix</option></primary>
33364 </indexterm>
33365 </para>
33366 <informaltable frame="all">
33367 <tgroup cols="4" colsep="0" rowsep="0">
33368 <colspec colwidth="8*" align="left"/>
33369 <colspec colwidth="6*" align="center"/>
33370 <colspec colwidth="6*" align="center"/>
33371 <colspec colwidth="6*" align="right"/>
33372 <tbody>
33373 <row>
33374 <entry><option>local_part_suffix</option></entry>
33375 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33376 <entry>Type: <emphasis>string list</emphasis></entry>
33377 <entry>Default: <emphasis>unset</emphasis></entry>
33378 </row>
33379 </tbody>
33380 </tgroup>
33381 </informaltable>
33382 <para>
33383 <indexterm role="concept">
33384 <primary>router</primary>
33385 <secondary>suffix for local part</secondary>
33386 </indexterm>
33387 <indexterm role="concept">
33388 <primary>suffix for local part</primary>
33389 <secondary>used in router</secondary>
33390 </indexterm>
33391 This option operates in the same way as <option>local_part_prefix</option>, except that the
33392 local part must end (rather than start) with the given string, the
33393 <option>local_part_suffix_optional</option> option determines whether the suffix is
33394 mandatory, and the wildcard * character, if present, must be the last
33395 character of the suffix. This option facility is commonly used to handle local
33396 parts of the form <option>something-request</option> and multiple user mailboxes of the form
33397 <option>username-foo</option>.
33398 </para>
33399 <para>
33400 <indexterm role="option">
33401 <primary><option>local_part_suffix_optional</option></primary>
33402 </indexterm>
33403 </para>
33404 <informaltable frame="all">
33405 <tgroup cols="4" colsep="0" rowsep="0">
33406 <colspec colwidth="8*" align="left"/>
33407 <colspec colwidth="6*" align="center"/>
33408 <colspec colwidth="6*" align="center"/>
33409 <colspec colwidth="6*" align="right"/>
33410 <tbody>
33411 <row>
33412 <entry><option>local_part_suffix_optional</option></entry>
33413 <entry>Use: <emphasis>routers</emphasis></entry>
33414 <entry>Type: <emphasis>boolean</emphasis></entry>
33415 <entry>Default: <emphasis>false</emphasis></entry>
33416 </row>
33417 </tbody>
33418 </tgroup>
33419 </informaltable>
33420 <para>
33421 See <option>local_part_suffix</option> above.
33422 </para>
33423 <para>
33424 <indexterm role="option">
33425 <primary><option>local_parts</option></primary>
33426 </indexterm>
33427 </para>
33428 <informaltable frame="all">
33429 <tgroup cols="4" colsep="0" rowsep="0">
33430 <colspec colwidth="8*" align="left"/>
33431 <colspec colwidth="6*" align="center"/>
33432 <colspec colwidth="6*" align="center"/>
33433 <colspec colwidth="6*" align="right"/>
33434 <tbody>
33435 <row>
33436 <entry><option>local_parts</option></entry>
33437 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33438 <entry>Type: <emphasis>local part list</emphasis>&dagger;<emphasis></emphasis></entry>
33439 <entry>Default: <emphasis>unset</emphasis></entry>
33440 </row>
33441 </tbody>
33442 </tgroup>
33443 </informaltable>
33444 <para>
33445 <indexterm role="concept">
33446 <primary>router</primary>
33447 <secondary>restricting to specific local parts</secondary>
33448 </indexterm>
33449 <indexterm role="concept">
33450 <primary>local part</primary>
33451 <secondary>checking in router</secondary>
33452 </indexterm>
33453 The router is run only if the local part of the address matches the list.
33454 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
33455 are evaluated, and
33456 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
33457 string is expanded, it is possible to make it depend on the domain, for
33458 example:
33459 </para>
33460 <literallayout class="monospaced">
33461 local_parts = dbm;/usr/local/specials/$domain
33462 </literallayout>
33463 <para>
33464 <indexterm role="variable">
33465 <primary><varname>$local_part_data</varname></primary>
33466 </indexterm>
33467 If the match is achieved by a lookup, the data that the lookup returned
33468 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
33469 expansions of the router&#x2019;s private options. You might use this option, for
33470 example, if you have a large number of local virtual domains, and you want to
33471 send all postmaster mail to the same place without having to set up an alias in
33472 each virtual domain:
33473 </para>
33474 <literallayout class="monospaced">
33475 postmaster:
33476   driver = redirect
33477   local_parts = postmaster
33478   data = postmaster@real.domain.example
33479 </literallayout>
33480 <para>
33481 <indexterm role="option">
33482 <primary><option>log_as_local</option></primary>
33483 </indexterm>
33484 </para>
33485 <informaltable frame="all">
33486 <tgroup cols="4" colsep="0" rowsep="0">
33487 <colspec colwidth="8*" align="left"/>
33488 <colspec colwidth="6*" align="center"/>
33489 <colspec colwidth="6*" align="center"/>
33490 <colspec colwidth="6*" align="right"/>
33491 <tbody>
33492 <row>
33493 <entry><option>log_as_local</option></entry>
33494 <entry>Use: <emphasis>routers</emphasis></entry>
33495 <entry>Type: <emphasis>boolean</emphasis></entry>
33496 <entry>Default: <emphasis>see below</emphasis></entry>
33497 </row>
33498 </tbody>
33499 </tgroup>
33500 </informaltable>
33501 <para>
33502 <indexterm role="concept">
33503 <primary>log</primary>
33504 <secondary>delivery line</secondary>
33505 </indexterm>
33506 <indexterm role="concept">
33507 <primary>delivery</primary>
33508 <secondary>log line format</secondary>
33509 </indexterm>
33510 Exim has two logging styles for delivery, the idea being to make local
33511 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
33512 recipient address is given just as the local part, without a domain. The use of
33513 this style is controlled by this option. It defaults to true for the <command>accept</command>
33514 router, and false for all the others. This option applies only when a
33515 router assigns an address to a transport. It has no effect on routers that
33516 redirect addresses.
33517 </para>
33518 <para>
33519 <indexterm role="option">
33520 <primary><option>more</option></primary>
33521 </indexterm>
33522 </para>
33523 <informaltable frame="all">
33524 <tgroup cols="4" colsep="0" rowsep="0">
33525 <colspec colwidth="8*" align="left"/>
33526 <colspec colwidth="6*" align="center"/>
33527 <colspec colwidth="6*" align="center"/>
33528 <colspec colwidth="6*" align="right"/>
33529 <tbody>
33530 <row>
33531 <entry><option>more</option></entry>
33532 <entry>Use: <emphasis>routers</emphasis></entry>
33533 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
33534 <entry>Default: <emphasis>true</emphasis></entry>
33535 </row>
33536 </tbody>
33537 </tgroup>
33538 </informaltable>
33539 <para>
33540 The result of string expansion for this option must be a valid boolean value,
33541 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
33542 result causes an error, and delivery is deferred. If the expansion is forced to
33543 fail, the default value for the option (true) is used. Other failures cause
33544 delivery to be deferred.
33545 </para>
33546 <para>
33547 If this option is set false, and the router declines to handle the address, no
33548 further routers are tried, routing fails, and the address is bounced.
33549 <indexterm role="option">
33550 <primary><option>self</option></primary>
33551 </indexterm>
33552 However, if the router explicitly passes an address to the following router by
33553 means of the setting
33554 </para>
33555 <literallayout class="monospaced">
33556 self = pass
33557 </literallayout>
33558 <para>
33559 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
33560 does not affect the behaviour if one of the precondition tests fails. In that
33561 case, the address is always passed to the next router.
33562 </para>
33563 <para>
33564 Note that <option>address_data</option> is not considered to be a precondition. If its
33565 expansion is forced to fail, the router declines, and the value of <option>more</option>
33566 controls what happens next.
33567 </para>
33568 <para>
33569 <indexterm role="option">
33570 <primary><option>pass_on_timeout</option></primary>
33571 </indexterm>
33572 </para>
33573 <informaltable frame="all">
33574 <tgroup cols="4" colsep="0" rowsep="0">
33575 <colspec colwidth="8*" align="left"/>
33576 <colspec colwidth="6*" align="center"/>
33577 <colspec colwidth="6*" align="center"/>
33578 <colspec colwidth="6*" align="right"/>
33579 <tbody>
33580 <row>
33581 <entry><option>pass_on_timeout</option></entry>
33582 <entry>Use: <emphasis>routers</emphasis></entry>
33583 <entry>Type: <emphasis>boolean</emphasis></entry>
33584 <entry>Default: <emphasis>false</emphasis></entry>
33585 </row>
33586 </tbody>
33587 </tgroup>
33588 </informaltable>
33589 <para>
33590 <indexterm role="concept">
33591 <primary>timeout</primary>
33592 <secondary>of router</secondary>
33593 </indexterm>
33594 <indexterm role="concept">
33595 <primary>router</primary>
33596 <secondary>timeout</secondary>
33597 </indexterm>
33598 If a router times out during a host lookup, it normally causes deferral of the
33599 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
33600 router, overriding <option>no_more</option>. This may be helpful for systems that are
33601 intermittently connected to the Internet, or those that want to pass to a smart
33602 host any messages that cannot immediately be delivered.
33603 </para>
33604 <para>
33605 There are occasional other temporary errors that can occur while doing DNS
33606 lookups. They are treated in the same way as a timeout, and this option
33607 applies to all of them.
33608 </para>
33609 <para>
33610 <indexterm role="option">
33611 <primary><option>pass_router</option></primary>
33612 </indexterm>
33613 </para>
33614 <informaltable frame="all">
33615 <tgroup cols="4" colsep="0" rowsep="0">
33616 <colspec colwidth="8*" align="left"/>
33617 <colspec colwidth="6*" align="center"/>
33618 <colspec colwidth="6*" align="center"/>
33619 <colspec colwidth="6*" align="right"/>
33620 <tbody>
33621 <row>
33622 <entry><option>pass_router</option></entry>
33623 <entry>Use: <emphasis>routers</emphasis></entry>
33624 <entry>Type: <emphasis>string</emphasis></entry>
33625 <entry>Default: <emphasis>unset</emphasis></entry>
33626 </row>
33627 </tbody>
33628 </tgroup>
33629 </informaltable>
33630 <para>
33631 <indexterm role="concept">
33632 <primary>router</primary>
33633 <secondary>go to after <quote>pass</quote></secondary>
33634 </indexterm>
33635 Routers that recognize the generic <option>self</option> option (<command>dnslookup</command>,
33636 <command>ipliteral</command>, and <command>manualroute</command>) are able to return <quote>pass</quote>, forcing
33637 routing to continue, and overriding a false setting of <option>more</option>. When one of
33638 these routers returns <quote>pass</quote>, the address is normally handed on to the next
33639 router in sequence. This can be changed by setting <option>pass_router</option> to the name
33640 of another router. However (unlike <option>redirect_router</option>) the named router must
33641 be below the current router, to avoid loops. Note that this option applies only
33642 to the special case of <quote>pass</quote>. It does not apply when a router returns
33643 <quote>decline</quote> because it cannot handle an address.
33644 </para>
33645 <para>
33646 <indexterm role="option">
33647 <primary><option>redirect_router</option></primary>
33648 </indexterm>
33649 </para>
33650 <informaltable frame="all">
33651 <tgroup cols="4" colsep="0" rowsep="0">
33652 <colspec colwidth="8*" align="left"/>
33653 <colspec colwidth="6*" align="center"/>
33654 <colspec colwidth="6*" align="center"/>
33655 <colspec colwidth="6*" align="right"/>
33656 <tbody>
33657 <row>
33658 <entry><option>redirect_router</option></entry>
33659 <entry>Use: <emphasis>routers</emphasis></entry>
33660 <entry>Type: <emphasis>string</emphasis></entry>
33661 <entry>Default: <emphasis>unset</emphasis></entry>
33662 </row>
33663 </tbody>
33664 </tgroup>
33665 </informaltable>
33666 <para>
33667 <indexterm role="concept">
33668 <primary>router</primary>
33669 <secondary>start at after redirection</secondary>
33670 </indexterm>
33671 Sometimes an administrator knows that it is pointless to reprocess addresses
33672 generated from alias or forward files with the same router again. For
33673 example, if an alias file translates real names into login ids there is no
33674 point searching the alias file a second time, especially if it is a large file.
33675 </para>
33676 <para>
33677 The <option>redirect_router</option> option can be set to the name of any router instance.
33678 It causes the routing of any generated addresses to start at the named router
33679 instead of at the first router. This option has no effect if the router in
33680 which it is set does not generate new addresses.
33681 </para>
33682 <para>
33683 <indexterm role="option">
33684 <primary><option>require_files</option></primary>
33685 </indexterm>
33686 </para>
33687 <informaltable frame="all">
33688 <tgroup cols="4" colsep="0" rowsep="0">
33689 <colspec colwidth="8*" align="left"/>
33690 <colspec colwidth="6*" align="center"/>
33691 <colspec colwidth="6*" align="center"/>
33692 <colspec colwidth="6*" align="right"/>
33693 <tbody>
33694 <row>
33695 <entry><option>require_files</option></entry>
33696 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33697 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
33698 <entry>Default: <emphasis>unset</emphasis></entry>
33699 </row>
33700 </tbody>
33701 </tgroup>
33702 </informaltable>
33703 <para>
33704 <indexterm role="concept">
33705 <primary>file</primary>
33706 <secondary>requiring for router</secondary>
33707 </indexterm>
33708 <indexterm role="concept">
33709 <primary>router</primary>
33710 <secondary>requiring file existence</secondary>
33711 </indexterm>
33712 This option provides a general mechanism for predicating the running of a
33713 router on the existence or non-existence of certain files or directories.
33714 Before running a router, as one of its precondition tests, Exim works its way
33715 through the <option>require_files</option> list, expanding each item separately.
33716 </para>
33717 <para>
33718 Because the list is split before expansion, any colons in expansion items must
33719 be doubled, or the facility for using a different list separator must be used.
33720 If any expansion is forced to fail, the item is ignored. Other expansion
33721 failures cause routing of the address to be deferred.
33722 </para>
33723 <para>
33724 If any expanded string is empty, it is ignored. Otherwise, except as described
33725 below, each string must be a fully qualified file path, optionally preceded by
33726 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
33727 existence of the files or directories. The router is skipped if any paths not
33728 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
33729 </para>
33730 <para>
33731 <indexterm role="concept">
33732 <primary>NFS</primary>
33733 </indexterm>
33734 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
33735 the message is deferred. This can happen when NFS-mounted filesystems are
33736 unavailable.
33737 </para>
33738 <para>
33739 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
33740 options, so you cannot use it to check for the existence of a file in which to
33741 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
33742 full list of the order in which preconditions are evaluated.) However, as
33743 these options are all expanded, you can use the <option>exists</option> expansion condition
33744 to make such tests. The <option>require_files</option> option is intended for checking files
33745 that the router may be going to use internally, or which are needed by a
33746 transport (for example <filename>.procmailrc</filename>).
33747 </para>
33748 <para>
33749 During delivery, the <function>stat()</function> function is run as root, but there is a
33750 facility for some checking of the accessibility of a file by another user.
33751 This is not a proper permissions check, but just a <quote>rough</quote> check that
33752 operates as follows:
33753 </para>
33754 <para>
33755 If an item in a <option>require_files</option> list does not contain any forward slash
33756 characters, it is taken to be the user (and optional group, separated by a
33757 comma) to be checked for subsequent files in the list. If no group is specified
33758 but the user is specified symbolically, the gid associated with the uid is
33759 used. For example:
33760 </para>
33761 <literallayout class="monospaced">
33762 require_files = mail:/some/file
33763 require_files = $local_part:$home/.procmailrc
33764 </literallayout>
33765 <para>
33766 If a user or group name in a <option>require_files</option> list does not exist, the
33767 <option>require_files</option> condition fails.
33768 </para>
33769 <para>
33770 Exim performs the check by scanning along the components of the file path, and
33771 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
33772 directories, and <quote>r</quote> access on the final file. Note that this means that file
33773 access control lists, if the operating system has them, are ignored.
33774 </para>
33775 <para>
33776 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
33777 incoming SMTP message, Exim is not running as root, but under its own uid. This
33778 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
33779 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
33780 user is not permitted to read one of the directories on the file&#x2019;s path.
33781 </para>
33782 <para>
33783 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
33784 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
33785 without root access. In this case, if a check for access by a particular user
33786 is requested, Exim creates a subprocess that runs as that user, and tries the
33787 check again in that process.
33788 </para>
33789 <para>
33790 The default action for handling an unresolved EACCES is to consider it to
33791 be caused by a configuration error, and routing is deferred because the
33792 existence or non-existence of the file cannot be determined. However, in some
33793 circumstances it may be desirable to treat this condition as if the file did
33794 not exist. If the file name (or the exclamation mark that precedes the file
33795 name for non-existence) is preceded by a plus sign, the EACCES error is treated
33796 as if the file did not exist. For example:
33797 </para>
33798 <literallayout class="monospaced">
33799 require_files = +/some/file
33800 </literallayout>
33801 <para>
33802 If the router is not an essential part of verification (for example, it
33803 handles users&#x2019; <filename>.forward</filename> files), another solution is to set the <option>verify</option>
33804 option false so that the router is skipped when verifying.
33805 </para>
33806 <para>
33807 <indexterm role="option">
33808 <primary><option>retry_use_local_part</option></primary>
33809 </indexterm>
33810 </para>
33811 <informaltable frame="all">
33812 <tgroup cols="4" colsep="0" rowsep="0">
33813 <colspec colwidth="8*" align="left"/>
33814 <colspec colwidth="6*" align="center"/>
33815 <colspec colwidth="6*" align="center"/>
33816 <colspec colwidth="6*" align="right"/>
33817 <tbody>
33818 <row>
33819 <entry><option>retry_use_local_part</option></entry>
33820 <entry>Use: <emphasis>routers</emphasis></entry>
33821 <entry>Type: <emphasis>boolean</emphasis></entry>
33822 <entry>Default: <emphasis>see below</emphasis></entry>
33823 </row>
33824 </tbody>
33825 </tgroup>
33826 </informaltable>
33827 <para>
33828 <indexterm role="concept">
33829 <primary>hints database</primary>
33830 <secondary>retry keys</secondary>
33831 </indexterm>
33832 <indexterm role="concept">
33833 <primary>local part</primary>
33834 <secondary>in retry keys</secondary>
33835 </indexterm>
33836 When a delivery suffers a temporary routing failure, a retry record is created
33837 in Exim&#x2019;s hints database. For addresses whose routing depends only on the
33838 domain, the key for the retry record should not involve the local part, but for
33839 other addresses, both the domain and the local part should be included.
33840 Usually, remote routing is of the former kind, and local routing is of the
33841 latter kind.
33842 </para>
33843 <para>
33844 This option controls whether the local part is used to form the key for retry
33845 hints for addresses that suffer temporary errors while being handled by this
33846 router. The default value is true for any router that has <option>check_local_user</option>
33847 set, and false otherwise. Note that this option does not apply to hints keys
33848 for transport delays; they are controlled by a generic transport option of the
33849 same name.
33850 </para>
33851 <para>
33852 The setting of <option>retry_use_local_part</option> applies only to the router on which it
33853 appears. If the router generates child addresses, they are routed
33854 independently; this setting does not become attached to them.
33855 </para>
33856 <para>
33857 <indexterm role="option">
33858 <primary><option>router_home_directory</option></primary>
33859 </indexterm>
33860 </para>
33861 <informaltable frame="all">
33862 <tgroup cols="4" colsep="0" rowsep="0">
33863 <colspec colwidth="8*" align="left"/>
33864 <colspec colwidth="6*" align="center"/>
33865 <colspec colwidth="6*" align="center"/>
33866 <colspec colwidth="6*" align="right"/>
33867 <tbody>
33868 <row>
33869 <entry><option>router_home_directory</option></entry>
33870 <entry>Use: <emphasis>routers</emphasis></entry>
33871 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33872 <entry>Default: <emphasis>unset</emphasis></entry>
33873 </row>
33874 </tbody>
33875 </tgroup>
33876 </informaltable>
33877 <para>
33878 <indexterm role="concept">
33879 <primary>router</primary>
33880 <secondary>home directory for</secondary>
33881 </indexterm>
33882 <indexterm role="concept">
33883 <primary>home directory</primary>
33884 <secondary>for router</secondary>
33885 </indexterm>
33886 <indexterm role="variable">
33887 <primary><varname>$home</varname></primary>
33888 </indexterm>
33889 This option sets a home directory for use while the router is running. (Compare
33890 <option>transport_home_directory</option>, which sets a home directory for later
33891 transporting.) In particular, if used on a <command>redirect</command> router, this option
33892 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
33893 forced expansion failure causes the option to be ignored &ndash; other failures
33894 cause the router to defer.
33895 </para>
33896 <para>
33897 Expansion of <option>router_home_directory</option> happens immediately after the
33898 <option>check_local_user</option> test (if configured), before any further expansions take
33899 place.
33900 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
33901 are evaluated.)
33902 While the router is running, <option>router_home_directory</option> overrides the value of
33903 <varname>$home</varname> that came from <option>check_local_user</option>.
33904 </para>
33905 <para>
33906 When a router accepts an address and assigns it to a local transport (including
33907 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
33908 delivery), the home directory setting for the transport is taken from the first
33909 of these values that is set:
33910 </para>
33911 <itemizedlist>
33912 <listitem>
33913 <para>
33914 The <option>home_directory</option> option on the transport;
33915 </para>
33916 </listitem>
33917 <listitem>
33918 <para>
33919 The <option>transport_home_directory</option> option on the router;
33920 </para>
33921 </listitem>
33922 <listitem>
33923 <para>
33924 The password data if <option>check_local_user</option> is set on the router;
33925 </para>
33926 </listitem>
33927 <listitem>
33928 <para>
33929 The <option>router_home_directory</option> option on the router.
33930 </para>
33931 </listitem>
33932 </itemizedlist>
33933 <para>
33934 In other words, <option>router_home_directory</option> overrides the password data for the
33935 router, but not for the transport.
33936 </para>
33937 <para>
33938 <indexterm role="option">
33939 <primary><option>self</option></primary>
33940 </indexterm>
33941 </para>
33942 <informaltable frame="all">
33943 <tgroup cols="4" colsep="0" rowsep="0">
33944 <colspec colwidth="8*" align="left"/>
33945 <colspec colwidth="6*" align="center"/>
33946 <colspec colwidth="6*" align="center"/>
33947 <colspec colwidth="6*" align="right"/>
33948 <tbody>
33949 <row>
33950 <entry><option>self</option></entry>
33951 <entry>Use: <emphasis>routers</emphasis></entry>
33952 <entry>Type: <emphasis>string</emphasis></entry>
33953 <entry>Default: <emphasis>freeze</emphasis></entry>
33954 </row>
33955 </tbody>
33956 </tgroup>
33957 </informaltable>
33958 <para>
33959 <indexterm role="concept">
33960 <primary>MX record</primary>
33961 <secondary>pointing to local host</secondary>
33962 </indexterm>
33963 <indexterm role="concept">
33964 <primary>local host</primary>
33965 <secondary>MX pointing to</secondary>
33966 </indexterm>
33967 This option applies to those routers that use a recipient address to find a
33968 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
33969 and <command>manualroute</command> routers.
33970 Certain configurations of the <command>queryprogram</command> router can also specify a list
33971 of remote hosts.
33972 Usually such routers are configured to send the message to a remote host via an
33973 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
33974 host on the list turns out to be the local host.
33975 The way in which Exim checks for the local host is described in section
33976 <xref linkend="SECTreclocipadd"/>.
33977 </para>
33978 <para>
33979 Normally this situation indicates either an error in Exim&#x2019;s configuration (for
33980 example, the router should be configured not to process this domain), or an
33981 error in the DNS (for example, the MX should not point to this host). For this
33982 reason, the default action is to log the incident, defer the address, and
33983 freeze the message. The following alternatives are provided for use in special
33984 cases:
33985 </para>
33986 <variablelist>
33987 <varlistentry>
33988 <term><option>defer</option></term>
33989 <listitem>
33990 <para>
33991 Delivery of the message is tried again later, but the message is not frozen.
33992 </para>
33993 </listitem></varlistentry>
33994 <varlistentry>
33995 <term><option>reroute</option>: &lt;<emphasis>domain</emphasis>&gt;</term>
33996 <listitem>
33997 <para>
33998 The domain is changed to the given domain, and the address is passed back to
33999 be reprocessed by the routers. No rewriting of headers takes place. This
34000 behaviour is essentially a redirection.
34001 </para>
34002 </listitem></varlistentry>
34003 <varlistentry>
34004 <term><option>reroute: rewrite:</option> &lt;<emphasis>domain</emphasis>&gt;</term>
34005 <listitem>
34006 <para>
34007 The domain is changed to the given domain, and the address is passed back to be
34008 reprocessed by the routers. Any headers that contain the original domain are
34009 rewritten.
34010 </para>
34011 </listitem></varlistentry>
34012 <varlistentry>
34013 <term><option>pass</option></term>
34014 <listitem>
34015 <para>
34016 <indexterm role="option">
34017 <primary><option>more</option></primary>
34018 </indexterm>
34019 <indexterm role="variable">
34020 <primary><varname>$self_hostname</varname></primary>
34021 </indexterm>
34022 The router passes the address to the next router, or to the router named in the
34023 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
34024 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
34025 name of the local host that the router encountered. This can be used to
34026 distinguish between different cases for hosts with multiple names. The
34027 combination
34028 </para>
34029 <literallayout class="monospaced">
34030 self = pass
34031 no_more
34032 </literallayout>
34033 <para>
34034 ensures that only those addresses that routed to the local host are passed on.
34035 Without <option>no_more</option>, addresses that were declined for other reasons would also
34036 be passed to the next router.
34037 </para>
34038 </listitem></varlistentry>
34039 <varlistentry>
34040 <term><option>fail</option></term>
34041 <listitem>
34042 <para>
34043 Delivery fails and an error report is generated.
34044 </para>
34045 </listitem></varlistentry>
34046 <varlistentry>
34047 <term><option>send</option></term>
34048 <listitem>
34049 <para>
34050 <indexterm role="concept">
34051 <primary>local host</primary>
34052 <secondary>sending to</secondary>
34053 </indexterm>
34054 The anomaly is ignored and the address is queued for the transport. This
34055 setting should be used with extreme caution. For an <command>smtp</command> transport, it
34056 makes sense only in cases where the program that is listening on the SMTP port
34057 is not this version of Exim. That is, it must be some other MTA, or Exim with a
34058 different configuration file that handles the domain in another way.
34059 </para>
34060 </listitem></varlistentry>
34061 </variablelist>
34062 <para>
34063 <indexterm role="option">
34064 <primary><option>senders</option></primary>
34065 </indexterm>
34066 </para>
34067 <informaltable frame="all">
34068 <tgroup cols="4" colsep="0" rowsep="0">
34069 <colspec colwidth="8*" align="left"/>
34070 <colspec colwidth="6*" align="center"/>
34071 <colspec colwidth="6*" align="center"/>
34072 <colspec colwidth="6*" align="right"/>
34073 <tbody>
34074 <row>
34075 <entry><option>senders</option></entry>
34076 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34077 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
34078 <entry>Default: <emphasis>unset</emphasis></entry>
34079 </row>
34080 </tbody>
34081 </tgroup>
34082 </informaltable>
34083 <para>
34084 <indexterm role="concept">
34085 <primary>router</primary>
34086 <secondary>checking senders</secondary>
34087 </indexterm>
34088 If this option is set, the router is skipped unless the message&#x2019;s sender
34089 address matches something on the list.
34090 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
34091 are evaluated.
34092 </para>
34093 <para>
34094 There are issues concerning verification when the running of routers is
34095 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
34096 setting, it sets the sender to the null string. When using the <option>-bt</option> option
34097 to check a configuration file, it is necessary also to use the <option>-f</option> option to
34098 set an appropriate sender. For incoming mail, the sender is unset when
34099 verifying the sender, but is available when verifying any recipients. If the
34100 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
34101 matters.
34102 </para>
34103 <para>
34104 <indexterm role="option">
34105 <primary><option>translate_ip_address</option></primary>
34106 </indexterm>
34107 </para>
34108 <informaltable frame="all">
34109 <tgroup cols="4" colsep="0" rowsep="0">
34110 <colspec colwidth="8*" align="left"/>
34111 <colspec colwidth="6*" align="center"/>
34112 <colspec colwidth="6*" align="center"/>
34113 <colspec colwidth="6*" align="right"/>
34114 <tbody>
34115 <row>
34116 <entry><option>translate_ip_address</option></entry>
34117 <entry>Use: <emphasis>routers</emphasis></entry>
34118 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34119 <entry>Default: <emphasis>unset</emphasis></entry>
34120 </row>
34121 </tbody>
34122 </tgroup>
34123 </informaltable>
34124 <para>
34125 <indexterm role="concept">
34126 <primary>IP address</primary>
34127 <secondary>translating</secondary>
34128 </indexterm>
34129 <indexterm role="concept">
34130 <primary>packet radio</primary>
34131 </indexterm>
34132 <indexterm role="concept">
34133 <primary>router</primary>
34134 <secondary>IP address translation</secondary>
34135 </indexterm>
34136 There exist some rare networking situations (for example, packet radio) where
34137 it is helpful to be able to translate IP addresses generated by normal routing
34138 mechanisms into other IP addresses, thus performing a kind of manual IP
34139 routing. This should be done only if the normal IP routing of the TCP/IP stack
34140 is inadequate or broken. Because this is an extremely uncommon requirement, the
34141 code to support this option is not included in the Exim binary unless
34142 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
34143 </para>
34144 <para>
34145 <indexterm role="variable">
34146 <primary><varname>$host_address</varname></primary>
34147 </indexterm>
34148 The <option>translate_ip_address</option> string is expanded for every IP address generated
34149 by the router, with the generated address set in <varname>$host_address</varname>. If the
34150 expansion is forced to fail, no action is taken.
34151 For any other expansion error, delivery of the message is deferred.
34152 If the result of the expansion is an IP address, that replaces the original
34153 address; otherwise the result is assumed to be a host name &ndash; this is looked
34154 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
34155 produce one or more replacement IP addresses. For example, to subvert all IP
34156 addresses in some specific networks, this could be added to a router:
34157 </para>
34158 <literallayout class="monospaced">
34159 translate_ip_address = \
34160   ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
34161     {$value}fail}}
34162 </literallayout>
34163 <para>
34164 The file would contain lines like
34165 </para>
34166 <literallayout class="monospaced">
34167 10.2.3.128/26    some.host
34168 10.8.4.34/26     10.44.8.15
34169 </literallayout>
34170 <para>
34171 You should not make use of this facility unless you really understand what you
34172 are doing.
34173 </para>
34174 <para>
34175 <indexterm role="option">
34176 <primary><option>transport</option></primary>
34177 </indexterm>
34178 </para>
34179 <informaltable frame="all">
34180 <tgroup cols="4" colsep="0" rowsep="0">
34181 <colspec colwidth="8*" align="left"/>
34182 <colspec colwidth="6*" align="center"/>
34183 <colspec colwidth="6*" align="center"/>
34184 <colspec colwidth="6*" align="right"/>
34185 <tbody>
34186 <row>
34187 <entry><option>transport</option></entry>
34188 <entry>Use: <emphasis>routers</emphasis></entry>
34189 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34190 <entry>Default: <emphasis>unset</emphasis></entry>
34191 </row>
34192 </tbody>
34193 </tgroup>
34194 </informaltable>
34195 <para>
34196 This option specifies the transport to be used when a router accepts an address
34197 and sets it up for delivery. A transport is never needed if a router is used
34198 only for verification. The value of the option is expanded at routing time,
34199 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
34200 and result must be the name of one of the configured transports. If it is not,
34201 delivery is deferred.
34202 </para>
34203 <para>
34204 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
34205 have some private options that set up transports for pipe and file deliveries
34206 (see chapter <xref linkend="CHAPredirect"/>).
34207 </para>
34208 <para>
34209 <indexterm role="option">
34210 <primary><option>transport_current_directory</option></primary>
34211 </indexterm>
34212 </para>
34213 <informaltable frame="all">
34214 <tgroup cols="4" colsep="0" rowsep="0">
34215 <colspec colwidth="8*" align="left"/>
34216 <colspec colwidth="6*" align="center"/>
34217 <colspec colwidth="6*" align="center"/>
34218 <colspec colwidth="6*" align="right"/>
34219 <tbody>
34220 <row>
34221 <entry><option>transport_current_directory</option></entry>
34222 <entry>Use: <emphasis>routers</emphasis></entry>
34223 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34224 <entry>Default: <emphasis>unset</emphasis></entry>
34225 </row>
34226 </tbody>
34227 </tgroup>
34228 </informaltable>
34229 <para>
34230 <indexterm role="concept">
34231 <primary>current directory for local transport</primary>
34232 </indexterm>
34233 This option associates a current directory with any address that is routed
34234 to a local transport. This can happen either because a transport is
34235 explicitly configured for the router, or because it generates a delivery to a
34236 file or a pipe. During the delivery process (that is, at transport time), this
34237 option string is expanded and is set as the current directory, unless
34238 overridden by a setting on the transport.
34239 If the expansion fails for any reason, including forced failure, an error is
34240 logged, and delivery is deferred.
34241 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
34242 environment.
34243 </para>
34244 <para>
34245 <indexterm role="option">
34246 <primary><option>transport_home_directory</option></primary>
34247 </indexterm>
34248 </para>
34249 <informaltable frame="all">
34250 <tgroup cols="4" colsep="0" rowsep="0">
34251 <colspec colwidth="8*" align="left"/>
34252 <colspec colwidth="6*" align="center"/>
34253 <colspec colwidth="6*" align="center"/>
34254 <colspec colwidth="6*" align="right"/>
34255 <tbody>
34256 <row>
34257 <entry><option>transport_home_directory</option></entry>
34258 <entry>Use: <emphasis>routers</emphasis></entry>
34259 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34260 <entry>Default: <emphasis>see below</emphasis></entry>
34261 </row>
34262 </tbody>
34263 </tgroup>
34264 </informaltable>
34265 <para>
34266 <indexterm role="concept">
34267 <primary>home directory</primary>
34268 <secondary>for local transport</secondary>
34269 </indexterm>
34270 This option associates a home directory with any address that is routed to a
34271 local transport. This can happen either because a transport is explicitly
34272 configured for the router, or because it generates a delivery to a file or a
34273 pipe. During the delivery process (that is, at transport time), the option
34274 string is expanded and is set as the home directory, unless overridden by a
34275 setting of <option>home_directory</option> on the transport.
34276 If the expansion fails for any reason, including forced failure, an error is
34277 logged, and delivery is deferred.
34278 </para>
34279 <para>
34280 If the transport does not specify a home directory, and
34281 <option>transport_home_directory</option> is not set for the router, the home directory for
34282 the transport is taken from the password data if <option>check_local_user</option> is set for
34283 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
34284 is set; if not, no home directory is set for the transport.
34285 </para>
34286 <para>
34287 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
34288 environment.
34289 </para>
34290 <para>
34291 <indexterm role="option">
34292 <primary><option>unseen</option></primary>
34293 </indexterm>
34294 </para>
34295 <informaltable frame="all">
34296 <tgroup cols="4" colsep="0" rowsep="0">
34297 <colspec colwidth="8*" align="left"/>
34298 <colspec colwidth="6*" align="center"/>
34299 <colspec colwidth="6*" align="center"/>
34300 <colspec colwidth="6*" align="right"/>
34301 <tbody>
34302 <row>
34303 <entry><option>unseen</option></entry>
34304 <entry>Use: <emphasis>routers</emphasis></entry>
34305 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
34306 <entry>Default: <emphasis>false</emphasis></entry>
34307 </row>
34308 </tbody>
34309 </tgroup>
34310 </informaltable>
34311 <para>
34312 <indexterm role="concept">
34313 <primary>router</primary>
34314 <secondary>carrying on after success</secondary>
34315 </indexterm>
34316 The result of string expansion for this option must be a valid boolean value,
34317 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
34318 result causes an error, and delivery is deferred. If the expansion is forced to
34319 fail, the default value for the option (false) is used. Other failures cause
34320 delivery to be deferred.
34321 </para>
34322 <para>
34323 When this option is set true, routing does not cease if the router accepts the
34324 address. Instead, a copy of the incoming address is passed to the next router,
34325 overriding a false setting of <option>more</option>. There is little point in setting
34326 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
34327 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
34328 sometimes true and sometimes false).
34329 </para>
34330 <para>
34331 <indexterm role="concept">
34332 <primary>copy of message (<option>unseen</option> option)</primary>
34333 </indexterm>
34334 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
34335 qualifier in filter files. It can be used to cause copies of messages to be
34336 delivered to some other destination, while also carrying out a normal delivery.
34337 In effect, the current address is made into a <quote>parent</quote> that has two children
34338 &ndash; one that is delivered as specified by this router, and a clone that goes on
34339 to be routed further. For this reason, <option>unseen</option> may not be combined with the
34340 <option>one_time</option> option in a <command>redirect</command> router.
34341 </para>
34342 <para>
34343 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
34344 this router or by previous routers affect the <quote>unseen</quote> copy of the message
34345 only. The clone that continues to be processed by further routers starts with
34346 no added headers and none specified for removal. For a <option>redirect</option> router, if
34347 a generated address is the same as the incoming address, this can lead to
34348 duplicate addresses with different header modifications. Exim does not do
34349 duplicate deliveries (except, in certain circumstances, to pipes -- see section
34350 <xref linkend="SECTdupaddr"/>), but it is undefined which of the duplicates is discarded,
34351 so this ambiguous situation should be avoided. The <option>repeat_use</option> option of the
34352 <option>redirect</option> router may be of help.
34353 </para>
34354 <para>
34355 Unlike the handling of header modifications, any data that was set by the
34356 <option>address_data</option> option in the current or previous routers <emphasis>is</emphasis> passed on to
34357 subsequent routers.
34358 </para>
34359 <para>
34360 <indexterm role="option">
34361 <primary><option>user</option></primary>
34362 </indexterm>
34363 </para>
34364 <informaltable frame="all">
34365 <tgroup cols="4" colsep="0" rowsep="0">
34366 <colspec colwidth="8*" align="left"/>
34367 <colspec colwidth="6*" align="center"/>
34368 <colspec colwidth="6*" align="center"/>
34369 <colspec colwidth="6*" align="right"/>
34370 <tbody>
34371 <row>
34372 <entry><option>user</option></entry>
34373 <entry>Use: <emphasis>routers</emphasis></entry>
34374 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34375 <entry>Default: <emphasis>see below</emphasis></entry>
34376 </row>
34377 </tbody>
34378 </tgroup>
34379 </informaltable>
34380 <para>
34381 <indexterm role="concept">
34382 <primary>uid (user id)</primary>
34383 <secondary>local delivery</secondary>
34384 </indexterm>
34385 <indexterm role="concept">
34386 <primary>local transports</primary>
34387 <secondary>uid and gid</secondary>
34388 </indexterm>
34389 <indexterm role="concept">
34390 <primary>transport</primary>
34391 <secondary>local</secondary>
34392 </indexterm>
34393 <indexterm role="concept">
34394 <primary>router</primary>
34395 <secondary>user for filter processing</secondary>
34396 </indexterm>
34397 <indexterm role="concept">
34398 <primary>filter</primary>
34399 <secondary>user for processing</secondary>
34400 </indexterm>
34401 When a router queues an address for a transport, and the transport does not
34402 specify a user, the user given here is used when running the delivery process.
34403 The user may be specified numerically or by name. If expansion fails, the
34404 error is logged and delivery is deferred.
34405 This user is also used by the <command>redirect</command> router when running a filter file.
34406 The default is unset, except when <option>check_local_user</option> is set. In this case,
34407 the default is taken from the password information. If the user is specified as
34408 a name, and <option>group</option> is not set, the group associated with the user is used.
34409 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
34410 <xref linkend="CHAPenvironment"/>.
34411 </para>
34412 <para>
34413 <indexterm role="option">
34414 <primary><option>verify</option></primary>
34415 </indexterm>
34416 </para>
34417 <informaltable frame="all">
34418 <tgroup cols="4" colsep="0" rowsep="0">
34419 <colspec colwidth="8*" align="left"/>
34420 <colspec colwidth="6*" align="center"/>
34421 <colspec colwidth="6*" align="center"/>
34422 <colspec colwidth="6*" align="right"/>
34423 <tbody>
34424 <row>
34425 <entry><option>verify</option></entry>
34426 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34427 <entry>Type: <emphasis>boolean</emphasis></entry>
34428 <entry>Default: <emphasis>true</emphasis></entry>
34429 </row>
34430 </tbody>
34431 </tgroup>
34432 </informaltable>
34433 <para>
34434 Setting this option has the effect of setting <option>verify_sender</option> and
34435 <option>verify_recipient</option> to the same value.
34436 </para>
34437 <para>
34438 <indexterm role="option">
34439 <primary><option>verify_only</option></primary>
34440 </indexterm>
34441 </para>
34442 <informaltable frame="all">
34443 <tgroup cols="4" colsep="0" rowsep="0">
34444 <colspec colwidth="8*" align="left"/>
34445 <colspec colwidth="6*" align="center"/>
34446 <colspec colwidth="6*" align="center"/>
34447 <colspec colwidth="6*" align="right"/>
34448 <tbody>
34449 <row>
34450 <entry><option>verify_only</option></entry>
34451 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34452 <entry>Type: <emphasis>boolean</emphasis></entry>
34453 <entry>Default: <emphasis>false</emphasis></entry>
34454 </row>
34455 </tbody>
34456 </tgroup>
34457 </informaltable>
34458 <para>
34459 <indexterm role="concept">
34460 <primary>EXPN</primary>
34461 <secondary>with <option>verify_only</option></secondary>
34462 </indexterm>
34463 <indexterm role="option">
34464 <primary><option>-bv</option></primary>
34465 </indexterm>
34466 <indexterm role="concept">
34467 <primary>router</primary>
34468 <secondary>used only when verifying</secondary>
34469 </indexterm>
34470 If this option is set, the router is used only when verifying an address,
34471 delivering in cutthrough mode or
34472 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
34473 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
34474 restricted to verifying only senders or recipients by means of
34475 <option>verify_sender</option> and <option>verify_recipient</option>.
34476 </para>
34477 <para>
34478 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
34479 SMTP message, Exim is not running as root, but under its own uid. If the router
34480 accesses any files, you need to make sure that they are accessible to the Exim
34481 user or group.
34482 </para>
34483 <para>
34484 <indexterm role="option">
34485 <primary><option>verify_recipient</option></primary>
34486 </indexterm>
34487 </para>
34488 <informaltable frame="all">
34489 <tgroup cols="4" colsep="0" rowsep="0">
34490 <colspec colwidth="8*" align="left"/>
34491 <colspec colwidth="6*" align="center"/>
34492 <colspec colwidth="6*" align="center"/>
34493 <colspec colwidth="6*" align="right"/>
34494 <tbody>
34495 <row>
34496 <entry><option>verify_recipient</option></entry>
34497 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34498 <entry>Type: <emphasis>boolean</emphasis></entry>
34499 <entry>Default: <emphasis>true</emphasis></entry>
34500 </row>
34501 </tbody>
34502 </tgroup>
34503 </informaltable>
34504 <para>
34505 If this option is false, the router is skipped when verifying recipient
34506 addresses,
34507 delivering in cutthrough mode
34508 or testing recipient verification using <option>-bv</option>.
34509 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
34510 are evaluated.
34511 See also the <varname>$verify_mode</varname> variable.
34512 </para>
34513 <para>
34514 <indexterm role="option">
34515 <primary><option>verify_sender</option></primary>
34516 </indexterm>
34517 </para>
34518 <informaltable frame="all">
34519 <tgroup cols="4" colsep="0" rowsep="0">
34520 <colspec colwidth="8*" align="left"/>
34521 <colspec colwidth="6*" align="center"/>
34522 <colspec colwidth="6*" align="center"/>
34523 <colspec colwidth="6*" align="right"/>
34524 <tbody>
34525 <row>
34526 <entry><option>verify_sender</option></entry>
34527 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34528 <entry>Type: <emphasis>boolean</emphasis></entry>
34529 <entry>Default: <emphasis>true</emphasis></entry>
34530 </row>
34531 </tbody>
34532 </tgroup>
34533 </informaltable>
34534 <para>
34535 If this option is false, the router is skipped when verifying sender addresses
34536 or testing sender verification using <option>-bvs</option>.
34537 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
34538 are evaluated.
34539 See also the <varname>$verify_mode</varname> variable.
34540 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
34541 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
34542 </para>
34543 </chapter>
34544
34545 <chapter id="CHID4">
34546 <title>The accept router</title>
34547 <para>
34548 <indexterm role="concept">
34549 <primary><command>accept</command> router</primary>
34550 </indexterm>
34551 <indexterm role="concept">
34552 <primary>routers</primary>
34553 <secondary><command>accept</command></secondary>
34554 </indexterm>
34555 The <command>accept</command> router has no private options of its own. Unless it is being
34556 used purely for verification (see <option>verify_only</option>) a transport is required to
34557 be defined by the generic <option>transport</option> option. If the preconditions that are
34558 specified by generic options are met, the router accepts the address and queues
34559 it for the given transport. The most common use of this router is for setting
34560 up deliveries to local mailboxes. For example:
34561 </para>
34562 <literallayout class="monospaced">
34563 localusers:
34564   driver = accept
34565   domains = mydomain.example
34566   check_local_user
34567   transport = local_delivery
34568 </literallayout>
34569 <para>
34570 The <option>domains</option> condition in this example checks the domain of the address, and
34571 <option>check_local_user</option> checks that the local part is the login of a local user.
34572 When both preconditions are met, the <command>accept</command> router runs, and queues the
34573 address for the <command>local_delivery</command> transport.
34574 </para>
34575 </chapter>
34576
34577 <chapter id="CHAPdnslookup">
34578 <title>The dnslookup router</title>
34579 <para>
34580 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
34581 <primary><command>dnslookup</command> router</primary>
34582 </indexterm>
34583 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
34584 <primary>routers</primary>
34585 <secondary><command>dnslookup</command></secondary>
34586 </indexterm>
34587 The <command>dnslookup</command> router looks up the hosts that handle mail for the
34588 recipient&#x2019;s domain in the DNS. A transport must always be set for this router,
34589 unless <option>verify_only</option> is set.
34590 </para>
34591 <para>
34592 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
34593 SRV records. If none are found, or if SRV support is not configured,
34594 MX records are looked up. If no MX records exist, address records are sought.
34595 However, <option>mx_domains</option> can be set to disable the direct use of address
34596 records.
34597 </para>
34598 <para>
34599 MX records of equal priority are sorted by Exim into a random order. Exim then
34600 looks for address records for the host names obtained from MX or SRV records.
34601 When a host has more than one IP address, they are sorted into a random order,
34602 except that IPv6 addresses are always sorted before IPv4 addresses. If all the
34603 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
34604 generic option, the router declines.
34605 </para>
34606 <para>
34607 Unless they have the highest priority (lowest MX value), MX records that point
34608 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
34609 are discarded, together with any other MX records of equal or lower priority.
34610 </para>
34611 <para>
34612 <indexterm role="concept">
34613 <primary>MX record</primary>
34614 <secondary>pointing to local host</secondary>
34615 </indexterm>
34616 <indexterm role="concept">
34617 <primary>local host</primary>
34618 <secondary>MX pointing to</secondary>
34619 </indexterm>
34620 <indexterm role="option">
34621 <primary><option>self</option></primary>
34622 <secondary>in <command>dnslookup</command> router</secondary>
34623 </indexterm>
34624 If the host pointed to by the highest priority MX record, or looked up as an
34625 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
34626 happens is controlled by the generic <option>self</option> option.
34627 </para>
34628 <section id="SECTprowitdnsloo">
34629 <title>Problems with DNS lookups</title>
34630 <para>
34631 There have been problems with DNS servers when SRV records are looked up.
34632 Some misbehaving servers return a DNS error or timeout when a non-existent
34633 SRV record is sought. Similar problems have in the past been reported for
34634 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
34635 problem, but it is heavy-handed because it is a global option.
34636 </para>
34637 <para>
34638 For this reason, there are two options, <option>srv_fail_domains</option> and
34639 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
34640 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
34641 an attempt to look up an SRV or MX record causes one of these results, and the
34642 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
34643 such record</quote>. In the case of an SRV lookup, this means that the router
34644 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
34645 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
34646 case routing fails.
34647 </para>
34648 </section>
34649 <section id="SECTdnslookupdecline">
34650 <title>Declining addresses by dnslookup</title>
34651 <para>
34652 <indexterm role="concept">
34653 <primary><command>dnslookup</command> router</primary>
34654 <secondary>declines</secondary>
34655 </indexterm>
34656 There are a few cases where a <command>dnslookup</command> router will decline to accept
34657 an address; if such a router is expected to handle "all remaining non-local
34658 domains", then it is important to set <option>no_more</option>.
34659 </para>
34660 <para>
34661 The router will defer rather than decline if the domain
34662 is found in the <option>fail_defer_domains</option> router option.
34663 </para>
34664 <para>
34665 Reasons for a <command>dnslookup</command> router to decline currently include:
34666 </para>
34667 <itemizedlist>
34668 <listitem>
34669 <para>
34670 The domain does not exist in DNS
34671 </para>
34672 </listitem>
34673 <listitem>
34674 <para>
34675 The domain exists but the MX record&#x2019;s host part is just "."; this is a common
34676 convention (borrowed from SRV) used to indicate that there is no such service
34677 for this domain and to not fall back to trying A/AAAA records.
34678 </para>
34679 </listitem>
34680 <listitem>
34681 <para>
34682 Ditto, but for SRV records, when <option>check_srv</option> is set on this router.
34683 </para>
34684 </listitem>
34685 <listitem>
34686 <para>
34687 MX record points to a non-existent host.
34688 </para>
34689 </listitem>
34690 <listitem>
34691 <para>
34692 MX record points to an IP address and the main section option
34693 <option>allow_mx_to_ip</option> is not set.
34694 </para>
34695 </listitem>
34696 <listitem>
34697 <para>
34698 MX records exist and point to valid hosts, but all hosts resolve only to
34699 addresses blocked by the <option>ignore_target_hosts</option> generic option on this router.
34700 </para>
34701 </listitem>
34702 <listitem>
34703 <para>
34704 The domain is not syntactically valid (see also <option>allow_utf8_domains</option> and
34705 <option>dns_check_names_pattern</option> for handling one variant of this)
34706 </para>
34707 </listitem>
34708 <listitem>
34709 <para>
34710 <option>check_secondary_mx</option> is set on this router but the local host can
34711 not be found in the MX records (see below)
34712 </para>
34713 </listitem>
34714 </itemizedlist>
34715 </section>
34716 <section id="SECID118">
34717 <title>Private options for dnslookup</title>
34718 <para>
34719 <indexterm role="concept">
34720 <primary>options</primary>
34721 <secondary><command>dnslookup</command> router</secondary>
34722 </indexterm>
34723 The private options for the <command>dnslookup</command> router are as follows:
34724 </para>
34725 <para>
34726 <indexterm role="option">
34727 <primary><option>check_secondary_mx</option></primary>
34728 </indexterm>
34729 </para>
34730 <informaltable frame="all">
34731 <tgroup cols="4" colsep="0" rowsep="0">
34732 <colspec colwidth="8*" align="left"/>
34733 <colspec colwidth="6*" align="center"/>
34734 <colspec colwidth="6*" align="center"/>
34735 <colspec colwidth="6*" align="right"/>
34736 <tbody>
34737 <row>
34738 <entry><option>check_secondary_mx</option></entry>
34739 <entry>Use: <emphasis>dnslookup</emphasis></entry>
34740 <entry>Type: <emphasis>boolean</emphasis></entry>
34741 <entry>Default: <emphasis>false</emphasis></entry>
34742 </row>
34743 </tbody>
34744 </tgroup>
34745 </informaltable>
34746 <para>
34747 <indexterm role="concept">
34748 <primary>MX record</primary>
34749 <secondary>checking for secondary</secondary>
34750 </indexterm>
34751 If this option is set, the router declines unless the local host is found in
34752 (and removed from) the list of hosts obtained by MX lookup. This can be used to
34753 process domains for which the local host is a secondary mail exchanger
34754 differently to other domains. The way in which Exim decides whether a host is
34755 the local host is described in section <xref linkend="SECTreclocipadd"/>.
34756 </para>
34757 <para>
34758 <indexterm role="option">
34759 <primary><option>check_srv</option></primary>
34760 </indexterm>
34761 </para>
34762 <informaltable frame="all">
34763 <tgroup cols="4" colsep="0" rowsep="0">
34764 <colspec colwidth="8*" align="left"/>
34765 <colspec colwidth="6*" align="center"/>
34766 <colspec colwidth="6*" align="center"/>
34767 <colspec colwidth="6*" align="right"/>
34768 <tbody>
34769 <row>
34770 <entry><option>check_srv</option></entry>
34771 <entry>Use: <emphasis>dnslookup</emphasis></entry>
34772 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34773 <entry>Default: <emphasis>unset</emphasis></entry>
34774 </row>
34775 </tbody>
34776 </tgroup>
34777 </informaltable>
34778 <para>
34779 <indexterm role="concept">
34780 <primary>SRV record</primary>
34781 <secondary>enabling use of</secondary>
34782 </indexterm>
34783 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
34784 addition to MX and address records. The support is disabled by default. To
34785 enable SRV support, set the <option>check_srv</option> option to the name of the service
34786 required. For example,
34787 </para>
34788 <literallayout class="monospaced">
34789 check_srv = smtp
34790 </literallayout>
34791 <para>
34792 looks for SRV records that refer to the normal smtp service. The option is
34793 expanded, so the service name can vary from message to message or address
34794 to address. This might be helpful if SRV records are being used for a
34795 submission service. If the expansion is forced to fail, the <option>check_srv</option>
34796 option is ignored, and the router proceeds to look for MX records in the
34797 normal way.
34798 </para>
34799 <para>
34800 When the expansion succeeds, the router searches first for SRV records for
34801 the given service (it assumes TCP protocol). A single SRV record with a
34802 host name that consists of just a single dot indicates <quote>no such service for
34803 this domain</quote>; if this is encountered, the router declines. If other kinds of
34804 SRV record are found, they are used to construct a host list for delivery
34805 according to the rules of RFC 2782. MX records are not sought in this case.
34806 </para>
34807 <para>
34808 When no SRV records are found, MX records (and address records) are sought in
34809 the traditional way. In other words, SRV records take precedence over MX
34810 records, just as MX records take precedence over address records. Note that
34811 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
34812 defined it. It is apparently believed that MX records are sufficient for email
34813 and that SRV records should not be used for this purpose. However, SRV records
34814 have an additional <quote>weight</quote> feature which some people might find useful when
34815 trying to split an SMTP load between hosts of different power.
34816 </para>
34817 <para>
34818 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim&#x2019;s behaviour
34819 when there is a DNS lookup error.
34820 </para>
34821 <para>
34822 <indexterm role="option">
34823 <primary><option>fail_defer_domains</option></primary>
34824 </indexterm>
34825 </para>
34826 <informaltable frame="all">
34827 <tgroup cols="4" colsep="0" rowsep="0">
34828 <colspec colwidth="8*" align="left"/>
34829 <colspec colwidth="6*" align="center"/>
34830 <colspec colwidth="6*" align="center"/>
34831 <colspec colwidth="6*" align="right"/>
34832 <tbody>
34833 <row>
34834 <entry><option>fail_defer_domains</option></entry>
34835 <entry>Use: <emphasis>dnslookup</emphasis></entry>
34836 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
34837 <entry>Default: <emphasis>unset</emphasis></entry>
34838 </row>
34839 </tbody>
34840 </tgroup>
34841 </informaltable>
34842 <para>
34843 <indexterm role="concept">
34844 <primary>MX record</primary>
34845 <secondary>not found</secondary>
34846 </indexterm>
34847 DNS lookups for domains matching <option>fail_defer_domains</option>
34848 which find no matching record will cause the router to defer
34849 rather than the default behaviour of decline.
34850 This maybe be useful for queueing messages for a newly created
34851 domain while the DNS configuration is not ready.
34852 However, it will result in any message with mistyped domains
34853 also being queued.
34854 </para>
34855 <para>
34856 <indexterm role="option">
34857 <primary><option>mx_domains</option></primary>
34858 </indexterm>
34859 </para>
34860 <informaltable frame="all">
34861 <tgroup cols="4" colsep="0" rowsep="0">
34862 <colspec colwidth="8*" align="left"/>
34863 <colspec colwidth="6*" align="center"/>
34864 <colspec colwidth="6*" align="center"/>
34865 <colspec colwidth="6*" align="right"/>
34866 <tbody>
34867 <row>
34868 <entry><option>mx_domains</option></entry>
34869 <entry>Use: <emphasis>dnslookup</emphasis></entry>
34870 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
34871 <entry>Default: <emphasis>unset</emphasis></entry>
34872 </row>
34873 </tbody>
34874 </tgroup>
34875 </informaltable>
34876 <para>
34877 <indexterm role="concept">
34878 <primary>MX record</primary>
34879 <secondary>required to exist</secondary>
34880 </indexterm>
34881 <indexterm role="concept">
34882 <primary>SRV record</primary>
34883 <secondary>required to exist</secondary>
34884 </indexterm>
34885 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
34886 record in order to be recognized. (The name of this option could be improved.)
34887 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
34888 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
34889 setting:
34890 </para>
34891 <literallayout class="monospaced">
34892 mx_domains = ! *.discworld.fict.example : *.fict.example
34893 </literallayout>
34894 <para>
34895 This specifies that messages addressed to a domain that matches the list but
34896 has no MX record should be bounced immediately instead of being routed using
34897 the address record.
34898 </para>
34899 <para>
34900 <indexterm role="option">
34901 <primary><option>mx_fail_domains</option></primary>
34902 </indexterm>
34903 </para>
34904 <informaltable frame="all">
34905 <tgroup cols="4" colsep="0" rowsep="0">
34906 <colspec colwidth="8*" align="left"/>
34907 <colspec colwidth="6*" align="center"/>
34908 <colspec colwidth="6*" align="center"/>
34909 <colspec colwidth="6*" align="right"/>
34910 <tbody>
34911 <row>
34912 <entry><option>mx_fail_domains</option></entry>
34913 <entry>Use: <emphasis>dnslookup</emphasis></entry>
34914 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
34915 <entry>Default: <emphasis>unset</emphasis></entry>
34916 </row>
34917 </tbody>
34918 </tgroup>
34919 </informaltable>
34920 <para>
34921 If the DNS lookup for MX records for one of the domains in this list causes a
34922 DNS lookup error, Exim behaves as if no MX records were found. See section
34923 <xref linkend="SECTprowitdnsloo"/> for more discussion.
34924 </para>
34925 <para>
34926 <indexterm role="option">
34927 <primary><option>qualify_single</option></primary>
34928 </indexterm>
34929 </para>
34930 <informaltable frame="all">
34931 <tgroup cols="4" colsep="0" rowsep="0">
34932 <colspec colwidth="8*" align="left"/>
34933 <colspec colwidth="6*" align="center"/>
34934 <colspec colwidth="6*" align="center"/>
34935 <colspec colwidth="6*" align="right"/>
34936 <tbody>
34937 <row>
34938 <entry><option>qualify_single</option></entry>
34939 <entry>Use: <emphasis>dnslookup</emphasis></entry>
34940 <entry>Type: <emphasis>boolean</emphasis></entry>
34941 <entry>Default: <emphasis>true</emphasis></entry>
34942 </row>
34943 </tbody>
34944 </tgroup>
34945 </informaltable>
34946 <para>
34947 <indexterm role="concept">
34948 <primary>DNS</primary>
34949 <secondary>resolver options</secondary>
34950 </indexterm>
34951 <indexterm role="concept">
34952 <primary>DNS</primary>
34953 <secondary>qualifying single-component names</secondary>
34954 </indexterm>
34955 When this option is true, the resolver option RES_DEFNAMES is set for DNS
34956 lookups. Typically, but not standardly, this causes the resolver to qualify
34957 single-component names with the default domain. For example, on a machine
34958 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
34959 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
34960 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
34961 <emphasis>resolv.conf</emphasis>.
34962 </para>
34963 <para>
34964 <indexterm role="option">
34965 <primary><option>rewrite_headers</option></primary>
34966 </indexterm>
34967 </para>
34968 <informaltable frame="all">
34969 <tgroup cols="4" colsep="0" rowsep="0">
34970 <colspec colwidth="8*" align="left"/>
34971 <colspec colwidth="6*" align="center"/>
34972 <colspec colwidth="6*" align="center"/>
34973 <colspec colwidth="6*" align="right"/>
34974 <tbody>
34975 <row>
34976 <entry><option>rewrite_headers</option></entry>
34977 <entry>Use: <emphasis>dnslookup</emphasis></entry>
34978 <entry>Type: <emphasis>boolean</emphasis></entry>
34979 <entry>Default: <emphasis>true</emphasis></entry>
34980 </row>
34981 </tbody>
34982 </tgroup>
34983 </informaltable>
34984 <para>
34985 <indexterm role="concept">
34986 <primary>rewriting</primary>
34987 <secondary>header lines</secondary>
34988 </indexterm>
34989 <indexterm role="concept">
34990 <primary>header lines</primary>
34991 <secondary>rewriting</secondary>
34992 </indexterm>
34993 If the domain name in the address that is being processed is not fully
34994 qualified, it may be expanded to its full form by a DNS lookup. For example, if
34995 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
34996 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
34997 occur as a result of setting the <option>widen_domains</option> option. If
34998 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
34999 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
35000 header lines of the message are rewritten with the full domain name.
35001 </para>
35002 <para>
35003 This option should be turned off only when it is known that no message is
35004 ever going to be sent outside an environment where the abbreviation makes
35005 sense.
35006 </para>
35007 <para>
35008 When an MX record is looked up in the DNS and matches a wildcard record, name
35009 servers normally return a record containing the name that has been looked up,
35010 making it impossible to detect whether a wildcard was present or not. However,
35011 some name servers have recently been seen to return the wildcard entry. If the
35012 name returned by a DNS lookup begins with an asterisk, it is not used for
35013 header rewriting.
35014 </para>
35015 <para>
35016 <indexterm role="option">
35017 <primary><option>same_domain_copy_routing</option></primary>
35018 </indexterm>
35019 </para>
35020 <informaltable frame="all">
35021 <tgroup cols="4" colsep="0" rowsep="0">
35022 <colspec colwidth="8*" align="left"/>
35023 <colspec colwidth="6*" align="center"/>
35024 <colspec colwidth="6*" align="center"/>
35025 <colspec colwidth="6*" align="right"/>
35026 <tbody>
35027 <row>
35028 <entry><option>same_domain_copy_routing</option></entry>
35029 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35030 <entry>Type: <emphasis>boolean</emphasis></entry>
35031 <entry>Default: <emphasis>false</emphasis></entry>
35032 </row>
35033 </tbody>
35034 </tgroup>
35035 </informaltable>
35036 <para>
35037 <indexterm role="concept">
35038 <primary>address</primary>
35039 <secondary>copying routing</secondary>
35040 </indexterm>
35041 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
35042 to the same list of hosts. However, this cannot be presumed, because the router
35043 options and preconditions may refer to the local part of the address. By
35044 default, therefore, Exim routes each address in a message independently. DNS
35045 servers run caches, so repeated DNS lookups are not normally expensive, and in
35046 any case, personal messages rarely have more than a few recipients.
35047 </para>
35048 <para>
35049 If you are running mailing lists with large numbers of subscribers at the same
35050 domain, and you are using a <command>dnslookup</command> router which is independent of the
35051 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
35052 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
35053 routes an address to a remote transport, any other unrouted addresses in the
35054 message that have the same domain are automatically given the same routing
35055 without processing them independently,
35056 provided the following conditions are met:
35057 </para>
35058 <itemizedlist>
35059 <listitem>
35060 <para>
35061 No router that processed the address specified <option>headers_add</option> or
35062 <option>headers_remove</option>.
35063 </para>
35064 </listitem>
35065 <listitem>
35066 <para>
35067 The router did not change the address in any way, for example, by <quote>widening</quote>
35068 the domain.
35069 </para>
35070 </listitem>
35071 </itemizedlist>
35072 <para>
35073 <indexterm role="option">
35074 <primary><option>search_parents</option></primary>
35075 </indexterm>
35076 </para>
35077 <informaltable frame="all">
35078 <tgroup cols="4" colsep="0" rowsep="0">
35079 <colspec colwidth="8*" align="left"/>
35080 <colspec colwidth="6*" align="center"/>
35081 <colspec colwidth="6*" align="center"/>
35082 <colspec colwidth="6*" align="right"/>
35083 <tbody>
35084 <row>
35085 <entry><option>search_parents</option></entry>
35086 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35087 <entry>Type: <emphasis>boolean</emphasis></entry>
35088 <entry>Default: <emphasis>false</emphasis></entry>
35089 </row>
35090 </tbody>
35091 </tgroup>
35092 </informaltable>
35093 <para>
35094 <indexterm role="concept">
35095 <primary>DNS</primary>
35096 <secondary>resolver options</secondary>
35097 </indexterm>
35098 When this option is true, the resolver option RES_DNSRCH is set for DNS
35099 lookups. This is different from the <option>qualify_single</option> option in that it
35100 applies to domains containing dots. Typically, but not standardly, it causes
35101 the resolver to search for the name in the current domain and in parent
35102 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
35103 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
35104 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
35105 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
35106 </para>
35107 <para>
35108 Setting this option true can cause problems in domains that have a wildcard MX
35109 record, because any domain that does not have its own MX record matches the
35110 local wildcard.
35111 </para>
35112 <para>
35113 <indexterm role="option">
35114 <primary><option>srv_fail_domains</option></primary>
35115 </indexterm>
35116 </para>
35117 <informaltable frame="all">
35118 <tgroup cols="4" colsep="0" rowsep="0">
35119 <colspec colwidth="8*" align="left"/>
35120 <colspec colwidth="6*" align="center"/>
35121 <colspec colwidth="6*" align="center"/>
35122 <colspec colwidth="6*" align="right"/>
35123 <tbody>
35124 <row>
35125 <entry><option>srv_fail_domains</option></entry>
35126 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35127 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
35128 <entry>Default: <emphasis>unset</emphasis></entry>
35129 </row>
35130 </tbody>
35131 </tgroup>
35132 </informaltable>
35133 <para>
35134 If the DNS lookup for SRV records for one of the domains in this list causes a
35135 DNS lookup error, Exim behaves as if no SRV records were found. See section
35136 <xref linkend="SECTprowitdnsloo"/> for more discussion.
35137 </para>
35138 <para>
35139 <indexterm role="option">
35140 <primary><option>widen_domains</option></primary>
35141 </indexterm>
35142 </para>
35143 <informaltable frame="all">
35144 <tgroup cols="4" colsep="0" rowsep="0">
35145 <colspec colwidth="8*" align="left"/>
35146 <colspec colwidth="6*" align="center"/>
35147 <colspec colwidth="6*" align="center"/>
35148 <colspec colwidth="6*" align="right"/>
35149 <tbody>
35150 <row>
35151 <entry><option>widen_domains</option></entry>
35152 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35153 <entry>Type: <emphasis>string list</emphasis></entry>
35154 <entry>Default: <emphasis>unset</emphasis></entry>
35155 </row>
35156 </tbody>
35157 </tgroup>
35158 </informaltable>
35159 <para>
35160 <indexterm role="concept">
35161 <primary>domain</primary>
35162 <secondary>partial; widening</secondary>
35163 </indexterm>
35164 If a DNS lookup fails and this option is set, each of its strings in turn is
35165 added onto the end of the domain, and the lookup is tried again. For example,
35166 if
35167 </para>
35168 <literallayout class="monospaced">
35169 widen_domains = fict.example:ref.example
35170 </literallayout>
35171 <para>
35172 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
35173 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
35174 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
35175 and <option>search_parents</option> options can cause some widening to be undertaken inside
35176 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
35177 when verifying, unless <option>rewrite_headers</option> is false (not the default).
35178 </para>
35179 </section>
35180 <section id="SECID119">
35181 <title>Effect of qualify_single and search_parents</title>
35182 <para>
35183 When a domain from an envelope recipient is changed by the resolver as a result
35184 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
35185 corresponding address in the message&#x2019;s header lines unless <option>rewrite_headers</option>
35186 is set false. Exim then re-routes the address, using the full domain.
35187 </para>
35188 <para>
35189 These two options affect only the DNS lookup that takes place inside the router
35190 for the domain of the address that is being routed. They do not affect lookups
35191 such as that implied by
35192 </para>
35193 <literallayout class="monospaced">
35194 domains = @mx_any
35195 </literallayout>
35196 <para>
35197 that may happen while processing a router precondition before the router is
35198 entered. No widening ever takes place for these lookups.
35199 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
35200 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
35201 </para>
35202 </section>
35203 </chapter>
35204
35205 <chapter id="CHID5">
35206 <title>The ipliteral router</title>
35207 <para>
35208 <indexterm role="concept">
35209 <primary><command>ipliteral</command> router</primary>
35210 </indexterm>
35211 <indexterm role="concept">
35212 <primary>domain literal</primary>
35213 <secondary>routing</secondary>
35214 </indexterm>
35215 <indexterm role="concept">
35216 <primary>routers</primary>
35217 <secondary><command>ipliteral</command></secondary>
35218 </indexterm>
35219 This router has no private options. Unless it is being used purely for
35220 verification (see <option>verify_only</option>) a transport is required to be defined by the
35221 generic <option>transport</option> option. The router accepts the address if its domain part
35222 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
35223 router handles the address
35224 </para>
35225 <literallayout class="monospaced">
35226 root@[192.168.1.1]
35227 </literallayout>
35228 <para>
35229 by setting up delivery to the host with that IP address. IPv4 domain literals
35230 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
35231 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
35232 </para>
35233 <literallayout class="monospaced">
35234 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
35235 </literallayout>
35236 <para>
35237 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
35238 grounds that sooner or later somebody will try it.
35239 </para>
35240 <para>
35241 <indexterm role="option">
35242 <primary><option>self</option></primary>
35243 <secondary>in <command>ipliteral</command> router</secondary>
35244 </indexterm>
35245 If the IP address matches something in <option>ignore_target_hosts</option>, the router
35246 declines. If an IP literal turns out to refer to the local host, the generic
35247 <option>self</option> option determines what happens.
35248 </para>
35249 <para>
35250 The RFCs require support for domain literals; however, their use is
35251 controversial in today&#x2019;s Internet. If you want to use this router, you must
35252 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
35253 Exim will not recognize the domain literal syntax in addresses.
35254 </para>
35255 </chapter>
35256
35257 <chapter id="CHID6">
35258 <title>The iplookup router</title>
35259 <para>
35260 <indexterm role="concept">
35261 <primary><command>iplookup</command> router</primary>
35262 </indexterm>
35263 <indexterm role="concept">
35264 <primary>routers</primary>
35265 <secondary><command>iplookup</command></secondary>
35266 </indexterm>
35267 The <command>iplookup</command> router was written to fulfil a specific requirement in
35268 Cambridge University (which in fact no longer exists). For this reason, it is
35269 not included in the binary of Exim by default. If you want to include it, you
35270 must set
35271 </para>
35272 <literallayout class="monospaced">
35273 ROUTER_IPLOOKUP=yes
35274 </literallayout>
35275 <para>
35276 in your <filename>Local/Makefile</filename> configuration file.
35277 </para>
35278 <para>
35279 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
35280 connection to one or more specific hosts. The host can then return the same or
35281 a different address &ndash; in effect rewriting the recipient address in the
35282 message&#x2019;s envelope. The new address is then passed on to subsequent routers. If
35283 this process fails, the address can be passed on to other routers, or delivery
35284 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
35285 must not be specified for it.
35286 </para>
35287 <para>
35288 <indexterm role="concept">
35289 <primary>options</primary>
35290 <secondary><command>iplookup</command> router</secondary>
35291 </indexterm>
35292 <indexterm role="option">
35293 <primary><option>hosts</option></primary>
35294 </indexterm>
35295 </para>
35296 <informaltable frame="all">
35297 <tgroup cols="4" colsep="0" rowsep="0">
35298 <colspec colwidth="8*" align="left"/>
35299 <colspec colwidth="6*" align="center"/>
35300 <colspec colwidth="6*" align="center"/>
35301 <colspec colwidth="6*" align="right"/>
35302 <tbody>
35303 <row>
35304 <entry><option>hosts</option></entry>
35305 <entry>Use: <emphasis>iplookup</emphasis></entry>
35306 <entry>Type: <emphasis>string</emphasis></entry>
35307 <entry>Default: <emphasis>unset</emphasis></entry>
35308 </row>
35309 </tbody>
35310 </tgroup>
35311 </informaltable>
35312 <para>
35313 This option must be supplied. Its value is a colon-separated list of host
35314 names. The hosts are looked up using <function>gethostbyname()</function>
35315 (or <function>getipnodebyname()</function> when available)
35316 and are tried in order until one responds to the query. If none respond, what
35317 happens is controlled by <option>optional</option>.
35318 </para>
35319 <para>
35320 <indexterm role="option">
35321 <primary><option>optional</option></primary>
35322 </indexterm>
35323 </para>
35324 <informaltable frame="all">
35325 <tgroup cols="4" colsep="0" rowsep="0">
35326 <colspec colwidth="8*" align="left"/>
35327 <colspec colwidth="6*" align="center"/>
35328 <colspec colwidth="6*" align="center"/>
35329 <colspec colwidth="6*" align="right"/>
35330 <tbody>
35331 <row>
35332 <entry><option>optional</option></entry>
35333 <entry>Use: <emphasis>iplookup</emphasis></entry>
35334 <entry>Type: <emphasis>boolean</emphasis></entry>
35335 <entry>Default: <emphasis>false</emphasis></entry>
35336 </row>
35337 </tbody>
35338 </tgroup>
35339 </informaltable>
35340 <para>
35341 If <option>optional</option> is true, if no response is obtained from any host, the address
35342 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
35343 delivery to the address is deferred.
35344 </para>
35345 <para>
35346 <indexterm role="option">
35347 <primary><option>port</option></primary>
35348 </indexterm>
35349 </para>
35350 <informaltable frame="all">
35351 <tgroup cols="4" colsep="0" rowsep="0">
35352 <colspec colwidth="8*" align="left"/>
35353 <colspec colwidth="6*" align="center"/>
35354 <colspec colwidth="6*" align="center"/>
35355 <colspec colwidth="6*" align="right"/>
35356 <tbody>
35357 <row>
35358 <entry><option>port</option></entry>
35359 <entry>Use: <emphasis>iplookup</emphasis></entry>
35360 <entry>Type: <emphasis>integer</emphasis></entry>
35361 <entry>Default: <emphasis>0</emphasis></entry>
35362 </row>
35363 </tbody>
35364 </tgroup>
35365 </informaltable>
35366 <para>
35367 <indexterm role="concept">
35368 <primary>port</primary>
35369 <secondary><command>iplookup</command> router</secondary>
35370 </indexterm>
35371 This option must be supplied. It specifies the port number for the TCP or UDP
35372 call.
35373 </para>
35374 <para>
35375 <indexterm role="option">
35376 <primary><option>protocol</option></primary>
35377 </indexterm>
35378 </para>
35379 <informaltable frame="all">
35380 <tgroup cols="4" colsep="0" rowsep="0">
35381 <colspec colwidth="8*" align="left"/>
35382 <colspec colwidth="6*" align="center"/>
35383 <colspec colwidth="6*" align="center"/>
35384 <colspec colwidth="6*" align="right"/>
35385 <tbody>
35386 <row>
35387 <entry><option>protocol</option></entry>
35388 <entry>Use: <emphasis>iplookup</emphasis></entry>
35389 <entry>Type: <emphasis>string</emphasis></entry>
35390 <entry>Default: <emphasis>udp</emphasis></entry>
35391 </row>
35392 </tbody>
35393 </tgroup>
35394 </informaltable>
35395 <para>
35396 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
35397 protocols is to be used.
35398 </para>
35399 <para>
35400 <indexterm role="option">
35401 <primary><option>query</option></primary>
35402 </indexterm>
35403 </para>
35404 <informaltable frame="all">
35405 <tgroup cols="4" colsep="0" rowsep="0">
35406 <colspec colwidth="8*" align="left"/>
35407 <colspec colwidth="6*" align="center"/>
35408 <colspec colwidth="6*" align="center"/>
35409 <colspec colwidth="6*" align="right"/>
35410 <tbody>
35411 <row>
35412 <entry><option>query</option></entry>
35413 <entry>Use: <emphasis>iplookup</emphasis></entry>
35414 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35415 <entry>Default: <emphasis>see below</emphasis></entry>
35416 </row>
35417 </tbody>
35418 </tgroup>
35419 </informaltable>
35420 <para>
35421 This defines the content of the query that is sent to the remote hosts. The
35422 default value is:
35423 </para>
35424 <literallayout class="monospaced">
35425 $local_part@$domain $local_part@$domain
35426 </literallayout>
35427 <para>
35428 The repetition serves as a way of checking that a response is to the correct
35429 query in the default case (see <option>response_pattern</option> below).
35430 </para>
35431 <para>
35432 <indexterm role="option">
35433 <primary><option>reroute</option></primary>
35434 </indexterm>
35435 </para>
35436 <informaltable frame="all">
35437 <tgroup cols="4" colsep="0" rowsep="0">
35438 <colspec colwidth="8*" align="left"/>
35439 <colspec colwidth="6*" align="center"/>
35440 <colspec colwidth="6*" align="center"/>
35441 <colspec colwidth="6*" align="right"/>
35442 <tbody>
35443 <row>
35444 <entry><option>reroute</option></entry>
35445 <entry>Use: <emphasis>iplookup</emphasis></entry>
35446 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35447 <entry>Default: <emphasis>unset</emphasis></entry>
35448 </row>
35449 </tbody>
35450 </tgroup>
35451 </informaltable>
35452 <para>
35453 If this option is not set, the rerouted address is precisely the byte string
35454 returned by the remote host, up to the first white space, if any. If set, the
35455 string is expanded to form the rerouted address. It can include parts matched
35456 in the response by <option>response_pattern</option> by means of numeric variables such as
35457 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
35458 whether or not a pattern is in use. In all cases, the rerouted address must end
35459 up in the form <emphasis>local_part@domain</emphasis>.
35460 </para>
35461 <para>
35462 <indexterm role="option">
35463 <primary><option>response_pattern</option></primary>
35464 </indexterm>
35465 </para>
35466 <informaltable frame="all">
35467 <tgroup cols="4" colsep="0" rowsep="0">
35468 <colspec colwidth="8*" align="left"/>
35469 <colspec colwidth="6*" align="center"/>
35470 <colspec colwidth="6*" align="center"/>
35471 <colspec colwidth="6*" align="right"/>
35472 <tbody>
35473 <row>
35474 <entry><option>response_pattern</option></entry>
35475 <entry>Use: <emphasis>iplookup</emphasis></entry>
35476 <entry>Type: <emphasis>string</emphasis></entry>
35477 <entry>Default: <emphasis>unset</emphasis></entry>
35478 </row>
35479 </tbody>
35480 </tgroup>
35481 </informaltable>
35482 <para>
35483 This option can be set to a regular expression that is applied to the string
35484 returned from the remote host. If the pattern does not match the response, the
35485 router declines. If <option>response_pattern</option> is not set, no checking of the
35486 response is done, unless the query was defaulted, in which case there is a
35487 check that the text returned after the first white space is the original
35488 address. This checks that the answer that has been received is in response to
35489 the correct question. For example, if the response is just a new domain, the
35490 following could be used:
35491 </para>
35492 <literallayout class="monospaced">
35493 response_pattern = ^([^@]+)$
35494 reroute = $local_part@$1
35495 </literallayout>
35496 <para>
35497 <indexterm role="option">
35498 <primary><option>timeout</option></primary>
35499 </indexterm>
35500 </para>
35501 <informaltable frame="all">
35502 <tgroup cols="4" colsep="0" rowsep="0">
35503 <colspec colwidth="8*" align="left"/>
35504 <colspec colwidth="6*" align="center"/>
35505 <colspec colwidth="6*" align="center"/>
35506 <colspec colwidth="6*" align="right"/>
35507 <tbody>
35508 <row>
35509 <entry><option>timeout</option></entry>
35510 <entry>Use: <emphasis>iplookup</emphasis></entry>
35511 <entry>Type: <emphasis>time</emphasis></entry>
35512 <entry>Default: <emphasis>5s</emphasis></entry>
35513 </row>
35514 </tbody>
35515 </tgroup>
35516 </informaltable>
35517 <para>
35518 This specifies the amount of time to wait for a response from the remote
35519 machine. The same timeout is used for the <function>connect()</function> function for a TCP
35520 call. It does not apply to UDP.
35521 </para>
35522 </chapter>
35523
35524 <chapter id="CHID7">
35525 <title>The manualroute router</title>
35526 <para>
35527 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
35528 <primary><command>manualroute</command> router</primary>
35529 </indexterm>
35530 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
35531 <primary>routers</primary>
35532 <secondary><command>manualroute</command></secondary>
35533 </indexterm>
35534 <indexterm role="concept">
35535 <primary>domain</primary>
35536 <secondary>manually routing</secondary>
35537 </indexterm>
35538 The <command>manualroute</command> router is so-called because it provides a way of manually
35539 routing an address according to its domain. It is mainly used when you want to
35540 route addresses to remote hosts according to your own rules, bypassing the
35541 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
35542 route to local transports, a facility that may be useful if you want to save
35543 messages for dial-in hosts in local files.
35544 </para>
35545 <para>
35546 The <command>manualroute</command> router compares a list of domain patterns with the domain
35547 it is trying to route. If there is no match, the router declines. Each pattern
35548 has associated with it a list of hosts and some other optional data, which may
35549 include a transport. The combination of a pattern and its data is called a
35550 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
35551 generic <option>transport</option> option must specify a transport, unless the router is
35552 being used purely for verification (see <option>verify_only</option>).
35553 </para>
35554 <para>
35555 <indexterm role="variable">
35556 <primary><varname>$host</varname></primary>
35557 </indexterm>
35558 In the case of verification, matching the domain pattern is sufficient for the
35559 router to accept the address. When actually routing an address for delivery,
35560 an address that matches a domain pattern is queued for the associated
35561 transport. If the transport is not a local one, a host list must be associated
35562 with the pattern; IP addresses are looked up for the hosts, and these are
35563 passed to the transport along with the mail address. For local transports, a
35564 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
35565 text string.
35566 </para>
35567 <para>
35568 The list of routing rules can be provided as an inline string in
35569 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
35570 or database by setting <option>route_data</option>. Only one of these settings may appear in
35571 any one instance of <command>manualroute</command>. The format of routing rules is described
35572 below, following the list of private options.
35573 </para>
35574 <section id="SECTprioptman">
35575 <title>Private options for manualroute</title>
35576 <para>
35577 <indexterm role="concept">
35578 <primary>options</primary>
35579 <secondary><command>manualroute</command> router</secondary>
35580 </indexterm>
35581 The private options for the <command>manualroute</command> router are as follows:
35582 </para>
35583 <para>
35584 <indexterm role="option">
35585 <primary><option>host_all_ignored</option></primary>
35586 </indexterm>
35587 </para>
35588 <informaltable frame="all">
35589 <tgroup cols="4" colsep="0" rowsep="0">
35590 <colspec colwidth="8*" align="left"/>
35591 <colspec colwidth="6*" align="center"/>
35592 <colspec colwidth="6*" align="center"/>
35593 <colspec colwidth="6*" align="right"/>
35594 <tbody>
35595 <row>
35596 <entry><option>host_all_ignored</option></entry>
35597 <entry>Use: <emphasis>manualroute</emphasis></entry>
35598 <entry>Type: <emphasis>string</emphasis></entry>
35599 <entry>Default: <emphasis>defer</emphasis></entry>
35600 </row>
35601 </tbody>
35602 </tgroup>
35603 </informaltable>
35604 <para>
35605 See <option>host_find_failed</option>.
35606 </para>
35607 <para>
35608 <indexterm role="option">
35609 <primary><option>host_find_failed</option></primary>
35610 </indexterm>
35611 </para>
35612 <informaltable frame="all">
35613 <tgroup cols="4" colsep="0" rowsep="0">
35614 <colspec colwidth="8*" align="left"/>
35615 <colspec colwidth="6*" align="center"/>
35616 <colspec colwidth="6*" align="center"/>
35617 <colspec colwidth="6*" align="right"/>
35618 <tbody>
35619 <row>
35620 <entry><option>host_find_failed</option></entry>
35621 <entry>Use: <emphasis>manualroute</emphasis></entry>
35622 <entry>Type: <emphasis>string</emphasis></entry>
35623 <entry>Default: <emphasis>freeze</emphasis></entry>
35624 </row>
35625 </tbody>
35626 </tgroup>
35627 </informaltable>
35628 <para>
35629 This option controls what happens when <command>manualroute</command> tries to find an IP
35630 address for a host, and the host does not exist. The option can be set to one
35631 of the following values:
35632 </para>
35633 <literallayout class="monospaced">
35634 decline
35635 defer
35636 fail
35637 freeze
35638 ignore
35639 pass
35640 </literallayout>
35641 <para>
35642 The default (<quote>freeze</quote>) assumes that this state is a serious configuration
35643 error. The difference between <quote>pass</quote> and <quote>decline</quote> is that the former
35644 forces the address to be passed to the next router (or the router defined by
35645 <option>pass_router</option>),
35646 <indexterm role="option">
35647 <primary><option>more</option></primary>
35648 </indexterm>
35649 overriding <option>no_more</option>, whereas the latter passes the address to the next
35650 router only if <option>more</option> is true.
35651 </para>
35652 <para>
35653 The value <quote>ignore</quote> causes Exim to completely ignore a host whose IP address
35654 cannot be found. If all the hosts in the list are ignored, the behaviour is
35655 controlled by the <option>host_all_ignored</option> option. This takes the same values
35656 as <option>host_find_failed</option>, except that it cannot be set to <quote>ignore</quote>.
35657 </para>
35658 <para>
35659 The <option>host_find_failed</option> option applies only to a definite <quote>does not exist</quote>
35660 state; if a host lookup gets a temporary error, delivery is deferred unless the
35661 generic <option>pass_on_timeout</option> option is set.
35662 </para>
35663 <para>
35664 <indexterm role="option">
35665 <primary><option>hosts_randomize</option></primary>
35666 </indexterm>
35667 </para>
35668 <informaltable frame="all">
35669 <tgroup cols="4" colsep="0" rowsep="0">
35670 <colspec colwidth="8*" align="left"/>
35671 <colspec colwidth="6*" align="center"/>
35672 <colspec colwidth="6*" align="center"/>
35673 <colspec colwidth="6*" align="right"/>
35674 <tbody>
35675 <row>
35676 <entry><option>hosts_randomize</option></entry>
35677 <entry>Use: <emphasis>manualroute</emphasis></entry>
35678 <entry>Type: <emphasis>boolean</emphasis></entry>
35679 <entry>Default: <emphasis>false</emphasis></entry>
35680 </row>
35681 </tbody>
35682 </tgroup>
35683 </informaltable>
35684 <para>
35685 <indexterm role="concept">
35686 <primary>randomized host list</primary>
35687 </indexterm>
35688 <indexterm role="concept">
35689 <primary>host</primary>
35690 <secondary>list of; randomized</secondary>
35691 </indexterm>
35692 If this option is set, the order of the items in a host list in a routing rule
35693 is randomized each time the list is used, unless an option in the routing rule
35694 overrides (see below). Randomizing the order of a host list can be used to do
35695 crude load sharing. However, if more than one mail address is routed by the
35696 same router to the same host list, the host lists are considered to be the same
35697 (even though they may be randomized into different orders) for the purpose of
35698 deciding whether to batch the deliveries into a single SMTP transaction.
35699 </para>
35700 <para>
35701 When <option>hosts_randomize</option> is true, a host list may be split
35702 into groups whose order is separately randomized. This makes it possible to
35703 set up MX-like behaviour. The boundaries between groups are indicated by an
35704 item that is just <literal>+</literal> in the host list. For example:
35705 </para>
35706 <literallayout class="monospaced">
35707 route_list = * host1:host2:host3:+:host4:host5
35708 </literallayout>
35709 <para>
35710 The order of the first three hosts and the order of the last two hosts is
35711 randomized for each use, but the first three always end up before the last two.
35712 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
35713 randomized host list is passed to an <command>smtp</command> transport that also has
35714 <option>hosts_randomize set</option>, the list is not re-randomized.
35715 </para>
35716 <para>
35717 <indexterm role="option">
35718 <primary><option>route_data</option></primary>
35719 </indexterm>
35720 </para>
35721 <informaltable frame="all">
35722 <tgroup cols="4" colsep="0" rowsep="0">
35723 <colspec colwidth="8*" align="left"/>
35724 <colspec colwidth="6*" align="center"/>
35725 <colspec colwidth="6*" align="center"/>
35726 <colspec colwidth="6*" align="right"/>
35727 <tbody>
35728 <row>
35729 <entry><option>route_data</option></entry>
35730 <entry>Use: <emphasis>manualroute</emphasis></entry>
35731 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35732 <entry>Default: <emphasis>unset</emphasis></entry>
35733 </row>
35734 </tbody>
35735 </tgroup>
35736 </informaltable>
35737 <para>
35738 If this option is set, it must expand to yield the data part of a routing rule.
35739 Typically, the expansion string includes a lookup based on the domain. For
35740 example:
35741 </para>
35742 <literallayout class="monospaced">
35743 route_data = ${lookup{$domain}dbm{/etc/routes}}
35744 </literallayout>
35745 <para>
35746 If the expansion is forced to fail, or the result is an empty string, the
35747 router declines. Other kinds of expansion failure cause delivery to be
35748 deferred.
35749 </para>
35750 <para>
35751 <indexterm role="option">
35752 <primary><option>route_list</option></primary>
35753 </indexterm>
35754 </para>
35755 <informaltable frame="all">
35756 <tgroup cols="4" colsep="0" rowsep="0">
35757 <colspec colwidth="8*" align="left"/>
35758 <colspec colwidth="6*" align="center"/>
35759 <colspec colwidth="6*" align="center"/>
35760 <colspec colwidth="6*" align="right"/>
35761 <tbody>
35762 <row>
35763 <entry><option>route_list</option></entry>
35764 <entry>Use: <emphasis>manualroute</emphasis></entry>
35765 <entry>Type: <emphasis>string list</emphasis></entry>
35766 <entry>Default: <emphasis>unset</emphasis></entry>
35767 </row>
35768 </tbody>
35769 </tgroup>
35770 </informaltable>
35771 <para>
35772 This string is a list of routing rules, in the form defined below. Note that,
35773 unlike most string lists, the items are separated by semicolons. This is so
35774 that they may contain colon-separated host lists.
35775 </para>
35776 <para>
35777 <indexterm role="option">
35778 <primary><option>same_domain_copy_routing</option></primary>
35779 </indexterm>
35780 </para>
35781 <informaltable frame="all">
35782 <tgroup cols="4" colsep="0" rowsep="0">
35783 <colspec colwidth="8*" align="left"/>
35784 <colspec colwidth="6*" align="center"/>
35785 <colspec colwidth="6*" align="center"/>
35786 <colspec colwidth="6*" align="right"/>
35787 <tbody>
35788 <row>
35789 <entry><option>same_domain_copy_routing</option></entry>
35790 <entry>Use: <emphasis>manualroute</emphasis></entry>
35791 <entry>Type: <emphasis>boolean</emphasis></entry>
35792 <entry>Default: <emphasis>false</emphasis></entry>
35793 </row>
35794 </tbody>
35795 </tgroup>
35796 </informaltable>
35797 <para>
35798 <indexterm role="concept">
35799 <primary>address</primary>
35800 <secondary>copying routing</secondary>
35801 </indexterm>
35802 Addresses with the same domain are normally routed by the <command>manualroute</command>
35803 router to the same list of hosts. However, this cannot be presumed, because the
35804 router options and preconditions may refer to the local part of the address. By
35805 default, therefore, Exim routes each address in a message independently. DNS
35806 servers run caches, so repeated DNS lookups are not normally expensive, and in
35807 any case, personal messages rarely have more than a few recipients.
35808 </para>
35809 <para>
35810 If you are running mailing lists with large numbers of subscribers at the same
35811 domain, and you are using a <command>manualroute</command> router which is independent of the
35812 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
35813 lookups for identical domains in one message. In this case, when
35814 <command>manualroute</command> routes an address to a remote transport, any other unrouted
35815 addresses in the message that have the same domain are automatically given the
35816 same routing without processing them independently. However, this is only done
35817 if <option>headers_add</option> and <option>headers_remove</option> are unset.
35818 </para>
35819 </section>
35820 <section id="SECID120">
35821 <title>Routing rules in route_list</title>
35822 <para>
35823 The value of <option>route_list</option> is a string consisting of a sequence of routing
35824 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
35825 entered as two semicolons. Alternatively, the list separator can be changed as
35826 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
35827 Empty rules are ignored. The format of each rule is
35828 </para>
35829 <literallayout>
35830 &lt;<emphasis>domain pattern</emphasis>&gt;  &lt;<emphasis>list of hosts</emphasis>&gt;  &lt;<emphasis>options</emphasis>&gt;
35831 </literallayout>
35832 <para>
35833 The following example contains two rules, each with a simple domain pattern and
35834 no options:
35835 </para>
35836 <literallayout class="monospaced">
35837 route_list = \
35838   dict.ref.example  mail-1.ref.example:mail-2.ref.example ; \
35839   thes.ref.example  mail-3.ref.example:mail-4.ref.example
35840 </literallayout>
35841 <para>
35842 The three parts of a rule are separated by white space. The pattern and the
35843 list of hosts can be enclosed in quotes if necessary, and if they are, the
35844 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
35845 single domain pattern, which is the only mandatory item in the rule. The
35846 pattern is in the same format as one item in a domain list (see section
35847 <xref linkend="SECTdomainlist"/>),
35848 except that it may not be the name of an interpolated file.
35849 That is, it may be wildcarded, or a regular expression, or a file or database
35850 lookup (with semicolons doubled, because of the use of semicolon as a separator
35851 in a <option>route_list</option>).
35852 </para>
35853 <para>
35854 The rules in <option>route_list</option> are searched in order until one of the patterns
35855 matches the domain that is being routed. The list of hosts and then options are
35856 then used as described below. If there is no match, the router declines. When
35857 <option>route_list</option> is set, <option>route_data</option> must not be set.
35858 </para>
35859 </section>
35860 <section id="SECID121">
35861 <title>Routing rules in route_data</title>
35862 <para>
35863 The use of <option>route_list</option> is convenient when there are only a small number of
35864 routing rules. For larger numbers, it is easier to use a file or database to
35865 hold the routing information, and use the <option>route_data</option> option instead.
35866 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
35867 Most commonly, <option>route_data</option> is set as a string that contains an
35868 expansion lookup. For example, suppose we place two routing rules in a file
35869 like this:
35870 </para>
35871 <literallayout class="monospaced">
35872 dict.ref.example:  mail-1.ref.example:mail-2.ref.example
35873 thes.ref.example:  mail-3.ref.example:mail-4.ref.example
35874 </literallayout>
35875 <para>
35876 This data can be accessed by setting
35877 </para>
35878 <literallayout class="monospaced">
35879 route_data = ${lookup{$domain}lsearch{/the/file/name}}
35880 </literallayout>
35881 <para>
35882 Failure of the lookup results in an empty string, causing the router to
35883 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
35884 requirement is that the result of expanding the string is a list of hosts,
35885 possibly followed by options, separated by white space. The list of hosts must
35886 be enclosed in quotes if it contains white space.
35887 </para>
35888 </section>
35889 <section id="SECID122">
35890 <title>Format of the list of hosts</title>
35891 <para>
35892 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
35893 always separately expanded before use. If the expansion fails, the router
35894 declines. The result of the expansion must be a colon-separated list of names
35895 and/or IP addresses, optionally also including ports. The format of each item
35896 in the list is described in the next section. The list separator can be changed
35897 as described in section <xref linkend="SECTlistconstruct"/>.
35898 </para>
35899 <para>
35900 If the list of hosts was obtained from a <option>route_list</option> item, the following
35901 variables are set during its expansion:
35902 </para>
35903 <itemizedlist>
35904 <listitem>
35905 <para>
35906 <indexterm role="concept">
35907 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname>  etc)</primary>
35908 <secondary>in <command>manualroute</command> router</secondary>
35909 </indexterm>
35910 If the domain was matched against a regular expression, the numeric variables
35911 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
35912 </para>
35913 <literallayout class="monospaced">
35914 route_list = ^domain(\d+)   host-$1.text.example
35915 </literallayout>
35916 </listitem>
35917 <listitem>
35918 <para>
35919 <varname>$0</varname> is always set to the entire domain.
35920 </para>
35921 </listitem>
35922 <listitem>
35923 <para>
35924 <varname>$1</varname> is also set when partial matching is done in a file lookup.
35925 </para>
35926 </listitem>
35927 <listitem>
35928 <para>
35929 <indexterm role="variable">
35930 <primary><varname>$value</varname></primary>
35931 </indexterm>
35932 If the pattern that matched the domain was a lookup item, the data that was
35933 looked up is available in the expansion variable <varname>$value</varname>. For example:
35934 </para>
35935 <literallayout class="monospaced">
35936 route_list = lsearch;;/some/file.routes  $value
35937 </literallayout>
35938 </listitem>
35939 </itemizedlist>
35940 <para>
35941 Note the doubling of the semicolon in the pattern that is necessary because
35942 semicolon is the default route list separator.
35943 </para>
35944 </section>
35945 <section id="SECTformatonehostitem">
35946 <title>Format of one host item</title>
35947 <para>
35948 Each item in the list of hosts is either a host name or an IP address,
35949 optionally with an attached port number. When no port is given, an IP address
35950 is not enclosed in brackets. When a port is specified, it overrides the port
35951 specification on the transport. The port is separated from the name or address
35952 by a colon. This leads to some complications:
35953 </para>
35954 <itemizedlist>
35955 <listitem>
35956 <para>
35957 Because colon is the default separator for the list of hosts, either
35958 the colon that specifies a port must be doubled, or the list separator must
35959 be changed. The following two examples have the same effect:
35960 </para>
35961 <literallayout class="monospaced">
35962 route_list = * "host1.tld::1225 : host2.tld::1226"
35963 route_list = * "&lt;+ host1.tld:1225 + host2.tld:1226"
35964 </literallayout>
35965 </listitem>
35966 <listitem>
35967 <para>
35968 When IPv6 addresses are involved, it gets worse, because they contain
35969 colons of their own. To make this case easier, it is permitted to
35970 enclose an IP address (either v4 or v6) in square brackets if a port
35971 number follows. For example:
35972 </para>
35973 <literallayout class="monospaced">
35974 route_list = * "&lt;/ [10.1.1.1]:1225 / [::1]:1226"
35975 </literallayout>
35976 </listitem>
35977 </itemizedlist>
35978 </section>
35979 <section id="SECThostshowused">
35980 <title>How the list of hosts is used</title>
35981 <para>
35982 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
35983 the hosts is tried, in the order specified, when carrying out the SMTP
35984 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
35985 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
35986 transport.
35987 </para>
35988 <para>
35989 Hosts may be listed by name or by IP address. An unadorned name in the list of
35990 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
35991 interpreted as an indirection to a sublist of hosts obtained by looking up MX
35992 records in the DNS. For example:
35993 </para>
35994 <literallayout class="monospaced">
35995 route_list = *  x.y.z:p.q.r/MX:e.f.g
35996 </literallayout>
35997 <para>
35998 If this feature is used with a port specifier, the port must come last. For
35999 example:
36000 </para>
36001 <literallayout class="monospaced">
36002 route_list = *  dom1.tld/mx::1225
36003 </literallayout>
36004 <para>
36005 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
36006 randomized before any lookups are done. Exim then scans the list; for any name
36007 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
36008 be an interface on the local host and the item is not the first in the list,
36009 Exim discards it and any subsequent items. If it is the first item, what
36010 happens is controlled by the
36011 <indexterm role="option">
36012 <primary><option>self</option></primary>
36013 <secondary>in <command>manualroute</command> router</secondary>
36014 </indexterm>
36015 <option>self</option> option of the router.
36016 </para>
36017 <para>
36018 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
36019 hosts obtained by looking up MX records for the name. This is always a DNS
36020 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
36021 below) are not relevant here. The order of these hosts is determined by the
36022 preference values in the MX records, according to the usual rules. Because
36023 randomizing happens before the MX lookup, it does not affect the order that is
36024 defined by MX preferences.
36025 </para>
36026 <para>
36027 If the local host is present in the sublist obtained from MX records, but is
36028 not the most preferred host in that list, it and any equally or less
36029 preferred hosts are removed before the sublist is inserted into the main list.
36030 </para>
36031 <para>
36032 If the local host is the most preferred host in the MX list, what happens
36033 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
36034 is not the first item (that is, there are previous hosts in the main list),
36035 Exim discards this name and any subsequent items in the main list.
36036 </para>
36037 <para>
36038 If the MX item is first in the list of hosts, and the local host is the
36039 most preferred host, what happens is controlled by the <option>self</option> option of the
36040 router.
36041 </para>
36042 <para>
36043 DNS failures when lookup up the MX records are treated in the same way as DNS
36044 failures when looking up IP addresses: <option>pass_on_timeout</option> and
36045 <option>host_find_failed</option> are used when relevant.
36046 </para>
36047 <para>
36048 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
36049 whether obtained from an MX lookup or not.
36050 </para>
36051 </section>
36052 <section id="SECThowoptused">
36053 <title>How the options are used</title>
36054 <para>
36055 The options are a sequence of words; in practice no more than three are ever
36056 present. One of the words can be the name of a transport; this overrides the
36057 <option>transport</option> option on the router for this particular routing rule only. The
36058 other words (if present) control randomization of the list of hosts on a
36059 per-rule basis, and how the IP addresses of the hosts are to be found when
36060 routing to a remote transport. These options are as follows:
36061 </para>
36062 <itemizedlist>
36063 <listitem>
36064 <para>
36065 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
36066 setting of <option>hosts_randomize</option> for this routing rule only.
36067 </para>
36068 </listitem>
36069 <listitem>
36070 <para>
36071 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
36072 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
36073 </para>
36074 </listitem>
36075 <listitem>
36076 <para>
36077 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
36078 find IP addresses. This function may ultimately cause a DNS lookup, but it may
36079 also look in <filename>/etc/hosts</filename> or other sources of information.
36080 </para>
36081 </listitem>
36082 <listitem>
36083 <para>
36084 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
36085 no address records are found. If there is a temporary DNS error (such as a
36086 timeout), delivery is deferred.
36087 </para>
36088 </listitem>
36089 </itemizedlist>
36090 <para>
36091 For example:
36092 </para>
36093 <literallayout class="monospaced">
36094 route_list = domain1  host1:host2:host3  randomize bydns;\
36095              domain2  host4:host5
36096 </literallayout>
36097 <para>
36098 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
36099 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
36100 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
36101 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
36102 call.
36103 </para>
36104 <para>
36105 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
36106 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
36107 instead of TRY_AGAIN. That is why the default action is to try a DNS
36108 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
36109 function called.
36110 </para>
36111 <para>
36112 If no IP address for a host can be found, what happens is controlled by the
36113 <option>host_find_failed</option> option.
36114 </para>
36115 <para>
36116 <indexterm role="variable">
36117 <primary><varname>$host</varname></primary>
36118 </indexterm>
36119 When an address is routed to a local transport, IP addresses are not looked up.
36120 The host list is passed to the transport in the <varname>$host</varname> variable.
36121 </para>
36122 </section>
36123 <section id="SECID123">
36124 <title>Manualroute examples</title>
36125 <para>
36126 In some of the examples that follow, the presence of the <option>remote_smtp</option>
36127 transport, as defined in the default configuration file, is assumed:
36128 </para>
36129 <itemizedlist>
36130 <listitem>
36131 <para>
36132 <indexterm role="concept">
36133 <primary>smart host</primary>
36134 <secondary>example router</secondary>
36135 </indexterm>
36136 The <command>manualroute</command> router can be used to forward all external mail to a
36137 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
36138 named domain list that contains your local domains, for example:
36139 </para>
36140 <literallayout class="monospaced">
36141 domainlist local_domains = my.domain.example
36142 </literallayout>
36143 <para>
36144 You can arrange for all other domains to be routed to a smart host by making
36145 your first router something like this:
36146 </para>
36147 <literallayout class="monospaced">
36148 smart_route:
36149   driver = manualroute
36150   domains = !+local_domains
36151   transport = remote_smtp
36152   route_list = * smarthost.ref.example
36153 </literallayout>
36154 <para>
36155 This causes all non-local addresses to be sent to the single host
36156 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
36157 they are tried in order
36158 (but you can use <option>hosts_randomize</option> to vary the order each time).
36159 Another way of configuring the same thing is this:
36160 </para>
36161 <literallayout class="monospaced">
36162 smart_route:
36163   driver = manualroute
36164   transport = remote_smtp
36165   route_list = !+local_domains  smarthost.ref.example
36166 </literallayout>
36167 <para>
36168 There is no difference in behaviour between these two routers as they stand.
36169 However, they behave differently if <option>no_more</option> is added to them. In the first
36170 example, the router is skipped if the domain does not match the <option>domains</option>
36171 precondition; the following router is always tried. If the router runs, it
36172 always matches the domain and so can never decline. Therefore, <option>no_more</option>
36173 would have no effect. In the second case, the router is never skipped; it
36174 always runs. However, if it doesn&#x2019;t match the domain, it declines. In this case
36175 <option>no_more</option> would prevent subsequent routers from running.
36176 </para>
36177 </listitem>
36178 <listitem>
36179 <para>
36180 <indexterm role="concept">
36181 <primary>mail hub example</primary>
36182 </indexterm>
36183 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
36184 records in the DNS and delivers it via its own private routing mechanism. Often
36185 the final destinations are behind a firewall, with the mail hub being the one
36186 machine that can connect to machines both inside and outside the firewall. The
36187 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
36188 to the correct hosts. For a small number of domains, the routing can be inline,
36189 using the <option>route_list</option> option, but for a larger number a file or database
36190 lookup is easier to manage.
36191 </para>
36192 <para>
36193 If the domain names are in fact the names of the machines to which the mail is
36194 to be sent by the mail hub, the configuration can be quite simple. For
36195 example:
36196 </para>
36197 <literallayout class="monospaced">
36198 hub_route:
36199   driver = manualroute
36200   transport = remote_smtp
36201   route_list = *.rhodes.tvs.example  $domain
36202 </literallayout>
36203 <para>
36204 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
36205 whose names are the same as the mail domains. A similar approach can be taken
36206 if the host name can be obtained from the domain name by a string manipulation
36207 that the expansion facilities can handle. Otherwise, a lookup based on the
36208 domain can be used to find the host:
36209 </para>
36210 <literallayout class="monospaced">
36211 through_firewall:
36212   driver = manualroute
36213   transport = remote_smtp
36214   route_data = ${lookup {$domain} cdb {/internal/host/routes}}
36215 </literallayout>
36216 <para>
36217 The result of the lookup must be the name or IP address of the host (or
36218 hosts) to which the address is to be routed. If the lookup fails, the route
36219 data is empty, causing the router to decline. The address then passes to the
36220 next router.
36221 </para>
36222 </listitem>
36223 <listitem>
36224 <para>
36225 <indexterm role="concept">
36226 <primary>batched SMTP output example</primary>
36227 </indexterm>
36228 <indexterm role="concept">
36229 <primary>SMTP</primary>
36230 <secondary>batched outgoing; example</secondary>
36231 </indexterm>
36232 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
36233 SMTP format for onward transportation by some other means. This is one way of
36234 storing mail for a dial-up host when it is not connected. The route list entry
36235 can be as simple as a single domain name in a configuration like this:
36236 </para>
36237 <literallayout class="monospaced">
36238 save_in_file:
36239   driver = manualroute
36240   transport = batchsmtp_appendfile
36241   route_list = saved.domain.example
36242 </literallayout>
36243 <para>
36244 though often a pattern is used to pick up more than one domain. If there are
36245 several domains or groups of domains with different transport requirements,
36246 different transports can be listed in the routing information:
36247 </para>
36248 <literallayout class="monospaced">
36249 save_in_file:
36250   driver = manualroute
36251   route_list = \
36252     *.saved.domain1.example  $domain  batch_appendfile; \
36253     *.saved.domain2.example  \
36254       ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
36255       batch_pipe
36256 </literallayout>
36257 <para>
36258 <indexterm role="variable">
36259 <primary><varname>$domain</varname></primary>
36260 </indexterm>
36261 <indexterm role="variable">
36262 <primary><varname>$host</varname></primary>
36263 </indexterm>
36264 The first of these just passes the domain in the <varname>$host</varname> variable, which
36265 doesn&#x2019;t achieve much (since it is also in <varname>$domain</varname>), but the second does a
36266 file lookup to find a value to pass, causing the router to decline to handle
36267 the address if the lookup fails.
36268 </para>
36269 </listitem>
36270 <listitem>
36271 <para>
36272 <indexterm role="concept">
36273 <primary>UUCP</primary>
36274 <secondary>example of router for</secondary>
36275 </indexterm>
36276 Routing mail directly to UUCP software is a specific case of the use of
36277 <command>manualroute</command> in a gateway to another mail environment. This is an example of
36278 one way it can be done:
36279 </para>
36280 <literallayout class="monospaced">
36281 # Transport
36282 uucp:
36283   driver = pipe
36284   user = nobody
36285   command = /usr/local/bin/uux -r - \
36286     ${substr_-5:$host}!rmail ${local_part}
36287   return_fail_output = true
36288
36289 # Router
36290 uucphost:
36291   transport = uucp
36292   driver = manualroute
36293   route_data = \
36294     ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
36295 </literallayout>
36296 <para>
36297 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
36298 </para>
36299 <literallayout class="monospaced">
36300 darksite.ethereal.example:           darksite.UUCP
36301 </literallayout>
36302 <para>
36303 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
36304 makes clear the distinction between the domain name
36305 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
36306 </para>
36307 </listitem>
36308 </itemizedlist>
36309 <para>
36310 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
36311 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
36312 </para>
36313 </section>
36314 </chapter>
36315
36316 <chapter id="CHAPdriverlast">
36317 <title>The queryprogram router</title>
36318 <para>
36319 <indexterm role="concept" id="IIDquerou1" class="startofrange">
36320 <primary><command>queryprogram</command> router</primary>
36321 </indexterm>
36322 <indexterm role="concept" id="IIDquerou2" class="startofrange">
36323 <primary>routers</primary>
36324 <secondary><command>queryprogram</command></secondary>
36325 </indexterm>
36326 <indexterm role="concept">
36327 <primary>routing</primary>
36328 <secondary>by external program</secondary>
36329 </indexterm>
36330 The <command>queryprogram</command> router routes an address by running an external command
36331 and acting on its output. This is an expensive way to route, and is intended
36332 mainly for use in lightly-loaded systems, or for performing experiments.
36333 However, if it is possible to use the precondition options (<option>domains</option>,
36334 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
36335 be used in special cases, even on a busy host. There are the following private
36336 options:
36337 <indexterm role="concept">
36338 <primary>options</primary>
36339 <secondary><command>queryprogram</command> router</secondary>
36340 </indexterm>
36341 </para>
36342 <para>
36343 <indexterm role="option">
36344 <primary><option>command</option></primary>
36345 </indexterm>
36346 </para>
36347 <informaltable frame="all">
36348 <tgroup cols="4" colsep="0" rowsep="0">
36349 <colspec colwidth="8*" align="left"/>
36350 <colspec colwidth="6*" align="center"/>
36351 <colspec colwidth="6*" align="center"/>
36352 <colspec colwidth="6*" align="right"/>
36353 <tbody>
36354 <row>
36355 <entry><option>command</option></entry>
36356 <entry>Use: <emphasis>queryprogram</emphasis></entry>
36357 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36358 <entry>Default: <emphasis>unset</emphasis></entry>
36359 </row>
36360 </tbody>
36361 </tgroup>
36362 </informaltable>
36363 <para>
36364 This option must be set. It specifies the command that is to be run. The
36365 command is split up into a command name and arguments, and then each is
36366 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
36367 <xref linkend="CHAPpipetransport"/>).
36368 </para>
36369 <para>
36370 <indexterm role="option">
36371 <primary><option>command_group</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>command_group</option></entry>
36383 <entry>Use: <emphasis>queryprogram</emphasis></entry>
36384 <entry>Type: <emphasis>string</emphasis></entry>
36385 <entry>Default: <emphasis>unset</emphasis></entry>
36386 </row>
36387 </tbody>
36388 </tgroup>
36389 </informaltable>
36390 <para>
36391 <indexterm role="concept">
36392 <primary>gid (group id)</primary>
36393 <secondary>in <command>queryprogram</command> router</secondary>
36394 </indexterm>
36395 This option specifies a gid to be set when running the command while routing an
36396 address for deliver. It must be set if <option>command_user</option> specifies a numerical
36397 uid. If it begins with a digit, it is interpreted as the numerical value of the
36398 gid. Otherwise it is looked up using <function>getgrnam()</function>.
36399 </para>
36400 <para>
36401 <indexterm role="option">
36402 <primary><option>command_user</option></primary>
36403 </indexterm>
36404 </para>
36405 <informaltable frame="all">
36406 <tgroup cols="4" colsep="0" rowsep="0">
36407 <colspec colwidth="8*" align="left"/>
36408 <colspec colwidth="6*" align="center"/>
36409 <colspec colwidth="6*" align="center"/>
36410 <colspec colwidth="6*" align="right"/>
36411 <tbody>
36412 <row>
36413 <entry><option>command_user</option></entry>
36414 <entry>Use: <emphasis>queryprogram</emphasis></entry>
36415 <entry>Type: <emphasis>string</emphasis></entry>
36416 <entry>Default: <emphasis>unset</emphasis></entry>
36417 </row>
36418 </tbody>
36419 </tgroup>
36420 </informaltable>
36421 <para>
36422 <indexterm role="concept">
36423 <primary>uid (user id)</primary>
36424 <secondary>for <command>queryprogram</command></secondary>
36425 </indexterm>
36426 This option must be set. It specifies the uid which is set when running the
36427 command while routing an address for delivery. If the value begins with a digit,
36428 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
36429 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
36430 not set, a value for the gid also.
36431 </para>
36432 <para>
36433 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
36434 root, which it does during a normal delivery in a conventional configuration.
36435 However, when an address is being verified during message reception, Exim is
36436 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
36437 is called from a non-root process, Exim cannot change uid or gid before running
36438 the command. In this circumstance the command runs under the current uid and
36439 gid.
36440 </para>
36441 <para>
36442 <indexterm role="option">
36443 <primary><option>current_directory</option></primary>
36444 </indexterm>
36445 </para>
36446 <informaltable frame="all">
36447 <tgroup cols="4" colsep="0" rowsep="0">
36448 <colspec colwidth="8*" align="left"/>
36449 <colspec colwidth="6*" align="center"/>
36450 <colspec colwidth="6*" align="center"/>
36451 <colspec colwidth="6*" align="right"/>
36452 <tbody>
36453 <row>
36454 <entry><option>current_directory</option></entry>
36455 <entry>Use: <emphasis>queryprogram</emphasis></entry>
36456 <entry>Type: <emphasis>string</emphasis></entry>
36457 <entry>Default: <emphasis>/</emphasis></entry>
36458 </row>
36459 </tbody>
36460 </tgroup>
36461 </informaltable>
36462 <para>
36463 This option specifies an absolute path which is made the current directory
36464 before running the command.
36465 </para>
36466 <para>
36467 <indexterm role="option">
36468 <primary><option>timeout</option></primary>
36469 </indexterm>
36470 </para>
36471 <informaltable frame="all">
36472 <tgroup cols="4" colsep="0" rowsep="0">
36473 <colspec colwidth="8*" align="left"/>
36474 <colspec colwidth="6*" align="center"/>
36475 <colspec colwidth="6*" align="center"/>
36476 <colspec colwidth="6*" align="right"/>
36477 <tbody>
36478 <row>
36479 <entry><option>timeout</option></entry>
36480 <entry>Use: <emphasis>queryprogram</emphasis></entry>
36481 <entry>Type: <emphasis>time</emphasis></entry>
36482 <entry>Default: <emphasis>1h</emphasis></entry>
36483 </row>
36484 </tbody>
36485 </tgroup>
36486 </informaltable>
36487 <para>
36488 If the command does not complete within the timeout period, its process group
36489 is killed and the message is frozen. A value of zero time specifies no
36490 timeout.
36491 </para>
36492 <para>
36493 The standard output of the command is connected to a pipe, which is read when
36494 the command terminates. It should consist of a single line of output,
36495 containing up to five fields, separated by white space. The maximum length of
36496 the line is 1023 characters. Longer lines are silently truncated. The first
36497 field is one of the following words (case-insensitive):
36498 </para>
36499 <itemizedlist>
36500 <listitem>
36501 <para>
36502 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
36503 below).
36504 </para>
36505 </listitem>
36506 <listitem>
36507 <para>
36508 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
36509 <option>no_more</option> is set.
36510 </para>
36511 </listitem>
36512 <listitem>
36513 <para>
36514 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
36515 subsequent text on the line is an error message. If the router is run as part
36516 of address verification during an incoming SMTP message, the message is
36517 included in the SMTP response.
36518 </para>
36519 </listitem>
36520 <listitem>
36521 <para>
36522 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
36523 subsequent text on the line is an error message which is logged. It is not
36524 included in any SMTP response.
36525 </para>
36526 </listitem>
36527 <listitem>
36528 <para>
36529 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
36530 </para>
36531 </listitem>
36532 <listitem>
36533 <para>
36534 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
36535 <option>pass_router</option>), overriding <option>no_more</option>.
36536 </para>
36537 </listitem>
36538 <listitem>
36539 <para>
36540 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
36541 new addresses, which are routed independently, starting with the first router,
36542 or the router specified by <option>redirect_router</option>, if set.
36543 </para>
36544 </listitem>
36545 </itemizedlist>
36546 <para>
36547 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
36548 number of keyed data values, as follows (split into two lines here, to fit on
36549 the page):
36550 </para>
36551 <literallayout class="monospaced">
36552 ACCEPT TRANSPORT=&lt;transport&gt; HOSTS=&lt;list of hosts&gt;
36553 LOOKUP=byname|bydns DATA=&lt;text&gt;
36554 </literallayout>
36555 <para>
36556 The data items can be given in any order, and all are optional. If no transport
36557 is included, the transport specified by the generic <option>transport</option> option is
36558 used. The list of hosts and the lookup type are needed only if the transport is
36559 an <command>smtp</command> transport that does not itself supply a list of hosts.
36560 </para>
36561 <para>
36562 The format of the list of hosts is the same as for the <command>manualroute</command> router.
36563 As well as host names and IP addresses with optional port numbers, as described
36564 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
36565 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
36566 (see section <xref linkend="SECThostshowused"/>).
36567 </para>
36568 <para>
36569 If the lookup type is not specified, Exim behaves as follows when trying to
36570 find an IP address for each host: First, a DNS lookup is done. If this yields
36571 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
36572 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
36573 result of the lookup is the result of that call.
36574 </para>
36575 <para>
36576 <indexterm role="variable">
36577 <primary><varname>$address_data</varname></primary>
36578 </indexterm>
36579 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
36580 variable. For example, this return line
36581 </para>
36582 <literallayout class="monospaced">
36583 accept hosts=x1.y.example:x2.y.example data="rule1"
36584 </literallayout>
36585 <para>
36586 routes the address to the default transport, passing a list of two hosts. When
36587 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
36588 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
36589 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
36590 </para>
36591 </chapter>
36592
36593 <chapter id="CHAPredirect">
36594 <title>The redirect router</title>
36595 <para>
36596 <indexterm role="concept" id="IIDredrou1" class="startofrange">
36597 <primary><command>redirect</command> router</primary>
36598 </indexterm>
36599 <indexterm role="concept" id="IIDredrou2" class="startofrange">
36600 <primary>routers</primary>
36601 <secondary><command>redirect</command></secondary>
36602 </indexterm>
36603 <indexterm role="concept">
36604 <primary>alias file</primary>
36605 <secondary>in a <command>redirect</command> router</secondary>
36606 </indexterm>
36607 <indexterm role="concept">
36608 <primary>address redirection</primary>
36609 <secondary><command>redirect</command> router</secondary>
36610 </indexterm>
36611 The <command>redirect</command> router handles several kinds of address redirection. Its most
36612 common uses are for resolving local part aliases from a central alias file
36613 (usually called <filename>/etc/aliases</filename>) and for handling users&#x2019; personal <filename>.forward</filename>
36614 files, but it has many other potential uses. The incoming address can be
36615 redirected in several different ways:
36616 </para>
36617 <itemizedlist>
36618 <listitem>
36619 <para>
36620 It can be replaced by one or more new addresses which are themselves routed
36621 independently.
36622 </para>
36623 </listitem>
36624 <listitem>
36625 <para>
36626 It can be routed to be delivered to a given file or directory.
36627 </para>
36628 </listitem>
36629 <listitem>
36630 <para>
36631 It can be routed to be delivered to a specified pipe command.
36632 </para>
36633 </listitem>
36634 <listitem>
36635 <para>
36636 It can cause an automatic reply to be generated.
36637 </para>
36638 </listitem>
36639 <listitem>
36640 <para>
36641 It can be forced to fail, optionally with a custom error message.
36642 </para>
36643 </listitem>
36644 <listitem>
36645 <para>
36646 It can be temporarily deferred, optionally with a custom message.
36647 </para>
36648 </listitem>
36649 <listitem>
36650 <para>
36651 It can be discarded.
36652 </para>
36653 </listitem>
36654 </itemizedlist>
36655 <para>
36656 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
36657 However, there are some private options which define transports for delivery to
36658 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
36659 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
36660 </para>
36661 <para>
36662 If success DSNs have been requested
36663 <indexterm role="concept">
36664 <primary>DSN</primary>
36665 <secondary>success</secondary>
36666 </indexterm>
36667 <indexterm role="concept">
36668 <primary>Delivery Status Notification</primary>
36669 <secondary>success</secondary>
36670 </indexterm>
36671 redirection triggers one and the DSN options are not passed any further.
36672 </para>
36673 <section id="SECID124">
36674 <title>Redirection data</title>
36675 <para>
36676 The router operates by interpreting a text string which it obtains either by
36677 expanding the contents of the <option>data</option> option, or by reading the entire
36678 contents of a file whose name is given in the <option>file</option> option. These two
36679 options are mutually exclusive. The first is commonly used for handling system
36680 aliases, in a configuration like this:
36681 </para>
36682 <literallayout class="monospaced">
36683 system_aliases:
36684   driver = redirect
36685   data = ${lookup{$local_part}lsearch{/etc/aliases}}
36686 </literallayout>
36687 <para>
36688 If the lookup fails, the expanded string in this example is empty. When the
36689 expansion of <option>data</option> results in an empty string, the router declines. A forced
36690 expansion failure also causes the router to decline; other expansion failures
36691 cause delivery to be deferred.
36692 </para>
36693 <para>
36694 A configuration using <option>file</option> is commonly used for handling users&#x2019;
36695 <filename>.forward</filename> files, like this:
36696 </para>
36697 <literallayout class="monospaced">
36698 userforward:
36699   driver = redirect
36700   check_local_user
36701   file = $home/.forward
36702   no_verify
36703 </literallayout>
36704 <para>
36705 If the file does not exist, or causes no action to be taken (for example, it is
36706 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
36707 is not the case when the file contains syntactically valid items that happen to
36708 yield empty addresses, for example, items containing only RFC 2822 address
36709 comments.
36710 </para>
36711 </section>
36712 <section id="SECID125">
36713 <title>Forward files and address verification</title>
36714 <para>
36715 <indexterm role="concept">
36716 <primary>address redirection</primary>
36717 <secondary>while verifying</secondary>
36718 </indexterm>
36719 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users&#x2019;
36720 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
36721 </para>
36722 <itemizedlist>
36723 <listitem>
36724 <para>
36725 When Exim is receiving an incoming SMTP message from a remote host, it is
36726 running under the Exim uid, not as root. Exim is unable to change uid to read
36727 the file as the user, and it may not be able to read it as the Exim user. So in
36728 practice the router may not be able to operate.
36729 </para>
36730 </listitem>
36731 <listitem>
36732 <para>
36733 However, even when the router can operate, the existence of a <filename>.forward</filename> file
36734 is unimportant when verifying an address. What should be checked is whether the
36735 local part is a valid user name or not. Cutting out the redirection processing
36736 saves some resources.
36737 </para>
36738 </listitem>
36739 </itemizedlist>
36740 </section>
36741 <section id="SECID126">
36742 <title>Interpreting redirection data</title>
36743 <para>
36744 <indexterm role="concept">
36745 <primary>Sieve filter</primary>
36746 <secondary>specifying in redirection data</secondary>
36747 </indexterm>
36748 <indexterm role="concept">
36749 <primary>filter</primary>
36750 <secondary>specifying in redirection data</secondary>
36751 </indexterm>
36752 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
36753 can be interpreted in two different ways:
36754 </para>
36755 <itemizedlist>
36756 <listitem>
36757 <para>
36758 If the <option>allow_filter</option> option is set true, and the data begins with the text
36759 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
36760 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
36761 respectively. Details of the syntax and semantics of filter files are described
36762 in a separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>; this
36763 document is intended for use by end users.
36764 </para>
36765 </listitem>
36766 <listitem>
36767 <para>
36768 Otherwise, the data must be a comma-separated list of redirection items, as
36769 described in the next section.
36770 </para>
36771 </listitem>
36772 </itemizedlist>
36773 <para>
36774 When a message is redirected to a file (a <quote>mail folder</quote>), the file name given
36775 in a non-filter redirection list must always be an absolute path. A filter may
36776 generate a relative path &ndash; how this is handled depends on the transport&#x2019;s
36777 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
36778 for the <command>appendfile</command> transport.
36779 </para>
36780 </section>
36781 <section id="SECTitenonfilred">
36782 <title>Items in a non-filter redirection list</title>
36783 <para>
36784 <indexterm role="concept">
36785 <primary>address redirection</primary>
36786 <secondary>non-filter list items</secondary>
36787 </indexterm>
36788 When the redirection data is not an Exim or Sieve filter, for example, if it
36789 comes from a conventional alias or forward file, it consists of a list of
36790 addresses, file names, pipe commands, or certain special items (see section
36791 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
36792 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
36793 depending on their default values. The items in the list are separated by
36794 commas or newlines.
36795 If a comma is required in an item, the entire item must be enclosed in double
36796 quotes.
36797 </para>
36798 <para>
36799 Lines starting with a # character are comments, and are ignored, and # may
36800 also appear following a comma, in which case everything between the # and the
36801 next newline character is ignored.
36802 </para>
36803 <para>
36804 If an item is entirely enclosed in double quotes, these are removed. Otherwise
36805 double quotes are retained because some forms of mail address require their use
36806 (but never to enclose the entire address). In the following description,
36807 <quote>item</quote> refers to what remains after any surrounding double quotes have been
36808 removed.
36809 </para>
36810 <para>
36811 <indexterm role="variable">
36812 <primary><varname>$local_part</varname></primary>
36813 </indexterm>
36814 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
36815 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
36816 of the <option>quote_local_part</option> expansion operator, in case the local part contains
36817 special characters. For example, to redirect all mail for the domain
36818 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
36819 setting:
36820 </para>
36821 <literallayout class="monospaced">
36822 data = ${quote_local_part:$local_part}@newdomain.example
36823 </literallayout>
36824 </section>
36825 <section id="SECTredlocmai">
36826 <title>Redirecting to a local mailbox</title>
36827 <para>
36828 <indexterm role="concept">
36829 <primary>routing</primary>
36830 <secondary>loops in</secondary>
36831 </indexterm>
36832 <indexterm role="concept">
36833 <primary>loop</primary>
36834 <secondary>while routing, avoidance of</secondary>
36835 </indexterm>
36836 <indexterm role="concept">
36837 <primary>address redirection</primary>
36838 <secondary>to local mailbox</secondary>
36839 </indexterm>
36840 A redirection item may safely be the same as the address currently under
36841 consideration. This does not cause a routing loop, because a router is
36842 automatically skipped if any ancestor of the address that is being processed
36843 is the same as the current address and was processed by the current router.
36844 Such an address is therefore passed to the following routers, so it is handled
36845 as if there were no redirection. When making this loop-avoidance test, the
36846 complete local part, including any prefix or suffix, is used.
36847 </para>
36848 <para>
36849 <indexterm role="concept">
36850 <primary>address redirection</primary>
36851 <secondary>local part without domain</secondary>
36852 </indexterm>
36853 Specifying the same local part without a domain is a common usage in personal
36854 filter files when the user wants to have messages delivered to the local
36855 mailbox and also forwarded elsewhere. For example, the user whose login is
36856 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
36857 </para>
36858 <literallayout class="monospaced">
36859 cleo, cleopatra@egypt.example
36860 </literallayout>
36861 <para>
36862 <indexterm role="concept">
36863 <primary>backslash in alias file</primary>
36864 </indexterm>
36865 <indexterm role="concept">
36866 <primary>alias file</primary>
36867 <secondary>backslash in</secondary>
36868 </indexterm>
36869 For compatibility with other MTAs, such unqualified local parts may be
36870 preceded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
36871 it does make a difference if more than one domain is being handled
36872 synonymously.
36873 </para>
36874 <para>
36875 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
36876 2822 address that does not include a domain, the item is qualified using the
36877 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
36878 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
36879 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
36880 </para>
36881 <para>
36882 Care must be taken if there are alias names for local users.
36883 Consider an MTA handling a single local domain where the system alias file
36884 contains:
36885 </para>
36886 <literallayout class="monospaced">
36887 Sam.Reman: spqr
36888 </literallayout>
36889 <para>
36890 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
36891 messages in the local mailbox, and also forward copies elsewhere. He creates
36892 this forward file:
36893 </para>
36894 <literallayout class="monospaced">
36895 Sam.Reman, spqr@reme.elsewhere.example
36896 </literallayout>
36897 <para>
36898 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
36899 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
36900 second time round, because it has previously routed it,
36901 and the following routers presumably cannot handle the alias. The forward file
36902 should really contain
36903 </para>
36904 <literallayout class="monospaced">
36905 spqr, spqr@reme.elsewhere.example
36906 </literallayout>
36907 <para>
36908 but because this is such a common error, the <option>check_ancestor</option> option (see
36909 below) exists to provide a way to get round it. This is normally set on a
36910 <command>redirect</command> router that is handling users&#x2019; <filename>.forward</filename> files.
36911 </para>
36912 </section>
36913 <section id="SECTspecitredli">
36914 <title>Special items in redirection lists</title>
36915 <para>
36916 In addition to addresses, the following types of item may appear in redirection
36917 lists (that is, in non-filter redirection data):
36918 </para>
36919 <itemizedlist>
36920 <listitem>
36921 <para>
36922 <indexterm role="concept">
36923 <primary>pipe</primary>
36924 <secondary>in redirection list</secondary>
36925 </indexterm>
36926 <indexterm role="concept">
36927 <primary>address redirection</primary>
36928 <secondary>to pipe</secondary>
36929 </indexterm>
36930 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
36931 as a valid RFC 2822 address that includes a domain. A transport for running the
36932 command must be specified by the <option>pipe_transport</option> option.
36933 Normally, either the router or the transport specifies a user and a group under
36934 which to run the delivery. The default is to use the Exim user and group.
36935 </para>
36936 <para>
36937 Single or double quotes can be used for enclosing the individual arguments of
36938 the pipe command; no interpretation of escapes is done for single quotes. If
36939 the command contains a comma character, it is necessary to put the whole item
36940 in double quotes, for example:
36941 </para>
36942 <literallayout class="monospaced">
36943 "|/some/command ready,steady,go"
36944 </literallayout>
36945 <para>
36946 since items in redirection lists are terminated by commas. Do not, however,
36947 quote just the command. An item such as
36948 </para>
36949 <literallayout class="monospaced">
36950 |"/some/command ready,steady,go"
36951 </literallayout>
36952 <para>
36953 is interpreted as a pipe with a rather strange command name, and no arguments.
36954 </para>
36955 <para>
36956 Note that the above example assumes that the text comes from a lookup source
36957 of some sort, so that the quotes are part of the data.  If composing a
36958 redirect router with a <option>data</option> option directly specifying this command, the
36959 quotes will be used by the configuration parser to define the extent of one
36960 string, but will not be passed down into the redirect router itself.  There
36961 are two main approaches to get around this: escape quotes to be part of the
36962 data itself, or avoid using this mechanism and instead create a custom
36963 transport with the <option>command</option> option set and reference that transport from
36964 an <option>accept</option> router.
36965 </para>
36966 </listitem>
36967 <listitem>
36968 <para>
36969 <indexterm role="concept">
36970 <primary>file</primary>
36971 <secondary>in redirection list</secondary>
36972 </indexterm>
36973 <indexterm role="concept">
36974 <primary>address redirection</primary>
36975 <secondary>to file</secondary>
36976 </indexterm>
36977 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
36978 parse as a valid RFC 2822 address that includes a domain. For example,
36979 </para>
36980 <literallayout class="monospaced">
36981 /home/world/minbari
36982 </literallayout>
36983 <para>
36984 is treated as a file name, but
36985 </para>
36986 <literallayout class="monospaced">
36987 /s=molari/o=babylon/@x400gate.way
36988 </literallayout>
36989 <para>
36990 is treated as an address. For a file name, a transport must be specified using
36991 the <option>file_transport</option> option. However, if the generated path name ends with a
36992 forward slash character, it is interpreted as a directory name rather than a
36993 file name, and <option>directory_transport</option> is used instead.
36994 </para>
36995 <para>
36996 Normally, either the router or the transport specifies a user and a group under
36997 which to run the delivery. The default is to use the Exim user and group.
36998 </para>
36999 <para>
37000 <indexterm role="concept">
37001 <primary><filename>/dev/null</filename></primary>
37002 </indexterm>
37003 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
37004 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
37005 instead of a transport name. In this case the user and group are not used.
37006 </para>
37007 </listitem>
37008 <listitem>
37009 <para>
37010 <indexterm role="concept">
37011 <primary>included address list</primary>
37012 </indexterm>
37013 <indexterm role="concept">
37014 <primary>address redirection</primary>
37015 <secondary>included external list</secondary>
37016 </indexterm>
37017 If an item is of the form
37018 </para>
37019 <literallayout class="monospaced">
37020 :include:&lt;path name&gt;
37021 </literallayout>
37022 <para>
37023 a list of further items is taken from the given file and included at that
37024 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
37025 out-of-line addition to the list. The items in the included list are separated
37026 by commas or newlines and are not subject to expansion. If this is the first
37027 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
37028 the alias name. This example is incorrect:
37029 </para>
37030 <literallayout class="monospaced">
37031 list1    :include:/opt/lists/list1
37032 </literallayout>
37033 <para>
37034 It must be given as
37035 </para>
37036 <literallayout class="monospaced">
37037 list1:   :include:/opt/lists/list1
37038 </literallayout>
37039 </listitem>
37040 <listitem>
37041 <para>
37042 <indexterm role="concept">
37043 <primary>address redirection</primary>
37044 <secondary>to black hole</secondary>
37045 </indexterm>
37046 Sometimes you want to throw away mail to a particular local part. Making the
37047 <option>data</option> option expand to an empty string does not work, because that causes
37048 the router to decline. Instead, the alias item
37049 <indexterm role="concept">
37050 <primary>black hole</primary>
37051 </indexterm>
37052 <indexterm role="concept">
37053 <primary>abandoning mail</primary>
37054 </indexterm>
37055 <emphasis>:blackhole:</emphasis> can be used. It does what its name implies. No delivery is
37056 done, and no error message is generated. This has the same effect as specifying
37057 <filename>/dev/null</filename> as a destination, but it can be independently disabled.
37058 </para>
37059 <para>
37060 <emphasis role="bold">Warning</emphasis>: If <emphasis>:blackhole:</emphasis> appears anywhere in a redirection list, no
37061 delivery is done for the original local part, even if other redirection items
37062 are present. If you are generating a multi-item list (for example, by reading a
37063 database) and need the ability to provide a no-op item, you must use
37064 <filename>/dev/null</filename>.
37065 </para>
37066 </listitem>
37067 <listitem>
37068 <para>
37069 <indexterm role="concept">
37070 <primary>delivery</primary>
37071 <secondary>forcing failure</secondary>
37072 </indexterm>
37073 <indexterm role="concept">
37074 <primary>delivery</primary>
37075 <secondary>forcing deferral</secondary>
37076 </indexterm>
37077 <indexterm role="concept">
37078 <primary>failing delivery</primary>
37079 <secondary>forcing</secondary>
37080 </indexterm>
37081 <indexterm role="concept">
37082 <primary>deferred delivery, forcing</primary>
37083 </indexterm>
37084 <indexterm role="concept">
37085 <primary>customizing</primary>
37086 <secondary>failure message</secondary>
37087 </indexterm>
37088 An attempt to deliver a particular address can be deferred or forced to fail by
37089 redirection items of the form
37090 </para>
37091 <literallayout class="monospaced">
37092 :defer:
37093 :fail:
37094 </literallayout>
37095 <para>
37096 respectively. When a redirection list contains such an item, it applies
37097 to the entire redirection; any other items in the list are ignored. Any
37098 text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error text
37099 associated with the failure. For example, an alias file might contain:
37100 </para>
37101 <literallayout class="monospaced">
37102 X.Employee:  :fail: Gone away, no forwarding address
37103 </literallayout>
37104 <para>
37105 In the case of an address that is being verified from an ACL or as the subject
37106 of a
37107 <indexterm role="concept">
37108 <primary>VRFY</primary>
37109 <secondary>error text, display of</secondary>
37110 </indexterm>
37111 VRFY command, the text is included in the SMTP error response by
37112 default.
37113 <indexterm role="concept">
37114 <primary>EXPN</primary>
37115 <secondary>error text, display of</secondary>
37116 </indexterm>
37117 The text is not included in the response to an EXPN command. In non-SMTP cases
37118 the text is included in the error message that Exim generates.
37119 </para>
37120 <para>
37121 <indexterm role="concept">
37122 <primary>SMTP</primary>
37123 <secondary>error codes</secondary>
37124 </indexterm>
37125 By default, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
37126 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
37127 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
37128 followed by a space, and the very first digit is the same as the default error
37129 code, the code from the message is used instead. If the very first digit is
37130 incorrect, a panic error is logged, and the default code is used. You can
37131 suppress the use of the supplied code in a redirect router by setting the
37132 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
37133 ignored.
37134 </para>
37135 <para>
37136 <indexterm role="variable">
37137 <primary><varname>$acl_verify_message</varname></primary>
37138 </indexterm>
37139 In an ACL, an explicitly provided message overrides the default, but the
37140 default message is available in the variable <varname>$acl_verify_message</varname> and can
37141 therefore be included in a custom message if this is desired.
37142 </para>
37143 <para>
37144 Normally the error text is the rest of the redirection list &ndash; a comma does
37145 not terminate it &ndash; but a newline does act as a terminator. Newlines are not
37146 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
37147 as part of the continuation process, but they may exist in other kinds of
37148 lookup and in <emphasis>:include:</emphasis> files.
37149 </para>
37150 <para>
37151 During routing for message delivery (as opposed to verification), a redirection
37152 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
37153 whereas <emphasis>:defer:</emphasis> causes the message to remain on the queue so that a
37154 subsequent delivery attempt can happen at a later time. If an address is
37155 deferred for too long, it will ultimately fail, because the normal retry
37156 rules still apply.
37157 </para>
37158 </listitem>
37159 <listitem>
37160 <para>
37161 <indexterm role="concept">
37162 <primary>alias file</primary>
37163 <secondary>exception to default</secondary>
37164 </indexterm>
37165 Sometimes it is useful to use a single-key search type with a default (see
37166 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
37167 for exceptions to the default. These can be handled by aliasing them to
37168 <emphasis>:unknown:</emphasis>. This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command>
37169 router to decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which
37170 results in an empty redirection list has the same effect.
37171 </para>
37172 </listitem>
37173 </itemizedlist>
37174 </section>
37175 <section id="SECTdupaddr">
37176 <title>Duplicate addresses</title>
37177 <para>
37178 <indexterm role="concept">
37179 <primary>duplicate addresses</primary>
37180 </indexterm>
37181 <indexterm role="concept">
37182 <primary>address duplicate, discarding</primary>
37183 </indexterm>
37184 <indexterm role="concept">
37185 <primary>pipe</primary>
37186 <secondary>duplicated</secondary>
37187 </indexterm>
37188 Exim removes duplicate addresses from the list to which it is delivering, so as
37189 to deliver just one copy to each address. This does not apply to deliveries
37190 routed to pipes by different immediate parent addresses, but an indirect
37191 aliasing scheme of the type
37192 </para>
37193 <literallayout class="monospaced">
37194 pipe:       |/some/command $local_part
37195 localpart1: pipe
37196 localpart2: pipe
37197 </literallayout>
37198 <para>
37199 does not work with a message that is addressed to both local parts, because
37200 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
37201 discarded as being the same as a previously handled address. However, a scheme
37202 such as
37203 </para>
37204 <literallayout class="monospaced">
37205 localpart1: |/some/command $local_part
37206 localpart2: |/some/command $local_part
37207 </literallayout>
37208 <para>
37209 does result in two different pipe deliveries, because the immediate parents of
37210 the pipes are distinct.
37211 </para>
37212 </section>
37213 <section id="SECID128">
37214 <title>Repeated redirection expansion</title>
37215 <para>
37216 <indexterm role="concept">
37217 <primary>repeated redirection expansion</primary>
37218 </indexterm>
37219 <indexterm role="concept">
37220 <primary>address redirection</primary>
37221 <secondary>repeated for each delivery attempt</secondary>
37222 </indexterm>
37223 When a message cannot be delivered to all of its recipients immediately,
37224 leading to two or more delivery attempts, redirection expansion is carried out
37225 afresh each time for those addresses whose children were not all previously
37226 delivered. If redirection is being used as a mailing list, this can lead to new
37227 members of the list receiving copies of old messages. The <option>one_time</option> option
37228 can be used to avoid this.
37229 </para>
37230 </section>
37231 <section id="SECID129">
37232 <title>Errors in redirection lists</title>
37233 <para>
37234 <indexterm role="concept">
37235 <primary>address redirection</primary>
37236 <secondary>errors</secondary>
37237 </indexterm>
37238 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
37239 error is skipped, and an entry is written to the main log. This may be useful
37240 for mailing lists that are automatically managed. Otherwise, if an error is
37241 detected while generating the list of new addresses, the original address is
37242 deferred. See also <option>syntax_errors_to</option>.
37243 </para>
37244 </section>
37245 <section id="SECID130">
37246 <title>Private options for the redirect router</title>
37247 <para>
37248 <indexterm role="concept">
37249 <primary>options</primary>
37250 <secondary><command>redirect</command> router</secondary>
37251 </indexterm>
37252 The private options for the <command>redirect</command> router are as follows:
37253 </para>
37254 <para>
37255 <indexterm role="option">
37256 <primary><option>allow_defer</option></primary>
37257 </indexterm>
37258 </para>
37259 <informaltable frame="all">
37260 <tgroup cols="4" colsep="0" rowsep="0">
37261 <colspec colwidth="8*" align="left"/>
37262 <colspec colwidth="6*" align="center"/>
37263 <colspec colwidth="6*" align="center"/>
37264 <colspec colwidth="6*" align="right"/>
37265 <tbody>
37266 <row>
37267 <entry><option>allow_defer</option></entry>
37268 <entry>Use: <emphasis>redirect</emphasis></entry>
37269 <entry>Type: <emphasis>boolean</emphasis></entry>
37270 <entry>Default: <emphasis>false</emphasis></entry>
37271 </row>
37272 </tbody>
37273 </tgroup>
37274 </informaltable>
37275 <para>
37276 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
37277 data, or the <option>defer</option> command in an Exim filter file.
37278 </para>
37279 <para>
37280 <indexterm role="option">
37281 <primary><option>allow_fail</option></primary>
37282 </indexterm>
37283 </para>
37284 <informaltable frame="all">
37285 <tgroup cols="4" colsep="0" rowsep="0">
37286 <colspec colwidth="8*" align="left"/>
37287 <colspec colwidth="6*" align="center"/>
37288 <colspec colwidth="6*" align="center"/>
37289 <colspec colwidth="6*" align="right"/>
37290 <tbody>
37291 <row>
37292 <entry><option>allow_fail</option></entry>
37293 <entry>Use: <emphasis>redirect</emphasis></entry>
37294 <entry>Type: <emphasis>boolean</emphasis></entry>
37295 <entry>Default: <emphasis>false</emphasis></entry>
37296 </row>
37297 </tbody>
37298 </tgroup>
37299 </informaltable>
37300 <para>
37301 <indexterm role="concept">
37302 <primary>failing delivery</primary>
37303 <secondary>from filter</secondary>
37304 </indexterm>
37305 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
37306 and the <option>fail</option> command may be used in an Exim filter file.
37307 </para>
37308 <para>
37309 <indexterm role="option">
37310 <primary><option>allow_filter</option></primary>
37311 </indexterm>
37312 </para>
37313 <informaltable frame="all">
37314 <tgroup cols="4" colsep="0" rowsep="0">
37315 <colspec colwidth="8*" align="left"/>
37316 <colspec colwidth="6*" align="center"/>
37317 <colspec colwidth="6*" align="center"/>
37318 <colspec colwidth="6*" align="right"/>
37319 <tbody>
37320 <row>
37321 <entry><option>allow_filter</option></entry>
37322 <entry>Use: <emphasis>redirect</emphasis></entry>
37323 <entry>Type: <emphasis>boolean</emphasis></entry>
37324 <entry>Default: <emphasis>false</emphasis></entry>
37325 </row>
37326 </tbody>
37327 </tgroup>
37328 </informaltable>
37329 <para>
37330 <indexterm role="concept">
37331 <primary>filter</primary>
37332 <secondary>enabling use of</secondary>
37333 </indexterm>
37334 <indexterm role="concept">
37335 <primary>Sieve filter</primary>
37336 <secondary>enabling use of</secondary>
37337 </indexterm>
37338 Setting this option allows Exim to interpret redirection data that starts with
37339 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
37340 are some features of Exim filter files that some administrators may wish to
37341 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
37342 </para>
37343 <para>
37344 It is also possible to lock out Exim filters or Sieve filters while allowing
37345 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
37346 </para>
37347 <para>
37348 The filter is run using the uid and gid set by the generic <option>user</option> and
37349 <option>group</option> options. These take their defaults from the password data if
37350 <option>check_local_user</option> is set, so in the normal case of users&#x2019; personal filter
37351 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
37352 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
37353 </para>
37354 <para>
37355 <indexterm role="option">
37356 <primary><option>allow_freeze</option></primary>
37357 </indexterm>
37358 </para>
37359 <informaltable frame="all">
37360 <tgroup cols="4" colsep="0" rowsep="0">
37361 <colspec colwidth="8*" align="left"/>
37362 <colspec colwidth="6*" align="center"/>
37363 <colspec colwidth="6*" align="center"/>
37364 <colspec colwidth="6*" align="right"/>
37365 <tbody>
37366 <row>
37367 <entry><option>allow_freeze</option></entry>
37368 <entry>Use: <emphasis>redirect</emphasis></entry>
37369 <entry>Type: <emphasis>boolean</emphasis></entry>
37370 <entry>Default: <emphasis>false</emphasis></entry>
37371 </row>
37372 </tbody>
37373 </tgroup>
37374 </informaltable>
37375 <para>
37376 <indexterm role="concept">
37377 <primary>freezing messages</primary>
37378 <secondary>allowing in filter</secondary>
37379 </indexterm>
37380 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
37381 This command is more normally encountered in system filters, and is disabled by
37382 default for redirection filters because it isn&#x2019;t something you usually want to
37383 let ordinary users do.
37384 </para>
37385 <para>
37386 <indexterm role="option">
37387 <primary><option>check_ancestor</option></primary>
37388 </indexterm>
37389 </para>
37390 <informaltable frame="all">
37391 <tgroup cols="4" colsep="0" rowsep="0">
37392 <colspec colwidth="8*" align="left"/>
37393 <colspec colwidth="6*" align="center"/>
37394 <colspec colwidth="6*" align="center"/>
37395 <colspec colwidth="6*" align="right"/>
37396 <tbody>
37397 <row>
37398 <entry><option>check_ancestor</option></entry>
37399 <entry>Use: <emphasis>redirect</emphasis></entry>
37400 <entry>Type: <emphasis>boolean</emphasis></entry>
37401 <entry>Default: <emphasis>false</emphasis></entry>
37402 </row>
37403 </tbody>
37404 </tgroup>
37405 </informaltable>
37406 <para>
37407 This option is concerned with handling generated addresses that are the same
37408 as some address in the list of redirection ancestors of the current address.
37409 Although it is turned off by default in the code, it is set in the default
37410 configuration file for handling users&#x2019; <filename>.forward</filename> files. It is recommended
37411 for this use of the <command>redirect</command> router.
37412 </para>
37413 <para>
37414 When <option>check_ancestor</option> is set, if a generated address (including the domain)
37415 is the same as any ancestor of the current address, it is replaced by a copy of
37416 the current address. This helps in the case where local part A is aliased to B,
37417 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
37418 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
37419 <filename>&nbsp;jb/.forward</filename> contains:
37420 </para>
37421 <literallayout class="monospaced">
37422 \Joe.Bloggs, &lt;other item(s)&gt;
37423 </literallayout>
37424 <para>
37425 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
37426 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
37427 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
37428 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
37429 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
37430 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
37431 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
37432 original address. See also the <option>repeat_use</option> option below.
37433 </para>
37434 <para>
37435 <indexterm role="option">
37436 <primary><option>check_group</option></primary>
37437 </indexterm>
37438 </para>
37439 <informaltable frame="all">
37440 <tgroup cols="4" colsep="0" rowsep="0">
37441 <colspec colwidth="8*" align="left"/>
37442 <colspec colwidth="6*" align="center"/>
37443 <colspec colwidth="6*" align="center"/>
37444 <colspec colwidth="6*" align="right"/>
37445 <tbody>
37446 <row>
37447 <entry><option>check_group</option></entry>
37448 <entry>Use: <emphasis>redirect</emphasis></entry>
37449 <entry>Type: <emphasis>boolean</emphasis></entry>
37450 <entry>Default: <emphasis>see below</emphasis></entry>
37451 </row>
37452 </tbody>
37453 </tgroup>
37454 </informaltable>
37455 <para>
37456 When the <option>file</option> option is used, the group owner of the file is checked only
37457 when this option is set. The permitted groups are those listed in the
37458 <option>owngroups</option> option, together with the user&#x2019;s default group if
37459 <option>check_local_user</option> is set. If the file has the wrong group, routing is
37460 deferred. The default setting for this option is true if <option>check_local_user</option>
37461 is set and the <option>modemask</option> option permits the group write bit, or if the
37462 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
37463 </para>
37464 <para>
37465 <indexterm role="option">
37466 <primary><option>check_owner</option></primary>
37467 </indexterm>
37468 </para>
37469 <informaltable frame="all">
37470 <tgroup cols="4" colsep="0" rowsep="0">
37471 <colspec colwidth="8*" align="left"/>
37472 <colspec colwidth="6*" align="center"/>
37473 <colspec colwidth="6*" align="center"/>
37474 <colspec colwidth="6*" align="right"/>
37475 <tbody>
37476 <row>
37477 <entry><option>check_owner</option></entry>
37478 <entry>Use: <emphasis>redirect</emphasis></entry>
37479 <entry>Type: <emphasis>boolean</emphasis></entry>
37480 <entry>Default: <emphasis>see below</emphasis></entry>
37481 </row>
37482 </tbody>
37483 </tgroup>
37484 </informaltable>
37485 <para>
37486 When the <option>file</option> option is used, the owner of the file is checked only when
37487 this option is set. If <option>check_local_user</option> is set, the local user is
37488 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
37489 option. The default value for this option is true if <option>check_local_user</option> or
37490 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
37491 </para>
37492 <para>
37493 <indexterm role="option">
37494 <primary><option>data</option></primary>
37495 </indexterm>
37496 </para>
37497 <informaltable frame="all">
37498 <tgroup cols="4" colsep="0" rowsep="0">
37499 <colspec colwidth="8*" align="left"/>
37500 <colspec colwidth="6*" align="center"/>
37501 <colspec colwidth="6*" align="center"/>
37502 <colspec colwidth="6*" align="right"/>
37503 <tbody>
37504 <row>
37505 <entry><option>data</option></entry>
37506 <entry>Use: <emphasis>redirect</emphasis></entry>
37507 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37508 <entry>Default: <emphasis>unset</emphasis></entry>
37509 </row>
37510 </tbody>
37511 </tgroup>
37512 </informaltable>
37513 <para>
37514 This option is mutually exclusive with <option>file</option>. One or other of them must be
37515 set, but not both. The contents of <option>data</option> are expanded, and then used as the
37516 list of forwarding items, or as a set of filtering instructions. If the
37517 expansion is forced to fail, or the result is an empty string or a string that
37518 has no effect (consists entirely of comments), the router declines.
37519 </para>
37520 <para>
37521 When filtering instructions are used, the string must begin with <quote>#Exim
37522 filter</quote>, and all comments in the string, including this initial one, must be
37523 terminated with newline characters. For example:
37524 </para>
37525 <literallayout class="monospaced">
37526 data = #Exim filter\n\
37527        if $h_to: contains Exim then save $home/mail/exim endif
37528 </literallayout>
37529 <para>
37530 If you are reading the data from a database where newlines cannot be included,
37531 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
37532 choice into a newline.
37533 </para>
37534 <para>
37535 <indexterm role="option">
37536 <primary><option>directory_transport</option></primary>
37537 </indexterm>
37538 </para>
37539 <informaltable frame="all">
37540 <tgroup cols="4" colsep="0" rowsep="0">
37541 <colspec colwidth="8*" align="left"/>
37542 <colspec colwidth="6*" align="center"/>
37543 <colspec colwidth="6*" align="center"/>
37544 <colspec colwidth="6*" align="right"/>
37545 <tbody>
37546 <row>
37547 <entry><option>directory_transport</option></entry>
37548 <entry>Use: <emphasis>redirect</emphasis></entry>
37549 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37550 <entry>Default: <emphasis>unset</emphasis></entry>
37551 </row>
37552 </tbody>
37553 </tgroup>
37554 </informaltable>
37555 <para>
37556 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
37557 ending with a slash is specified as a new <quote>address</quote>. The transport used is
37558 specified by this option, which, after expansion, must be the name of a
37559 configured transport. This should normally be an <command>appendfile</command> transport.
37560 </para>
37561 <para>
37562 <indexterm role="option">
37563 <primary><option>file</option></primary>
37564 </indexterm>
37565 </para>
37566 <informaltable frame="all">
37567 <tgroup cols="4" colsep="0" rowsep="0">
37568 <colspec colwidth="8*" align="left"/>
37569 <colspec colwidth="6*" align="center"/>
37570 <colspec colwidth="6*" align="center"/>
37571 <colspec colwidth="6*" align="right"/>
37572 <tbody>
37573 <row>
37574 <entry><option>file</option></entry>
37575 <entry>Use: <emphasis>redirect</emphasis></entry>
37576 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37577 <entry>Default: <emphasis>unset</emphasis></entry>
37578 </row>
37579 </tbody>
37580 </tgroup>
37581 </informaltable>
37582 <para>
37583 This option specifies the name of a file that contains the redirection data. It
37584 is mutually exclusive with the <option>data</option> option. The string is expanded before
37585 use; if the expansion is forced to fail, the router declines. Other expansion
37586 failures cause delivery to be deferred. The result of a successful expansion
37587 must be an absolute path. The entire file is read and used as the redirection
37588 data. If the data is an empty string or a string that has no effect (consists
37589 entirely of comments), the router declines.
37590 </para>
37591 <para>
37592 <indexterm role="concept">
37593 <primary>NFS</primary>
37594 <secondary>checking for file existence</secondary>
37595 </indexterm>
37596 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
37597 runs a check on the containing directory,
37598 unless <option>ignore_enotdir</option> is true (see below).
37599 If the directory does not appear to exist, delivery is deferred. This can
37600 happen when users&#x2019; <filename>.forward</filename> files are in NFS-mounted directories, and there
37601 is a mount problem. If the containing directory does exist, but the file does
37602 not, the router declines.
37603 </para>
37604 <para>
37605 <indexterm role="option">
37606 <primary><option>file_transport</option></primary>
37607 </indexterm>
37608 </para>
37609 <informaltable frame="all">
37610 <tgroup cols="4" colsep="0" rowsep="0">
37611 <colspec colwidth="8*" align="left"/>
37612 <colspec colwidth="6*" align="center"/>
37613 <colspec colwidth="6*" align="center"/>
37614 <colspec colwidth="6*" align="right"/>
37615 <tbody>
37616 <row>
37617 <entry><option>file_transport</option></entry>
37618 <entry>Use: <emphasis>redirect</emphasis></entry>
37619 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37620 <entry>Default: <emphasis>unset</emphasis></entry>
37621 </row>
37622 </tbody>
37623 </tgroup>
37624 </informaltable>
37625 <para>
37626 <indexterm role="variable">
37627 <primary><varname>$address_file</varname></primary>
37628 </indexterm>
37629 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
37630 ending in a slash is specified as a new <quote>address</quote>. The transport used is
37631 specified by this option, which, after expansion, must be the name of a
37632 configured transport. This should normally be an <command>appendfile</command> transport. When
37633 it is running, the file name is in <varname>$address_file</varname>.
37634 </para>
37635 <para>
37636 <indexterm role="option">
37637 <primary><option>filter_prepend_home</option></primary>
37638 </indexterm>
37639 </para>
37640 <informaltable frame="all">
37641 <tgroup cols="4" colsep="0" rowsep="0">
37642 <colspec colwidth="8*" align="left"/>
37643 <colspec colwidth="6*" align="center"/>
37644 <colspec colwidth="6*" align="center"/>
37645 <colspec colwidth="6*" align="right"/>
37646 <tbody>
37647 <row>
37648 <entry><option>filter_prepend_home</option></entry>
37649 <entry>Use: <emphasis>redirect</emphasis></entry>
37650 <entry>Type: <emphasis>boolean</emphasis></entry>
37651 <entry>Default: <emphasis>true</emphasis></entry>
37652 </row>
37653 </tbody>
37654 </tgroup>
37655 </informaltable>
37656 <para>
37657 When this option is true, if a <command>save</command> command in an Exim filter specifies a
37658 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
37659 relative path. If this option is set false, this action does not happen. The
37660 relative path is then passed to the transport unmodified.
37661 </para>
37662 <para>
37663 <indexterm role="option">
37664 <primary><option>forbid_blackhole</option></primary>
37665 </indexterm>
37666 </para>
37667 <informaltable frame="all">
37668 <tgroup cols="4" colsep="0" rowsep="0">
37669 <colspec colwidth="8*" align="left"/>
37670 <colspec colwidth="6*" align="center"/>
37671 <colspec colwidth="6*" align="center"/>
37672 <colspec colwidth="6*" align="right"/>
37673 <tbody>
37674 <row>
37675 <entry><option>forbid_blackhole</option></entry>
37676 <entry>Use: <emphasis>redirect</emphasis></entry>
37677 <entry>Type: <emphasis>boolean</emphasis></entry>
37678 <entry>Default: <emphasis>false</emphasis></entry>
37679 </row>
37680 </tbody>
37681 </tgroup>
37682 </informaltable>
37683 <para>
37684 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
37685 redirection list.
37686 </para>
37687 <para>
37688 <indexterm role="option">
37689 <primary><option>forbid_exim_filter</option></primary>
37690 </indexterm>
37691 </para>
37692 <informaltable frame="all">
37693 <tgroup cols="4" colsep="0" rowsep="0">
37694 <colspec colwidth="8*" align="left"/>
37695 <colspec colwidth="6*" align="center"/>
37696 <colspec colwidth="6*" align="center"/>
37697 <colspec colwidth="6*" align="right"/>
37698 <tbody>
37699 <row>
37700 <entry><option>forbid_exim_filter</option></entry>
37701 <entry>Use: <emphasis>redirect</emphasis></entry>
37702 <entry>Type: <emphasis>boolean</emphasis></entry>
37703 <entry>Default: <emphasis>false</emphasis></entry>
37704 </row>
37705 </tbody>
37706 </tgroup>
37707 </informaltable>
37708 <para>
37709 If this option is set true, only Sieve filters are permitted when
37710 <option>allow_filter</option> is true.
37711 </para>
37712 <para>
37713 <indexterm role="option">
37714 <primary><option>forbid_file</option></primary>
37715 </indexterm>
37716 </para>
37717 <informaltable frame="all">
37718 <tgroup cols="4" colsep="0" rowsep="0">
37719 <colspec colwidth="8*" align="left"/>
37720 <colspec colwidth="6*" align="center"/>
37721 <colspec colwidth="6*" align="center"/>
37722 <colspec colwidth="6*" align="right"/>
37723 <tbody>
37724 <row>
37725 <entry><option>forbid_file</option></entry>
37726 <entry>Use: <emphasis>redirect</emphasis></entry>
37727 <entry>Type: <emphasis>boolean</emphasis></entry>
37728 <entry>Default: <emphasis>false</emphasis></entry>
37729 </row>
37730 </tbody>
37731 </tgroup>
37732 </informaltable>
37733 <para>
37734 <indexterm role="concept">
37735 <primary>delivery</primary>
37736 <secondary>to file; forbidding</secondary>
37737 </indexterm>
37738 <indexterm role="concept">
37739 <primary>Sieve filter</primary>
37740 <secondary>forbidding delivery to a file</secondary>
37741 </indexterm>
37742 <indexterm role="concept">
37743 <primary>Sieve filter</primary>
37744 <secondary><quote>keep</quote> facility; disabling</secondary>
37745 </indexterm>
37746 If this option is true, this router may not generate a new address that
37747 specifies delivery to a local file or directory, either from a filter or from a
37748 conventional forward file. This option is forced to be true if <option>one_time</option> is
37749 set. It applies to Sieve filters as well as to Exim filters, but if true, it
37750 locks out the Sieve&#x2019;s <quote>keep</quote> facility.
37751 </para>
37752 <para>
37753 <indexterm role="option">
37754 <primary><option>forbid_filter_dlfunc</option></primary>
37755 </indexterm>
37756 </para>
37757 <informaltable frame="all">
37758 <tgroup cols="4" colsep="0" rowsep="0">
37759 <colspec colwidth="8*" align="left"/>
37760 <colspec colwidth="6*" align="center"/>
37761 <colspec colwidth="6*" align="center"/>
37762 <colspec colwidth="6*" align="right"/>
37763 <tbody>
37764 <row>
37765 <entry><option>forbid_filter_dlfunc</option></entry>
37766 <entry>Use: <emphasis>redirect</emphasis></entry>
37767 <entry>Type: <emphasis>boolean</emphasis></entry>
37768 <entry>Default: <emphasis>false</emphasis></entry>
37769 </row>
37770 </tbody>
37771 </tgroup>
37772 </informaltable>
37773 <para>
37774 <indexterm role="concept">
37775 <primary>filter</primary>
37776 <secondary>locking out certain features</secondary>
37777 </indexterm>
37778 If this option is true, string expansions in Exim filters are not allowed to
37779 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
37780 functions.
37781 </para>
37782 <para>
37783 <indexterm role="option">
37784 <primary><option>forbid_filter_existstest</option></primary>
37785 </indexterm>
37786 </para>
37787 <informaltable frame="all">
37788 <tgroup cols="4" colsep="0" rowsep="0">
37789 <colspec colwidth="8*" align="left"/>
37790 <colspec colwidth="6*" align="center"/>
37791 <colspec colwidth="6*" align="center"/>
37792 <colspec colwidth="6*" align="right"/>
37793 <tbody>
37794 <row>
37795 <entry><option>forbid_filter_existstest</option></entry>
37796 <entry>Use: <emphasis>redirect</emphasis></entry>
37797 <entry>Type: <emphasis>boolean</emphasis></entry>
37798 <entry>Default: <emphasis>false</emphasis></entry>
37799 </row>
37800 </tbody>
37801 </tgroup>
37802 </informaltable>
37803 <para>
37804 <indexterm role="concept">
37805 <primary>expansion</primary>
37806 <secondary>statting a file</secondary>
37807 </indexterm>
37808 If this option is true, string expansions in Exim filters are not allowed to
37809 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
37810 </para>
37811 <para>
37812 <indexterm role="option">
37813 <primary><option>forbid_filter_logwrite</option></primary>
37814 </indexterm>
37815 </para>
37816 <informaltable frame="all">
37817 <tgroup cols="4" colsep="0" rowsep="0">
37818 <colspec colwidth="8*" align="left"/>
37819 <colspec colwidth="6*" align="center"/>
37820 <colspec colwidth="6*" align="center"/>
37821 <colspec colwidth="6*" align="right"/>
37822 <tbody>
37823 <row>
37824 <entry><option>forbid_filter_logwrite</option></entry>
37825 <entry>Use: <emphasis>redirect</emphasis></entry>
37826 <entry>Type: <emphasis>boolean</emphasis></entry>
37827 <entry>Default: <emphasis>false</emphasis></entry>
37828 </row>
37829 </tbody>
37830 </tgroup>
37831 </informaltable>
37832 <para>
37833 If this option is true, use of the logging facility in Exim filters is not
37834 permitted. Logging is in any case available only if the filter is being run
37835 under some unprivileged uid (which is normally the case for ordinary users&#x2019;
37836 <filename>.forward</filename> files).
37837 </para>
37838 <para>
37839 <indexterm role="option">
37840 <primary><option>forbid_filter_lookup</option></primary>
37841 </indexterm>
37842 </para>
37843 <informaltable frame="all">
37844 <tgroup cols="4" colsep="0" rowsep="0">
37845 <colspec colwidth="8*" align="left"/>
37846 <colspec colwidth="6*" align="center"/>
37847 <colspec colwidth="6*" align="center"/>
37848 <colspec colwidth="6*" align="right"/>
37849 <tbody>
37850 <row>
37851 <entry><option>forbid_filter_lookup</option></entry>
37852 <entry>Use: <emphasis>redirect</emphasis></entry>
37853 <entry>Type: <emphasis>boolean</emphasis></entry>
37854 <entry>Default: <emphasis>false</emphasis></entry>
37855 </row>
37856 </tbody>
37857 </tgroup>
37858 </informaltable>
37859 <para>
37860 If this option is true, string expansions in Exim filter files are not allowed
37861 to make use of <option>lookup</option> items.
37862 </para>
37863 <para>
37864 <indexterm role="option">
37865 <primary><option>forbid_filter_perl</option></primary>
37866 </indexterm>
37867 </para>
37868 <informaltable frame="all">
37869 <tgroup cols="4" colsep="0" rowsep="0">
37870 <colspec colwidth="8*" align="left"/>
37871 <colspec colwidth="6*" align="center"/>
37872 <colspec colwidth="6*" align="center"/>
37873 <colspec colwidth="6*" align="right"/>
37874 <tbody>
37875 <row>
37876 <entry><option>forbid_filter_perl</option></entry>
37877 <entry>Use: <emphasis>redirect</emphasis></entry>
37878 <entry>Type: <emphasis>boolean</emphasis></entry>
37879 <entry>Default: <emphasis>false</emphasis></entry>
37880 </row>
37881 </tbody>
37882 </tgroup>
37883 </informaltable>
37884 <para>
37885 This option has an effect only if Exim is built with embedded Perl support. If
37886 it is true, string expansions in Exim filter files are not allowed to make use
37887 of the embedded Perl support.
37888 </para>
37889 <para>
37890 <indexterm role="option">
37891 <primary><option>forbid_filter_readfile</option></primary>
37892 </indexterm>
37893 </para>
37894 <informaltable frame="all">
37895 <tgroup cols="4" colsep="0" rowsep="0">
37896 <colspec colwidth="8*" align="left"/>
37897 <colspec colwidth="6*" align="center"/>
37898 <colspec colwidth="6*" align="center"/>
37899 <colspec colwidth="6*" align="right"/>
37900 <tbody>
37901 <row>
37902 <entry><option>forbid_filter_readfile</option></entry>
37903 <entry>Use: <emphasis>redirect</emphasis></entry>
37904 <entry>Type: <emphasis>boolean</emphasis></entry>
37905 <entry>Default: <emphasis>false</emphasis></entry>
37906 </row>
37907 </tbody>
37908 </tgroup>
37909 </informaltable>
37910 <para>
37911 If this option is true, string expansions in Exim filter files are not allowed
37912 to make use of <option>readfile</option> items.
37913 </para>
37914 <para>
37915 <indexterm role="option">
37916 <primary><option>forbid_filter_readsocket</option></primary>
37917 </indexterm>
37918 </para>
37919 <informaltable frame="all">
37920 <tgroup cols="4" colsep="0" rowsep="0">
37921 <colspec colwidth="8*" align="left"/>
37922 <colspec colwidth="6*" align="center"/>
37923 <colspec colwidth="6*" align="center"/>
37924 <colspec colwidth="6*" align="right"/>
37925 <tbody>
37926 <row>
37927 <entry><option>forbid_filter_readsocket</option></entry>
37928 <entry>Use: <emphasis>redirect</emphasis></entry>
37929 <entry>Type: <emphasis>boolean</emphasis></entry>
37930 <entry>Default: <emphasis>false</emphasis></entry>
37931 </row>
37932 </tbody>
37933 </tgroup>
37934 </informaltable>
37935 <para>
37936 If this option is true, string expansions in Exim filter files are not allowed
37937 to make use of <option>readsocket</option> items.
37938 </para>
37939 <para>
37940 <indexterm role="option">
37941 <primary><option>forbid_filter_reply</option></primary>
37942 </indexterm>
37943 </para>
37944 <informaltable frame="all">
37945 <tgroup cols="4" colsep="0" rowsep="0">
37946 <colspec colwidth="8*" align="left"/>
37947 <colspec colwidth="6*" align="center"/>
37948 <colspec colwidth="6*" align="center"/>
37949 <colspec colwidth="6*" align="right"/>
37950 <tbody>
37951 <row>
37952 <entry><option>forbid_filter_reply</option></entry>
37953 <entry>Use: <emphasis>redirect</emphasis></entry>
37954 <entry>Type: <emphasis>boolean</emphasis></entry>
37955 <entry>Default: <emphasis>false</emphasis></entry>
37956 </row>
37957 </tbody>
37958 </tgroup>
37959 </informaltable>
37960 <para>
37961 If this option is true, this router may not generate an automatic reply
37962 message. Automatic replies can be generated only from Exim or Sieve filter
37963 files, not from traditional forward files. This option is forced to be true if
37964 <option>one_time</option> is set.
37965 </para>
37966 <para>
37967 <indexterm role="option">
37968 <primary><option>forbid_filter_run</option></primary>
37969 </indexterm>
37970 </para>
37971 <informaltable frame="all">
37972 <tgroup cols="4" colsep="0" rowsep="0">
37973 <colspec colwidth="8*" align="left"/>
37974 <colspec colwidth="6*" align="center"/>
37975 <colspec colwidth="6*" align="center"/>
37976 <colspec colwidth="6*" align="right"/>
37977 <tbody>
37978 <row>
37979 <entry><option>forbid_filter_run</option></entry>
37980 <entry>Use: <emphasis>redirect</emphasis></entry>
37981 <entry>Type: <emphasis>boolean</emphasis></entry>
37982 <entry>Default: <emphasis>false</emphasis></entry>
37983 </row>
37984 </tbody>
37985 </tgroup>
37986 </informaltable>
37987 <para>
37988 If this option is true, string expansions in Exim filter files are not allowed
37989 to make use of <option>run</option> items.
37990 </para>
37991 <para>
37992 <indexterm role="option">
37993 <primary><option>forbid_include</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>forbid_include</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 If this option is true, items of the form
38014 </para>
38015 <literallayout class="monospaced">
38016 :include:&lt;path name&gt;
38017 </literallayout>
38018 <para>
38019 are not permitted in non-filter redirection lists.
38020 </para>
38021 <para>
38022 <indexterm role="option">
38023 <primary><option>forbid_pipe</option></primary>
38024 </indexterm>
38025 </para>
38026 <informaltable frame="all">
38027 <tgroup cols="4" colsep="0" rowsep="0">
38028 <colspec colwidth="8*" align="left"/>
38029 <colspec colwidth="6*" align="center"/>
38030 <colspec colwidth="6*" align="center"/>
38031 <colspec colwidth="6*" align="right"/>
38032 <tbody>
38033 <row>
38034 <entry><option>forbid_pipe</option></entry>
38035 <entry>Use: <emphasis>redirect</emphasis></entry>
38036 <entry>Type: <emphasis>boolean</emphasis></entry>
38037 <entry>Default: <emphasis>false</emphasis></entry>
38038 </row>
38039 </tbody>
38040 </tgroup>
38041 </informaltable>
38042 <para>
38043 <indexterm role="concept">
38044 <primary>delivery</primary>
38045 <secondary>to pipe; forbidding</secondary>
38046 </indexterm>
38047 If this option is true, this router may not generate a new address which
38048 specifies delivery to a pipe, either from an Exim filter or from a conventional
38049 forward file. This option is forced to be true if <option>one_time</option> is set.
38050 </para>
38051 <para>
38052 <indexterm role="option">
38053 <primary><option>forbid_sieve_filter</option></primary>
38054 </indexterm>
38055 </para>
38056 <informaltable frame="all">
38057 <tgroup cols="4" colsep="0" rowsep="0">
38058 <colspec colwidth="8*" align="left"/>
38059 <colspec colwidth="6*" align="center"/>
38060 <colspec colwidth="6*" align="center"/>
38061 <colspec colwidth="6*" align="right"/>
38062 <tbody>
38063 <row>
38064 <entry><option>forbid_sieve_filter</option></entry>
38065 <entry>Use: <emphasis>redirect</emphasis></entry>
38066 <entry>Type: <emphasis>boolean</emphasis></entry>
38067 <entry>Default: <emphasis>false</emphasis></entry>
38068 </row>
38069 </tbody>
38070 </tgroup>
38071 </informaltable>
38072 <para>
38073 If this option is set true, only Exim filters are permitted when
38074 <option>allow_filter</option> is true.
38075 </para>
38076 <para>
38077 <indexterm role="concept">
38078 <primary>SMTP</primary>
38079 <secondary>error codes</secondary>
38080 </indexterm>
38081 <indexterm role="option">
38082 <primary><option>forbid_smtp_code</option></primary>
38083 </indexterm>
38084 </para>
38085 <informaltable frame="all">
38086 <tgroup cols="4" colsep="0" rowsep="0">
38087 <colspec colwidth="8*" align="left"/>
38088 <colspec colwidth="6*" align="center"/>
38089 <colspec colwidth="6*" align="center"/>
38090 <colspec colwidth="6*" align="right"/>
38091 <tbody>
38092 <row>
38093 <entry><option>forbid_smtp_code</option></entry>
38094 <entry>Use: <emphasis>redirect</emphasis></entry>
38095 <entry>Type: <emphasis>boolean</emphasis></entry>
38096 <entry>Default: <emphasis>false</emphasis></entry>
38097 </row>
38098 </tbody>
38099 </tgroup>
38100 </informaltable>
38101 <para>
38102 If this option is set true, any SMTP error codes that are present at the start
38103 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
38104 the default codes (451 and 550, respectively) are always used.
38105 </para>
38106 <para>
38107 <indexterm role="option">
38108 <primary><option>hide_child_in_errmsg</option></primary>
38109 </indexterm>
38110 </para>
38111 <informaltable frame="all">
38112 <tgroup cols="4" colsep="0" rowsep="0">
38113 <colspec colwidth="8*" align="left"/>
38114 <colspec colwidth="6*" align="center"/>
38115 <colspec colwidth="6*" align="center"/>
38116 <colspec colwidth="6*" align="right"/>
38117 <tbody>
38118 <row>
38119 <entry><option>hide_child_in_errmsg</option></entry>
38120 <entry>Use: <emphasis>redirect</emphasis></entry>
38121 <entry>Type: <emphasis>boolean</emphasis></entry>
38122 <entry>Default: <emphasis>false</emphasis></entry>
38123 </row>
38124 </tbody>
38125 </tgroup>
38126 </informaltable>
38127 <para>
38128 <indexterm role="concept">
38129 <primary>bounce message</primary>
38130 <secondary>redirection details; suppressing</secondary>
38131 </indexterm>
38132 If this option is true, it prevents Exim from quoting a child address if it
38133 generates a bounce or delay message for it. Instead it says <quote>an address
38134 generated from &lt;<emphasis>the top level address</emphasis>&gt;</quote>. Of course, this applies only to
38135 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
38136 bounce may well quote the generated address.
38137 </para>
38138 <para>
38139 <indexterm role="option">
38140 <primary><option>ignore_eacces</option></primary>
38141 </indexterm>
38142 </para>
38143 <informaltable frame="all">
38144 <tgroup cols="4" colsep="0" rowsep="0">
38145 <colspec colwidth="8*" align="left"/>
38146 <colspec colwidth="6*" align="center"/>
38147 <colspec colwidth="6*" align="center"/>
38148 <colspec colwidth="6*" align="right"/>
38149 <tbody>
38150 <row>
38151 <entry><option>ignore_eacces</option></entry>
38152 <entry>Use: <emphasis>redirect</emphasis></entry>
38153 <entry>Type: <emphasis>boolean</emphasis></entry>
38154 <entry>Default: <emphasis>false</emphasis></entry>
38155 </row>
38156 </tbody>
38157 </tgroup>
38158 </informaltable>
38159 <para>
38160 <indexterm role="concept">
38161 <primary>EACCES</primary>
38162 </indexterm>
38163 If this option is set and an attempt to open a redirection file yields the
38164 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
38165 file did not exist.
38166 </para>
38167 <para>
38168 <indexterm role="option">
38169 <primary><option>ignore_enotdir</option></primary>
38170 </indexterm>
38171 </para>
38172 <informaltable frame="all">
38173 <tgroup cols="4" colsep="0" rowsep="0">
38174 <colspec colwidth="8*" align="left"/>
38175 <colspec colwidth="6*" align="center"/>
38176 <colspec colwidth="6*" align="center"/>
38177 <colspec colwidth="6*" align="right"/>
38178 <tbody>
38179 <row>
38180 <entry><option>ignore_enotdir</option></entry>
38181 <entry>Use: <emphasis>redirect</emphasis></entry>
38182 <entry>Type: <emphasis>boolean</emphasis></entry>
38183 <entry>Default: <emphasis>false</emphasis></entry>
38184 </row>
38185 </tbody>
38186 </tgroup>
38187 </informaltable>
38188 <para>
38189 <indexterm role="concept">
38190 <primary>ENOTDIR</primary>
38191 </indexterm>
38192 If this option is set and an attempt to open a redirection file yields the
38193 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
38194 router behaves as if the file did not exist.
38195 </para>
38196 <para>
38197 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
38198 router that has the <option>file</option> option set discovers that the file does not exist
38199 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
38200 against unmounted NFS directories. If the parent can not be statted, delivery
38201 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
38202 is set, because that option tells Exim to ignore <quote>something on the path is not
38203 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
38204 that some operating systems give ENOENT where others give ENOTDIR.
38205 </para>
38206 <para>
38207 <indexterm role="option">
38208 <primary><option>include_directory</option></primary>
38209 </indexterm>
38210 </para>
38211 <informaltable frame="all">
38212 <tgroup cols="4" colsep="0" rowsep="0">
38213 <colspec colwidth="8*" align="left"/>
38214 <colspec colwidth="6*" align="center"/>
38215 <colspec colwidth="6*" align="center"/>
38216 <colspec colwidth="6*" align="right"/>
38217 <tbody>
38218 <row>
38219 <entry><option>include_directory</option></entry>
38220 <entry>Use: <emphasis>redirect</emphasis></entry>
38221 <entry>Type: <emphasis>string</emphasis></entry>
38222 <entry>Default: <emphasis>unset</emphasis></entry>
38223 </row>
38224 </tbody>
38225 </tgroup>
38226 </informaltable>
38227 <para>
38228 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
38229 redirection list must start with this directory.
38230 </para>
38231 <para>
38232 <indexterm role="option">
38233 <primary><option>modemask</option></primary>
38234 </indexterm>
38235 </para>
38236 <informaltable frame="all">
38237 <tgroup cols="4" colsep="0" rowsep="0">
38238 <colspec colwidth="8*" align="left"/>
38239 <colspec colwidth="6*" align="center"/>
38240 <colspec colwidth="6*" align="center"/>
38241 <colspec colwidth="6*" align="right"/>
38242 <tbody>
38243 <row>
38244 <entry><option>modemask</option></entry>
38245 <entry>Use: <emphasis>redirect</emphasis></entry>
38246 <entry>Type: <emphasis>octal integer</emphasis></entry>
38247 <entry>Default: <emphasis>022</emphasis></entry>
38248 </row>
38249 </tbody>
38250 </tgroup>
38251 </informaltable>
38252 <para>
38253 This specifies mode bits which must not be set for a file specified by the
38254 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
38255 </para>
38256 <para>
38257 <indexterm role="option">
38258 <primary><option>one_time</option></primary>
38259 </indexterm>
38260 </para>
38261 <informaltable frame="all">
38262 <tgroup cols="4" colsep="0" rowsep="0">
38263 <colspec colwidth="8*" align="left"/>
38264 <colspec colwidth="6*" align="center"/>
38265 <colspec colwidth="6*" align="center"/>
38266 <colspec colwidth="6*" align="right"/>
38267 <tbody>
38268 <row>
38269 <entry><option>one_time</option></entry>
38270 <entry>Use: <emphasis>redirect</emphasis></entry>
38271 <entry>Type: <emphasis>boolean</emphasis></entry>
38272 <entry>Default: <emphasis>false</emphasis></entry>
38273 </row>
38274 </tbody>
38275 </tgroup>
38276 </informaltable>
38277 <para>
38278 <indexterm role="concept">
38279 <primary>one-time aliasing/forwarding expansion</primary>
38280 </indexterm>
38281 <indexterm role="concept">
38282 <primary>alias file</primary>
38283 <secondary>one-time expansion</secondary>
38284 </indexterm>
38285 <indexterm role="concept">
38286 <primary>forward file</primary>
38287 <secondary>one-time expansion</secondary>
38288 </indexterm>
38289 <indexterm role="concept">
38290 <primary>mailing lists</primary>
38291 <secondary>one-time expansion</secondary>
38292 </indexterm>
38293 <indexterm role="concept">
38294 <primary>address redirection</primary>
38295 <secondary>one-time expansion</secondary>
38296 </indexterm>
38297 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
38298 files each time it tries to deliver a message causes a problem when one or more
38299 of the generated addresses fails be delivered at the first attempt. The problem
38300 is not one of duplicate delivery &ndash; Exim is clever enough to handle that &ndash;
38301 but of what happens when the redirection list changes during the time that the
38302 message is on Exim&#x2019;s queue. This is particularly true in the case of mailing
38303 lists, where new subscribers might receive copies of messages that were posted
38304 before they subscribed.
38305 </para>
38306 <para>
38307 If <option>one_time</option> is set and any addresses generated by the router fail to
38308 deliver at the first attempt, the failing addresses are added to the message as
38309 <quote>top level</quote> addresses, and the parent address that generated them is marked
38310 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
38311 attempt.
38312 </para>
38313 <para>
38314 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
38315 router would be lost if delivery did not succeed at the first attempt. For this
38316 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
38317 permitted when <option>one_time</option> is set.
38318 </para>
38319 <para>
38320 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
38321 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
38322 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
38323 </para>
38324 <para>
38325 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
38326 <option>one_time</option>.
38327 </para>
38328 <para>
38329 The original top-level address is remembered with each of the generated
38330 addresses, and is output in any log messages. However, any intermediate parent
38331 addresses are not recorded. This makes a difference to the log only if
38332 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
38333 typically be used for mailing lists, where there is normally just one level of
38334 expansion.
38335 </para>
38336 <para>
38337 <indexterm role="option">
38338 <primary><option>owners</option></primary>
38339 </indexterm>
38340 </para>
38341 <informaltable frame="all">
38342 <tgroup cols="4" colsep="0" rowsep="0">
38343 <colspec colwidth="8*" align="left"/>
38344 <colspec colwidth="6*" align="center"/>
38345 <colspec colwidth="6*" align="center"/>
38346 <colspec colwidth="6*" align="right"/>
38347 <tbody>
38348 <row>
38349 <entry><option>owners</option></entry>
38350 <entry>Use: <emphasis>redirect</emphasis></entry>
38351 <entry>Type: <emphasis>string list</emphasis></entry>
38352 <entry>Default: <emphasis>unset</emphasis></entry>
38353 </row>
38354 </tbody>
38355 </tgroup>
38356 </informaltable>
38357 <para>
38358 <indexterm role="concept">
38359 <primary>ownership</primary>
38360 <secondary>alias file</secondary>
38361 </indexterm>
38362 <indexterm role="concept">
38363 <primary>ownership</primary>
38364 <secondary>forward file</secondary>
38365 </indexterm>
38366 <indexterm role="concept">
38367 <primary>alias file</primary>
38368 <secondary>ownership</secondary>
38369 </indexterm>
38370 <indexterm role="concept">
38371 <primary>forward file</primary>
38372 <secondary>ownership</secondary>
38373 </indexterm>
38374 This specifies a list of permitted owners for the file specified by <option>file</option>.
38375 This list is in addition to the local user when <option>check_local_user</option> is set.
38376 See <option>check_owner</option> above.
38377 </para>
38378 <para>
38379 <indexterm role="option">
38380 <primary><option>owngroups</option></primary>
38381 </indexterm>
38382 </para>
38383 <informaltable frame="all">
38384 <tgroup cols="4" colsep="0" rowsep="0">
38385 <colspec colwidth="8*" align="left"/>
38386 <colspec colwidth="6*" align="center"/>
38387 <colspec colwidth="6*" align="center"/>
38388 <colspec colwidth="6*" align="right"/>
38389 <tbody>
38390 <row>
38391 <entry><option>owngroups</option></entry>
38392 <entry>Use: <emphasis>redirect</emphasis></entry>
38393 <entry>Type: <emphasis>string list</emphasis></entry>
38394 <entry>Default: <emphasis>unset</emphasis></entry>
38395 </row>
38396 </tbody>
38397 </tgroup>
38398 </informaltable>
38399 <para>
38400 This specifies a list of permitted groups for the file specified by <option>file</option>.
38401 The list is in addition to the local user&#x2019;s primary group when
38402 <option>check_local_user</option> is set. See <option>check_group</option> above.
38403 </para>
38404 <para>
38405 <indexterm role="option">
38406 <primary><option>pipe_transport</option></primary>
38407 </indexterm>
38408 </para>
38409 <informaltable frame="all">
38410 <tgroup cols="4" colsep="0" rowsep="0">
38411 <colspec colwidth="8*" align="left"/>
38412 <colspec colwidth="6*" align="center"/>
38413 <colspec colwidth="6*" align="center"/>
38414 <colspec colwidth="6*" align="right"/>
38415 <tbody>
38416 <row>
38417 <entry><option>pipe_transport</option></entry>
38418 <entry>Use: <emphasis>redirect</emphasis></entry>
38419 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38420 <entry>Default: <emphasis>unset</emphasis></entry>
38421 </row>
38422 </tbody>
38423 </tgroup>
38424 </informaltable>
38425 <para>
38426 <indexterm role="variable">
38427 <primary><varname>$address_pipe</varname></primary>
38428 </indexterm>
38429 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
38430 starting with a vertical bar character is specified as a new <quote>address</quote>. The
38431 transport used is specified by this option, which, after expansion, must be the
38432 name of a configured transport. This should normally be a <command>pipe</command> transport.
38433 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
38434 </para>
38435 <para>
38436 <indexterm role="option">
38437 <primary><option>qualify_domain</option></primary>
38438 </indexterm>
38439 </para>
38440 <informaltable frame="all">
38441 <tgroup cols="4" colsep="0" rowsep="0">
38442 <colspec colwidth="8*" align="left"/>
38443 <colspec colwidth="6*" align="center"/>
38444 <colspec colwidth="6*" align="center"/>
38445 <colspec colwidth="6*" align="right"/>
38446 <tbody>
38447 <row>
38448 <entry><option>qualify_domain</option></entry>
38449 <entry>Use: <emphasis>redirect</emphasis></entry>
38450 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38451 <entry>Default: <emphasis>unset</emphasis></entry>
38452 </row>
38453 </tbody>
38454 </tgroup>
38455 </informaltable>
38456 <para>
38457 <indexterm role="variable">
38458 <primary><varname>$qualify_recipient</varname></primary>
38459 </indexterm>
38460 If this option is set, and an unqualified address (one without a domain) is
38461 generated, and that address would normally be qualified by the global setting
38462 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
38463 expanding this string. If the expansion fails, the router declines. If you want
38464 to revert to the default, you can have the expansion generate
38465 <varname>$qualify_recipient</varname>.
38466 </para>
38467 <para>
38468 This option applies to all unqualified addresses generated by Exim filters,
38469 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
38470 not preceded by a backslash. Sieve filters cannot generate unqualified
38471 addresses.
38472 </para>
38473 <para>
38474 <indexterm role="option">
38475 <primary><option>qualify_preserve_domain</option></primary>
38476 </indexterm>
38477 </para>
38478 <informaltable frame="all">
38479 <tgroup cols="4" colsep="0" rowsep="0">
38480 <colspec colwidth="8*" align="left"/>
38481 <colspec colwidth="6*" align="center"/>
38482 <colspec colwidth="6*" align="center"/>
38483 <colspec colwidth="6*" align="right"/>
38484 <tbody>
38485 <row>
38486 <entry><option>qualify_preserve_domain</option></entry>
38487 <entry>Use: <emphasis>redirect</emphasis></entry>
38488 <entry>Type: <emphasis>boolean</emphasis></entry>
38489 <entry>Default: <emphasis>false</emphasis></entry>
38490 </row>
38491 </tbody>
38492 </tgroup>
38493 </informaltable>
38494 <para>
38495 <indexterm role="concept">
38496 <primary>domain</primary>
38497 <secondary>in redirection; preserving</secondary>
38498 </indexterm>
38499 <indexterm role="concept">
38500 <primary>preserving domain in redirection</primary>
38501 </indexterm>
38502 <indexterm role="concept">
38503 <primary>address redirection</primary>
38504 <secondary>domain; preserving</secondary>
38505 </indexterm>
38506 If this option is set, the router&#x2019;s local <option>qualify_domain</option> option must not be
38507 set (a configuration error occurs if it is). If an unqualified address (one
38508 without a domain) is generated, it is qualified with the domain of the parent
38509 address (the immediately preceding ancestor) instead of the global
38510 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
38511 this applies whether or not the address is preceded by a backslash.
38512 </para>
38513 <para>
38514 <indexterm role="option">
38515 <primary><option>repeat_use</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>repeat_use</option></entry>
38527 <entry>Use: <emphasis>redirect</emphasis></entry>
38528 <entry>Type: <emphasis>boolean</emphasis></entry>
38529 <entry>Default: <emphasis>true</emphasis></entry>
38530 </row>
38531 </tbody>
38532 </tgroup>
38533 </informaltable>
38534 <para>
38535 If this option is set false, the router is skipped for a child address that has
38536 any ancestor that was routed by this router. This test happens before any of
38537 the other preconditions are tested. Exim&#x2019;s default anti-looping rules skip
38538 only when the ancestor is the same as the current address. See also
38539 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
38540 </para>
38541 <para>
38542 <indexterm role="option">
38543 <primary><option>reply_transport</option></primary>
38544 </indexterm>
38545 </para>
38546 <informaltable frame="all">
38547 <tgroup cols="4" colsep="0" rowsep="0">
38548 <colspec colwidth="8*" align="left"/>
38549 <colspec colwidth="6*" align="center"/>
38550 <colspec colwidth="6*" align="center"/>
38551 <colspec colwidth="6*" align="right"/>
38552 <tbody>
38553 <row>
38554 <entry><option>reply_transport</option></entry>
38555 <entry>Use: <emphasis>redirect</emphasis></entry>
38556 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38557 <entry>Default: <emphasis>unset</emphasis></entry>
38558 </row>
38559 </tbody>
38560 </tgroup>
38561 </informaltable>
38562 <para>
38563 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
38564 <option>vacation</option> command is used in a filter file. The transport used is specified
38565 by this option, which, after expansion, must be the name of a configured
38566 transport. This should normally be an <command>autoreply</command> transport. Other transports
38567 are unlikely to do anything sensible or useful.
38568 </para>
38569 <para>
38570 <indexterm role="option">
38571 <primary><option>rewrite</option></primary>
38572 </indexterm>
38573 </para>
38574 <informaltable frame="all">
38575 <tgroup cols="4" colsep="0" rowsep="0">
38576 <colspec colwidth="8*" align="left"/>
38577 <colspec colwidth="6*" align="center"/>
38578 <colspec colwidth="6*" align="center"/>
38579 <colspec colwidth="6*" align="right"/>
38580 <tbody>
38581 <row>
38582 <entry><option>rewrite</option></entry>
38583 <entry>Use: <emphasis>redirect</emphasis></entry>
38584 <entry>Type: <emphasis>boolean</emphasis></entry>
38585 <entry>Default: <emphasis>true</emphasis></entry>
38586 </row>
38587 </tbody>
38588 </tgroup>
38589 </informaltable>
38590 <para>
38591 <indexterm role="concept">
38592 <primary>address redirection</primary>
38593 <secondary>disabling rewriting</secondary>
38594 </indexterm>
38595 If this option is set false, addresses generated by the router are not
38596 subject to address rewriting. Otherwise, they are treated like new addresses
38597 and are rewritten according to the global rewriting rules.
38598 </para>
38599 <para>
38600 <indexterm role="option">
38601 <primary><option>sieve_subaddress</option></primary>
38602 </indexterm>
38603 </para>
38604 <informaltable frame="all">
38605 <tgroup cols="4" colsep="0" rowsep="0">
38606 <colspec colwidth="8*" align="left"/>
38607 <colspec colwidth="6*" align="center"/>
38608 <colspec colwidth="6*" align="center"/>
38609 <colspec colwidth="6*" align="right"/>
38610 <tbody>
38611 <row>
38612 <entry><option>sieve_subaddress</option></entry>
38613 <entry>Use: <emphasis>redirect</emphasis></entry>
38614 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38615 <entry>Default: <emphasis>unset</emphasis></entry>
38616 </row>
38617 </tbody>
38618 </tgroup>
38619 </informaltable>
38620 <para>
38621 The value of this option is passed to a Sieve filter to specify the
38622 :subaddress part of an address.
38623 </para>
38624 <para>
38625 <indexterm role="option">
38626 <primary><option>sieve_useraddress</option></primary>
38627 </indexterm>
38628 </para>
38629 <informaltable frame="all">
38630 <tgroup cols="4" colsep="0" rowsep="0">
38631 <colspec colwidth="8*" align="left"/>
38632 <colspec colwidth="6*" align="center"/>
38633 <colspec colwidth="6*" align="center"/>
38634 <colspec colwidth="6*" align="right"/>
38635 <tbody>
38636 <row>
38637 <entry><option>sieve_useraddress</option></entry>
38638 <entry>Use: <emphasis>redirect</emphasis></entry>
38639 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38640 <entry>Default: <emphasis>unset</emphasis></entry>
38641 </row>
38642 </tbody>
38643 </tgroup>
38644 </informaltable>
38645 <para>
38646 The value of this option is passed to a Sieve filter to specify the :user part
38647 of an address. However, if it is unset, the entire original local part
38648 (including any prefix or suffix) is used for :user.
38649 </para>
38650 <para>
38651 <indexterm role="option">
38652 <primary><option>sieve_vacation_directory</option></primary>
38653 </indexterm>
38654 </para>
38655 <informaltable frame="all">
38656 <tgroup cols="4" colsep="0" rowsep="0">
38657 <colspec colwidth="8*" align="left"/>
38658 <colspec colwidth="6*" align="center"/>
38659 <colspec colwidth="6*" align="center"/>
38660 <colspec colwidth="6*" align="right"/>
38661 <tbody>
38662 <row>
38663 <entry><option>sieve_vacation_directory</option></entry>
38664 <entry>Use: <emphasis>redirect</emphasis></entry>
38665 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38666 <entry>Default: <emphasis>unset</emphasis></entry>
38667 </row>
38668 </tbody>
38669 </tgroup>
38670 </informaltable>
38671 <para>
38672 <indexterm role="concept">
38673 <primary>Sieve filter</primary>
38674 <secondary>vacation directory</secondary>
38675 </indexterm>
38676 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
38677 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
38678 (do not put anything else in that directory), and ensure that the
38679 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
38680 needs their own directory; Exim will create it if necessary.
38681 </para>
38682 <para>
38683 <indexterm role="option">
38684 <primary><option>skip_syntax_errors</option></primary>
38685 </indexterm>
38686 </para>
38687 <informaltable frame="all">
38688 <tgroup cols="4" colsep="0" rowsep="0">
38689 <colspec colwidth="8*" align="left"/>
38690 <colspec colwidth="6*" align="center"/>
38691 <colspec colwidth="6*" align="center"/>
38692 <colspec colwidth="6*" align="right"/>
38693 <tbody>
38694 <row>
38695 <entry><option>skip_syntax_errors</option></entry>
38696 <entry>Use: <emphasis>redirect</emphasis></entry>
38697 <entry>Type: <emphasis>boolean</emphasis></entry>
38698 <entry>Default: <emphasis>false</emphasis></entry>
38699 </row>
38700 </tbody>
38701 </tgroup>
38702 </informaltable>
38703 <para>
38704 <indexterm role="concept">
38705 <primary>forward file</primary>
38706 <secondary>broken</secondary>
38707 </indexterm>
38708 <indexterm role="concept">
38709 <primary>address redirection</primary>
38710 <secondary>broken files</secondary>
38711 </indexterm>
38712 <indexterm role="concept">
38713 <primary>alias file</primary>
38714 <secondary>broken</secondary>
38715 </indexterm>
38716 <indexterm role="concept">
38717 <primary>broken alias or forward files</primary>
38718 </indexterm>
38719 <indexterm role="concept">
38720 <primary>ignoring faulty addresses</primary>
38721 </indexterm>
38722 <indexterm role="concept">
38723 <primary>skipping faulty addresses</primary>
38724 </indexterm>
38725 <indexterm role="concept">
38726 <primary>error</primary>
38727 <secondary>skipping bad syntax</secondary>
38728 </indexterm>
38729 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
38730 non-filter redirection data are skipped, and each failing address is logged. If
38731 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
38732 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
38733 are expanded and placed at the head of the error message generated by
38734 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
38735 be the same address as the generic <option>errors_to</option> option. The
38736 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
38737 </para>
38738 <para>
38739 If all the addresses in a redirection list are skipped because of syntax
38740 errors, the router declines to handle the original address, and it is passed to
38741 the following routers.
38742 </para>
38743 <para>
38744 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
38745 error in the filter causes filtering to be abandoned without any action being
38746 taken. The incident is logged, and the router declines to handle the address,
38747 so it is passed to the following routers.
38748 </para>
38749 <para>
38750 <indexterm role="concept">
38751 <primary>Sieve filter</primary>
38752 <secondary>syntax errors in</secondary>
38753 </indexterm>
38754 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
38755 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
38756 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
38757 </para>
38758 <para>
38759 <option>skip_syntax_errors</option> can be used to specify that errors in users&#x2019; forward
38760 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
38761 option, used with an address that does not get redirected, can be used to
38762 notify users of these errors, by means of a router like this:
38763 </para>
38764 <literallayout class="monospaced">
38765 userforward:
38766   driver = redirect
38767   allow_filter
38768   check_local_user
38769   file = $home/.forward
38770   file_transport = address_file
38771   pipe_transport = address_pipe
38772   reply_transport = address_reply
38773   no_verify
38774   skip_syntax_errors
38775   syntax_errors_to = real-$local_part@$domain
38776   syntax_errors_text = \
38777    This is an automatically generated message. An error has\n\
38778    been found in your .forward file. Details of the error are\n\
38779    reported below. While this error persists, you will receive\n\
38780    a copy of this message for every message that is addressed\n\
38781    to you. If your .forward file is a filter file, or if it is\n\
38782    a non-filter file containing no valid forwarding addresses,\n\
38783    a copy of each incoming message will be put in your normal\n\
38784    mailbox. If a non-filter file contains at least one valid\n\
38785    forwarding address, forwarding to the valid addresses will\n\
38786    happen, and those will be the only deliveries that occur.
38787 </literallayout>
38788 <para>
38789 You also need a router to ensure that local addresses that are prefixed by
38790 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
38791 put this immediately before the <command>userforward</command> router:
38792 </para>
38793 <literallayout class="monospaced">
38794 real_localuser:
38795   driver = accept
38796   check_local_user
38797   local_part_prefix = real-
38798   transport = local_delivery
38799 </literallayout>
38800 <para>
38801 For security, it would probably be a good idea to restrict the use of this
38802 router to locally-generated messages, using a condition such as this:
38803 </para>
38804 <literallayout class="monospaced">
38805   condition = ${if match {$sender_host_address}\
38806                          {\N^(|127\.0\.0\.1)$\N}}
38807 </literallayout>
38808 <para>
38809 <indexterm role="option">
38810 <primary><option>syntax_errors_text</option></primary>
38811 </indexterm>
38812 </para>
38813 <informaltable frame="all">
38814 <tgroup cols="4" colsep="0" rowsep="0">
38815 <colspec colwidth="8*" align="left"/>
38816 <colspec colwidth="6*" align="center"/>
38817 <colspec colwidth="6*" align="center"/>
38818 <colspec colwidth="6*" align="right"/>
38819 <tbody>
38820 <row>
38821 <entry><option>syntax_errors_text</option></entry>
38822 <entry>Use: <emphasis>redirect</emphasis></entry>
38823 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38824 <entry>Default: <emphasis>unset</emphasis></entry>
38825 </row>
38826 </tbody>
38827 </tgroup>
38828 </informaltable>
38829 <para>
38830 See <option>skip_syntax_errors</option> above.
38831 </para>
38832 <para>
38833 <indexterm role="option">
38834 <primary><option>syntax_errors_to</option></primary>
38835 </indexterm>
38836 </para>
38837 <informaltable frame="all">
38838 <tgroup cols="4" colsep="0" rowsep="0">
38839 <colspec colwidth="8*" align="left"/>
38840 <colspec colwidth="6*" align="center"/>
38841 <colspec colwidth="6*" align="center"/>
38842 <colspec colwidth="6*" align="right"/>
38843 <tbody>
38844 <row>
38845 <entry><option>syntax_errors_to</option></entry>
38846 <entry>Use: <emphasis>redirect</emphasis></entry>
38847 <entry>Type: <emphasis>string</emphasis></entry>
38848 <entry>Default: <emphasis>unset</emphasis></entry>
38849 </row>
38850 </tbody>
38851 </tgroup>
38852 </informaltable>
38853 <para>
38854 See <option>skip_syntax_errors</option> above.
38855 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
38856 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
38857 </para>
38858 </section>
38859 </chapter>
38860
38861 <chapter id="CHAPenvironment">
38862 <title>Environment for running local transports</title>
38863 <titleabbrev>Environment for local transports</titleabbrev>
38864 <para>
38865 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
38866 <primary>local transports</primary>
38867 <secondary>environment for</secondary>
38868 </indexterm>
38869 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
38870 <primary>environment</primary>
38871 <secondary>local transports</secondary>
38872 </indexterm>
38873 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
38874 <primary>transport</primary>
38875 <secondary>local; environment for</secondary>
38876 </indexterm>
38877 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
38878 transport can be thought of as similar to a pipe.) Exim always runs transports
38879 in subprocesses, under specified uids and gids. Typical deliveries to local
38880 mailboxes run under the uid and gid of the local user.
38881 </para>
38882 <para>
38883 Exim also sets a specific current directory while running the transport; for
38884 some transports a home directory setting is also relevant. The <command>pipe</command>
38885 transport is the only one that sets up environment variables; see section
38886 <xref linkend="SECTpipeenv"/> for details.
38887 </para>
38888 <para>
38889 The values used for the uid, gid, and the directories may come from several
38890 different places. In many cases, the router that handles the address associates
38891 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
38892 or <option>user</option> options. However, values may also be given in the transport&#x2019;s own
38893 configuration, and these override anything that comes from the router.
38894 </para>
38895 <section id="SECID131">
38896 <title>Concurrent deliveries</title>
38897 <para>
38898 <indexterm role="concept">
38899 <primary>concurrent deliveries</primary>
38900 </indexterm>
38901 <indexterm role="concept">
38902 <primary>simultaneous deliveries</primary>
38903 </indexterm>
38904 If two different messages for the same local recipient arrive more or less
38905 simultaneously, the two delivery processes are likely to run concurrently. When
38906 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
38907 rules to stop concurrent processes from writing to the same file at the same
38908 time.
38909 </para>
38910 <para>
38911 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
38912 locking that is needed. Here is a silly example:
38913 </para>
38914 <literallayout class="monospaced">
38915 my_transport:
38916   driver = pipe
38917   command = /bin/sh -c 'cat &gt;&gt;/some/file'
38918 </literallayout>
38919 <para>
38920 This is supposed to write the message at the end of the file. However, if two
38921 messages arrive at the same time, the file will be scrambled. You can use the
38922 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
38923 file using the same algorithm that Exim itself uses.
38924 </para>
38925 </section>
38926 <section id="SECTenvuidgid">
38927 <title>Uids and gids</title>
38928 <para>
38929 <indexterm role="concept">
38930 <primary>local transports</primary>
38931 <secondary>uid and gid</secondary>
38932 </indexterm>
38933 <indexterm role="concept">
38934 <primary>transport</primary>
38935 <secondary>local; uid and gid</secondary>
38936 </indexterm>
38937 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
38938 overrides any group that the router set in the address, even if <option>user</option> is not
38939 set for the transport. This makes it possible, for example, to run local mail
38940 delivery under the uid of the recipient (set by the router), but in a special
38941 group (set by the transport). For example:
38942 </para>
38943 <literallayout class="monospaced">
38944 # Routers ...
38945 # User/group are set by check_local_user in this router
38946 local_users:
38947   driver = accept
38948   check_local_user
38949   transport = group_delivery
38950
38951 # Transports ...
38952 # This transport overrides the group
38953 group_delivery:
38954   driver = appendfile
38955   file = /var/spool/mail/$local_part
38956   group = mail
38957 </literallayout>
38958 <para>
38959 If <option>user</option> is set for a transport, its value overrides what is set in the
38960 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
38961 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
38962 set.
38963 </para>
38964 <para>
38965 <indexterm role="option">
38966 <primary><option>initgroups</option></primary>
38967 </indexterm>
38968 When the uid is taken from the transport&#x2019;s configuration, the <function>initgroups()</function>
38969 function is called for the groups associated with that uid if the
38970 <option>initgroups</option> option is set for the transport. When the uid is not specified
38971 by the transport, but is associated with the address by a router, the option
38972 for calling <function>initgroups()</function> is taken from the router configuration.
38973 </para>
38974 <para>
38975 <indexterm role="concept">
38976 <primary><command>pipe</command> transport</primary>
38977 <secondary>uid for</secondary>
38978 </indexterm>
38979 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
38980 is set and <option>user</option> is not set, the uid of the process that called Exim to
38981 receive the message is used, and if <option>group</option> is not set, the corresponding
38982 original gid is also used.
38983 </para>
38984 <para>
38985 This is the detailed preference order for obtaining a gid; the first of the
38986 following that is set is used:
38987 </para>
38988 <itemizedlist>
38989 <listitem>
38990 <para>
38991 A <option>group</option> setting of the transport;
38992 </para>
38993 </listitem>
38994 <listitem>
38995 <para>
38996 A <option>group</option> setting of the router;
38997 </para>
38998 </listitem>
38999 <listitem>
39000 <para>
39001 A gid associated with a user setting of the router, either as a result of
39002 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
39003 </para>
39004 </listitem>
39005 <listitem>
39006 <para>
39007 The group associated with a non-numeric <option>user</option> setting of the transport;
39008 </para>
39009 </listitem>
39010 <listitem>
39011 <para>
39012 In a <command>pipe</command> transport, the creator&#x2019;s gid if <option>deliver_as_creator</option> is set and
39013 the uid is the creator&#x2019;s uid;
39014 </para>
39015 </listitem>
39016 <listitem>
39017 <para>
39018 The Exim gid if the Exim uid is being used as a default.
39019 </para>
39020 </listitem>
39021 </itemizedlist>
39022 <para>
39023 If, for example, the user is specified numerically on the router and there are
39024 no group settings, no gid is available. In this situation, an error occurs.
39025 This is different for the uid, for which there always is an ultimate default.
39026 The first of the following that is set is used:
39027 </para>
39028 <itemizedlist>
39029 <listitem>
39030 <para>
39031 A <option>user</option> setting of the transport;
39032 </para>
39033 </listitem>
39034 <listitem>
39035 <para>
39036 In a <command>pipe</command> transport, the creator&#x2019;s uid if <option>deliver_as_creator</option> is set;
39037 </para>
39038 </listitem>
39039 <listitem>
39040 <para>
39041 A <option>user</option> setting of the router;
39042 </para>
39043 </listitem>
39044 <listitem>
39045 <para>
39046 A <option>check_local_user</option> setting of the router;
39047 </para>
39048 </listitem>
39049 <listitem>
39050 <para>
39051 The Exim uid.
39052 </para>
39053 </listitem>
39054 </itemizedlist>
39055 <para>
39056 Of course, an error will still occur if the uid that is chosen is on the
39057 <option>never_users</option> list.
39058 </para>
39059 </section>
39060 <section id="SECID132">
39061 <title>Current and home directories</title>
39062 <para>
39063 <indexterm role="concept">
39064 <primary>current directory for local transport</primary>
39065 </indexterm>
39066 <indexterm role="concept">
39067 <primary>home directory</primary>
39068 <secondary>for local transport</secondary>
39069 </indexterm>
39070 <indexterm role="concept">
39071 <primary>transport</primary>
39072 <secondary>local; home directory for</secondary>
39073 </indexterm>
39074 <indexterm role="concept">
39075 <primary>transport</primary>
39076 <secondary>local; current directory for</secondary>
39077 </indexterm>
39078 Routers may set current and home directories for local transports by means of
39079 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
39080 However, if the transport&#x2019;s <option>current_directory</option> or <option>home_directory</option> options
39081 are set, they override the router&#x2019;s values. In detail, the home directory
39082 for a local transport is taken from the first of these values that is set:
39083 </para>
39084 <itemizedlist>
39085 <listitem>
39086 <para>
39087 The <option>home_directory</option> option on the transport;
39088 </para>
39089 </listitem>
39090 <listitem>
39091 <para>
39092 The <option>transport_home_directory</option> option on the router;
39093 </para>
39094 </listitem>
39095 <listitem>
39096 <para>
39097 The password data if <option>check_local_user</option> is set on the router;
39098 </para>
39099 </listitem>
39100 <listitem>
39101 <para>
39102 The <option>router_home_directory</option> option on the router.
39103 </para>
39104 </listitem>
39105 </itemizedlist>
39106 <para>
39107 The current directory is taken from the first of these values that is set:
39108 </para>
39109 <itemizedlist>
39110 <listitem>
39111 <para>
39112 The <option>current_directory</option> option on the transport;
39113 </para>
39114 </listitem>
39115 <listitem>
39116 <para>
39117 The <option>transport_current_directory</option> option on the router.
39118 </para>
39119 </listitem>
39120 </itemizedlist>
39121 <para>
39122 If neither the router nor the transport sets a current directory, Exim uses the
39123 value of the home directory, if it is set. Otherwise it sets the current
39124 directory to <filename>/</filename> before running a local transport.
39125 </para>
39126 </section>
39127 <section id="SECID133">
39128 <title>Expansion variables derived from the address</title>
39129 <para>
39130 <indexterm role="variable">
39131 <primary><varname>$domain</varname></primary>
39132 </indexterm>
39133 <indexterm role="variable">
39134 <primary><varname>$local_part</varname></primary>
39135 </indexterm>
39136 <indexterm role="variable">
39137 <primary><varname>$original_domain</varname></primary>
39138 </indexterm>
39139 Normally a local delivery is handling a single address, and in that case the
39140 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
39141 deliveries. However, in some circumstances more than one address may be handled
39142 at once (for example, while writing batch SMTP for onward transmission by some
39143 other means). In this case, the variables associated with the local part are
39144 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
39145 and <varname>$original_domain</varname> is never set.
39146 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
39147 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
39148 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
39149 </para>
39150 </section>
39151 </chapter>
39152
39153 <chapter id="CHAPtransportgeneric">
39154 <title>Generic options for transports</title>
39155 <para>
39156 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
39157 <primary>generic options</primary>
39158 <secondary>transport</secondary>
39159 </indexterm>
39160 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
39161 <primary>options</primary>
39162 <secondary>generic; for transports</secondary>
39163 </indexterm>
39164 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
39165 <primary>transport</primary>
39166 <secondary>generic options for</secondary>
39167 </indexterm>
39168 The following generic options apply to all transports:
39169 </para>
39170 <para>
39171 <indexterm role="option">
39172 <primary><option>body_only</option></primary>
39173 </indexterm>
39174 </para>
39175 <informaltable frame="all">
39176 <tgroup cols="4" colsep="0" rowsep="0">
39177 <colspec colwidth="8*" align="left"/>
39178 <colspec colwidth="6*" align="center"/>
39179 <colspec colwidth="6*" align="center"/>
39180 <colspec colwidth="6*" align="right"/>
39181 <tbody>
39182 <row>
39183 <entry><option>body_only</option></entry>
39184 <entry>Use: <emphasis>transports</emphasis></entry>
39185 <entry>Type: <emphasis>boolean</emphasis></entry>
39186 <entry>Default: <emphasis>false</emphasis></entry>
39187 </row>
39188 </tbody>
39189 </tgroup>
39190 </informaltable>
39191 <para>
39192 <indexterm role="concept">
39193 <primary>transport</primary>
39194 <secondary>body only</secondary>
39195 </indexterm>
39196 <indexterm role="concept">
39197 <primary>message</primary>
39198 <secondary>transporting body only</secondary>
39199 </indexterm>
39200 <indexterm role="concept">
39201 <primary>body of message</primary>
39202 <secondary>transporting</secondary>
39203 </indexterm>
39204 If this option is set, the message&#x2019;s headers are not transported. It is
39205 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
39206 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
39207 <option>message_suffix</option> should be checked, because this option does not
39208 automatically suppress them.
39209 </para>
39210 <para>
39211 <indexterm role="option">
39212 <primary><option>current_directory</option></primary>
39213 </indexterm>
39214 </para>
39215 <informaltable frame="all">
39216 <tgroup cols="4" colsep="0" rowsep="0">
39217 <colspec colwidth="8*" align="left"/>
39218 <colspec colwidth="6*" align="center"/>
39219 <colspec colwidth="6*" align="center"/>
39220 <colspec colwidth="6*" align="right"/>
39221 <tbody>
39222 <row>
39223 <entry><option>current_directory</option></entry>
39224 <entry>Use: <emphasis>transports</emphasis></entry>
39225 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39226 <entry>Default: <emphasis>unset</emphasis></entry>
39227 </row>
39228 </tbody>
39229 </tgroup>
39230 </informaltable>
39231 <para>
39232 <indexterm role="concept">
39233 <primary>transport</primary>
39234 <secondary>current directory for</secondary>
39235 </indexterm>
39236 This specifies the current directory that is to be set while running the
39237 transport, overriding any value that may have been set by the router.
39238 If the expansion fails for any reason, including forced failure, an error is
39239 logged, and delivery is deferred.
39240 </para>
39241 <para>
39242 <indexterm role="option">
39243 <primary><option>disable_logging</option></primary>
39244 </indexterm>
39245 </para>
39246 <informaltable frame="all">
39247 <tgroup cols="4" colsep="0" rowsep="0">
39248 <colspec colwidth="8*" align="left"/>
39249 <colspec colwidth="6*" align="center"/>
39250 <colspec colwidth="6*" align="center"/>
39251 <colspec colwidth="6*" align="right"/>
39252 <tbody>
39253 <row>
39254 <entry><option>disable_logging</option></entry>
39255 <entry>Use: <emphasis>transports</emphasis></entry>
39256 <entry>Type: <emphasis>boolean</emphasis></entry>
39257 <entry>Default: <emphasis>false</emphasis></entry>
39258 </row>
39259 </tbody>
39260 </tgroup>
39261 </informaltable>
39262 <para>
39263 If this option is set true, nothing is logged for any
39264 deliveries by the transport or for any
39265 transport errors. You should not set this option unless you really, really know
39266 what you are doing.
39267 </para>
39268 <para>
39269 <indexterm role="option">
39270 <primary><option>debug_print</option></primary>
39271 </indexterm>
39272 </para>
39273 <informaltable frame="all">
39274 <tgroup cols="4" colsep="0" rowsep="0">
39275 <colspec colwidth="8*" align="left"/>
39276 <colspec colwidth="6*" align="center"/>
39277 <colspec colwidth="6*" align="center"/>
39278 <colspec colwidth="6*" align="right"/>
39279 <tbody>
39280 <row>
39281 <entry><option>debug_print</option></entry>
39282 <entry>Use: <emphasis>transports</emphasis></entry>
39283 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39284 <entry>Default: <emphasis>unset</emphasis></entry>
39285 </row>
39286 </tbody>
39287 </tgroup>
39288 </informaltable>
39289 <para>
39290 <indexterm role="concept">
39291 <primary>testing</primary>
39292 <secondary>variables in drivers</secondary>
39293 </indexterm>
39294 If this option is set and debugging is enabled (see the <option>-d</option> command line
39295 option), the string is expanded and included in the debugging output when the
39296 transport is run.
39297 If expansion of the string fails, the error message is written to the debugging
39298 output, and Exim carries on processing.
39299 This facility is provided to help with checking out the values of variables and
39300 so on when debugging driver configurations. For example, if a <option>headers_add</option>
39301 option is not working properly, <option>debug_print</option> could be used to output the
39302 variables it references. A newline is added to the text if it does not end with
39303 one.
39304 The variables <varname>$transport_name</varname> and <varname>$router_name</varname> contain the name of the
39305 transport and the router that called it.
39306 </para>
39307 <para>
39308 <indexterm role="option">
39309 <primary><option>delivery_date_add</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>delivery_date_add</option></entry>
39321 <entry>Use: <emphasis>transports</emphasis></entry>
39322 <entry>Type: <emphasis>boolean</emphasis></entry>
39323 <entry>Default: <emphasis>false</emphasis></entry>
39324 </row>
39325 </tbody>
39326 </tgroup>
39327 </informaltable>
39328 <para>
39329 <indexterm role="concept">
39330 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
39331 </indexterm>
39332 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
39333 This gives the actual time the delivery was made. As this is not a standard
39334 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
39335 requests its removal from incoming messages, so that delivered messages can
39336 safely be resent to other recipients.
39337 </para>
39338 <para>
39339 <indexterm role="option">
39340 <primary><option>driver</option></primary>
39341 </indexterm>
39342 </para>
39343 <informaltable frame="all">
39344 <tgroup cols="4" colsep="0" rowsep="0">
39345 <colspec colwidth="8*" align="left"/>
39346 <colspec colwidth="6*" align="center"/>
39347 <colspec colwidth="6*" align="center"/>
39348 <colspec colwidth="6*" align="right"/>
39349 <tbody>
39350 <row>
39351 <entry><option>driver</option></entry>
39352 <entry>Use: <emphasis>transports</emphasis></entry>
39353 <entry>Type: <emphasis>string</emphasis></entry>
39354 <entry>Default: <emphasis>unset</emphasis></entry>
39355 </row>
39356 </tbody>
39357 </tgroup>
39358 </informaltable>
39359 <para>
39360 This specifies which of the available transport drivers is to be used.
39361 There is no default, and this option must be set for every transport.
39362 </para>
39363 <para>
39364 <indexterm role="option">
39365 <primary><option>envelope_to_add</option></primary>
39366 </indexterm>
39367 </para>
39368 <informaltable frame="all">
39369 <tgroup cols="4" colsep="0" rowsep="0">
39370 <colspec colwidth="8*" align="left"/>
39371 <colspec colwidth="6*" align="center"/>
39372 <colspec colwidth="6*" align="center"/>
39373 <colspec colwidth="6*" align="right"/>
39374 <tbody>
39375 <row>
39376 <entry><option>envelope_to_add</option></entry>
39377 <entry>Use: <emphasis>transports</emphasis></entry>
39378 <entry>Type: <emphasis>boolean</emphasis></entry>
39379 <entry>Default: <emphasis>false</emphasis></entry>
39380 </row>
39381 </tbody>
39382 </tgroup>
39383 </informaltable>
39384 <para>
39385 <indexterm role="concept">
39386 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
39387 </indexterm>
39388 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
39389 This gives the original address(es) in the incoming envelope that caused this
39390 delivery to happen. More than one address may be present if the transport is
39391 configured to handle several addresses at once, or if more than one original
39392 address was redirected to the same final address. As this is not a standard
39393 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
39394 its removal from incoming messages, so that delivered messages can safely be
39395 resent to other recipients.
39396 </para>
39397 <para>
39398 <indexterm role="option">
39399 <primary><option>event_action</option></primary>
39400 </indexterm>
39401 </para>
39402 <informaltable frame="all">
39403 <tgroup cols="4" colsep="0" rowsep="0">
39404 <colspec colwidth="8*" align="left"/>
39405 <colspec colwidth="6*" align="center"/>
39406 <colspec colwidth="6*" align="center"/>
39407 <colspec colwidth="6*" align="right"/>
39408 <tbody>
39409 <row>
39410 <entry><option>event_action</option></entry>
39411 <entry>Use: <emphasis>transports</emphasis></entry>
39412 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39413 <entry>Default: <emphasis>unset</emphasis></entry>
39414 </row>
39415 </tbody>
39416 </tgroup>
39417 </informaltable>
39418 <para>
39419 <indexterm role="concept">
39420 <primary>events</primary>
39421 </indexterm>
39422 This option declares a string to be expanded for Exim&#x2019;s events mechanism.
39423 For details see <xref linkend="CHAPevents"/>.
39424 </para>
39425 <para>
39426 <indexterm role="option">
39427 <primary><option>group</option></primary>
39428 </indexterm>
39429 </para>
39430 <informaltable frame="all">
39431 <tgroup cols="4" colsep="0" rowsep="0">
39432 <colspec colwidth="8*" align="left"/>
39433 <colspec colwidth="6*" align="center"/>
39434 <colspec colwidth="6*" align="center"/>
39435 <colspec colwidth="6*" align="right"/>
39436 <tbody>
39437 <row>
39438 <entry><option>group</option></entry>
39439 <entry>Use: <emphasis>transports</emphasis></entry>
39440 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39441 <entry>Default: <emphasis>Exim group</emphasis></entry>
39442 </row>
39443 </tbody>
39444 </tgroup>
39445 </informaltable>
39446 <para>
39447 <indexterm role="concept">
39448 <primary>transport</primary>
39449 <secondary>group; specifying</secondary>
39450 </indexterm>
39451 This option specifies a gid for running the transport process, overriding any
39452 value that the router supplies, and also overriding any value associated with
39453 <option>user</option> (see below).
39454 </para>
39455 <para>
39456 <indexterm role="option">
39457 <primary><option>headers_add</option></primary>
39458 </indexterm>
39459 </para>
39460 <informaltable frame="all">
39461 <tgroup cols="4" colsep="0" rowsep="0">
39462 <colspec colwidth="8*" align="left"/>
39463 <colspec colwidth="6*" align="center"/>
39464 <colspec colwidth="6*" align="center"/>
39465 <colspec colwidth="6*" align="right"/>
39466 <tbody>
39467 <row>
39468 <entry><option>headers_add</option></entry>
39469 <entry>Use: <emphasis>transports</emphasis></entry>
39470 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
39471 <entry>Default: <emphasis>unset</emphasis></entry>
39472 </row>
39473 </tbody>
39474 </tgroup>
39475 </informaltable>
39476 <para>
39477 <indexterm role="concept">
39478 <primary>header lines</primary>
39479 <secondary>adding in transport</secondary>
39480 </indexterm>
39481 <indexterm role="concept">
39482 <primary>transport</primary>
39483 <secondary>header lines; adding</secondary>
39484 </indexterm>
39485 This option specifies a list of text headers,
39486 newline-separated (by default, changeable in the usual way),
39487 which are (separately) expanded and added to the header
39488 portion of a message as it is transported, as described in section
39489 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
39490 routers. If the result of the expansion is an empty string, or if the expansion
39491 is forced to fail, no action is taken. Other expansion failures are treated as
39492 errors and cause the delivery to be deferred.
39493 </para>
39494 <para>
39495 Unlike most options, <option>headers_add</option> can be specified multiple times
39496 for a transport; all listed headers are added.
39497 </para>
39498 <para>
39499 <indexterm role="option">
39500 <primary><option>headers_only</option></primary>
39501 </indexterm>
39502 </para>
39503 <informaltable frame="all">
39504 <tgroup cols="4" colsep="0" rowsep="0">
39505 <colspec colwidth="8*" align="left"/>
39506 <colspec colwidth="6*" align="center"/>
39507 <colspec colwidth="6*" align="center"/>
39508 <colspec colwidth="6*" align="right"/>
39509 <tbody>
39510 <row>
39511 <entry><option>headers_only</option></entry>
39512 <entry>Use: <emphasis>transports</emphasis></entry>
39513 <entry>Type: <emphasis>boolean</emphasis></entry>
39514 <entry>Default: <emphasis>false</emphasis></entry>
39515 </row>
39516 </tbody>
39517 </tgroup>
39518 </informaltable>
39519 <para>
39520 <indexterm role="concept">
39521 <primary>transport</primary>
39522 <secondary>header lines only</secondary>
39523 </indexterm>
39524 <indexterm role="concept">
39525 <primary>message</primary>
39526 <secondary>transporting headers only</secondary>
39527 </indexterm>
39528 <indexterm role="concept">
39529 <primary>header lines</primary>
39530 <secondary>transporting</secondary>
39531 </indexterm>
39532 If this option is set, the message&#x2019;s body is not transported. It is mutually
39533 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
39534 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
39535 checked, since this option does not automatically suppress them.
39536 </para>
39537 <para>
39538 <indexterm role="option">
39539 <primary><option>headers_remove</option></primary>
39540 </indexterm>
39541 </para>
39542 <informaltable frame="all">
39543 <tgroup cols="4" colsep="0" rowsep="0">
39544 <colspec colwidth="8*" align="left"/>
39545 <colspec colwidth="6*" align="center"/>
39546 <colspec colwidth="6*" align="center"/>
39547 <colspec colwidth="6*" align="right"/>
39548 <tbody>
39549 <row>
39550 <entry><option>headers_remove</option></entry>
39551 <entry>Use: <emphasis>transports</emphasis></entry>
39552 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
39553 <entry>Default: <emphasis>unset</emphasis></entry>
39554 </row>
39555 </tbody>
39556 </tgroup>
39557 </informaltable>
39558 <para>
39559 <indexterm role="concept">
39560 <primary>header lines</primary>
39561 <secondary>removing</secondary>
39562 </indexterm>
39563 <indexterm role="concept">
39564 <primary>transport</primary>
39565 <secondary>header lines; removing</secondary>
39566 </indexterm>
39567 This option specifies a list of header names,
39568 colon-separated (by default, changeable in the usual way);
39569 these headers are omitted from the message as it is transported, as described
39570 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
39571 routers.
39572 Each list item is separately expanded.
39573 If the result of the expansion is an empty string, or if the expansion
39574 is forced to fail, no action is taken. Other expansion failures are treated as
39575 errors and cause the delivery to be deferred.
39576 </para>
39577 <para>
39578 Unlike most options, <option>headers_remove</option> can be specified multiple times
39579 for a router; all listed headers are removed.
39580 </para>
39581 <para>
39582 <emphasis role="bold">Warning</emphasis>: Because of the separate expansion of the list items,
39583 items that contain a list separator must have it doubled.
39584 To avoid this, change the list separator (<xref linkend="SECTlistsepchange"/>).
39585 </para>
39586 <para>
39587 <indexterm role="option">
39588 <primary><option>headers_rewrite</option></primary>
39589 </indexterm>
39590 </para>
39591 <informaltable frame="all">
39592 <tgroup cols="4" colsep="0" rowsep="0">
39593 <colspec colwidth="8*" align="left"/>
39594 <colspec colwidth="6*" align="center"/>
39595 <colspec colwidth="6*" align="center"/>
39596 <colspec colwidth="6*" align="right"/>
39597 <tbody>
39598 <row>
39599 <entry><option>headers_rewrite</option></entry>
39600 <entry>Use: <emphasis>transports</emphasis></entry>
39601 <entry>Type: <emphasis>string</emphasis></entry>
39602 <entry>Default: <emphasis>unset</emphasis></entry>
39603 </row>
39604 </tbody>
39605 </tgroup>
39606 </informaltable>
39607 <para>
39608 <indexterm role="concept">
39609 <primary>transport</primary>
39610 <secondary>header lines; rewriting</secondary>
39611 </indexterm>
39612 <indexterm role="concept">
39613 <primary>rewriting</primary>
39614 <secondary>at transport time</secondary>
39615 </indexterm>
39616 This option allows addresses in header lines to be rewritten at transport time,
39617 that is, as the message is being copied to its destination. The contents of the
39618 option are a colon-separated list of rewriting rules. Each rule is in exactly
39619 the same form as one of the general rewriting rules that are applied when a
39620 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
39621 example,
39622 </para>
39623 <literallayout class="monospaced">
39624 headers_rewrite = a@b c@d f : \
39625                   x@y w@z
39626 </literallayout>
39627 <para>
39628 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
39629 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
39630 header lines just before they are written out at transport time, so they affect
39631 only those copies of the message that pass through the transport. However, only
39632 the message&#x2019;s original header lines, and any that were added by a system
39633 filter, are rewritten. If a router or transport adds header lines, they are not
39634 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
39635 envelope. You can change the return path using <option>return_path</option>, but you cannot
39636 change envelope recipients at this time.
39637 </para>
39638 <para>
39639 <indexterm role="option">
39640 <primary><option>home_directory</option></primary>
39641 </indexterm>
39642 </para>
39643 <informaltable frame="all">
39644 <tgroup cols="4" colsep="0" rowsep="0">
39645 <colspec colwidth="8*" align="left"/>
39646 <colspec colwidth="6*" align="center"/>
39647 <colspec colwidth="6*" align="center"/>
39648 <colspec colwidth="6*" align="right"/>
39649 <tbody>
39650 <row>
39651 <entry><option>home_directory</option></entry>
39652 <entry>Use: <emphasis>transports</emphasis></entry>
39653 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39654 <entry>Default: <emphasis>unset</emphasis></entry>
39655 </row>
39656 </tbody>
39657 </tgroup>
39658 </informaltable>
39659 <para>
39660 <indexterm role="concept">
39661 <primary>transport</primary>
39662 <secondary>home directory for</secondary>
39663 </indexterm>
39664 <indexterm role="variable">
39665 <primary><varname>$home</varname></primary>
39666 </indexterm>
39667 This option specifies a home directory setting for a local transport,
39668 overriding any value that may be set by the router. The home directory is
39669 placed in <varname>$home</varname> while expanding the transport&#x2019;s private options. It is also
39670 used as the current directory if no current directory is set by the
39671 <option>current_directory</option> option on the transport or the
39672 <option>transport_current_directory</option> option on the router. If the expansion fails
39673 for any reason, including forced failure, an error is logged, and delivery is
39674 deferred.
39675 </para>
39676 <para>
39677 <indexterm role="option">
39678 <primary><option>initgroups</option></primary>
39679 </indexterm>
39680 </para>
39681 <informaltable frame="all">
39682 <tgroup cols="4" colsep="0" rowsep="0">
39683 <colspec colwidth="8*" align="left"/>
39684 <colspec colwidth="6*" align="center"/>
39685 <colspec colwidth="6*" align="center"/>
39686 <colspec colwidth="6*" align="right"/>
39687 <tbody>
39688 <row>
39689 <entry><option>initgroups</option></entry>
39690 <entry>Use: <emphasis>transports</emphasis></entry>
39691 <entry>Type: <emphasis>boolean</emphasis></entry>
39692 <entry>Default: <emphasis>false</emphasis></entry>
39693 </row>
39694 </tbody>
39695 </tgroup>
39696 </informaltable>
39697 <para>
39698 <indexterm role="concept">
39699 <primary>additional groups</primary>
39700 </indexterm>
39701 <indexterm role="concept">
39702 <primary>groups</primary>
39703 <secondary>additional</secondary>
39704 </indexterm>
39705 <indexterm role="concept">
39706 <primary>transport</primary>
39707 <secondary>group; additional</secondary>
39708 </indexterm>
39709 If this option is true and the uid for the delivery process is provided by the
39710 transport, the <function>initgroups()</function> function is called when running the transport
39711 to ensure that any additional groups associated with the uid are set up.
39712 </para>
39713 <para revisionflag="changed">
39714 <indexterm role="option">
39715 <primary><option>max_parallel</option></primary>
39716 </indexterm>
39717 </para>
39718 <informaltable frame="all" revisionflag="changed">
39719 <tgroup cols="4" colsep="0" rowsep="0">
39720 <colspec colwidth="8*" align="left"/>
39721 <colspec colwidth="6*" align="center"/>
39722 <colspec colwidth="6*" align="center"/>
39723 <colspec colwidth="6*" align="right"/>
39724 <tbody>
39725 <row>
39726 <entry><option>max_parallel</option></entry>
39727 <entry>Use: <emphasis>transports</emphasis></entry>
39728 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
39729 <entry>Default: <emphasis>unset</emphasis></entry>
39730 </row>
39731 </tbody>
39732 </tgroup>
39733 </informaltable>
39734 <para revisionflag="changed">
39735 <indexterm role="concept">
39736 <primary>limit</primary>
39737 <secondary>transport parallelism</secondary>
39738 </indexterm>
39739 <indexterm role="concept">
39740 <primary>transport</primary>
39741 <secondary>parallel processes</secondary>
39742 </indexterm>
39743 <indexterm role="concept">
39744 <primary>transport</primary>
39745 <secondary>concurrency limit</secondary>
39746 </indexterm>
39747 <indexterm role="concept">
39748 <primary>delivery</primary>
39749 <secondary>parallelism for transport</secondary>
39750 </indexterm>
39751 If this option is set and expands to an integer greater than zero
39752 it limits the number of concurrent runs of the transport.
39753 The control does not apply to shadow transports.
39754 </para>
39755 <para revisionflag="changed">
39756 <indexterm role="concept">
39757 <primary>hints database</primary>
39758 <secondary>transport concurrency control</secondary>
39759 </indexterm>
39760 Exim implements this control by means of a hints database in which a record is
39761 incremented whenever a transport process is beaing created. The record
39762 is decremented and possibly removed when the process terminates.
39763 Obviously there is scope for
39764 records to get left lying around if there is a system or program crash. To
39765 guard against this, Exim ignores any records that are more than six hours old.
39766 </para>
39767 <para revisionflag="changed">
39768 If you use this option, you should also arrange to delete the
39769 relevant hints database whenever your system reboots. The names of the files
39770 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
39771 may be one or two files, depending on the type of DBM in use. The same files
39772 are used for ETRN and smtp transport serialization.
39773 </para>
39774 <para>
39775 <indexterm role="option">
39776 <primary><option>message_size_limit</option></primary>
39777 </indexterm>
39778 </para>
39779 <informaltable frame="all">
39780 <tgroup cols="4" colsep="0" rowsep="0">
39781 <colspec colwidth="8*" align="left"/>
39782 <colspec colwidth="6*" align="center"/>
39783 <colspec colwidth="6*" align="center"/>
39784 <colspec colwidth="6*" align="right"/>
39785 <tbody>
39786 <row>
39787 <entry><option>message_size_limit</option></entry>
39788 <entry>Use: <emphasis>transports</emphasis></entry>
39789 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39790 <entry>Default: <emphasis>0</emphasis></entry>
39791 </row>
39792 </tbody>
39793 </tgroup>
39794 </informaltable>
39795 <para>
39796 <indexterm role="concept">
39797 <primary>limit</primary>
39798 <secondary>message size per transport</secondary>
39799 </indexterm>
39800 <indexterm role="concept">
39801 <primary>size</primary>
39802 <secondary>of message, limit</secondary>
39803 </indexterm>
39804 <indexterm role="concept">
39805 <primary>transport</primary>
39806 <secondary>message size; limiting</secondary>
39807 </indexterm>
39808 This option controls the size of messages passed through the transport. It is
39809 expanded before use; the result of the expansion must be a sequence of decimal
39810 digits, optionally followed by K or M. If the expansion fails for any reason,
39811 including forced failure, or if the result is not of the required form,
39812 delivery is deferred. If the value is greater than zero and the size of a
39813 message exceeds this limit, the address is failed. If there is any chance that
39814 the resulting bounce message could be routed to the same transport, you should
39815 ensure that <option>return_size_limit</option> is less than the transport&#x2019;s
39816 <option>message_size_limit</option>, as otherwise the bounce message will fail to get
39817 delivered.
39818 </para>
39819 <para>
39820 <indexterm role="option">
39821 <primary><option>rcpt_include_affixes</option></primary>
39822 </indexterm>
39823 </para>
39824 <informaltable frame="all">
39825 <tgroup cols="4" colsep="0" rowsep="0">
39826 <colspec colwidth="8*" align="left"/>
39827 <colspec colwidth="6*" align="center"/>
39828 <colspec colwidth="6*" align="center"/>
39829 <colspec colwidth="6*" align="right"/>
39830 <tbody>
39831 <row>
39832 <entry><option>rcpt_include_affixes</option></entry>
39833 <entry>Use: <emphasis>transports</emphasis></entry>
39834 <entry>Type: <emphasis>boolean</emphasis></entry>
39835 <entry>Default: <emphasis>false</emphasis></entry>
39836 </row>
39837 </tbody>
39838 </tgroup>
39839 </informaltable>
39840 <para>
39841 <indexterm role="concept">
39842 <primary>prefix</primary>
39843 <secondary>for local part, including in envelope</secondary>
39844 </indexterm>
39845 <indexterm role="concept">
39846 <primary>suffix for local part</primary>
39847 <secondary>including in envelope</secondary>
39848 </indexterm>
39849 <indexterm role="concept">
39850 <primary>local part</primary>
39851 <secondary>prefix</secondary>
39852 </indexterm>
39853 <indexterm role="concept">
39854 <primary>local part</primary>
39855 <secondary>suffix</secondary>
39856 </indexterm>
39857 When this option is false (the default), and an address that has had any
39858 affixes (prefixes or suffixes) removed from the local part is delivered by any
39859 form of SMTP or LMTP, the affixes are not included. For example, if a router
39860 that contains
39861 </para>
39862 <literallayout class="monospaced">
39863 local_part_prefix = *-
39864 </literallayout>
39865 <para>
39866 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
39867 is delivered with
39868 </para>
39869 <literallayout class="monospaced">
39870 RCPT TO:&lt;xyz@some.domain&gt;
39871 </literallayout>
39872 <para>
39873 This is also the case when an ACL-time callout is being used to verify a
39874 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
39875 whole local part is included in the RCPT command. This option applies to BSMTP
39876 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
39877 <command>lmtp</command> and <command>smtp</command> transports.
39878 </para>
39879 <para>
39880 <indexterm role="option">
39881 <primary><option>retry_use_local_part</option></primary>
39882 </indexterm>
39883 </para>
39884 <informaltable frame="all">
39885 <tgroup cols="4" colsep="0" rowsep="0">
39886 <colspec colwidth="8*" align="left"/>
39887 <colspec colwidth="6*" align="center"/>
39888 <colspec colwidth="6*" align="center"/>
39889 <colspec colwidth="6*" align="right"/>
39890 <tbody>
39891 <row>
39892 <entry><option>retry_use_local_part</option></entry>
39893 <entry>Use: <emphasis>transports</emphasis></entry>
39894 <entry>Type: <emphasis>boolean</emphasis></entry>
39895 <entry>Default: <emphasis>see below</emphasis></entry>
39896 </row>
39897 </tbody>
39898 </tgroup>
39899 </informaltable>
39900 <para>
39901 <indexterm role="concept">
39902 <primary>hints database</primary>
39903 <secondary>retry keys</secondary>
39904 </indexterm>
39905 When a delivery suffers a temporary failure, a retry record is created
39906 in Exim&#x2019;s hints database. For remote deliveries, the key for the retry record
39907 is based on the name and/or IP address of the failing remote host. For local
39908 deliveries, the key is normally the entire address, including both the local
39909 part and the domain. This is suitable for most common cases of local delivery
39910 temporary failure &ndash; for example, exceeding a mailbox quota should delay only
39911 deliveries to that mailbox, not to the whole domain.
39912 </para>
39913 <para>
39914 However, in some special cases you may want to treat a temporary local delivery
39915 as a failure associated with the domain, and not with a particular local part.
39916 (For example, if you are storing all mail for some domain in files.) You can do
39917 this by setting <option>retry_use_local_part</option> false.
39918 </para>
39919 <para>
39920 For all the local transports, its default value is true. For remote transports,
39921 the default value is false for tidiness, but changing the value has no effect
39922 on a remote transport in the current implementation.
39923 </para>
39924 <para>
39925 <indexterm role="option">
39926 <primary><option>return_path</option></primary>
39927 </indexterm>
39928 </para>
39929 <informaltable frame="all">
39930 <tgroup cols="4" colsep="0" rowsep="0">
39931 <colspec colwidth="8*" align="left"/>
39932 <colspec colwidth="6*" align="center"/>
39933 <colspec colwidth="6*" align="center"/>
39934 <colspec colwidth="6*" align="right"/>
39935 <tbody>
39936 <row>
39937 <entry><option>return_path</option></entry>
39938 <entry>Use: <emphasis>transports</emphasis></entry>
39939 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39940 <entry>Default: <emphasis>unset</emphasis></entry>
39941 </row>
39942 </tbody>
39943 </tgroup>
39944 </informaltable>
39945 <para>
39946 <indexterm role="concept">
39947 <primary>envelope sender</primary>
39948 </indexterm>
39949 <indexterm role="concept">
39950 <primary>transport</primary>
39951 <secondary>return path; changing</secondary>
39952 </indexterm>
39953 <indexterm role="concept">
39954 <primary>return path</primary>
39955 <secondary>changing in transport</secondary>
39956 </indexterm>
39957 If this option is set, the string is expanded at transport time and replaces
39958 the existing return path (envelope sender) value in the copy of the message
39959 that is being delivered. An empty return path is permitted. This feature is
39960 designed for remote deliveries, where the value of this option is used in the
39961 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
39962 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
39963 header line, if one is added to the message (see the next option).
39964 </para>
39965 <para>
39966 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
39967 <option>return_path_on_delivery</option> to the log selector.
39968 </para>
39969 <para>
39970 <indexterm role="variable">
39971 <primary><varname>$return_path</varname></primary>
39972 </indexterm>
39973 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
39974 either the message&#x2019;s envelope sender, or an address set by the
39975 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
39976 replacement occurs; if it fails for another reason, delivery is deferred. This
39977 option can be used to support VERP (Variable Envelope Return Paths) &ndash; see
39978 section <xref linkend="SECTverp"/>.
39979 </para>
39980 <para>
39981 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
39982 remote server rejects a message at SMTP time, the bounce message is not sent to
39983 the value of this option. It is sent to the previously set errors address.
39984 This defaults to the incoming sender address, but can be changed by setting
39985 <option>errors_to</option> in a router.
39986 </para>
39987 <para>
39988 <indexterm role="option">
39989 <primary><option>return_path_add</option></primary>
39990 </indexterm>
39991 </para>
39992 <informaltable frame="all">
39993 <tgroup cols="4" colsep="0" rowsep="0">
39994 <colspec colwidth="8*" align="left"/>
39995 <colspec colwidth="6*" align="center"/>
39996 <colspec colwidth="6*" align="center"/>
39997 <colspec colwidth="6*" align="right"/>
39998 <tbody>
39999 <row>
40000 <entry><option>return_path_add</option></entry>
40001 <entry>Use: <emphasis>transports</emphasis></entry>
40002 <entry>Type: <emphasis>boolean</emphasis></entry>
40003 <entry>Default: <emphasis>false</emphasis></entry>
40004 </row>
40005 </tbody>
40006 </tgroup>
40007 </informaltable>
40008 <para>
40009 <indexterm role="concept">
40010 <primary><emphasis>Return-path:</emphasis> header line</primary>
40011 </indexterm>
40012 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
40013 Although the return path is normally available in the prefix line of BSD
40014 mailboxes, this is commonly not displayed by MUAs, and so the user does not
40015 have easy access to it.
40016 </para>
40017 <para>
40018 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
40019 the delivery SMTP server makes the final delivery</quote>. This implies that this
40020 header should not be present in incoming messages. Exim has a configuration
40021 option, <option>return_path_remove</option>, which requests removal of this header from
40022 incoming messages, so that delivered messages can safely be resent to other
40023 recipients.
40024 </para>
40025 <para>
40026 <indexterm role="option">
40027 <primary><option>shadow_condition</option></primary>
40028 </indexterm>
40029 </para>
40030 <informaltable frame="all">
40031 <tgroup cols="4" colsep="0" rowsep="0">
40032 <colspec colwidth="8*" align="left"/>
40033 <colspec colwidth="6*" align="center"/>
40034 <colspec colwidth="6*" align="center"/>
40035 <colspec colwidth="6*" align="right"/>
40036 <tbody>
40037 <row>
40038 <entry><option>shadow_condition</option></entry>
40039 <entry>Use: <emphasis>transports</emphasis></entry>
40040 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40041 <entry>Default: <emphasis>unset</emphasis></entry>
40042 </row>
40043 </tbody>
40044 </tgroup>
40045 </informaltable>
40046 <para>
40047 See <option>shadow_transport</option> below.
40048 </para>
40049 <para>
40050 <indexterm role="option">
40051 <primary><option>shadow_transport</option></primary>
40052 </indexterm>
40053 </para>
40054 <informaltable frame="all">
40055 <tgroup cols="4" colsep="0" rowsep="0">
40056 <colspec colwidth="8*" align="left"/>
40057 <colspec colwidth="6*" align="center"/>
40058 <colspec colwidth="6*" align="center"/>
40059 <colspec colwidth="6*" align="right"/>
40060 <tbody>
40061 <row>
40062 <entry><option>shadow_transport</option></entry>
40063 <entry>Use: <emphasis>transports</emphasis></entry>
40064 <entry>Type: <emphasis>string</emphasis></entry>
40065 <entry>Default: <emphasis>unset</emphasis></entry>
40066 </row>
40067 </tbody>
40068 </tgroup>
40069 </informaltable>
40070 <para>
40071 <indexterm role="concept">
40072 <primary>shadow transport</primary>
40073 </indexterm>
40074 <indexterm role="concept">
40075 <primary>transport</primary>
40076 <secondary>shadow</secondary>
40077 </indexterm>
40078 A local transport may set the <option>shadow_transport</option> option to the name of
40079 another local transport. Shadow remote transports are not supported.
40080 </para>
40081 <para>
40082 Whenever a delivery to the main transport succeeds, and either
40083 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
40084 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
40085 passed to the shadow transport, with the same delivery address or addresses. If
40086 expansion fails, no action is taken except that non-forced expansion failures
40087 cause a log line to be written.
40088 </para>
40089 <para>
40090 The result of the shadow transport is discarded and does not affect the
40091 subsequent processing of the message. Only a single level of shadowing is
40092 provided; the <option>shadow_transport</option> option is ignored on any transport when it
40093 is running as a shadow. Options concerned with output from pipes are also
40094 ignored. The log line for the successful delivery has an item added on the end,
40095 of the form
40096 </para>
40097 <literallayout class="monospaced">
40098 ST=&lt;shadow transport name&gt;
40099 </literallayout>
40100 <para>
40101 If the shadow transport did not succeed, the error message is put in
40102 parentheses afterwards. Shadow transports can be used for a number of different
40103 purposes, including keeping more detailed log information than Exim normally
40104 provides, and implementing automatic acknowledgment policies based on message
40105 headers that some sites insist on.
40106 </para>
40107 <para>
40108 <indexterm role="option">
40109 <primary><option>transport_filter</option></primary>
40110 </indexterm>
40111 </para>
40112 <informaltable frame="all">
40113 <tgroup cols="4" colsep="0" rowsep="0">
40114 <colspec colwidth="8*" align="left"/>
40115 <colspec colwidth="6*" align="center"/>
40116 <colspec colwidth="6*" align="center"/>
40117 <colspec colwidth="6*" align="right"/>
40118 <tbody>
40119 <row>
40120 <entry><option>transport_filter</option></entry>
40121 <entry>Use: <emphasis>transports</emphasis></entry>
40122 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40123 <entry>Default: <emphasis>unset</emphasis></entry>
40124 </row>
40125 </tbody>
40126 </tgroup>
40127 </informaltable>
40128 <para>
40129 <indexterm role="concept">
40130 <primary>transport</primary>
40131 <secondary>filter</secondary>
40132 </indexterm>
40133 <indexterm role="concept">
40134 <primary>filter</primary>
40135 <secondary>transport filter</secondary>
40136 </indexterm>
40137 This option sets up a filtering (in the Unix shell sense) process for messages
40138 at transport time. It should not be confused with mail filtering as set up by
40139 individual users or via a system filter.
40140 </para>
40141 <para revisionflag="changed">
40142 If unset, or expanding to an empty string, no filtering is done.
40143 </para>
40144 <para>
40145 When the message is about to be written out, the command specified by
40146 <option>transport_filter</option> is started up in a separate, parallel process, and
40147 the entire message, including the header lines, is passed to it on its standard
40148 input (this in fact is done from a third process, to avoid deadlock). The
40149 command must be specified as an absolute path.
40150 </para>
40151 <para>
40152 The lines of the message that are written to the transport filter are
40153 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
40154 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
40155 lines beginning with a dot, and also before any processing implied by the
40156 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
40157 <command>pipe</command> transports.
40158 </para>
40159 <para>
40160 The standard error for the filter process is set to the same destination as its
40161 standard output; this is read and written to the message&#x2019;s ultimate
40162 destination. The process that writes the message to the filter, the
40163 filter itself, and the original process that reads the result and delivers it
40164 are all run in parallel, like a shell pipeline.
40165 </para>
40166 <para>
40167 The filter can perform any transformations it likes, but of course should take
40168 care not to break RFC 2822 syntax. Exim does not check the result, except to
40169 test for a final newline when SMTP is in use. All messages transmitted over
40170 SMTP must end with a newline, so Exim supplies one if it is missing.
40171 </para>
40172 <para>
40173 <indexterm role="concept">
40174 <primary>content scanning</primary>
40175 <secondary>per user</secondary>
40176 </indexterm>
40177 A transport filter can be used to provide content-scanning on a per-user basis
40178 at delivery time if the only required effect of the scan is to modify the
40179 message. For example, a content scan could insert a new header line containing
40180 a spam score. This could be interpreted by a filter in the user&#x2019;s MUA. It is
40181 not possible to discard a message at this stage.
40182 </para>
40183 <para>
40184 <indexterm role="concept">
40185 <primary>SMTP</primary>
40186 <secondary>SIZE</secondary>
40187 </indexterm>
40188 A problem might arise if the filter increases the size of a message that is
40189 being sent down an SMTP connection. If the receiving SMTP server has indicated
40190 support for the SIZE parameter, Exim will have sent the size of the message
40191 at the start of the SMTP session. If what is actually sent is substantially
40192 more, the server might reject the message. This can be worked round by setting
40193 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
40194 additions to the message, or to disable the use of SIZE altogether.
40195 </para>
40196 <para>
40197 <indexterm role="variable">
40198 <primary><varname>$pipe_addresses</varname></primary>
40199 </indexterm>
40200 The value of the <option>transport_filter</option> option is the command string for starting
40201 the filter, which is run directly from Exim, not under a shell. The string is
40202 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
40203 Exim breaks it up into arguments and then expands each argument separately (see
40204 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
40205 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
40206 of arguments, one for each address that applies to this delivery. (This isn&#x2019;t
40207 an ideal name for this feature here, but as it was already implemented for the
40208 <command>pipe</command> transport, it seemed sensible not to change it.)
40209 </para>
40210 <para>
40211 <indexterm role="variable">
40212 <primary><varname>$host</varname></primary>
40213 </indexterm>
40214 <indexterm role="variable">
40215 <primary><varname>$host_address</varname></primary>
40216 </indexterm>
40217 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
40218 transport is a remote one. They contain the name and IP address of the host to
40219 which the message is being sent. For example:
40220 </para>
40221 <literallayout class="monospaced">
40222 transport_filter = /some/directory/transport-filter.pl \
40223   $host $host_address $sender_address $pipe_addresses
40224 </literallayout>
40225 <para>
40226 Two problems arise if you want to use more complicated expansion items to
40227 generate transport filter commands, both of which due to the fact that the
40228 command is split up <emphasis>before</emphasis> expansion.
40229 </para>
40230 <itemizedlist>
40231 <listitem>
40232 <para>
40233 If an expansion item contains white space, you must quote it, so that it is all
40234 part of the same command item. If the entire option setting is one such
40235 expansion item, you have to take care what kind of quoting you use. For
40236 example:
40237 </para>
40238 <literallayout class="monospaced">
40239 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
40240 </literallayout>
40241 <para>
40242 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
40243 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
40244 stripped by Exim when it read the option&#x2019;s value. When the value is used, if
40245 the single quotes were missing, the line would be split into two items,
40246 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
40247 Exim tried to expand the first one.
40248 </para>
40249 </listitem>
40250 <listitem>
40251 <para>
40252 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
40253 expansion cannot generate multiple arguments, or a command name followed by
40254 arguments. Consider this example:
40255 </para>
40256 <literallayout class="monospaced">
40257 transport_filter = ${lookup{$host}lsearch{/a/file}\
40258                     {$value}{/bin/cat}}
40259 </literallayout>
40260 <para>
40261 The result of the lookup is interpreted as the name of the command, even
40262 if it contains white space. The simplest way round this is to use a shell:
40263 </para>
40264 <literallayout class="monospaced">
40265 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/a/file}\
40266                                {$value}{/bin/cat}}
40267 </literallayout>
40268 </listitem>
40269 </itemizedlist>
40270 <para>
40271 The filter process is run under the same uid and gid as the normal delivery.
40272 For remote deliveries this is the Exim uid/gid by default. The command should
40273 normally yield a zero return code. Transport filters are not supposed to fail.
40274 A non-zero code is taken to mean that the transport filter encountered some
40275 serious problem. Delivery of the message is deferred; the message remains on
40276 the queue and is tried again later. It is not possible to cause a message to be
40277 bounced from a transport filter.
40278 </para>
40279 <para>
40280 If a transport filter is set on an autoreply transport, the original message is
40281 passed through the filter as it is being copied into the newly generated
40282 message, which happens if the <option>return_message</option> option is set.
40283 </para>
40284 <para>
40285 <indexterm role="option">
40286 <primary><option>transport_filter_timeout</option></primary>
40287 </indexterm>
40288 </para>
40289 <informaltable frame="all">
40290 <tgroup cols="4" colsep="0" rowsep="0">
40291 <colspec colwidth="8*" align="left"/>
40292 <colspec colwidth="6*" align="center"/>
40293 <colspec colwidth="6*" align="center"/>
40294 <colspec colwidth="6*" align="right"/>
40295 <tbody>
40296 <row>
40297 <entry><option>transport_filter_timeout</option></entry>
40298 <entry>Use: <emphasis>transports</emphasis></entry>
40299 <entry>Type: <emphasis>time</emphasis></entry>
40300 <entry>Default: <emphasis>5m</emphasis></entry>
40301 </row>
40302 </tbody>
40303 </tgroup>
40304 </informaltable>
40305 <para>
40306 <indexterm role="concept">
40307 <primary>transport</primary>
40308 <secondary>filter, timeout</secondary>
40309 </indexterm>
40310 When Exim is reading the output of a transport filter, it applies a timeout
40311 that can be set by this option. Exceeding the timeout is normally treated as a
40312 temporary delivery failure. However, if a transport filter is used with a
40313 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
40314 way as a timeout in the pipe command itself. By default, a timeout is a hard
40315 error, but if the <command>pipe</command> transport&#x2019;s <option>timeout_defer</option> option is set true, it
40316 becomes a temporary error.
40317 </para>
40318 <para>
40319 <indexterm role="option">
40320 <primary><option>user</option></primary>
40321 </indexterm>
40322 </para>
40323 <informaltable frame="all">
40324 <tgroup cols="4" colsep="0" rowsep="0">
40325 <colspec colwidth="8*" align="left"/>
40326 <colspec colwidth="6*" align="center"/>
40327 <colspec colwidth="6*" align="center"/>
40328 <colspec colwidth="6*" align="right"/>
40329 <tbody>
40330 <row>
40331 <entry><option>user</option></entry>
40332 <entry>Use: <emphasis>transports</emphasis></entry>
40333 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40334 <entry>Default: <emphasis>Exim user</emphasis></entry>
40335 </row>
40336 </tbody>
40337 </tgroup>
40338 </informaltable>
40339 <para>
40340 <indexterm role="concept">
40341 <primary>uid (user id)</primary>
40342 <secondary>local delivery</secondary>
40343 </indexterm>
40344 <indexterm role="concept">
40345 <primary>transport</primary>
40346 <secondary>user, specifying</secondary>
40347 </indexterm>
40348 This option specifies the user under whose uid the delivery process is to be
40349 run, overriding any uid that may have been set by the router. If the user is
40350 given as a name, the uid is looked up from the password data, and the
40351 associated group is taken as the value of the gid to be used if the <option>group</option>
40352 option is not set.
40353 </para>
40354 <para>
40355 For deliveries that use local transports, a user and group are normally
40356 specified explicitly or implicitly (for example, as a result of
40357 <option>check_local_user</option>) by the router or transport.
40358 </para>
40359 <para>
40360 <indexterm role="concept">
40361 <primary>hints database</primary>
40362 <secondary>access by remote transport</secondary>
40363 </indexterm>
40364 For remote transports, you should leave this option unset unless you really are
40365 sure you know what you are doing. When a remote transport is running, it needs
40366 to be able to access Exim&#x2019;s hints databases, because each host may have its own
40367 retry data.
40368 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
40369 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
40370 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
40371 </para>
40372 </chapter>
40373
40374 <chapter id="CHAPbatching">
40375 <title>Address batching in local transports</title>
40376 <titleabbrev>Address batching</titleabbrev>
40377 <para>
40378 <indexterm role="concept">
40379 <primary>transport</primary>
40380 <secondary>local; address batching in</secondary>
40381 </indexterm>
40382 The only remote transport (<command>smtp</command>) is normally configured to handle more than
40383 one address at a time, so that when several addresses are routed to the same
40384 remote host, just one copy of the message is sent. Local transports, however,
40385 normally handle one address at a time. That is, a separate instance of the
40386 transport is run for each address that is routed to the transport. A separate
40387 copy of the message is delivered each time.
40388 </para>
40389 <para>
40390 <indexterm role="concept">
40391 <primary>batched local delivery</primary>
40392 </indexterm>
40393 <indexterm role="option">
40394 <primary><option>batch_max</option></primary>
40395 </indexterm>
40396 <indexterm role="option">
40397 <primary><option>batch_id</option></primary>
40398 </indexterm>
40399 In special cases, it may be desirable to handle several addresses at once in a
40400 local transport, for example:
40401 </para>
40402 <itemizedlist>
40403 <listitem>
40404 <para>
40405 In an <command>appendfile</command> transport, when storing messages in files for later
40406 delivery by some other means, a single copy of the message with multiple
40407 recipients saves space.
40408 </para>
40409 </listitem>
40410 <listitem>
40411 <para>
40412 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
40413 a single copy saves time, and is the normal way LMTP is expected to work.
40414 </para>
40415 </listitem>
40416 <listitem>
40417 <para>
40418 In a <command>pipe</command> transport, when passing the message
40419 to a scanner program or
40420 to some other delivery mechanism such as UUCP, multiple recipients may be
40421 acceptable.
40422 </para>
40423 </listitem>
40424 </itemizedlist>
40425 <para>
40426 These three local transports all have the same options for controlling multiple
40427 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
40428 repeating the information for each transport, these options are described here.
40429 </para>
40430 <para>
40431 The <option>batch_max</option> option specifies the maximum number of addresses that can be
40432 delivered together in a single run of the transport. Its default value is one
40433 (no batching). When more than one address is routed to a transport that has a
40434 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
40435 (that is, in a single run of the transport with multiple recipients), subject
40436 to certain conditions:
40437 </para>
40438 <itemizedlist>
40439 <listitem>
40440 <para>
40441 <indexterm role="variable">
40442 <primary><varname>$local_part</varname></primary>
40443 </indexterm>
40444 If any of the transport&#x2019;s options contain a reference to <varname>$local_part</varname>, no
40445 batching is possible.
40446 </para>
40447 </listitem>
40448 <listitem>
40449 <para>
40450 <indexterm role="variable">
40451 <primary><varname>$domain</varname></primary>
40452 </indexterm>
40453 If any of the transport&#x2019;s options contain a reference to <varname>$domain</varname>, only
40454 addresses with the same domain are batched.
40455 </para>
40456 </listitem>
40457 <listitem>
40458 <para>
40459 <indexterm role="concept">
40460 <primary>customizing</primary>
40461 <secondary>batching condition</secondary>
40462 </indexterm>
40463 If <option>batch_id</option> is set, it is expanded for each address, and only those
40464 addresses with the same expanded value are batched. This allows you to specify
40465 customized batching conditions. Failure of the expansion for any reason,
40466 including forced failure, disables batching, but it does not stop the delivery
40467 from taking place.
40468 </para>
40469 </listitem>
40470 <listitem>
40471 <para>
40472 Batched addresses must also have the same errors address (where to send
40473 delivery errors), the same header additions and removals, the same user and
40474 group for the transport, and if a host list is present, the first host must
40475 be the same.
40476 </para>
40477 </listitem>
40478 </itemizedlist>
40479 <para>
40480 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
40481 both when the file or pipe command is specified in the transport, and when it
40482 is specified by a <command>redirect</command> router, but all the batched addresses must of
40483 course be routed to the same file or pipe command. These two transports have an
40484 option called <option>use_bsmtp</option>, which causes them to deliver the message in
40485 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
40486 <option>check_string</option> and <option>escape_string</option> options are forced to the values
40487 </para>
40488 <literallayout class="monospaced">
40489 check_string = "."
40490 escape_string = ".."
40491 </literallayout>
40492 <para>
40493 when batched SMTP is in use. A full description of the batch SMTP mechanism is
40494 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
40495 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
40496 </para>
40497 <para>
40498 <indexterm role="concept">
40499 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
40500 </indexterm>
40501 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
40502 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
40503 that are being processed together. If you are using a batching <command>appendfile</command>
40504 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
40505 addresses is to set the <option>envelope_to_add</option> option.
40506 </para>
40507 <para>
40508 <indexterm role="concept">
40509 <primary><command>pipe</command> transport</primary>
40510 <secondary>with multiple addresses</secondary>
40511 </indexterm>
40512 <indexterm role="variable">
40513 <primary><varname>$pipe_addresses</varname></primary>
40514 </indexterm>
40515 If you are using a <command>pipe</command> transport without BSMTP, and setting the
40516 transport&#x2019;s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
40517 the command. This is not a true variable; it is a bit of magic that causes each
40518 of the recipient addresses to be inserted into the command as a separate
40519 argument. This provides a way of accessing all the addresses that are being
40520 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
40521 are specified by a <command>redirect</command> router.
40522 </para>
40523 </chapter>
40524
40525 <chapter id="CHAPappendfile">
40526 <title>The appendfile transport</title>
40527 <para>
40528 <indexterm role="concept" id="IIDapptra1" class="startofrange">
40529 <primary><command>appendfile</command> transport</primary>
40530 </indexterm>
40531 <indexterm role="concept" id="IIDapptra2" class="startofrange">
40532 <primary>transports</primary>
40533 <secondary><command>appendfile</command></secondary>
40534 </indexterm>
40535 <indexterm role="concept">
40536 <primary>directory creation</primary>
40537 </indexterm>
40538 <indexterm role="concept">
40539 <primary>creating directories</primary>
40540 </indexterm>
40541 The <command>appendfile</command> transport delivers a message by appending it to an existing
40542 file, or by creating an entirely new file in a specified directory. Single
40543 files to which messages are appended can be in the traditional Unix mailbox
40544 format, or optionally in the MBX format supported by the Pine MUA and
40545 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
40546 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
40547 to give added protection against failures that happen part-way through the
40548 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
40549 supported. For all file formats, Exim attempts to create as many levels of
40550 directory as necessary, provided that <option>create_directory</option> is set.
40551 </para>
40552 <para>
40553 The code for the optional formats is not included in the Exim binary by
40554 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
40555 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
40556 included.
40557 </para>
40558 <para>
40559 <indexterm role="concept">
40560 <primary>quota</primary>
40561 <secondary>system</secondary>
40562 </indexterm>
40563 Exim recognizes system quota errors, and generates an appropriate message. Exim
40564 also supports its own quota control within the transport, for use when the
40565 system facility is unavailable or cannot be used for some reason.
40566 </para>
40567 <para>
40568 If there is an error while appending to a file (for example, quota exceeded or
40569 partition filled), Exim attempts to reset the file&#x2019;s length and last
40570 modification time back to what they were before. If there is an error while
40571 creating an entirely new file, the new file is removed.
40572 </para>
40573 <para>
40574 Before appending to a file, a number of security checks are made, and the
40575 file is locked. A detailed description is given below, after the list of
40576 private options.
40577 </para>
40578 <para>
40579 The <command>appendfile</command> transport is most commonly used for local deliveries to
40580 users&#x2019; mailboxes. However, it can also be used as a pseudo-remote transport for
40581 putting messages into files for remote delivery by some means other than Exim.
40582 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
40583 option).
40584 </para>
40585 <section id="SECTfildiropt">
40586 <title>The file and directory options</title>
40587 <para>
40588 The <option>file</option> option specifies a single file, to which the message is appended;
40589 the <option>directory</option> option specifies a directory, in which a new file containing
40590 the message is created. Only one of these two options can be set, and for
40591 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
40592 </para>
40593 <para>
40594 <indexterm role="variable">
40595 <primary><varname>$address_file</varname></primary>
40596 </indexterm>
40597 <indexterm role="variable">
40598 <primary><varname>$local_part</varname></primary>
40599 </indexterm>
40600 However, <command>appendfile</command> is also used for delivering messages to files or
40601 directories whose names (or parts of names) are obtained from alias,
40602 forwarding, or filtering operations (for example, a <option>save</option> command in a
40603 user&#x2019;s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
40604 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
40605 name (or partial name) of the file or directory generated by the redirection
40606 operation. There are two cases:
40607 </para>
40608 <itemizedlist>
40609 <listitem>
40610 <para>
40611 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
40612 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
40613 common case when users with local accounts use filtering to sort mail into
40614 different folders. See for example, the <command>address_file</command> transport in the
40615 default configuration. If the path ends with a slash, it is assumed to be the
40616 name of a directory. A delivery to a directory can also be forced by setting
40617 <option>maildir_format</option> or <option>mailstore_format</option>.
40618 </para>
40619 </listitem>
40620 <listitem>
40621 <para>
40622 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
40623 used to determine the file or directory name for the delivery. Normally, the
40624 contents of <varname>$address_file</varname> are used in some way in the string expansion.
40625 </para>
40626 </listitem>
40627 </itemizedlist>
40628 <para>
40629 <indexterm role="concept">
40630 <primary>Sieve filter</primary>
40631 <secondary>configuring <command>appendfile</command></secondary>
40632 </indexterm>
40633 <indexterm role="concept">
40634 <primary>Sieve filter</primary>
40635 <secondary>relative mailbox path handling</secondary>
40636 </indexterm>
40637 As an example of the second case, consider an environment where users do not
40638 have home directories. They may be permitted to use Exim filter commands of the
40639 form:
40640 </para>
40641 <literallayout class="monospaced">
40642 save folder23
40643 </literallayout>
40644 <para>
40645 or Sieve filter commands of the form:
40646 </para>
40647 <literallayout class="monospaced">
40648 require "fileinto";
40649 fileinto "folder23";
40650 </literallayout>
40651 <para>
40652 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
40653 must transform the relative path into an appropriate absolute file name. In the
40654 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
40655 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
40656 way of handling this requirement:
40657 </para>
40658 <literallayout class="monospaced">
40659 file = ${if eq{$address_file}{inbox} \
40660             {/var/mail/$local_part} \
40661             {${if eq{${substr_0_1:$address_file}}{/} \
40662                   {$address_file} \
40663                   {$home/mail/$address_file} \
40664             }} \
40665        }
40666 </literallayout>
40667 <para>
40668 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
40669 location, absolute paths are used without change, and other folders are in the
40670 <filename>mail</filename> directory within the home directory.
40671 </para>
40672 <para>
40673 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
40674 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
40675 the router. In particular, this is the case if <option>check_local_user</option> is set. If
40676 you want to prevent this happening at routing time, you can set
40677 <option>router_home_directory</option> empty. This forces the router to pass the relative
40678 path to the transport.
40679 </para>
40680 <para>
40681 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
40682 the <option>file</option> or <option>directory</option> option is still used if it is set.
40683 </para>
40684 </section>
40685 <section id="SECID134">
40686 <title>Private options for appendfile</title>
40687 <para>
40688 <indexterm role="concept">
40689 <primary>options</primary>
40690 <secondary><command>appendfile</command> transport</secondary>
40691 </indexterm>
40692 </para>
40693 <para>
40694 <indexterm role="option">
40695 <primary><option>allow_fifo</option></primary>
40696 </indexterm>
40697 </para>
40698 <informaltable frame="all">
40699 <tgroup cols="4" colsep="0" rowsep="0">
40700 <colspec colwidth="8*" align="left"/>
40701 <colspec colwidth="6*" align="center"/>
40702 <colspec colwidth="6*" align="center"/>
40703 <colspec colwidth="6*" align="right"/>
40704 <tbody>
40705 <row>
40706 <entry><option>allow_fifo</option></entry>
40707 <entry>Use: <emphasis>appendfile</emphasis></entry>
40708 <entry>Type: <emphasis>boolean</emphasis></entry>
40709 <entry>Default: <emphasis>false</emphasis></entry>
40710 </row>
40711 </tbody>
40712 </tgroup>
40713 </informaltable>
40714 <para>
40715 <indexterm role="concept">
40716 <primary>fifo (named pipe)</primary>
40717 </indexterm>
40718 <indexterm role="concept">
40719 <primary>named pipe (fifo)</primary>
40720 </indexterm>
40721 <indexterm role="concept">
40722 <primary>pipe</primary>
40723 <secondary>named (fifo)</secondary>
40724 </indexterm>
40725 Setting this option permits delivery to named pipes (FIFOs) as well as to
40726 regular files. If no process is reading the named pipe at delivery time, the
40727 delivery is deferred.
40728 </para>
40729 <para>
40730 <indexterm role="option">
40731 <primary><option>allow_symlink</option></primary>
40732 </indexterm>
40733 </para>
40734 <informaltable frame="all">
40735 <tgroup cols="4" colsep="0" rowsep="0">
40736 <colspec colwidth="8*" align="left"/>
40737 <colspec colwidth="6*" align="center"/>
40738 <colspec colwidth="6*" align="center"/>
40739 <colspec colwidth="6*" align="right"/>
40740 <tbody>
40741 <row>
40742 <entry><option>allow_symlink</option></entry>
40743 <entry>Use: <emphasis>appendfile</emphasis></entry>
40744 <entry>Type: <emphasis>boolean</emphasis></entry>
40745 <entry>Default: <emphasis>false</emphasis></entry>
40746 </row>
40747 </tbody>
40748 </tgroup>
40749 </informaltable>
40750 <para>
40751 <indexterm role="concept">
40752 <primary>symbolic link</primary>
40753 <secondary>to mailbox</secondary>
40754 </indexterm>
40755 <indexterm role="concept">
40756 <primary>mailbox</primary>
40757 <secondary>symbolic link</secondary>
40758 </indexterm>
40759 By default, <command>appendfile</command> will not deliver if the path name for the file is
40760 that of a symbolic link. Setting this option relaxes that constraint, but there
40761 are security issues involved in the use of symbolic links. Be sure you know
40762 what you are doing if you set this. Details of exactly what this option affects
40763 are included in the discussion which follows this list of options.
40764 </para>
40765 <para>
40766 <indexterm role="option">
40767 <primary><option>batch_id</option></primary>
40768 </indexterm>
40769 </para>
40770 <informaltable frame="all">
40771 <tgroup cols="4" colsep="0" rowsep="0">
40772 <colspec colwidth="8*" align="left"/>
40773 <colspec colwidth="6*" align="center"/>
40774 <colspec colwidth="6*" align="center"/>
40775 <colspec colwidth="6*" align="right"/>
40776 <tbody>
40777 <row>
40778 <entry><option>batch_id</option></entry>
40779 <entry>Use: <emphasis>appendfile</emphasis></entry>
40780 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40781 <entry>Default: <emphasis>unset</emphasis></entry>
40782 </row>
40783 </tbody>
40784 </tgroup>
40785 </informaltable>
40786 <para>
40787 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
40788 However, batching is automatically disabled for <command>appendfile</command> deliveries that
40789 happen as a result of forwarding or aliasing or other redirection directly to a
40790 file.
40791 </para>
40792 <para>
40793 <indexterm role="option">
40794 <primary><option>batch_max</option></primary>
40795 </indexterm>
40796 </para>
40797 <informaltable frame="all">
40798 <tgroup cols="4" colsep="0" rowsep="0">
40799 <colspec colwidth="8*" align="left"/>
40800 <colspec colwidth="6*" align="center"/>
40801 <colspec colwidth="6*" align="center"/>
40802 <colspec colwidth="6*" align="right"/>
40803 <tbody>
40804 <row>
40805 <entry><option>batch_max</option></entry>
40806 <entry>Use: <emphasis>appendfile</emphasis></entry>
40807 <entry>Type: <emphasis>integer</emphasis></entry>
40808 <entry>Default: <emphasis>1</emphasis></entry>
40809 </row>
40810 </tbody>
40811 </tgroup>
40812 </informaltable>
40813 <para>
40814 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
40815 </para>
40816 <para>
40817 <indexterm role="option">
40818 <primary><option>check_group</option></primary>
40819 </indexterm>
40820 </para>
40821 <informaltable frame="all">
40822 <tgroup cols="4" colsep="0" rowsep="0">
40823 <colspec colwidth="8*" align="left"/>
40824 <colspec colwidth="6*" align="center"/>
40825 <colspec colwidth="6*" align="center"/>
40826 <colspec colwidth="6*" align="right"/>
40827 <tbody>
40828 <row>
40829 <entry><option>check_group</option></entry>
40830 <entry>Use: <emphasis>appendfile</emphasis></entry>
40831 <entry>Type: <emphasis>boolean</emphasis></entry>
40832 <entry>Default: <emphasis>false</emphasis></entry>
40833 </row>
40834 </tbody>
40835 </tgroup>
40836 </informaltable>
40837 <para>
40838 When this option is set, the group owner of the file defined by the <option>file</option>
40839 option is checked to see that it is the same as the group under which the
40840 delivery process is running. The default setting is false because the default
40841 file mode is 0600, which means that the group is irrelevant.
40842 </para>
40843 <para>
40844 <indexterm role="option">
40845 <primary><option>check_owner</option></primary>
40846 </indexterm>
40847 </para>
40848 <informaltable frame="all">
40849 <tgroup cols="4" colsep="0" rowsep="0">
40850 <colspec colwidth="8*" align="left"/>
40851 <colspec colwidth="6*" align="center"/>
40852 <colspec colwidth="6*" align="center"/>
40853 <colspec colwidth="6*" align="right"/>
40854 <tbody>
40855 <row>
40856 <entry><option>check_owner</option></entry>
40857 <entry>Use: <emphasis>appendfile</emphasis></entry>
40858 <entry>Type: <emphasis>boolean</emphasis></entry>
40859 <entry>Default: <emphasis>true</emphasis></entry>
40860 </row>
40861 </tbody>
40862 </tgroup>
40863 </informaltable>
40864 <para>
40865 When this option is set, the owner of the file defined by the <option>file</option> option
40866 is checked to ensure that it is the same as the user under which the delivery
40867 process is running.
40868 </para>
40869 <para>
40870 <indexterm role="option">
40871 <primary><option>check_string</option></primary>
40872 </indexterm>
40873 </para>
40874 <informaltable frame="all">
40875 <tgroup cols="4" colsep="0" rowsep="0">
40876 <colspec colwidth="8*" align="left"/>
40877 <colspec colwidth="6*" align="center"/>
40878 <colspec colwidth="6*" align="center"/>
40879 <colspec colwidth="6*" align="right"/>
40880 <tbody>
40881 <row>
40882 <entry><option>check_string</option></entry>
40883 <entry>Use: <emphasis>appendfile</emphasis></entry>
40884 <entry>Type: <emphasis>string</emphasis></entry>
40885 <entry>Default: <emphasis>see below</emphasis></entry>
40886 </row>
40887 </tbody>
40888 </tgroup>
40889 </informaltable>
40890 <para>
40891 <indexterm role="concept">
40892 <primary><quote>From</quote> line</primary>
40893 </indexterm>
40894 As <command>appendfile</command> writes the message, the start of each line is tested for
40895 matching <option>check_string</option>, and if it does, the initial matching characters are
40896 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
40897 a literal string, not a regular expression, and the case of any letters it
40898 contains is significant.
40899 </para>
40900 <para>
40901 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
40902 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
40903 configuration are ignored. Otherwise, they default to <quote>From&nbsp;</quote> and
40904 <quote>&gt;From&nbsp;</quote> when the <option>file</option> option is set, and unset when any of the
40905 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
40906 </para>
40907 <para>
40908 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
40909 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
40910 <quote>From&nbsp;</quote> indicates the start of a new message. All four options need changing
40911 if another format is used. For example, to deliver to mailboxes in MMDF format:
40912 <indexterm role="concept">
40913 <primary>MMDF format mailbox</primary>
40914 </indexterm>
40915 <indexterm role="concept">
40916 <primary>mailbox</primary>
40917 <secondary>MMDF format</secondary>
40918 </indexterm>
40919 </para>
40920 <literallayout class="monospaced">
40921 check_string = "\1\1\1\1\n"
40922 escape_string = "\1\1\1\1 \n"
40923 message_prefix = "\1\1\1\1\n"
40924 message_suffix = "\1\1\1\1\n"
40925 </literallayout>
40926 <para>
40927 <indexterm role="option">
40928 <primary><option>create_directory</option></primary>
40929 </indexterm>
40930 </para>
40931 <informaltable frame="all">
40932 <tgroup cols="4" colsep="0" rowsep="0">
40933 <colspec colwidth="8*" align="left"/>
40934 <colspec colwidth="6*" align="center"/>
40935 <colspec colwidth="6*" align="center"/>
40936 <colspec colwidth="6*" align="right"/>
40937 <tbody>
40938 <row>
40939 <entry><option>create_directory</option></entry>
40940 <entry>Use: <emphasis>appendfile</emphasis></entry>
40941 <entry>Type: <emphasis>boolean</emphasis></entry>
40942 <entry>Default: <emphasis>true</emphasis></entry>
40943 </row>
40944 </tbody>
40945 </tgroup>
40946 </informaltable>
40947 <para>
40948 <indexterm role="concept">
40949 <primary>directory creation</primary>
40950 </indexterm>
40951 When this option is true, Exim attempts to create any missing superior
40952 directories for the file that it is about to write. A created directory&#x2019;s mode
40953 is given by the <option>directory_mode</option> option.
40954 </para>
40955 <para>
40956 The group ownership of a newly created directory is highly dependent on the
40957 operating system (and possibly the file system) that is being used. For
40958 example, in Solaris, if the parent directory has the setgid bit set, its group
40959 is propagated to the child; if not, the currently set group is used. However,
40960 in FreeBSD, the parent&#x2019;s group is always used.
40961 </para>
40962 <para>
40963 <indexterm role="option">
40964 <primary><option>create_file</option></primary>
40965 </indexterm>
40966 </para>
40967 <informaltable frame="all">
40968 <tgroup cols="4" colsep="0" rowsep="0">
40969 <colspec colwidth="8*" align="left"/>
40970 <colspec colwidth="6*" align="center"/>
40971 <colspec colwidth="6*" align="center"/>
40972 <colspec colwidth="6*" align="right"/>
40973 <tbody>
40974 <row>
40975 <entry><option>create_file</option></entry>
40976 <entry>Use: <emphasis>appendfile</emphasis></entry>
40977 <entry>Type: <emphasis>string</emphasis></entry>
40978 <entry>Default: <emphasis>anywhere</emphasis></entry>
40979 </row>
40980 </tbody>
40981 </tgroup>
40982 </informaltable>
40983 <para>
40984 This option constrains the location of files and directories that are created
40985 by this transport. It applies to files defined by the <option>file</option> option and
40986 directories defined by the <option>directory</option> option. In the case of maildir
40987 delivery, it applies to the top level directory, not the maildir directories
40988 beneath.
40989 </para>
40990 <para>
40991 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
40992 <quote>belowhome</quote>. In the second and third cases, a home directory must have been
40993 set for the transport. This option is not useful when an explicit file name is
40994 given for normal mailbox deliveries. It is intended for the case when file
40995 names are generated from users&#x2019; <filename>.forward</filename> files. These are usually handled
40996 by an <command>appendfile</command> transport called <option>address_file</option>. See also
40997 <option>file_must_exist</option>.
40998 </para>
40999 <para>
41000 <indexterm role="option">
41001 <primary><option>directory</option></primary>
41002 </indexterm>
41003 </para>
41004 <informaltable frame="all">
41005 <tgroup cols="4" colsep="0" rowsep="0">
41006 <colspec colwidth="8*" align="left"/>
41007 <colspec colwidth="6*" align="center"/>
41008 <colspec colwidth="6*" align="center"/>
41009 <colspec colwidth="6*" align="right"/>
41010 <tbody>
41011 <row>
41012 <entry><option>directory</option></entry>
41013 <entry>Use: <emphasis>appendfile</emphasis></entry>
41014 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41015 <entry>Default: <emphasis>unset</emphasis></entry>
41016 </row>
41017 </tbody>
41018 </tgroup>
41019 </informaltable>
41020 <para>
41021 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
41022 or <option>directory</option> must be set, unless the delivery is the direct result of a
41023 redirection (see section <xref linkend="SECTfildiropt"/>).
41024 </para>
41025 <para>
41026 When <option>directory</option> is set, the string is expanded, and the message is delivered
41027 into a new file or files in or below the given directory, instead of being
41028 appended to a single mailbox file. A number of different formats are provided
41029 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
41030 <xref linkend="SECTopdir"/> for further details of this form of delivery.
41031 </para>
41032 <para>
41033 <indexterm role="option">
41034 <primary><option>directory_file</option></primary>
41035 </indexterm>
41036 </para>
41037 <informaltable frame="all">
41038 <tgroup cols="4" colsep="0" rowsep="0">
41039 <colspec colwidth="8*" align="left"/>
41040 <colspec colwidth="6*" align="center"/>
41041 <colspec colwidth="6*" align="center"/>
41042 <colspec colwidth="6*" align="right"/>
41043 <tbody>
41044 <row>
41045 <entry><option>directory_file</option></entry>
41046 <entry>Use: <emphasis>appendfile</emphasis></entry>
41047 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41048 <entry>Default: <emphasis>see below</emphasis></entry>
41049 </row>
41050 </tbody>
41051 </tgroup>
41052 </informaltable>
41053 <para>
41054 <indexterm role="concept">
41055 <primary>base62</primary>
41056 </indexterm>
41057 <indexterm role="variable">
41058 <primary><varname>$inode</varname></primary>
41059 </indexterm>
41060 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
41061 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
41062 whose name is obtained by expanding this string. The default value is:
41063 </para>
41064 <literallayout class="monospaced">
41065 q${base62:$tod_epoch}-$inode
41066 </literallayout>
41067 <para>
41068 This generates a unique name from the current time, in base 62 form, and the
41069 inode of the file. The variable <varname>$inode</varname> is available only when expanding this
41070 option.
41071 </para>
41072 <para>
41073 <indexterm role="option">
41074 <primary><option>directory_mode</option></primary>
41075 </indexterm>
41076 </para>
41077 <informaltable frame="all">
41078 <tgroup cols="4" colsep="0" rowsep="0">
41079 <colspec colwidth="8*" align="left"/>
41080 <colspec colwidth="6*" align="center"/>
41081 <colspec colwidth="6*" align="center"/>
41082 <colspec colwidth="6*" align="right"/>
41083 <tbody>
41084 <row>
41085 <entry><option>directory_mode</option></entry>
41086 <entry>Use: <emphasis>appendfile</emphasis></entry>
41087 <entry>Type: <emphasis>octal integer</emphasis></entry>
41088 <entry>Default: <emphasis>0700</emphasis></entry>
41089 </row>
41090 </tbody>
41091 </tgroup>
41092 </informaltable>
41093 <para>
41094 If <command>appendfile</command> creates any directories as a result of the
41095 <option>create_directory</option> option, their mode is specified by this option.
41096 </para>
41097 <para>
41098 <indexterm role="option">
41099 <primary><option>escape_string</option></primary>
41100 </indexterm>
41101 </para>
41102 <informaltable frame="all">
41103 <tgroup cols="4" colsep="0" rowsep="0">
41104 <colspec colwidth="8*" align="left"/>
41105 <colspec colwidth="6*" align="center"/>
41106 <colspec colwidth="6*" align="center"/>
41107 <colspec colwidth="6*" align="right"/>
41108 <tbody>
41109 <row>
41110 <entry><option>escape_string</option></entry>
41111 <entry>Use: <emphasis>appendfile</emphasis></entry>
41112 <entry>Type: <emphasis>string</emphasis></entry>
41113 <entry>Default: <emphasis>see description</emphasis></entry>
41114 </row>
41115 </tbody>
41116 </tgroup>
41117 </informaltable>
41118 <para>
41119 See <option>check_string</option> above.
41120 </para>
41121 <para>
41122 <indexterm role="option">
41123 <primary><option>file</option></primary>
41124 </indexterm>
41125 </para>
41126 <informaltable frame="all">
41127 <tgroup cols="4" colsep="0" rowsep="0">
41128 <colspec colwidth="8*" align="left"/>
41129 <colspec colwidth="6*" align="center"/>
41130 <colspec colwidth="6*" align="center"/>
41131 <colspec colwidth="6*" align="right"/>
41132 <tbody>
41133 <row>
41134 <entry><option>file</option></entry>
41135 <entry>Use: <emphasis>appendfile</emphasis></entry>
41136 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41137 <entry>Default: <emphasis>unset</emphasis></entry>
41138 </row>
41139 </tbody>
41140 </tgroup>
41141 </informaltable>
41142 <para>
41143 This option is mutually exclusive with the <option>directory</option> option, but one of
41144 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
41145 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
41146 specifies a single file, to which the message is appended. One or more of
41147 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
41148 <option>file</option>.
41149 </para>
41150 <para>
41151 <indexterm role="concept">
41152 <primary>NFS</primary>
41153 <secondary>lock file</secondary>
41154 </indexterm>
41155 <indexterm role="concept">
41156 <primary>locking files</primary>
41157 </indexterm>
41158 <indexterm role="concept">
41159 <primary>lock files</primary>
41160 </indexterm>
41161 If you are using more than one host to deliver over NFS into the same
41162 mailboxes, you should always use lock files.
41163 </para>
41164 <para>
41165 The string value is expanded for each delivery, and must yield an absolute
41166 path. The most common settings of this option are variations on one of these
41167 examples:
41168 </para>
41169 <literallayout class="monospaced">
41170 file = /var/spool/mail/$local_part
41171 file = /home/$local_part/inbox
41172 file = $home/inbox
41173 </literallayout>
41174 <para>
41175 <indexterm role="concept">
41176 <primary><quote>sticky</quote> bit</primary>
41177 </indexterm>
41178 In the first example, all deliveries are done into the same directory. If Exim
41179 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
41180 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
41181 deliveries to be possible, or alternatively the <option>group</option> option can be used to
41182 run the delivery under a group id which has write access to the directory.
41183 </para>
41184 <para>
41185 <indexterm role="option">
41186 <primary><option>file_format</option></primary>
41187 </indexterm>
41188 </para>
41189 <informaltable frame="all">
41190 <tgroup cols="4" colsep="0" rowsep="0">
41191 <colspec colwidth="8*" align="left"/>
41192 <colspec colwidth="6*" align="center"/>
41193 <colspec colwidth="6*" align="center"/>
41194 <colspec colwidth="6*" align="right"/>
41195 <tbody>
41196 <row>
41197 <entry><option>file_format</option></entry>
41198 <entry>Use: <emphasis>appendfile</emphasis></entry>
41199 <entry>Type: <emphasis>string</emphasis></entry>
41200 <entry>Default: <emphasis>unset</emphasis></entry>
41201 </row>
41202 </tbody>
41203 </tgroup>
41204 </informaltable>
41205 <para>
41206 <indexterm role="concept">
41207 <primary>file</primary>
41208 <secondary>mailbox; checking existing format</secondary>
41209 </indexterm>
41210 This option requests the transport to check the format of an existing file
41211 before adding to it. The check consists of matching a specific string at the
41212 start of the file. The value of the option consists of an even number of
41213 colon-separated strings. The first of each pair is the test string, and the
41214 second is the name of a transport. If the transport associated with a matched
41215 string is not the current transport, control is passed over to the other
41216 transport. For example, suppose the standard <command>local_delivery</command> transport has
41217 this added to it:
41218 </para>
41219 <literallayout class="monospaced">
41220 file_format = "From       : local_delivery :\
41221                \1\1\1\1\n : local_mmdf_delivery"
41222 </literallayout>
41223 <para>
41224 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
41225 a mailbox begins with four binary ones followed by a newline, control is passed
41226 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
41227 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
41228 is assumed to match the current transport. If the start of a mailbox doesn&#x2019;t
41229 match any string, or if the transport named for a given string is not defined,
41230 delivery is deferred.
41231 </para>
41232 <para>
41233 <indexterm role="option">
41234 <primary><option>file_must_exist</option></primary>
41235 </indexterm>
41236 </para>
41237 <informaltable frame="all">
41238 <tgroup cols="4" colsep="0" rowsep="0">
41239 <colspec colwidth="8*" align="left"/>
41240 <colspec colwidth="6*" align="center"/>
41241 <colspec colwidth="6*" align="center"/>
41242 <colspec colwidth="6*" align="right"/>
41243 <tbody>
41244 <row>
41245 <entry><option>file_must_exist</option></entry>
41246 <entry>Use: <emphasis>appendfile</emphasis></entry>
41247 <entry>Type: <emphasis>boolean</emphasis></entry>
41248 <entry>Default: <emphasis>false</emphasis></entry>
41249 </row>
41250 </tbody>
41251 </tgroup>
41252 </informaltable>
41253 <para>
41254 If this option is true, the file specified by the <option>file</option> option must exist.
41255 A temporary error occurs if it does not, causing delivery to be deferred.
41256 If this option is false, the file is created if it does not exist.
41257 </para>
41258 <para>
41259 <indexterm role="option">
41260 <primary><option>lock_fcntl_timeout</option></primary>
41261 </indexterm>
41262 </para>
41263 <informaltable frame="all">
41264 <tgroup cols="4" colsep="0" rowsep="0">
41265 <colspec colwidth="8*" align="left"/>
41266 <colspec colwidth="6*" align="center"/>
41267 <colspec colwidth="6*" align="center"/>
41268 <colspec colwidth="6*" align="right"/>
41269 <tbody>
41270 <row>
41271 <entry><option>lock_fcntl_timeout</option></entry>
41272 <entry>Use: <emphasis>appendfile</emphasis></entry>
41273 <entry>Type: <emphasis>time</emphasis></entry>
41274 <entry>Default: <emphasis>0s</emphasis></entry>
41275 </row>
41276 </tbody>
41277 </tgroup>
41278 </informaltable>
41279 <para>
41280 <indexterm role="concept">
41281 <primary>timeout</primary>
41282 <secondary>mailbox locking</secondary>
41283 </indexterm>
41284 <indexterm role="concept">
41285 <primary>mailbox</primary>
41286 <secondary>locking, blocking and non-blocking</secondary>
41287 </indexterm>
41288 <indexterm role="concept">
41289 <primary>locking files</primary>
41290 </indexterm>
41291 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
41292 when locking an open mailbox file. If the call fails, the delivery process
41293 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
41294 Non-blocking calls are used so that the file is not kept open during the wait
41295 for the lock; the reason for this is to make it as safe as possible for
41296 deliveries over NFS in the case when processes might be accessing an NFS
41297 mailbox without using a lock file. This should not be done, but
41298 misunderstandings and hence misconfigurations are not unknown.
41299 </para>
41300 <para>
41301 On a busy system, however, the performance of a non-blocking lock approach is
41302 not as good as using a blocking lock with a timeout. In this case, the waiting
41303 is done inside the system call, and Exim&#x2019;s delivery process acquires the lock
41304 and can proceed as soon as the previous lock holder releases it.
41305 </para>
41306 <para>
41307 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
41308 timeout, are used. There may still be some retrying: the maximum number of
41309 retries is
41310 </para>
41311 <literallayout class="monospaced">
41312 (lock_retries * lock_interval) / lock_fcntl_timeout
41313 </literallayout>
41314 <para>
41315 rounded up to the next whole number. In other words, the total time during
41316 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
41317 <option>lock_fcntl_timeout</option> is set very large.
41318 </para>
41319 <para>
41320 You should consider setting this option if you are getting a lot of delayed
41321 local deliveries because of errors of the form
41322 </para>
41323 <literallayout class="monospaced">
41324 failed to lock mailbox /some/file (fcntl)
41325 </literallayout>
41326 <para>
41327 <indexterm role="option">
41328 <primary><option>lock_flock_timeout</option></primary>
41329 </indexterm>
41330 </para>
41331 <informaltable frame="all">
41332 <tgroup cols="4" colsep="0" rowsep="0">
41333 <colspec colwidth="8*" align="left"/>
41334 <colspec colwidth="6*" align="center"/>
41335 <colspec colwidth="6*" align="center"/>
41336 <colspec colwidth="6*" align="right"/>
41337 <tbody>
41338 <row>
41339 <entry><option>lock_flock_timeout</option></entry>
41340 <entry>Use: <emphasis>appendfile</emphasis></entry>
41341 <entry>Type: <emphasis>time</emphasis></entry>
41342 <entry>Default: <emphasis>0s</emphasis></entry>
41343 </row>
41344 </tbody>
41345 </tgroup>
41346 </informaltable>
41347 <para>
41348 This timeout applies to file locking when using <function>flock()</function> (see
41349 <option>use_flock</option>); the timeout operates in a similar manner to
41350 <option>lock_fcntl_timeout</option>.
41351 </para>
41352 <para>
41353 <indexterm role="option">
41354 <primary><option>lock_interval</option></primary>
41355 </indexterm>
41356 </para>
41357 <informaltable frame="all">
41358 <tgroup cols="4" colsep="0" rowsep="0">
41359 <colspec colwidth="8*" align="left"/>
41360 <colspec colwidth="6*" align="center"/>
41361 <colspec colwidth="6*" align="center"/>
41362 <colspec colwidth="6*" align="right"/>
41363 <tbody>
41364 <row>
41365 <entry><option>lock_interval</option></entry>
41366 <entry>Use: <emphasis>appendfile</emphasis></entry>
41367 <entry>Type: <emphasis>time</emphasis></entry>
41368 <entry>Default: <emphasis>3s</emphasis></entry>
41369 </row>
41370 </tbody>
41371 </tgroup>
41372 </informaltable>
41373 <para>
41374 This specifies the time to wait between attempts to lock the file. See below
41375 for details of locking.
41376 </para>
41377 <para>
41378 <indexterm role="option">
41379 <primary><option>lock_retries</option></primary>
41380 </indexterm>
41381 </para>
41382 <informaltable frame="all">
41383 <tgroup cols="4" colsep="0" rowsep="0">
41384 <colspec colwidth="8*" align="left"/>
41385 <colspec colwidth="6*" align="center"/>
41386 <colspec colwidth="6*" align="center"/>
41387 <colspec colwidth="6*" align="right"/>
41388 <tbody>
41389 <row>
41390 <entry><option>lock_retries</option></entry>
41391 <entry>Use: <emphasis>appendfile</emphasis></entry>
41392 <entry>Type: <emphasis>integer</emphasis></entry>
41393 <entry>Default: <emphasis>10</emphasis></entry>
41394 </row>
41395 </tbody>
41396 </tgroup>
41397 </informaltable>
41398 <para>
41399 This specifies the maximum number of attempts to lock the file. A value of zero
41400 is treated as 1. See below for details of locking.
41401 </para>
41402 <para>
41403 <indexterm role="option">
41404 <primary><option>lockfile_mode</option></primary>
41405 </indexterm>
41406 </para>
41407 <informaltable frame="all">
41408 <tgroup cols="4" colsep="0" rowsep="0">
41409 <colspec colwidth="8*" align="left"/>
41410 <colspec colwidth="6*" align="center"/>
41411 <colspec colwidth="6*" align="center"/>
41412 <colspec colwidth="6*" align="right"/>
41413 <tbody>
41414 <row>
41415 <entry><option>lockfile_mode</option></entry>
41416 <entry>Use: <emphasis>appendfile</emphasis></entry>
41417 <entry>Type: <emphasis>octal integer</emphasis></entry>
41418 <entry>Default: <emphasis>0600</emphasis></entry>
41419 </row>
41420 </tbody>
41421 </tgroup>
41422 </informaltable>
41423 <para>
41424 This specifies the mode of the created lock file, when a lock file is being
41425 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
41426 </para>
41427 <para>
41428 <indexterm role="option">
41429 <primary><option>lockfile_timeout</option></primary>
41430 </indexterm>
41431 </para>
41432 <informaltable frame="all">
41433 <tgroup cols="4" colsep="0" rowsep="0">
41434 <colspec colwidth="8*" align="left"/>
41435 <colspec colwidth="6*" align="center"/>
41436 <colspec colwidth="6*" align="center"/>
41437 <colspec colwidth="6*" align="right"/>
41438 <tbody>
41439 <row>
41440 <entry><option>lockfile_timeout</option></entry>
41441 <entry>Use: <emphasis>appendfile</emphasis></entry>
41442 <entry>Type: <emphasis>time</emphasis></entry>
41443 <entry>Default: <emphasis>30m</emphasis></entry>
41444 </row>
41445 </tbody>
41446 </tgroup>
41447 </informaltable>
41448 <para>
41449 <indexterm role="concept">
41450 <primary>timeout</primary>
41451 <secondary>mailbox locking</secondary>
41452 </indexterm>
41453 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
41454 exists and is older than this value, it is assumed to have been left behind by
41455 accident, and Exim attempts to remove it.
41456 </para>
41457 <para>
41458 <indexterm role="option">
41459 <primary><option>mailbox_filecount</option></primary>
41460 </indexterm>
41461 </para>
41462 <informaltable frame="all">
41463 <tgroup cols="4" colsep="0" rowsep="0">
41464 <colspec colwidth="8*" align="left"/>
41465 <colspec colwidth="6*" align="center"/>
41466 <colspec colwidth="6*" align="center"/>
41467 <colspec colwidth="6*" align="right"/>
41468 <tbody>
41469 <row>
41470 <entry><option>mailbox_filecount</option></entry>
41471 <entry>Use: <emphasis>appendfile</emphasis></entry>
41472 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41473 <entry>Default: <emphasis>unset</emphasis></entry>
41474 </row>
41475 </tbody>
41476 </tgroup>
41477 </informaltable>
41478 <para>
41479 <indexterm role="concept">
41480 <primary>mailbox</primary>
41481 <secondary>specifying size of</secondary>
41482 </indexterm>
41483 <indexterm role="concept">
41484 <primary>size</primary>
41485 <secondary>of mailbox</secondary>
41486 </indexterm>
41487 If this option is set, it is expanded, and the result is taken as the current
41488 number of files in the mailbox. It must be a decimal number, optionally
41489 followed by K or M. This provides a way of obtaining this information from an
41490 external source that maintains the data.
41491 </para>
41492 <para>
41493 <indexterm role="option">
41494 <primary><option>mailbox_size</option></primary>
41495 </indexterm>
41496 </para>
41497 <informaltable frame="all">
41498 <tgroup cols="4" colsep="0" rowsep="0">
41499 <colspec colwidth="8*" align="left"/>
41500 <colspec colwidth="6*" align="center"/>
41501 <colspec colwidth="6*" align="center"/>
41502 <colspec colwidth="6*" align="right"/>
41503 <tbody>
41504 <row>
41505 <entry><option>mailbox_size</option></entry>
41506 <entry>Use: <emphasis>appendfile</emphasis></entry>
41507 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41508 <entry>Default: <emphasis>unset</emphasis></entry>
41509 </row>
41510 </tbody>
41511 </tgroup>
41512 </informaltable>
41513 <para>
41514 <indexterm role="concept">
41515 <primary>mailbox</primary>
41516 <secondary>specifying size of</secondary>
41517 </indexterm>
41518 <indexterm role="concept">
41519 <primary>size</primary>
41520 <secondary>of mailbox</secondary>
41521 </indexterm>
41522 If this option is set, it is expanded, and the result is taken as the current
41523 size the mailbox. It must be a decimal number, optionally followed by K or M.
41524 This provides a way of obtaining this information from an external source that
41525 maintains the data. This is likely to be helpful for maildir deliveries where
41526 it is computationally expensive to compute the size of a mailbox.
41527 </para>
41528 <para>
41529 <indexterm role="option">
41530 <primary><option>maildir_format</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>maildir_format</option></entry>
41542 <entry>Use: <emphasis>appendfile</emphasis></entry>
41543 <entry>Type: <emphasis>boolean</emphasis></entry>
41544 <entry>Default: <emphasis>false</emphasis></entry>
41545 </row>
41546 </tbody>
41547 </tgroup>
41548 </informaltable>
41549 <para>
41550 <indexterm role="concept">
41551 <primary>maildir format</primary>
41552 <secondary>specifying</secondary>
41553 </indexterm>
41554 If this option is set with the <option>directory</option> option, the delivery is into a new
41555 file, in the <quote>maildir</quote> format that is used by other mail software. When the
41556 transport is activated directly from a <command>redirect</command> router (for example, the
41557 <command>address_file</command> transport in the default configuration), setting
41558 <option>maildir_format</option> causes the path received from the router to be treated as a
41559 directory, whether or not it ends with <literal>/</literal>. This option is available only if
41560 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
41561 <xref linkend="SECTmaildirdelivery"/> below for further details.
41562 </para>
41563 <para>
41564 <indexterm role="option">
41565 <primary><option>maildir_quota_directory_regex</option></primary>
41566 </indexterm>
41567 </para>
41568 <informaltable frame="all">
41569 <tgroup cols="4" colsep="0" rowsep="0">
41570 <colspec colwidth="8*" align="left"/>
41571 <colspec colwidth="6*" align="center"/>
41572 <colspec colwidth="6*" align="center"/>
41573 <colspec colwidth="6*" align="right"/>
41574 <tbody>
41575 <row>
41576 <entry><option>maildir_quota_directory_regex</option></entry>
41577 <entry>Use: <emphasis>appendfile</emphasis></entry>
41578 <entry>Type: <emphasis>string</emphasis></entry>
41579 <entry>Default: <emphasis>See below</emphasis></entry>
41580 </row>
41581 </tbody>
41582 </tgroup>
41583 </informaltable>
41584 <para>
41585 <indexterm role="concept">
41586 <primary>maildir format</primary>
41587 <secondary>quota; directories included in</secondary>
41588 </indexterm>
41589 <indexterm role="concept">
41590 <primary>quota</primary>
41591 <secondary>maildir; directories included in</secondary>
41592 </indexterm>
41593 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
41594 a regular expression for specifying directories, relative to the quota
41595 directory (see <option>quota_directory</option>), that should be included in the quota
41596 calculation. The default value is:
41597 </para>
41598 <literallayout class="monospaced">
41599 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
41600 </literallayout>
41601 <para>
41602 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
41603 (directories whose names begin with a dot). If you want to exclude the
41604 <filename>Trash</filename>
41605 folder from the count (as some sites do), you need to change this setting to
41606 </para>
41607 <literallayout class="monospaced">
41608 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
41609 </literallayout>
41610 <para>
41611 This uses a negative lookahead in the regular expression to exclude the
41612 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
41613 calculations, quota processing is bypassed for any messages that are delivered
41614 directly into that directory.
41615 </para>
41616 <para>
41617 <indexterm role="option">
41618 <primary><option>maildir_retries</option></primary>
41619 </indexterm>
41620 </para>
41621 <informaltable frame="all">
41622 <tgroup cols="4" colsep="0" rowsep="0">
41623 <colspec colwidth="8*" align="left"/>
41624 <colspec colwidth="6*" align="center"/>
41625 <colspec colwidth="6*" align="center"/>
41626 <colspec colwidth="6*" align="right"/>
41627 <tbody>
41628 <row>
41629 <entry><option>maildir_retries</option></entry>
41630 <entry>Use: <emphasis>appendfile</emphasis></entry>
41631 <entry>Type: <emphasis>integer</emphasis></entry>
41632 <entry>Default: <emphasis>10</emphasis></entry>
41633 </row>
41634 </tbody>
41635 </tgroup>
41636 </informaltable>
41637 <para>
41638 This option specifies the number of times to retry when writing a file in
41639 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
41640 </para>
41641 <para>
41642 <indexterm role="option">
41643 <primary><option>maildir_tag</option></primary>
41644 </indexterm>
41645 </para>
41646 <informaltable frame="all">
41647 <tgroup cols="4" colsep="0" rowsep="0">
41648 <colspec colwidth="8*" align="left"/>
41649 <colspec colwidth="6*" align="center"/>
41650 <colspec colwidth="6*" align="center"/>
41651 <colspec colwidth="6*" align="right"/>
41652 <tbody>
41653 <row>
41654 <entry><option>maildir_tag</option></entry>
41655 <entry>Use: <emphasis>appendfile</emphasis></entry>
41656 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41657 <entry>Default: <emphasis>unset</emphasis></entry>
41658 </row>
41659 </tbody>
41660 </tgroup>
41661 </informaltable>
41662 <para>
41663 This option applies only to deliveries in maildir format, and is described in
41664 section <xref linkend="SECTmaildirdelivery"/> below.
41665 </para>
41666 <para>
41667 <indexterm role="option">
41668 <primary><option>maildir_use_size_file</option></primary>
41669 </indexterm>
41670 </para>
41671 <informaltable frame="all">
41672 <tgroup cols="4" colsep="0" rowsep="0">
41673 <colspec colwidth="8*" align="left"/>
41674 <colspec colwidth="6*" align="center"/>
41675 <colspec colwidth="6*" align="center"/>
41676 <colspec colwidth="6*" align="right"/>
41677 <tbody>
41678 <row>
41679 <entry><option>maildir_use_size_file</option></entry>
41680 <entry>Use: <emphasis>appendfile</emphasis>&dagger;<emphasis></emphasis></entry>
41681 <entry>Type: <emphasis>boolean</emphasis></entry>
41682 <entry>Default: <emphasis>false</emphasis></entry>
41683 </row>
41684 </tbody>
41685 </tgroup>
41686 </informaltable>
41687 <para>
41688 <indexterm role="concept">
41689 <primary>maildir format</primary>
41690 <secondary><filename>maildirsize</filename> file</secondary>
41691 </indexterm>
41692 The result of string expansion for this option must be a valid boolean value.
41693 If it is true, it enables support for <filename>maildirsize</filename> files. Exim
41694 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
41695 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
41696 value is zero. See <option>maildir_quota_directory_regex</option> above and section
41697 <xref linkend="SECTmaildirdelivery"/> below for further details.
41698 </para>
41699 <para>
41700 <indexterm role="option">
41701 <primary><option>maildirfolder_create_regex</option></primary>
41702 </indexterm>
41703 </para>
41704 <informaltable frame="all">
41705 <tgroup cols="4" colsep="0" rowsep="0">
41706 <colspec colwidth="8*" align="left"/>
41707 <colspec colwidth="6*" align="center"/>
41708 <colspec colwidth="6*" align="center"/>
41709 <colspec colwidth="6*" align="right"/>
41710 <tbody>
41711 <row>
41712 <entry><option>maildirfolder_create_regex</option></entry>
41713 <entry>Use: <emphasis>appendfile</emphasis></entry>
41714 <entry>Type: <emphasis>string</emphasis></entry>
41715 <entry>Default: <emphasis>unset</emphasis></entry>
41716 </row>
41717 </tbody>
41718 </tgroup>
41719 </informaltable>
41720 <para>
41721 <indexterm role="concept">
41722 <primary>maildir format</primary>
41723 <secondary><filename>maildirfolder</filename> file</secondary>
41724 </indexterm>
41725 <indexterm role="concept">
41726 <primary><filename>maildirfolder</filename>, creating</primary>
41727 </indexterm>
41728 The value of this option is a regular expression. If it is unset, it has no
41729 effect. Otherwise, before a maildir delivery takes place, the pattern is
41730 matched against the name of the maildir directory, that is, the directory
41731 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
41732 delivery. If there is a match, Exim checks for the existence of a file called
41733 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
41734 See section <xref linkend="SECTmaildirdelivery"/> for more details.
41735 </para>
41736 <para>
41737 <indexterm role="option">
41738 <primary><option>mailstore_format</option></primary>
41739 </indexterm>
41740 </para>
41741 <informaltable frame="all">
41742 <tgroup cols="4" colsep="0" rowsep="0">
41743 <colspec colwidth="8*" align="left"/>
41744 <colspec colwidth="6*" align="center"/>
41745 <colspec colwidth="6*" align="center"/>
41746 <colspec colwidth="6*" align="right"/>
41747 <tbody>
41748 <row>
41749 <entry><option>mailstore_format</option></entry>
41750 <entry>Use: <emphasis>appendfile</emphasis></entry>
41751 <entry>Type: <emphasis>boolean</emphasis></entry>
41752 <entry>Default: <emphasis>false</emphasis></entry>
41753 </row>
41754 </tbody>
41755 </tgroup>
41756 </informaltable>
41757 <para>
41758 <indexterm role="concept">
41759 <primary>mailstore format</primary>
41760 <secondary>specifying</secondary>
41761 </indexterm>
41762 If this option is set with the <option>directory</option> option, the delivery is into two
41763 new files in  <quote>mailstore</quote> format. The option is available only if
41764 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
41765 below for further details.
41766 </para>
41767 <para>
41768 <indexterm role="option">
41769 <primary><option>mailstore_prefix</option></primary>
41770 </indexterm>
41771 </para>
41772 <informaltable frame="all">
41773 <tgroup cols="4" colsep="0" rowsep="0">
41774 <colspec colwidth="8*" align="left"/>
41775 <colspec colwidth="6*" align="center"/>
41776 <colspec colwidth="6*" align="center"/>
41777 <colspec colwidth="6*" align="right"/>
41778 <tbody>
41779 <row>
41780 <entry><option>mailstore_prefix</option></entry>
41781 <entry>Use: <emphasis>appendfile</emphasis></entry>
41782 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41783 <entry>Default: <emphasis>unset</emphasis></entry>
41784 </row>
41785 </tbody>
41786 </tgroup>
41787 </informaltable>
41788 <para>
41789 This option applies only to deliveries in mailstore format, and is described in
41790 section <xref linkend="SECTopdir"/> below.
41791 </para>
41792 <para>
41793 <indexterm role="option">
41794 <primary><option>mailstore_suffix</option></primary>
41795 </indexterm>
41796 </para>
41797 <informaltable frame="all">
41798 <tgroup cols="4" colsep="0" rowsep="0">
41799 <colspec colwidth="8*" align="left"/>
41800 <colspec colwidth="6*" align="center"/>
41801 <colspec colwidth="6*" align="center"/>
41802 <colspec colwidth="6*" align="right"/>
41803 <tbody>
41804 <row>
41805 <entry><option>mailstore_suffix</option></entry>
41806 <entry>Use: <emphasis>appendfile</emphasis></entry>
41807 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41808 <entry>Default: <emphasis>unset</emphasis></entry>
41809 </row>
41810 </tbody>
41811 </tgroup>
41812 </informaltable>
41813 <para>
41814 This option applies only to deliveries in mailstore format, and is described in
41815 section <xref linkend="SECTopdir"/> below.
41816 </para>
41817 <para>
41818 <indexterm role="option">
41819 <primary><option>mbx_format</option></primary>
41820 </indexterm>
41821 </para>
41822 <informaltable frame="all">
41823 <tgroup cols="4" colsep="0" rowsep="0">
41824 <colspec colwidth="8*" align="left"/>
41825 <colspec colwidth="6*" align="center"/>
41826 <colspec colwidth="6*" align="center"/>
41827 <colspec colwidth="6*" align="right"/>
41828 <tbody>
41829 <row>
41830 <entry><option>mbx_format</option></entry>
41831 <entry>Use: <emphasis>appendfile</emphasis></entry>
41832 <entry>Type: <emphasis>boolean</emphasis></entry>
41833 <entry>Default: <emphasis>false</emphasis></entry>
41834 </row>
41835 </tbody>
41836 </tgroup>
41837 </informaltable>
41838 <para>
41839 <indexterm role="concept">
41840 <primary>locking files</primary>
41841 </indexterm>
41842 <indexterm role="concept">
41843 <primary>file</primary>
41844 <secondary>locking</secondary>
41845 </indexterm>
41846 <indexterm role="concept">
41847 <primary>file</primary>
41848 <secondary>MBX format</secondary>
41849 </indexterm>
41850 <indexterm role="concept">
41851 <primary>MBX format, specifying</primary>
41852 </indexterm>
41853 This option is available only if Exim has been compiled with SUPPORT_MBX
41854 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
41855 the message is appended to the mailbox file in MBX format instead of
41856 traditional Unix format. This format is supported by Pine4 and its associated
41857 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
41858 </para>
41859 <para>
41860 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
41861 automatically changed by the use of <option>mbx_format</option>. They should normally be set
41862 empty when using MBX format, so this option almost always appears in this
41863 combination:
41864 </para>
41865 <literallayout class="monospaced">
41866 mbx_format = true
41867 message_prefix =
41868 message_suffix =
41869 </literallayout>
41870 <para>
41871 If none of the locking options are mentioned in the configuration,
41872 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
41873 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
41874 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
41875 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
41876 should not be used if any program that does not use this form of locking is
41877 going to access the mailbox, nor should it be used if the mailbox file is NFS
41878 mounted, because it works only when the mailbox is accessed from a single host.
41879 </para>
41880 <para>
41881 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
41882 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
41883 (this means for the whole of a Pine or IMAP session), Exim will not be able to
41884 append messages to it.
41885 </para>
41886 <para>
41887 <indexterm role="option">
41888 <primary><option>message_prefix</option></primary>
41889 </indexterm>
41890 </para>
41891 <informaltable frame="all">
41892 <tgroup cols="4" colsep="0" rowsep="0">
41893 <colspec colwidth="8*" align="left"/>
41894 <colspec colwidth="6*" align="center"/>
41895 <colspec colwidth="6*" align="center"/>
41896 <colspec colwidth="6*" align="right"/>
41897 <tbody>
41898 <row>
41899 <entry><option>message_prefix</option></entry>
41900 <entry>Use: <emphasis>appendfile</emphasis></entry>
41901 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41902 <entry>Default: <emphasis>see below</emphasis></entry>
41903 </row>
41904 </tbody>
41905 </tgroup>
41906 </informaltable>
41907 <para>
41908 <indexterm role="concept">
41909 <primary><quote>From</quote> line</primary>
41910 </indexterm>
41911 The string specified here is expanded and output at the start of every message.
41912 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
41913 in which case it is:
41914 </para>
41915 <literallayout class="monospaced">
41916 message_prefix = "From ${if def:return_path{$return_path}\
41917   {MAILER-DAEMON}} $tod_bsdinbox\n"
41918 </literallayout>
41919 <para>
41920 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
41921 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
41922 </para>
41923 <para>
41924 <indexterm role="option">
41925 <primary><option>message_suffix</option></primary>
41926 </indexterm>
41927 </para>
41928 <informaltable frame="all">
41929 <tgroup cols="4" colsep="0" rowsep="0">
41930 <colspec colwidth="8*" align="left"/>
41931 <colspec colwidth="6*" align="center"/>
41932 <colspec colwidth="6*" align="center"/>
41933 <colspec colwidth="6*" align="right"/>
41934 <tbody>
41935 <row>
41936 <entry><option>message_suffix</option></entry>
41937 <entry>Use: <emphasis>appendfile</emphasis></entry>
41938 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41939 <entry>Default: <emphasis>see below</emphasis></entry>
41940 </row>
41941 </tbody>
41942 </tgroup>
41943 </informaltable>
41944 <para>
41945 The string specified here is expanded and output at the end of every message.
41946 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
41947 in which case it is a single newline character. The suffix can be suppressed by
41948 setting
41949 </para>
41950 <literallayout class="monospaced">
41951 message_suffix =
41952 </literallayout>
41953 <para>
41954 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
41955 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
41956 </para>
41957 <para>
41958 <indexterm role="option">
41959 <primary><option>mode</option></primary>
41960 </indexterm>
41961 </para>
41962 <informaltable frame="all">
41963 <tgroup cols="4" colsep="0" rowsep="0">
41964 <colspec colwidth="8*" align="left"/>
41965 <colspec colwidth="6*" align="center"/>
41966 <colspec colwidth="6*" align="center"/>
41967 <colspec colwidth="6*" align="right"/>
41968 <tbody>
41969 <row>
41970 <entry><option>mode</option></entry>
41971 <entry>Use: <emphasis>appendfile</emphasis></entry>
41972 <entry>Type: <emphasis>octal integer</emphasis></entry>
41973 <entry>Default: <emphasis>0600</emphasis></entry>
41974 </row>
41975 </tbody>
41976 </tgroup>
41977 </informaltable>
41978 <para>
41979 If the output file is created, it is given this mode. If it already exists and
41980 has wider permissions, they are reduced to this mode. If it has narrower
41981 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
41982 if the delivery is the result of a <option>save</option> command in a filter file specifying
41983 a particular mode, the mode of the output file is always forced to take that
41984 value, and this option is ignored.
41985 </para>
41986 <para>
41987 <indexterm role="option">
41988 <primary><option>mode_fail_narrower</option></primary>
41989 </indexterm>
41990 </para>
41991 <informaltable frame="all">
41992 <tgroup cols="4" colsep="0" rowsep="0">
41993 <colspec colwidth="8*" align="left"/>
41994 <colspec colwidth="6*" align="center"/>
41995 <colspec colwidth="6*" align="center"/>
41996 <colspec colwidth="6*" align="right"/>
41997 <tbody>
41998 <row>
41999 <entry><option>mode_fail_narrower</option></entry>
42000 <entry>Use: <emphasis>appendfile</emphasis></entry>
42001 <entry>Type: <emphasis>boolean</emphasis></entry>
42002 <entry>Default: <emphasis>true</emphasis></entry>
42003 </row>
42004 </tbody>
42005 </tgroup>
42006 </informaltable>
42007 <para>
42008 This option applies in the case when an existing mailbox file has a narrower
42009 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
42010 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
42011 continues with the delivery attempt, using the existing mode of the file.
42012 </para>
42013 <para>
42014 <indexterm role="option">
42015 <primary><option>notify_comsat</option></primary>
42016 </indexterm>
42017 </para>
42018 <informaltable frame="all">
42019 <tgroup cols="4" colsep="0" rowsep="0">
42020 <colspec colwidth="8*" align="left"/>
42021 <colspec colwidth="6*" align="center"/>
42022 <colspec colwidth="6*" align="center"/>
42023 <colspec colwidth="6*" align="right"/>
42024 <tbody>
42025 <row>
42026 <entry><option>notify_comsat</option></entry>
42027 <entry>Use: <emphasis>appendfile</emphasis></entry>
42028 <entry>Type: <emphasis>boolean</emphasis></entry>
42029 <entry>Default: <emphasis>false</emphasis></entry>
42030 </row>
42031 </tbody>
42032 </tgroup>
42033 </informaltable>
42034 <para>
42035 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
42036 successful delivery to a user mailbox. This is the daemon that notifies logged
42037 on users about incoming mail.
42038 </para>
42039 <para>
42040 <indexterm role="option">
42041 <primary><option>quota</option></primary>
42042 </indexterm>
42043 </para>
42044 <informaltable frame="all">
42045 <tgroup cols="4" colsep="0" rowsep="0">
42046 <colspec colwidth="8*" align="left"/>
42047 <colspec colwidth="6*" align="center"/>
42048 <colspec colwidth="6*" align="center"/>
42049 <colspec colwidth="6*" align="right"/>
42050 <tbody>
42051 <row>
42052 <entry><option>quota</option></entry>
42053 <entry>Use: <emphasis>appendfile</emphasis></entry>
42054 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42055 <entry>Default: <emphasis>unset</emphasis></entry>
42056 </row>
42057 </tbody>
42058 </tgroup>
42059 </informaltable>
42060 <para>
42061 <indexterm role="concept">
42062 <primary>quota</primary>
42063 <secondary>imposed by Exim</secondary>
42064 </indexterm>
42065 This option imposes a limit on the size of the file to which Exim is appending,
42066 or to the total space used in the directory tree when the <option>directory</option> option
42067 is set. In the latter case, computation of the space used is expensive, because
42068 all the files in the directory (and any sub-directories) have to be
42069 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
42070 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
42071 have no shell access to their mailboxes).
42072 </para>
42073 <para>
42074 As there is no interlock against two simultaneous deliveries into a
42075 multi-file mailbox, it is possible for the quota to be overrun in this case.
42076 For single-file mailboxes, of course, an interlock is a necessity.
42077 </para>
42078 <para>
42079 A file&#x2019;s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
42080 may be a lot less than the actual amount of disk space allocated to the file.
42081 If the sizes of a number of files are being added up, the rounding effect can
42082 become quite noticeable, especially on systems that have large block sizes.
42083 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
42084 the obvious value which users understand most easily.
42085 </para>
42086 <para>
42087 The value of the option is expanded, and must then be a numerical value
42088 (decimal point allowed), optionally followed by one of the letters K, M, or G,
42089 for kilobytes, megabytes, or gigabytes. If Exim is running on a system with
42090 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
42091 be handled.
42092 </para>
42093 <para>
42094 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
42095 </para>
42096 <para>
42097 The expansion happens while Exim is running as root, before it changes uid for
42098 the delivery. This means that files that are inaccessible to the end user can
42099 be used to hold quota values that are looked up in the expansion. When delivery
42100 fails because this quota is exceeded, the handling of the error is as for
42101 system quota failures.
42102 </para>
42103 <para>
42104 By default, Exim&#x2019;s quota checking mimics system quotas, and restricts the
42105 mailbox to the specified maximum size, though the value is not accurate to the
42106 last byte, owing to separator lines and additional headers that may get added
42107 during message delivery. When a mailbox is nearly full, large messages may get
42108 refused even though small ones are accepted, because the size of the current
42109 message is added to the quota when the check is made. This behaviour can be
42110 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
42111 for exceeding the quota does not include the current message. Thus, deliveries
42112 continue until the quota has been exceeded; thereafter, no further messages are
42113 delivered. See also <option>quota_warn_threshold</option>.
42114 </para>
42115 <para>
42116 <indexterm role="option">
42117 <primary><option>quota_directory</option></primary>
42118 </indexterm>
42119 </para>
42120 <informaltable frame="all">
42121 <tgroup cols="4" colsep="0" rowsep="0">
42122 <colspec colwidth="8*" align="left"/>
42123 <colspec colwidth="6*" align="center"/>
42124 <colspec colwidth="6*" align="center"/>
42125 <colspec colwidth="6*" align="right"/>
42126 <tbody>
42127 <row>
42128 <entry><option>quota_directory</option></entry>
42129 <entry>Use: <emphasis>appendfile</emphasis></entry>
42130 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42131 <entry>Default: <emphasis>unset</emphasis></entry>
42132 </row>
42133 </tbody>
42134 </tgroup>
42135 </informaltable>
42136 <para>
42137 This option defines the directory to check for quota purposes when delivering
42138 into individual files. The default is the delivery directory, or, if a file
42139 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
42140 delivery directory.
42141 </para>
42142 <para>
42143 <indexterm role="option">
42144 <primary><option>quota_filecount</option></primary>
42145 </indexterm>
42146 </para>
42147 <informaltable frame="all">
42148 <tgroup cols="4" colsep="0" rowsep="0">
42149 <colspec colwidth="8*" align="left"/>
42150 <colspec colwidth="6*" align="center"/>
42151 <colspec colwidth="6*" align="center"/>
42152 <colspec colwidth="6*" align="right"/>
42153 <tbody>
42154 <row>
42155 <entry><option>quota_filecount</option></entry>
42156 <entry>Use: <emphasis>appendfile</emphasis></entry>
42157 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42158 <entry>Default: <emphasis>0</emphasis></entry>
42159 </row>
42160 </tbody>
42161 </tgroup>
42162 </informaltable>
42163 <para>
42164 This option applies when the <option>directory</option> option is set. It limits the total
42165 number of files in the directory (compare the inode limit in system quotas). It
42166 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
42167 failure causes delivery to be deferred. A value of zero is interpreted as
42168 <quote>no quota</quote>.
42169 </para>
42170 <para>
42171 <indexterm role="option">
42172 <primary><option>quota_is_inclusive</option></primary>
42173 </indexterm>
42174 </para>
42175 <informaltable frame="all">
42176 <tgroup cols="4" colsep="0" rowsep="0">
42177 <colspec colwidth="8*" align="left"/>
42178 <colspec colwidth="6*" align="center"/>
42179 <colspec colwidth="6*" align="center"/>
42180 <colspec colwidth="6*" align="right"/>
42181 <tbody>
42182 <row>
42183 <entry><option>quota_is_inclusive</option></entry>
42184 <entry>Use: <emphasis>appendfile</emphasis></entry>
42185 <entry>Type: <emphasis>boolean</emphasis></entry>
42186 <entry>Default: <emphasis>true</emphasis></entry>
42187 </row>
42188 </tbody>
42189 </tgroup>
42190 </informaltable>
42191 <para>
42192 See <option>quota</option> above.
42193 </para>
42194 <para>
42195 <indexterm role="option">
42196 <primary><option>quota_size_regex</option></primary>
42197 </indexterm>
42198 </para>
42199 <informaltable frame="all">
42200 <tgroup cols="4" colsep="0" rowsep="0">
42201 <colspec colwidth="8*" align="left"/>
42202 <colspec colwidth="6*" align="center"/>
42203 <colspec colwidth="6*" align="center"/>
42204 <colspec colwidth="6*" align="right"/>
42205 <tbody>
42206 <row>
42207 <entry><option>quota_size_regex</option></entry>
42208 <entry>Use: <emphasis>appendfile</emphasis></entry>
42209 <entry>Type: <emphasis>string</emphasis></entry>
42210 <entry>Default: <emphasis>unset</emphasis></entry>
42211 </row>
42212 </tbody>
42213 </tgroup>
42214 </informaltable>
42215 <para>
42216 This option applies when one of the delivery modes that writes a separate file
42217 for each message is being used. When Exim wants to find the size of one of
42218 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
42219 If this is set to a regular expression that matches the file name, and it
42220 captures one string, that string is interpreted as a representation of the
42221 file&#x2019;s size. The value of <option>quota_size_regex</option> is not expanded.
42222 </para>
42223 <para>
42224 This feature is useful only when users have no shell access to their mailboxes
42225 &ndash; otherwise they could defeat the quota simply by renaming the files. This
42226 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
42227 the file length to the file name. For example:
42228 </para>
42229 <literallayout class="monospaced">
42230 maildir_tag = ,S=$message_size
42231 quota_size_regex = ,S=(\d+)
42232 </literallayout>
42233 <para>
42234 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
42235 number of lines in the message.
42236 </para>
42237 <para>
42238 The regular expression should not assume that the length is at the end of the
42239 file name (even though <option>maildir_tag</option> puts it there) because maildir MUAs
42240 sometimes add other information onto the ends of message file names.
42241 </para>
42242 <para>
42243 Section <xref linkend="SECID136"/> contains further information.
42244 </para>
42245 <para>
42246 <indexterm role="option">
42247 <primary><option>quota_warn_message</option></primary>
42248 </indexterm>
42249 </para>
42250 <informaltable frame="all">
42251 <tgroup cols="4" colsep="0" rowsep="0">
42252 <colspec colwidth="8*" align="left"/>
42253 <colspec colwidth="6*" align="center"/>
42254 <colspec colwidth="6*" align="center"/>
42255 <colspec colwidth="6*" align="right"/>
42256 <tbody>
42257 <row>
42258 <entry><option>quota_warn_message</option></entry>
42259 <entry>Use: <emphasis>appendfile</emphasis></entry>
42260 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42261 <entry>Default: <emphasis>see below</emphasis></entry>
42262 </row>
42263 </tbody>
42264 </tgroup>
42265 </informaltable>
42266 <para>
42267 See below for the use of this option. If it is not set when
42268 <option>quota_warn_threshold</option> is set, it defaults to
42269 </para>
42270 <literallayout class="monospaced">
42271 quota_warn_message = "\
42272   To: $local_part@$domain\n\
42273   Subject: Your mailbox\n\n\
42274   This message is automatically created \
42275   by mail delivery software.\n\n\
42276   The size of your mailbox has exceeded \
42277   a warning threshold that is\n\
42278   set by the system administrator.\n"
42279 </literallayout>
42280 <para>
42281 <indexterm role="option">
42282 <primary><option>quota_warn_threshold</option></primary>
42283 </indexterm>
42284 </para>
42285 <informaltable frame="all">
42286 <tgroup cols="4" colsep="0" rowsep="0">
42287 <colspec colwidth="8*" align="left"/>
42288 <colspec colwidth="6*" align="center"/>
42289 <colspec colwidth="6*" align="center"/>
42290 <colspec colwidth="6*" align="right"/>
42291 <tbody>
42292 <row>
42293 <entry><option>quota_warn_threshold</option></entry>
42294 <entry>Use: <emphasis>appendfile</emphasis></entry>
42295 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42296 <entry>Default: <emphasis>0</emphasis></entry>
42297 </row>
42298 </tbody>
42299 </tgroup>
42300 </informaltable>
42301 <para>
42302 <indexterm role="concept">
42303 <primary>quota</primary>
42304 <secondary>warning threshold</secondary>
42305 </indexterm>
42306 <indexterm role="concept">
42307 <primary>mailbox</primary>
42308 <secondary>size warning</secondary>
42309 </indexterm>
42310 <indexterm role="concept">
42311 <primary>size</primary>
42312 <secondary>of mailbox</secondary>
42313 </indexterm>
42314 This option is expanded in the same way as <option>quota</option> (see above). If the
42315 resulting value is greater than zero, and delivery of the message causes the
42316 size of the file or total space in the directory tree to cross the given
42317 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
42318 may be specified as a percentage of it by following the value with a percent
42319 sign. For example:
42320 </para>
42321 <literallayout class="monospaced">
42322 quota = 10M
42323 quota_warn_threshold = 75%
42324 </literallayout>
42325 <para>
42326 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
42327 percent sign is ignored.
42328 </para>
42329 <para>
42330 The warning message itself is specified by the <option>quota_warn_message</option> option,
42331 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
42332 warning message. These do not necessarily have to include the recipient(s) of
42333 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
42334 can include any other header lines that you want. If you do not include a
42335 <emphasis>From:</emphasis> line, the default is:
42336 </para>
42337 <literallayout class="monospaced">
42338 From: Mail Delivery System &lt;mailer-daemon@$qualify_domain_sender&gt;
42339 </literallayout>
42340 <para>
42341 <indexterm role="option">
42342 <primary><option>errors_reply_to</option></primary>
42343 </indexterm>
42344 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
42345 option.
42346 </para>
42347 <para>
42348 The <option>quota</option> option does not have to be set in order to use this option; they
42349 are independent of one another except when the threshold is specified as a
42350 percentage.
42351 </para>
42352 <para>
42353 <indexterm role="option">
42354 <primary><option>use_bsmtp</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>use_bsmtp</option></entry>
42366 <entry>Use: <emphasis>appendfile</emphasis></entry>
42367 <entry>Type: <emphasis>boolean</emphasis></entry>
42368 <entry>Default: <emphasis>false</emphasis></entry>
42369 </row>
42370 </tbody>
42371 </tgroup>
42372 </informaltable>
42373 <para>
42374 <indexterm role="concept">
42375 <primary>envelope sender</primary>
42376 </indexterm>
42377 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
42378 format, with the envelope sender and recipient(s) included as SMTP commands. If
42379 you want to include a leading HELO command with such messages, you can do
42380 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
42381 for details of batch SMTP.
42382 </para>
42383 <para>
42384 <indexterm role="option">
42385 <primary><option>use_crlf</option></primary>
42386 </indexterm>
42387 </para>
42388 <informaltable frame="all">
42389 <tgroup cols="4" colsep="0" rowsep="0">
42390 <colspec colwidth="8*" align="left"/>
42391 <colspec colwidth="6*" align="center"/>
42392 <colspec colwidth="6*" align="center"/>
42393 <colspec colwidth="6*" align="right"/>
42394 <tbody>
42395 <row>
42396 <entry><option>use_crlf</option></entry>
42397 <entry>Use: <emphasis>appendfile</emphasis></entry>
42398 <entry>Type: <emphasis>boolean</emphasis></entry>
42399 <entry>Default: <emphasis>false</emphasis></entry>
42400 </row>
42401 </tbody>
42402 </tgroup>
42403 </informaltable>
42404 <para>
42405 <indexterm role="concept">
42406 <primary>carriage return</primary>
42407 </indexterm>
42408 <indexterm role="concept">
42409 <primary>linefeed</primary>
42410 </indexterm>
42411 This option causes lines to be terminated with the two-character CRLF sequence
42412 (carriage return, linefeed) instead of just a linefeed character. In the case
42413 of batched SMTP, the byte sequence written to the file is then an exact image
42414 of what would be sent down a real SMTP connection.
42415 </para>
42416 <para>
42417 <emphasis role="bold">Note:</emphasis> The contents of the <option>message_prefix</option> and <option>message_suffix</option> options
42418 (which are used to supply the traditional <quote>From&nbsp;</quote> and blank line separators
42419 in Berkeley-style mailboxes) are written verbatim, so must contain their own
42420 carriage return characters if these are needed. In cases where these options
42421 have non-empty defaults, the values end with a single linefeed, so they must be
42422 changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
42423 </para>
42424 <para>
42425 <indexterm role="option">
42426 <primary><option>use_fcntl_lock</option></primary>
42427 </indexterm>
42428 </para>
42429 <informaltable frame="all">
42430 <tgroup cols="4" colsep="0" rowsep="0">
42431 <colspec colwidth="8*" align="left"/>
42432 <colspec colwidth="6*" align="center"/>
42433 <colspec colwidth="6*" align="center"/>
42434 <colspec colwidth="6*" align="right"/>
42435 <tbody>
42436 <row>
42437 <entry><option>use_fcntl_lock</option></entry>
42438 <entry>Use: <emphasis>appendfile</emphasis></entry>
42439 <entry>Type: <emphasis>boolean</emphasis></entry>
42440 <entry>Default: <emphasis>see below</emphasis></entry>
42441 </row>
42442 </tbody>
42443 </tgroup>
42444 </informaltable>
42445 <para>
42446 This option controls the use of the <function>fcntl()</function> function to lock a file for
42447 exclusive use when a message is being appended. It is set by default unless
42448 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
42449 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
42450 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
42451 </para>
42452 <para>
42453 <indexterm role="option">
42454 <primary><option>use_flock_lock</option></primary>
42455 </indexterm>
42456 </para>
42457 <informaltable frame="all">
42458 <tgroup cols="4" colsep="0" rowsep="0">
42459 <colspec colwidth="8*" align="left"/>
42460 <colspec colwidth="6*" align="center"/>
42461 <colspec colwidth="6*" align="center"/>
42462 <colspec colwidth="6*" align="right"/>
42463 <tbody>
42464 <row>
42465 <entry><option>use_flock_lock</option></entry>
42466 <entry>Use: <emphasis>appendfile</emphasis></entry>
42467 <entry>Type: <emphasis>boolean</emphasis></entry>
42468 <entry>Default: <emphasis>false</emphasis></entry>
42469 </row>
42470 </tbody>
42471 </tgroup>
42472 </informaltable>
42473 <para>
42474 This option is provided to support the use of <function>flock()</function> for file locking, for
42475 the few situations where it is needed. Most modern operating systems support
42476 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
42477 each other. Exim uses <function>fcntl()</function> locking by default.
42478 </para>
42479 <para>
42480 This option is required only if you are using an operating system where
42481 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
42482 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
42483 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
42484 </para>
42485 <para>
42486 <indexterm role="concept">
42487 <primary>Solaris</primary>
42488 <secondary><function>flock()</function> support</secondary>
42489 </indexterm>
42490 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
42491 have it (and some, I think, provide a not quite right version built on top of
42492 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
42493 the ability to use it, and any attempt to do so will cause a configuration
42494 error.
42495 </para>
42496 <para>
42497 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
42498 is just being mapped onto <function>fcntl()</function> by the OS).
42499 </para>
42500 <para>
42501 <indexterm role="option">
42502 <primary><option>use_lockfile</option></primary>
42503 </indexterm>
42504 </para>
42505 <informaltable frame="all">
42506 <tgroup cols="4" colsep="0" rowsep="0">
42507 <colspec colwidth="8*" align="left"/>
42508 <colspec colwidth="6*" align="center"/>
42509 <colspec colwidth="6*" align="center"/>
42510 <colspec colwidth="6*" align="right"/>
42511 <tbody>
42512 <row>
42513 <entry><option>use_lockfile</option></entry>
42514 <entry>Use: <emphasis>appendfile</emphasis></entry>
42515 <entry>Type: <emphasis>boolean</emphasis></entry>
42516 <entry>Default: <emphasis>see below</emphasis></entry>
42517 </row>
42518 </tbody>
42519 </tgroup>
42520 </informaltable>
42521 <para>
42522 If this option is turned off, Exim does not attempt to create a lock file when
42523 appending to a mailbox file. In this situation, the only locking is by
42524 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
42525 sure that every MUA that is ever going to look at your users&#x2019; mailboxes uses
42526 <function>fcntl()</function> rather than a lock file, and even then only when you are not
42527 delivering over NFS from more than one host.
42528 </para>
42529 <para>
42530 <indexterm role="concept">
42531 <primary>NFS</primary>
42532 <secondary>lock file</secondary>
42533 </indexterm>
42534 In order to append to an NFS file safely from more than one host, it is
42535 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
42536 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
42537 file corruption.
42538 </para>
42539 <para>
42540 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
42541 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
42542 except when <option>mbx_format</option> is set.
42543 </para>
42544 <para>
42545 <indexterm role="option">
42546 <primary><option>use_mbx_lock</option></primary>
42547 </indexterm>
42548 </para>
42549 <informaltable frame="all">
42550 <tgroup cols="4" colsep="0" rowsep="0">
42551 <colspec colwidth="8*" align="left"/>
42552 <colspec colwidth="6*" align="center"/>
42553 <colspec colwidth="6*" align="center"/>
42554 <colspec colwidth="6*" align="right"/>
42555 <tbody>
42556 <row>
42557 <entry><option>use_mbx_lock</option></entry>
42558 <entry>Use: <emphasis>appendfile</emphasis></entry>
42559 <entry>Type: <emphasis>boolean</emphasis></entry>
42560 <entry>Default: <emphasis>see below</emphasis></entry>
42561 </row>
42562 </tbody>
42563 </tgroup>
42564 </informaltable>
42565 <para>
42566 This option is available only if Exim has been compiled with SUPPORT_MBX
42567 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
42568 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
42569 of the locking options are mentioned in the configuration. The locking rules
42570 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
42571 the IMAP4 and POP daemons that come with it (see the discussion below). The
42572 rules allow for shared access to the mailbox. However, this kind of locking
42573 does not work when the mailbox is NFS mounted.
42574 </para>
42575 <para>
42576 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
42577 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
42578 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
42579 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
42580 </para>
42581 </section>
42582 <section id="SECTopappend">
42583 <title>Operational details for appending</title>
42584 <para>
42585 <indexterm role="concept">
42586 <primary>appending to a file</primary>
42587 </indexterm>
42588 <indexterm role="concept">
42589 <primary>file</primary>
42590 <secondary>appending</secondary>
42591 </indexterm>
42592 Before appending to a file, the following preparations are made:
42593 </para>
42594 <itemizedlist>
42595 <listitem>
42596 <para>
42597 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
42598 return is given.
42599 </para>
42600 </listitem>
42601 <listitem>
42602 <para>
42603 <indexterm role="concept">
42604 <primary>directory creation</primary>
42605 </indexterm>
42606 If any directories on the file&#x2019;s path are missing, Exim creates them if the
42607 <option>create_directory</option> option is set. A created directory&#x2019;s mode is given by the
42608 <option>directory_mode</option> option.
42609 </para>
42610 </listitem>
42611 <listitem>
42612 <para>
42613 If <option>file_format</option> is set, the format of an existing file is checked. If this
42614 indicates that a different transport should be used, control is passed to that
42615 transport.
42616 </para>
42617 </listitem>
42618 <listitem>
42619 <para>
42620 <indexterm role="concept">
42621 <primary>file</primary>
42622 <secondary>locking</secondary>
42623 </indexterm>
42624 <indexterm role="concept">
42625 <primary>locking files</primary>
42626 </indexterm>
42627 <indexterm role="concept">
42628 <primary>NFS</primary>
42629 <secondary>lock file</secondary>
42630 </indexterm>
42631 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
42632 reliably over NFS, as follows:
42633 </para>
42634 <orderedlist numeration="arabic">
42635 <listitem>
42636 <para>
42637 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
42638 current time, primary host name, and process id added, by opening for writing
42639 as a new file. If this fails with an access error, delivery is deferred.
42640 </para>
42641 </listitem>
42642 <listitem>
42643 <para>
42644 Close the hitching post file, and hard link it to the lock file name.
42645 </para>
42646 </listitem>
42647 <listitem>
42648 <para>
42649 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
42650 Unlink the hitching post name.
42651 </para>
42652 </listitem>
42653 <listitem>
42654 <para>
42655 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
42656 then unlink hitching post name. If the number of links is exactly two, creation
42657 of the lock file succeeded but something (for example, an NFS server crash and
42658 restart) caused this fact not to be communicated to the <function>link()</function> call.
42659 </para>
42660 </listitem>
42661 <listitem>
42662 <para>
42663 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
42664 up to <option>lock_retries</option> times. However, since any program that writes to a
42665 mailbox should complete its task very quickly, it is reasonable to time out old
42666 lock files that are normally the result of user agent and system crashes. If an
42667 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
42668 it before trying again.
42669 </para>
42670 </listitem>
42671 </orderedlist>
42672 </listitem>
42673 <listitem>
42674 <para>
42675 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
42676 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
42677 than non-existence, delivery is deferred.
42678 </para>
42679 </listitem>
42680 <listitem>
42681 <para>
42682 <indexterm role="concept">
42683 <primary>symbolic link</primary>
42684 <secondary>to mailbox</secondary>
42685 </indexterm>
42686 <indexterm role="concept">
42687 <primary>mailbox</primary>
42688 <secondary>symbolic link</secondary>
42689 </indexterm>
42690 If the file does exist and is a symbolic link, delivery is deferred, unless the
42691 <option>allow_symlink</option> option is set, in which case the ownership of the link is
42692 checked, and then <function>stat()</function> is called to find out about the real file, which
42693 is then subjected to the checks below. The check on the top-level link
42694 ownership prevents one user creating a link for another&#x2019;s mailbox in a sticky
42695 directory, though allowing symbolic links in this case is definitely not a good
42696 idea. If there is a chain of symbolic links, the intermediate ones are not
42697 checked.
42698 </para>
42699 </listitem>
42700 <listitem>
42701 <para>
42702 If the file already exists but is not a regular file, or if the file&#x2019;s owner
42703 and group (if the group is being checked &ndash; see <option>check_group</option> above) are
42704 different from the user and group under which the delivery is running,
42705 delivery is deferred.
42706 </para>
42707 </listitem>
42708 <listitem>
42709 <para>
42710 If the file&#x2019;s permissions are more generous than specified, they are reduced.
42711 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
42712 is set false, in which case the delivery is tried using the existing
42713 permissions.
42714 </para>
42715 </listitem>
42716 <listitem>
42717 <para>
42718 The file&#x2019;s inode number is saved, and the file is then opened for appending.
42719 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
42720 hadn&#x2019;t existed (see below). For any other failures, delivery is deferred.
42721 </para>
42722 </listitem>
42723 <listitem>
42724 <para>
42725 If the file is opened successfully, check that the inode number hasn&#x2019;t
42726 changed, that it is still a regular file, and that the owner and permissions
42727 have not changed. If anything is wrong, defer delivery and freeze the message.
42728 </para>
42729 </listitem>
42730 <listitem>
42731 <para>
42732 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
42733 option is set. Otherwise, check that the file is being created in a permitted
42734 directory if the <option>create_file</option> option is set (deferring on failure), and then
42735 open for writing as a new file, with the O_EXCL and O_CREAT options,
42736 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
42737 set). In this case, which can happen if the link points to a non-existent file,
42738 the file is opened for writing using O_CREAT but not O_EXCL, because
42739 that prevents link following.
42740 </para>
42741 </listitem>
42742 <listitem>
42743 <para>
42744 <indexterm role="concept">
42745 <primary>loop</primary>
42746 <secondary>while file testing</secondary>
42747 </indexterm>
42748 If opening fails because the file exists, obey the tests given above for
42749 existing files. However, to avoid looping in a situation where the file is
42750 being continuously created and destroyed, the exists/not-exists loop is broken
42751 after 10 repetitions, and the message is then frozen.
42752 </para>
42753 </listitem>
42754 <listitem>
42755 <para>
42756 If opening fails with any other error, defer delivery.
42757 </para>
42758 </listitem>
42759 <listitem>
42760 <para>
42761 <indexterm role="concept">
42762 <primary>file</primary>
42763 <secondary>locking</secondary>
42764 </indexterm>
42765 <indexterm role="concept">
42766 <primary>locking files</primary>
42767 </indexterm>
42768 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
42769 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
42770 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
42771 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
42772 file, and an exclusive lock on the file whose name is
42773 </para>
42774 <literallayout class="monospaced">
42775 /tmp/.&lt;device-number&gt;.&lt;inode-number&gt;
42776 </literallayout>
42777 <para>
42778 using the device and inode numbers of the open mailbox file, in accordance with
42779 the MBX locking rules. This file is created with a mode that is specified by
42780 the <option>lockfile_mode</option> option.
42781 </para>
42782 <para>
42783 If Exim fails to lock the file, there are two possible courses of action,
42784 depending on the value of the locking timeout. This is obtained from
42785 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
42786 </para>
42787 <para>
42788 If the timeout value is zero, the file is closed, Exim waits for
42789 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
42790 to lock it again. This happens up to <option>lock_retries</option> times, after which the
42791 delivery is deferred.
42792 </para>
42793 <para>
42794 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
42795 <function>flock()</function> are used (with the given timeout), so there has already been some
42796 waiting involved by the time locking fails. Nevertheless, Exim does not give up
42797 immediately. It retries up to
42798 </para>
42799 <literallayout class="monospaced">
42800 (lock_retries * lock_interval) / &lt;timeout&gt;
42801 </literallayout>
42802 <para>
42803 times (rounded up).
42804 </para>
42805 </listitem>
42806 </itemizedlist>
42807 <para>
42808 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
42809 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
42810 </para>
42811 </section>
42812 <section id="SECTopdir">
42813 <title>Operational details for delivery to a new file</title>
42814 <para>
42815 <indexterm role="concept">
42816 <primary>delivery</primary>
42817 <secondary>to single file</secondary>
42818 </indexterm>
42819 <indexterm role="concept">
42820 <primary><quote>From</quote> line</primary>
42821 </indexterm>
42822 When the <option>directory</option> option is set instead of <option>file</option>, each message is
42823 delivered into a newly-created file or set of files. When <command>appendfile</command> is
42824 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
42825 <option>directory</option> is normally set, because the path for delivery is supplied by the
42826 router. (See for example, the <command>address_file</command> transport in the default
42827 configuration.) In this case, delivery is to a new file if either the path name
42828 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
42829 </para>
42830 <para>
42831 No locking is required while writing the message to a new file, so the various
42832 locking options of the transport are ignored. The <quote>From</quote> line that by default
42833 separates messages in a single file is not normally needed, nor is the escaping
42834 of message lines that start with <quote>From</quote>, and there is no need to ensure a
42835 newline at the end of each message. Consequently, the default values for
42836 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
42837 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
42838 </para>
42839 <para>
42840 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
42841 the files in the delivery directory by default. However, you can specify a
42842 different directory by setting <option>quota_directory</option>. Also, for maildir
42843 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
42844 </para>
42845 <para>
42846 <indexterm role="concept">
42847 <primary>maildir format</primary>
42848 </indexterm>
42849 <indexterm role="concept">
42850 <primary>mailstore format</primary>
42851 </indexterm>
42852 There are three different ways in which delivery to individual files can be
42853 done, controlled by the settings of the <option>maildir_format</option> and
42854 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
42855 formats is not included in the binary unless SUPPORT_MAILDIR or
42856 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
42857 </para>
42858 <para>
42859 <indexterm role="concept">
42860 <primary>directory creation</primary>
42861 </indexterm>
42862 In all three cases an attempt is made to create the directory and any necessary
42863 sub-directories if they do not exist, provided that the <option>create_directory</option>
42864 option is set (the default). The location of a created directory can be
42865 constrained by setting <option>create_file</option>. A created directory&#x2019;s mode is given by
42866 the <option>directory_mode</option> option. If creation fails, or if the
42867 <option>create_directory</option> option is not set when creation is required, delivery is
42868 deferred.
42869 </para>
42870 </section>
42871 <section id="SECTmaildirdelivery">
42872 <title>Maildir delivery</title>
42873 <para>
42874 <indexterm role="concept">
42875 <primary>maildir format</primary>
42876 <secondary>description of</secondary>
42877 </indexterm>
42878 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
42879 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
42880 directory that is defined by the <option>directory</option> option (the <quote>delivery
42881 directory</quote>). If the delivery is successful, the file is renamed into the
42882 <filename>new</filename> subdirectory.
42883 </para>
42884 <para>
42885 In the file name, &lt;<emphasis>stime</emphasis>&gt; is the current time of day in seconds, and
42886 &lt;<emphasis>mtime</emphasis>&gt; is the microsecond fraction of the time. After a maildir delivery,
42887 Exim checks that the time-of-day clock has moved on by at least one microsecond
42888 before terminating the delivery process. This guarantees uniqueness for the
42889 file name. However, as a precaution, Exim calls <function>stat()</function> for the file before
42890 opening it. If any response other than ENOENT (does not exist) is given,
42891 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
42892 </para>
42893 <para>
42894 Before Exim carries out a maildir delivery, it ensures that subdirectories
42895 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
42896 do not exist, Exim tries to create them and any superior directories in their
42897 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
42898 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
42899 contains matches the delivery directory, Exim also ensures that a file called
42900 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
42901 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
42902 </para>
42903 <para>
42904 These features make it possible to use Exim to create all the necessary files
42905 and directories in a maildir mailbox, including subdirectories for maildir++
42906 folders. Consider this example:
42907 </para>
42908 <literallayout class="monospaced">
42909 maildir_format = true
42910 directory = /var/mail/$local_part\
42911            ${if eq{$local_part_suffix}{}{}\
42912            {/.${substr_1:$local_part_suffix}}}
42913 maildirfolder_create_regex = /\.[^/]+$
42914 </literallayout>
42915 <para>
42916 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
42917 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
42918 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
42919 not match this name, so Exim will not look for or create the file
42920 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
42921 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
42922 </para>
42923 <para>
42924 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
42925 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
42926 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
42927 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
42928 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
42929 </para>
42930 <para>
42931 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
42932 not inadvertently match the toplevel maildir directory, because a
42933 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
42934 </para>
42935 <para>
42936 <indexterm role="concept">
42937 <primary>quota</primary>
42938 <secondary>in maildir delivery</secondary>
42939 </indexterm>
42940 <indexterm role="concept">
42941 <primary>maildir++</primary>
42942 </indexterm>
42943 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
42944 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
42945 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
42946 Exim assumes the directory is a maildir++ folder directory, which is one level
42947 down from the user&#x2019;s top level mailbox directory. This causes it to start at
42948 the parent directory instead of the current directory when calculating the
42949 amount of space used.
42950 </para>
42951 <para>
42952 One problem with delivering into a multi-file mailbox is that it is
42953 computationally expensive to compute the size of the mailbox for quota
42954 checking. Various approaches have been taken to reduce the amount of work
42955 needed. The next two sections describe two of them. A third alternative is to
42956 use some external process for maintaining the size data, and use the expansion
42957 of the <option>mailbox_size</option> option as a way of importing it into Exim.
42958 </para>
42959 </section>
42960 <section id="SECID135">
42961 <title>Using tags to record message sizes</title>
42962 <para>
42963 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
42964 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
42965 tag is added to its name. However, if adding the tag takes the length of the
42966 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
42967 the tag is dropped and the maildir file is created with no tag.
42968 </para>
42969 <para>
42970 <indexterm role="variable">
42971 <primary><varname>$message_size</varname></primary>
42972 </indexterm>
42973 Tags can be used to encode the size of files in their names; see
42974 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
42975 happens after the message has been written. The value of the <varname>$message_size</varname>
42976 variable is set to the number of bytes actually written. If the expansion is
42977 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
42978 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
42979 Non-printing characters in the string are ignored; if the resulting string is
42980 empty, it is ignored. If it starts with an alphanumeric character, a leading
42981 colon is inserted; this default has not proven to be the path that popular
42982 maildir implementations have chosen (but changing it in Exim would break
42983 backwards compatibility).
42984 </para>
42985 <para>
42986 For one common implementation, you might set:
42987 </para>
42988 <literallayout class="monospaced">
42989 maildir_tag = ,S=${message_size}
42990 </literallayout>
42991 <para>
42992 but you should check the documentation of the other software to be sure.
42993 </para>
42994 <para>
42995 It is advisable to also set <option>quota_size_regex</option> when setting <option>maildir_tag</option>
42996 as this allows Exim to extract the size from your tag, instead of having to
42997 <function>stat()</function> each message file.
42998 </para>
42999 </section>
43000 <section id="SECID136">
43001 <title>Using a maildirsize file</title>
43002 <para>
43003 <indexterm role="concept">
43004 <primary>quota</primary>
43005 <secondary>in maildir delivery</secondary>
43006 </indexterm>
43007 <indexterm role="concept">
43008 <primary>maildir format</primary>
43009 <secondary><filename>maildirsize</filename> file</secondary>
43010 </indexterm>
43011 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
43012 storing quota and message size information in a file called <filename>maildirsize</filename>
43013 within the toplevel maildir directory. If this file does not exist, Exim
43014 creates it, setting the quota from the <option>quota</option> option of the transport. If
43015 the maildir directory itself does not exist, it is created before any attempt
43016 to write a <filename>maildirsize</filename> file.
43017 </para>
43018 <para>
43019 The <filename>maildirsize</filename> file is used to hold information about the sizes of
43020 messages in the maildir, thus speeding up quota calculations. The quota value
43021 in the file is just a cache; if the quota is changed in the transport, the new
43022 value overrides the cached value when the next message is delivered. The cache
43023 is maintained for the benefit of other programs that access the maildir and
43024 need to know the quota.
43025 </para>
43026 <para>
43027 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
43028 file is maintained (with a zero quota setting), but no quota is imposed.
43029 </para>
43030 <para>
43031 A regular expression is available for controlling which directories in the
43032 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
43033 See the description of the <option>maildir_quota_directory_regex</option> option above for
43034 details.
43035 </para>
43036 </section>
43037 <section id="SECID137">
43038 <title>Mailstore delivery</title>
43039 <para>
43040 <indexterm role="concept">
43041 <primary>mailstore format</primary>
43042 <secondary>description of</secondary>
43043 </indexterm>
43044 If the <option>mailstore_format</option> option is true, each message is written as two
43045 files in the given directory. A unique base name is constructed from the
43046 message id and the current delivery process, and the files that are written use
43047 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
43048 contains the message&#x2019;s envelope, and the <filename>.msg</filename> file contains the message
43049 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
43050 </para>
43051 <para>
43052 During delivery, the envelope is first written to a file with the suffix
43053 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
43054 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
43055 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
43056 file before accessing either of them. An alternative approach is to wait for
43057 the absence of a <filename>.tmp</filename> file.
43058 </para>
43059 <para>
43060 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
43061 option, expanded and terminated by a newline if there isn&#x2019;t one. Then follows
43062 the sender address on one line, then all the recipient addresses, one per line.
43063 There can be more than one recipient only if the <option>batch_max</option> option is set
43064 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
43065 appended to the file, followed by a newline if it does not end with one.
43066 </para>
43067 <para>
43068 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
43069 failure, it is ignored. Other expansion errors are treated as serious
43070 configuration errors, and delivery is deferred. The variable
43071 <varname>$mailstore_basename</varname> is available for use during these expansions.
43072 </para>
43073 </section>
43074 <section id="SECID138">
43075 <title>Non-special new file delivery</title>
43076 <para>
43077 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
43078 file is created directly in the named directory. For example, when delivering
43079 messages into files in batched SMTP format for later delivery to some host (see
43080 section <xref linkend="SECTbatchSMTP"/>), a setting such as
43081 </para>
43082 <literallayout class="monospaced">
43083 directory = /var/bsmtp/$host
43084 </literallayout>
43085 <para>
43086 might be used. A message is written to a file with a temporary name, which is
43087 then renamed when the delivery is complete. The final name is obtained by
43088 expanding the contents of the <option>directory_file</option> option.
43089 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
43090 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
43091 </para>
43092 </section>
43093 </chapter>
43094
43095 <chapter id="CHID8">
43096 <title>The autoreply transport</title>
43097 <para>
43098 <indexterm role="concept" id="IIDauttra1" class="startofrange">
43099 <primary>transports</primary>
43100 <secondary><command>autoreply</command></secondary>
43101 </indexterm>
43102 <indexterm role="concept" id="IIDauttra2" class="startofrange">
43103 <primary><command>autoreply</command> transport</primary>
43104 </indexterm>
43105 The <command>autoreply</command> transport is not a true transport in that it does not cause
43106 the message to be transmitted. Instead, it generates a new mail message as an
43107 automatic reply to the incoming message. <emphasis>References:</emphasis> and
43108 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
43109 to the rules in RFCs 2822 and 3834, respectively.
43110 </para>
43111 <para>
43112 If the router that passes the message to this transport does not have the
43113 <option>unseen</option> option set, the original message (for the current recipient) is not
43114 delivered anywhere. However, when the <option>unseen</option> option is set on the router
43115 that passes the message to this transport, routing of the address continues, so
43116 another router can set up a normal message delivery.
43117 </para>
43118 <para>
43119 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
43120 <quote>vacation</quote> message being the standard example. However, it can also be run
43121 directly from a router like any other transport. To reduce the possibility of
43122 message cascades, messages created by the <command>autoreply</command> transport always have
43123 empty envelope sender addresses, like bounce messages.
43124 </para>
43125 <para>
43126 The parameters of the message to be sent can be specified in the configuration
43127 by options described below. However, these are used only when the address
43128 passed to the transport does not contain its own reply information. When the
43129 transport is run as a consequence of a
43130 <option>mail</option>
43131 or <option>vacation</option> command in a filter file, the parameters of the message are
43132 supplied by the filter, and passed with the address. The transport&#x2019;s options
43133 that define the message are then ignored (so they are not usually set in this
43134 case). The message is specified entirely by the filter or by the transport; it
43135 is never built from a mixture of options. However, the <option>file_optional</option>,
43136 <option>mode</option>, and <option>return_message</option> options apply in all cases.
43137 </para>
43138 <para>
43139 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
43140 command in a user&#x2019;s filter file, <command>autoreply</command> normally runs under the uid and
43141 gid of the user, and with appropriate current and home directories (see chapter
43142 <xref linkend="CHAPenvironment"/>).
43143 </para>
43144 <para>
43145 There is a subtle difference between routing a message to a <command>pipe</command> transport
43146 that generates some text to be returned to the sender, and routing it to an
43147 <command>autoreply</command> transport. This difference is noticeable only if more than one
43148 address from the same message is so handled. In the case of a pipe, the
43149 separate outputs from the different addresses are gathered up and returned to
43150 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
43151 message is generated for each address that is passed to it.
43152 </para>
43153 <para>
43154 Non-printing characters are not permitted in the header lines generated for the
43155 message that <command>autoreply</command> creates, with the exception of newlines that are
43156 immediately followed by white space. If any non-printing characters are found,
43157 the transport defers.
43158 Whether characters with the top bit set count as printing characters or not is
43159 controlled by the <option>print_topbitchars</option> global option.
43160 </para>
43161 <para>
43162 If any of the generic options for manipulating headers (for example,
43163 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
43164 of the original message that is included in the generated message when
43165 <option>return_message</option> is set. They do not apply to the generated message itself.
43166 </para>
43167 <para>
43168 <indexterm role="variable">
43169 <primary><varname>$sender_address</varname></primary>
43170 </indexterm>
43171 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
43172 the message, indicating that there were no recipients, it does not treat this
43173 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
43174 is empty (because the incoming message is a bounce message) do not cause
43175 problems. They are just discarded.
43176 </para>
43177 <section id="SECID139">
43178 <title>Private options for autoreply</title>
43179 <para>
43180 <indexterm role="concept">
43181 <primary>options</primary>
43182 <secondary><command>autoreply</command> transport</secondary>
43183 </indexterm>
43184 </para>
43185 <para>
43186 <indexterm role="option">
43187 <primary><option>bcc</option></primary>
43188 </indexterm>
43189 </para>
43190 <informaltable frame="all">
43191 <tgroup cols="4" colsep="0" rowsep="0">
43192 <colspec colwidth="8*" align="left"/>
43193 <colspec colwidth="6*" align="center"/>
43194 <colspec colwidth="6*" align="center"/>
43195 <colspec colwidth="6*" align="right"/>
43196 <tbody>
43197 <row>
43198 <entry><option>bcc</option></entry>
43199 <entry>Use: <emphasis>autoreply</emphasis></entry>
43200 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43201 <entry>Default: <emphasis>unset</emphasis></entry>
43202 </row>
43203 </tbody>
43204 </tgroup>
43205 </informaltable>
43206 <para>
43207 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
43208 message when the message is specified by the transport.
43209 </para>
43210 <para>
43211 <indexterm role="option">
43212 <primary><option>cc</option></primary>
43213 </indexterm>
43214 </para>
43215 <informaltable frame="all">
43216 <tgroup cols="4" colsep="0" rowsep="0">
43217 <colspec colwidth="8*" align="left"/>
43218 <colspec colwidth="6*" align="center"/>
43219 <colspec colwidth="6*" align="center"/>
43220 <colspec colwidth="6*" align="right"/>
43221 <tbody>
43222 <row>
43223 <entry><option>cc</option></entry>
43224 <entry>Use: <emphasis>autoreply</emphasis></entry>
43225 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43226 <entry>Default: <emphasis>unset</emphasis></entry>
43227 </row>
43228 </tbody>
43229 </tgroup>
43230 </informaltable>
43231 <para>
43232 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
43233 when the message is specified by the transport.
43234 </para>
43235 <para>
43236 <indexterm role="option">
43237 <primary><option>file</option></primary>
43238 </indexterm>
43239 </para>
43240 <informaltable frame="all">
43241 <tgroup cols="4" colsep="0" rowsep="0">
43242 <colspec colwidth="8*" align="left"/>
43243 <colspec colwidth="6*" align="center"/>
43244 <colspec colwidth="6*" align="center"/>
43245 <colspec colwidth="6*" align="right"/>
43246 <tbody>
43247 <row>
43248 <entry><option>file</option></entry>
43249 <entry>Use: <emphasis>autoreply</emphasis></entry>
43250 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43251 <entry>Default: <emphasis>unset</emphasis></entry>
43252 </row>
43253 </tbody>
43254 </tgroup>
43255 </informaltable>
43256 <para>
43257 The contents of the file are sent as the body of the message when the message
43258 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
43259 string comes first.
43260 </para>
43261 <para>
43262 <indexterm role="option">
43263 <primary><option>file_expand</option></primary>
43264 </indexterm>
43265 </para>
43266 <informaltable frame="all">
43267 <tgroup cols="4" colsep="0" rowsep="0">
43268 <colspec colwidth="8*" align="left"/>
43269 <colspec colwidth="6*" align="center"/>
43270 <colspec colwidth="6*" align="center"/>
43271 <colspec colwidth="6*" align="right"/>
43272 <tbody>
43273 <row>
43274 <entry><option>file_expand</option></entry>
43275 <entry>Use: <emphasis>autoreply</emphasis></entry>
43276 <entry>Type: <emphasis>boolean</emphasis></entry>
43277 <entry>Default: <emphasis>false</emphasis></entry>
43278 </row>
43279 </tbody>
43280 </tgroup>
43281 </informaltable>
43282 <para>
43283 If this is set, the contents of the file named by the <option>file</option> option are
43284 subjected to string expansion as they are added to the message.
43285 </para>
43286 <para>
43287 <indexterm role="option">
43288 <primary><option>file_optional</option></primary>
43289 </indexterm>
43290 </para>
43291 <informaltable frame="all">
43292 <tgroup cols="4" colsep="0" rowsep="0">
43293 <colspec colwidth="8*" align="left"/>
43294 <colspec colwidth="6*" align="center"/>
43295 <colspec colwidth="6*" align="center"/>
43296 <colspec colwidth="6*" align="right"/>
43297 <tbody>
43298 <row>
43299 <entry><option>file_optional</option></entry>
43300 <entry>Use: <emphasis>autoreply</emphasis></entry>
43301 <entry>Type: <emphasis>boolean</emphasis></entry>
43302 <entry>Default: <emphasis>false</emphasis></entry>
43303 </row>
43304 </tbody>
43305 </tgroup>
43306 </informaltable>
43307 <para>
43308 If this option is true, no error is generated if the file named by the <option>file</option>
43309 option or passed with the address does not exist or cannot be read.
43310 </para>
43311 <para>
43312 <indexterm role="option">
43313 <primary><option>from</option></primary>
43314 </indexterm>
43315 </para>
43316 <informaltable frame="all">
43317 <tgroup cols="4" colsep="0" rowsep="0">
43318 <colspec colwidth="8*" align="left"/>
43319 <colspec colwidth="6*" align="center"/>
43320 <colspec colwidth="6*" align="center"/>
43321 <colspec colwidth="6*" align="right"/>
43322 <tbody>
43323 <row>
43324 <entry><option>from</option></entry>
43325 <entry>Use: <emphasis>autoreply</emphasis></entry>
43326 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43327 <entry>Default: <emphasis>unset</emphasis></entry>
43328 </row>
43329 </tbody>
43330 </tgroup>
43331 </informaltable>
43332 <para>
43333 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
43334 specified by the transport.
43335 </para>
43336 <para>
43337 <indexterm role="option">
43338 <primary><option>headers</option></primary>
43339 </indexterm>
43340 </para>
43341 <informaltable frame="all">
43342 <tgroup cols="4" colsep="0" rowsep="0">
43343 <colspec colwidth="8*" align="left"/>
43344 <colspec colwidth="6*" align="center"/>
43345 <colspec colwidth="6*" align="center"/>
43346 <colspec colwidth="6*" align="right"/>
43347 <tbody>
43348 <row>
43349 <entry><option>headers</option></entry>
43350 <entry>Use: <emphasis>autoreply</emphasis></entry>
43351 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43352 <entry>Default: <emphasis>unset</emphasis></entry>
43353 </row>
43354 </tbody>
43355 </tgroup>
43356 </informaltable>
43357 <para>
43358 This specifies additional RFC 2822 headers that are to be added to the message
43359 when the message is specified by the transport. Several can be given by using
43360 <quote>\n</quote> to separate them. There is no check on the format.
43361 </para>
43362 <para>
43363 <indexterm role="option">
43364 <primary><option>log</option></primary>
43365 </indexterm>
43366 </para>
43367 <informaltable frame="all">
43368 <tgroup cols="4" colsep="0" rowsep="0">
43369 <colspec colwidth="8*" align="left"/>
43370 <colspec colwidth="6*" align="center"/>
43371 <colspec colwidth="6*" align="center"/>
43372 <colspec colwidth="6*" align="right"/>
43373 <tbody>
43374 <row>
43375 <entry><option>log</option></entry>
43376 <entry>Use: <emphasis>autoreply</emphasis></entry>
43377 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43378 <entry>Default: <emphasis>unset</emphasis></entry>
43379 </row>
43380 </tbody>
43381 </tgroup>
43382 </informaltable>
43383 <para>
43384 This option names a file in which a record of every message sent is logged when
43385 the message is specified by the transport.
43386 </para>
43387 <para>
43388 <indexterm role="option">
43389 <primary><option>mode</option></primary>
43390 </indexterm>
43391 </para>
43392 <informaltable frame="all">
43393 <tgroup cols="4" colsep="0" rowsep="0">
43394 <colspec colwidth="8*" align="left"/>
43395 <colspec colwidth="6*" align="center"/>
43396 <colspec colwidth="6*" align="center"/>
43397 <colspec colwidth="6*" align="right"/>
43398 <tbody>
43399 <row>
43400 <entry><option>mode</option></entry>
43401 <entry>Use: <emphasis>autoreply</emphasis></entry>
43402 <entry>Type: <emphasis>octal integer</emphasis></entry>
43403 <entry>Default: <emphasis>0600</emphasis></entry>
43404 </row>
43405 </tbody>
43406 </tgroup>
43407 </informaltable>
43408 <para>
43409 If either the log file or the <quote>once</quote> file has to be created, this mode is
43410 used.
43411 </para>
43412 <para>
43413 <indexterm role="option">
43414 <primary><option>never_mail</option></primary>
43415 </indexterm>
43416 </para>
43417 <informaltable frame="all">
43418 <tgroup cols="4" colsep="0" rowsep="0">
43419 <colspec colwidth="8*" align="left"/>
43420 <colspec colwidth="6*" align="center"/>
43421 <colspec colwidth="6*" align="center"/>
43422 <colspec colwidth="6*" align="right"/>
43423 <tbody>
43424 <row>
43425 <entry><option>never_mail</option></entry>
43426 <entry>Use: <emphasis>autoreply</emphasis></entry>
43427 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
43428 <entry>Default: <emphasis>unset</emphasis></entry>
43429 </row>
43430 </tbody>
43431 </tgroup>
43432 </informaltable>
43433 <para>
43434 If any run of the transport creates a message with a recipient that matches any
43435 item in the list, that recipient is quietly discarded. If all recipients are
43436 discarded, no message is created. This applies both when the recipients are
43437 generated by a filter and when they are specified in the transport.
43438 </para>
43439 <para>
43440 <indexterm role="option">
43441 <primary><option>once</option></primary>
43442 </indexterm>
43443 </para>
43444 <informaltable frame="all">
43445 <tgroup cols="4" colsep="0" rowsep="0">
43446 <colspec colwidth="8*" align="left"/>
43447 <colspec colwidth="6*" align="center"/>
43448 <colspec colwidth="6*" align="center"/>
43449 <colspec colwidth="6*" align="right"/>
43450 <tbody>
43451 <row>
43452 <entry><option>once</option></entry>
43453 <entry>Use: <emphasis>autoreply</emphasis></entry>
43454 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43455 <entry>Default: <emphasis>unset</emphasis></entry>
43456 </row>
43457 </tbody>
43458 </tgroup>
43459 </informaltable>
43460 <para>
43461 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
43462 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
43463 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
43464 </para>
43465 <para>
43466 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
43467 By default, if <option>once</option> is set to a non-empty file name, the message
43468 is not sent if a potential recipient is already listed in the database.
43469 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
43470 message is sent if that much time has elapsed since a message was last sent to
43471 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
43472 prevents a message from being sent a second time &ndash; in this case, zero means
43473 infinity.
43474 </para>
43475 <para>
43476 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
43477 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
43478 greater than zero, it changes the way Exim implements the <option>once</option> option.
43479 Instead of using a DBM file to record every recipient it sends to, it uses a
43480 regular file, whose size will never get larger than the given value.
43481 </para>
43482 <para>
43483 In the file, Exim keeps a linear list of recipient addresses and the times at
43484 which they were sent messages. If the file is full when a new address needs to
43485 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
43486 means that a given recipient may receive multiple messages, but at
43487 unpredictable intervals that depend on the rate of turnover of addresses in the
43488 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
43489 </para>
43490 <para>
43491 <indexterm role="option">
43492 <primary><option>once_file_size</option></primary>
43493 </indexterm>
43494 </para>
43495 <informaltable frame="all">
43496 <tgroup cols="4" colsep="0" rowsep="0">
43497 <colspec colwidth="8*" align="left"/>
43498 <colspec colwidth="6*" align="center"/>
43499 <colspec colwidth="6*" align="center"/>
43500 <colspec colwidth="6*" align="right"/>
43501 <tbody>
43502 <row>
43503 <entry><option>once_file_size</option></entry>
43504 <entry>Use: <emphasis>autoreply</emphasis></entry>
43505 <entry>Type: <emphasis>integer</emphasis></entry>
43506 <entry>Default: <emphasis>0</emphasis></entry>
43507 </row>
43508 </tbody>
43509 </tgroup>
43510 </informaltable>
43511 <para>
43512 See <option>once</option> above.
43513 </para>
43514 <para>
43515 <indexterm role="option">
43516 <primary><option>once_repeat</option></primary>
43517 </indexterm>
43518 </para>
43519 <informaltable frame="all">
43520 <tgroup cols="4" colsep="0" rowsep="0">
43521 <colspec colwidth="8*" align="left"/>
43522 <colspec colwidth="6*" align="center"/>
43523 <colspec colwidth="6*" align="center"/>
43524 <colspec colwidth="6*" align="right"/>
43525 <tbody>
43526 <row>
43527 <entry><option>once_repeat</option></entry>
43528 <entry>Use: <emphasis>autoreply</emphasis></entry>
43529 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
43530 <entry>Default: <emphasis>0s</emphasis></entry>
43531 </row>
43532 </tbody>
43533 </tgroup>
43534 </informaltable>
43535 <para>
43536 See <option>once</option> above.
43537 After expansion, the value of this option must be a valid time value.
43538 </para>
43539 <para>
43540 <indexterm role="option">
43541 <primary><option>reply_to</option></primary>
43542 </indexterm>
43543 </para>
43544 <informaltable frame="all">
43545 <tgroup cols="4" colsep="0" rowsep="0">
43546 <colspec colwidth="8*" align="left"/>
43547 <colspec colwidth="6*" align="center"/>
43548 <colspec colwidth="6*" align="center"/>
43549 <colspec colwidth="6*" align="right"/>
43550 <tbody>
43551 <row>
43552 <entry><option>reply_to</option></entry>
43553 <entry>Use: <emphasis>autoreply</emphasis></entry>
43554 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43555 <entry>Default: <emphasis>unset</emphasis></entry>
43556 </row>
43557 </tbody>
43558 </tgroup>
43559 </informaltable>
43560 <para>
43561 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
43562 specified by the transport.
43563 </para>
43564 <para>
43565 <indexterm role="option">
43566 <primary><option>return_message</option></primary>
43567 </indexterm>
43568 </para>
43569 <informaltable frame="all">
43570 <tgroup cols="4" colsep="0" rowsep="0">
43571 <colspec colwidth="8*" align="left"/>
43572 <colspec colwidth="6*" align="center"/>
43573 <colspec colwidth="6*" align="center"/>
43574 <colspec colwidth="6*" align="right"/>
43575 <tbody>
43576 <row>
43577 <entry><option>return_message</option></entry>
43578 <entry>Use: <emphasis>autoreply</emphasis></entry>
43579 <entry>Type: <emphasis>boolean</emphasis></entry>
43580 <entry>Default: <emphasis>false</emphasis></entry>
43581 </row>
43582 </tbody>
43583 </tgroup>
43584 </informaltable>
43585 <para>
43586 If this is set, a copy of the original message is returned with the new
43587 message, subject to the maximum size set in the <option>return_size_limit</option> global
43588 configuration option.
43589 </para>
43590 <para>
43591 <indexterm role="option">
43592 <primary><option>subject</option></primary>
43593 </indexterm>
43594 </para>
43595 <informaltable frame="all">
43596 <tgroup cols="4" colsep="0" rowsep="0">
43597 <colspec colwidth="8*" align="left"/>
43598 <colspec colwidth="6*" align="center"/>
43599 <colspec colwidth="6*" align="center"/>
43600 <colspec colwidth="6*" align="right"/>
43601 <tbody>
43602 <row>
43603 <entry><option>subject</option></entry>
43604 <entry>Use: <emphasis>autoreply</emphasis></entry>
43605 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43606 <entry>Default: <emphasis>unset</emphasis></entry>
43607 </row>
43608 </tbody>
43609 </tgroup>
43610 </informaltable>
43611 <para>
43612 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
43613 specified by the transport. It is tempting to quote the original subject in
43614 automatic responses. For example:
43615 </para>
43616 <literallayout class="monospaced">
43617 subject = Re: $h_subject:
43618 </literallayout>
43619 <para>
43620 There is a danger in doing this, however. It may allow a third party to
43621 subscribe your users to an opt-in mailing list, provided that the list accepts
43622 bounce messages as subscription confirmations. Well-managed lists require a
43623 non-bounce message to confirm a subscription, so the danger is relatively
43624 small.
43625 </para>
43626 <para>
43627 <indexterm role="option">
43628 <primary><option>text</option></primary>
43629 </indexterm>
43630 </para>
43631 <informaltable frame="all">
43632 <tgroup cols="4" colsep="0" rowsep="0">
43633 <colspec colwidth="8*" align="left"/>
43634 <colspec colwidth="6*" align="center"/>
43635 <colspec colwidth="6*" align="center"/>
43636 <colspec colwidth="6*" align="right"/>
43637 <tbody>
43638 <row>
43639 <entry><option>text</option></entry>
43640 <entry>Use: <emphasis>autoreply</emphasis></entry>
43641 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43642 <entry>Default: <emphasis>unset</emphasis></entry>
43643 </row>
43644 </tbody>
43645 </tgroup>
43646 </informaltable>
43647 <para>
43648 This specifies a single string to be used as the body of the message when the
43649 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
43650 the text comes first.
43651 </para>
43652 <para>
43653 <indexterm role="option">
43654 <primary><option>to</option></primary>
43655 </indexterm>
43656 </para>
43657 <informaltable frame="all">
43658 <tgroup cols="4" colsep="0" rowsep="0">
43659 <colspec colwidth="8*" align="left"/>
43660 <colspec colwidth="6*" align="center"/>
43661 <colspec colwidth="6*" align="center"/>
43662 <colspec colwidth="6*" align="right"/>
43663 <tbody>
43664 <row>
43665 <entry><option>to</option></entry>
43666 <entry>Use: <emphasis>autoreply</emphasis></entry>
43667 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43668 <entry>Default: <emphasis>unset</emphasis></entry>
43669 </row>
43670 </tbody>
43671 </tgroup>
43672 </informaltable>
43673 <para>
43674 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
43675 when the message is specified by the transport.
43676 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
43677 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
43678 </para>
43679 </section>
43680 </chapter>
43681
43682 <chapter id="CHAPLMTP">
43683 <title>The lmtp transport</title>
43684 <para>
43685 <indexterm role="concept">
43686 <primary>transports</primary>
43687 <secondary><command>lmtp</command></secondary>
43688 </indexterm>
43689 <indexterm role="concept">
43690 <primary><command>lmtp</command> transport</primary>
43691 </indexterm>
43692 <indexterm role="concept">
43693 <primary>LMTP</primary>
43694 <secondary>over a pipe</secondary>
43695 </indexterm>
43696 <indexterm role="concept">
43697 <primary>LMTP</primary>
43698 <secondary>over a socket</secondary>
43699 </indexterm>
43700 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
43701 specified command
43702 or by interacting with a Unix domain socket.
43703 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
43704 transports. Exim also has support for using LMTP over TCP/IP; this is
43705 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
43706 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
43707 has it commented out. You need to ensure that
43708 </para>
43709 <literallayout class="monospaced">
43710 TRANSPORT_LMTP=yes
43711 </literallayout>
43712 <para>
43713 <indexterm role="concept">
43714 <primary>options</primary>
43715 <secondary><command>lmtp</command> transport</secondary>
43716 </indexterm>
43717 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
43718 included in the Exim binary. The private options of the <command>lmtp</command> transport are
43719 as follows:
43720 </para>
43721 <para>
43722 <indexterm role="option">
43723 <primary><option>batch_id</option></primary>
43724 </indexterm>
43725 </para>
43726 <informaltable frame="all">
43727 <tgroup cols="4" colsep="0" rowsep="0">
43728 <colspec colwidth="8*" align="left"/>
43729 <colspec colwidth="6*" align="center"/>
43730 <colspec colwidth="6*" align="center"/>
43731 <colspec colwidth="6*" align="right"/>
43732 <tbody>
43733 <row>
43734 <entry><option>batch_id</option></entry>
43735 <entry>Use: <emphasis>lmtp</emphasis></entry>
43736 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43737 <entry>Default: <emphasis>unset</emphasis></entry>
43738 </row>
43739 </tbody>
43740 </tgroup>
43741 </informaltable>
43742 <para>
43743 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
43744 </para>
43745 <para>
43746 <indexterm role="option">
43747 <primary><option>batch_max</option></primary>
43748 </indexterm>
43749 </para>
43750 <informaltable frame="all">
43751 <tgroup cols="4" colsep="0" rowsep="0">
43752 <colspec colwidth="8*" align="left"/>
43753 <colspec colwidth="6*" align="center"/>
43754 <colspec colwidth="6*" align="center"/>
43755 <colspec colwidth="6*" align="right"/>
43756 <tbody>
43757 <row>
43758 <entry><option>batch_max</option></entry>
43759 <entry>Use: <emphasis>lmtp</emphasis></entry>
43760 <entry>Type: <emphasis>integer</emphasis></entry>
43761 <entry>Default: <emphasis>1</emphasis></entry>
43762 </row>
43763 </tbody>
43764 </tgroup>
43765 </informaltable>
43766 <para>
43767 This limits the number of addresses that can be handled in a single delivery.
43768 Most LMTP servers can handle several addresses at once, so it is normally a
43769 good idea to increase this value. See the description of local delivery
43770 batching in chapter <xref linkend="CHAPbatching"/>.
43771 </para>
43772 <para>
43773 <indexterm role="option">
43774 <primary><option>command</option></primary>
43775 </indexterm>
43776 </para>
43777 <informaltable frame="all">
43778 <tgroup cols="4" colsep="0" rowsep="0">
43779 <colspec colwidth="8*" align="left"/>
43780 <colspec colwidth="6*" align="center"/>
43781 <colspec colwidth="6*" align="center"/>
43782 <colspec colwidth="6*" align="right"/>
43783 <tbody>
43784 <row>
43785 <entry><option>command</option></entry>
43786 <entry>Use: <emphasis>lmtp</emphasis></entry>
43787 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43788 <entry>Default: <emphasis>unset</emphasis></entry>
43789 </row>
43790 </tbody>
43791 </tgroup>
43792 </informaltable>
43793 <para>
43794 This option must be set if <option>socket</option> is not set. The string is a command which
43795 is run in a separate process. It is split up into a command name and list of
43796 arguments, each of which is separately expanded (so expansion cannot change the
43797 number of arguments). The command is run directly, not via a shell. The message
43798 is passed to the new process using the standard input and output to operate the
43799 LMTP protocol.
43800 </para>
43801 <para>
43802 <indexterm role="option">
43803 <primary><option>ignore_quota</option></primary>
43804 </indexterm>
43805 </para>
43806 <informaltable frame="all">
43807 <tgroup cols="4" colsep="0" rowsep="0">
43808 <colspec colwidth="8*" align="left"/>
43809 <colspec colwidth="6*" align="center"/>
43810 <colspec colwidth="6*" align="center"/>
43811 <colspec colwidth="6*" align="right"/>
43812 <tbody>
43813 <row>
43814 <entry><option>ignore_quota</option></entry>
43815 <entry>Use: <emphasis>lmtp</emphasis></entry>
43816 <entry>Type: <emphasis>boolean</emphasis></entry>
43817 <entry>Default: <emphasis>false</emphasis></entry>
43818 </row>
43819 </tbody>
43820 </tgroup>
43821 </informaltable>
43822 <para>
43823 <indexterm role="concept">
43824 <primary>LMTP</primary>
43825 <secondary>ignoring quota errors</secondary>
43826 </indexterm>
43827 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
43828 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
43829 in its response to the LHLO command.
43830 </para>
43831 <para>
43832 <indexterm role="option">
43833 <primary><option>socket</option></primary>
43834 </indexterm>
43835 </para>
43836 <informaltable frame="all">
43837 <tgroup cols="4" colsep="0" rowsep="0">
43838 <colspec colwidth="8*" align="left"/>
43839 <colspec colwidth="6*" align="center"/>
43840 <colspec colwidth="6*" align="center"/>
43841 <colspec colwidth="6*" align="right"/>
43842 <tbody>
43843 <row>
43844 <entry><option>socket</option></entry>
43845 <entry>Use: <emphasis>lmtp</emphasis></entry>
43846 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43847 <entry>Default: <emphasis>unset</emphasis></entry>
43848 </row>
43849 </tbody>
43850 </tgroup>
43851 </informaltable>
43852 <para>
43853 This option must be set if <option>command</option> is not set. The result of expansion must
43854 be the name of a Unix domain socket. The transport connects to the socket and
43855 delivers the message to it using the LMTP protocol.
43856 </para>
43857 <para>
43858 <indexterm role="option">
43859 <primary><option>timeout</option></primary>
43860 </indexterm>
43861 </para>
43862 <informaltable frame="all">
43863 <tgroup cols="4" colsep="0" rowsep="0">
43864 <colspec colwidth="8*" align="left"/>
43865 <colspec colwidth="6*" align="center"/>
43866 <colspec colwidth="6*" align="center"/>
43867 <colspec colwidth="6*" align="right"/>
43868 <tbody>
43869 <row>
43870 <entry><option>timeout</option></entry>
43871 <entry>Use: <emphasis>lmtp</emphasis></entry>
43872 <entry>Type: <emphasis>time</emphasis></entry>
43873 <entry>Default: <emphasis>5m</emphasis></entry>
43874 </row>
43875 </tbody>
43876 </tgroup>
43877 </informaltable>
43878 <para>
43879 The transport is aborted if the created process or Unix domain socket does not
43880 respond to LMTP commands or message input within this timeout. Delivery
43881 is deferred, and will be tried again later. Here is an example of a typical
43882 LMTP transport:
43883 </para>
43884 <literallayout class="monospaced">
43885 lmtp:
43886   driver = lmtp
43887   command = /some/local/lmtp/delivery/program
43888   batch_max = 20
43889   user = exim
43890 </literallayout>
43891 <para>
43892 This delivers up to 20 addresses at a time, in a mixture of domains if
43893 necessary, running as the user <emphasis>exim</emphasis>.
43894 </para>
43895 </chapter>
43896
43897 <chapter id="CHAPpipetransport">
43898 <title>The pipe transport</title>
43899 <para>
43900 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
43901 <primary>transports</primary>
43902 <secondary><command>pipe</command></secondary>
43903 </indexterm>
43904 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
43905 <primary><command>pipe</command> transport</primary>
43906 </indexterm>
43907 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
43908 running in another process. One example is the use of <command>pipe</command> as a
43909 pseudo-remote transport for passing messages to some other delivery mechanism
43910 (such as UUCP). Another is the use by individual users to automatically process
43911 their incoming messages. The <command>pipe</command> transport can be used in one of the
43912 following ways:
43913 </para>
43914 <itemizedlist>
43915 <listitem>
43916 <para>
43917 <indexterm role="variable">
43918 <primary><varname>$local_part</varname></primary>
43919 </indexterm>
43920 A router routes one address to a transport in the normal way, and the
43921 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
43922 contains the local part of the address (as usual), and the command that is run
43923 is specified by the <option>command</option> option on the transport.
43924 </para>
43925 </listitem>
43926 <listitem>
43927 <para>
43928 <indexterm role="variable">
43929 <primary><varname>$pipe_addresses</varname></primary>
43930 </indexterm>
43931 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
43932 transport can handle more than one address in a single run. In this case, when
43933 more than one address is routed to the transport, <varname>$local_part</varname> is not set
43934 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
43935 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
43936 that are routed to the transport.
43937 </para>
43938 </listitem>
43939 <listitem>
43940 <para>
43941 <indexterm role="variable">
43942 <primary><varname>$address_pipe</varname></primary>
43943 </indexterm>
43944 A router redirects an address directly to a pipe command (for example, from an
43945 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
43946 pipe command, and the <option>command</option> option on the transport is ignored unless
43947 <option>force_command</option> is set. If only one address is being transported
43948 (<option>batch_max</option> is not greater than one, or only one address was redirected to
43949 this pipe command), <varname>$local_part</varname> contains the local part that was redirected.
43950 </para>
43951 </listitem>
43952 </itemizedlist>
43953 <para>
43954 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
43955 deliver messages over pipes using the LMTP interactive protocol. This is
43956 implemented by the <command>lmtp</command> transport.
43957 </para>
43958 <para>
43959 In the case when <command>pipe</command> is run as a consequence of an entry in a local user&#x2019;s
43960 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
43961 other cases, the uid and gid have to be specified explicitly, either on the
43962 transport or on the router that handles the address. Current and <quote>home</quote>
43963 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
43964 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
43965 for a discussion of local delivery batching.
43966 </para>
43967 <section id="SECID140">
43968 <title>Concurrent delivery</title>
43969 <para>
43970 If two messages arrive at almost the same time, and both are routed to a pipe
43971 delivery, the two pipe transports may be run concurrently. You must ensure that
43972 any pipe commands you set up are robust against this happening. If the commands
43973 write to a file, the <option>exim_lock</option> utility might be of use.
43974 </para>
43975 <para revisionflag="changed">
43976 Alternatively the <option>max_parallel</option> option could be used with a value
43977 of "1" to enforce serialization.
43978 </para>
43979 </section>
43980 <section id="SECID141">
43981 <title>Returned status and data</title>
43982 <para>
43983 <indexterm role="concept">
43984 <primary><command>pipe</command> transport</primary>
43985 <secondary>returned data</secondary>
43986 </indexterm>
43987 If the command exits with a non-zero return code, the delivery is deemed to
43988 have failed, unless either the <option>ignore_status</option> option is set (in which case
43989 the return code is treated as zero), or the return code is one of those listed
43990 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
43991 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
43992 logged, but are not included in the bounce message, which merely contains
43993 <quote>local delivery failed</quote>.
43994 </para>
43995 <para>
43996 If the command exits on a signal and the <option>freeze_signal</option> option is set then
43997 the message will be frozen in the queue. If that option is not set, a bounce
43998 will be sent as normal.
43999 </para>
44000 <para>
44001 If the return code is greater than 128 and the command being run is a shell
44002 script, it normally means that the script was terminated by a signal whose
44003 value is the return code minus 128. The <option>freeze_signal</option> option does not
44004 apply in this case.
44005 </para>
44006 <para>
44007 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
44008 return code is set to 127. This is the value that a shell returns if it is
44009 asked to run a non-existent command. The wording for the log line suggests that
44010 a non-existent command may be the problem.
44011 </para>
44012 <para>
44013 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
44014 set and the command produces any output on its standard output or standard
44015 error streams, the command is considered to have failed, even if it gave a zero
44016 return code or if <option>ignore_status</option> is set. The output from the command is
44017 included as part of the bounce message. The <option>return_fail_output</option> option is
44018 similar, except that output is returned only when the command exits with a
44019 failure return code, that is, a value other than zero or a code that matches
44020 <option>temp_errors</option>.
44021 </para>
44022 </section>
44023 <section id="SECThowcommandrun">
44024 <title>How the command is run</title>
44025 <para>
44026 <indexterm role="concept">
44027 <primary><command>pipe</command> transport</primary>
44028 <secondary>path for command</secondary>
44029 </indexterm>
44030 The command line is (by default) broken down into a command name and arguments
44031 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
44032 <option>restrict_to_path</option> options can be used to restrict the commands that may be
44033 run.
44034 </para>
44035 <para>
44036 <indexterm role="concept">
44037 <primary>quoting</primary>
44038 <secondary>in pipe command</secondary>
44039 </indexterm>
44040 Unquoted arguments are delimited by white space. If an argument appears in
44041 double quotes, backslash is interpreted as an escape character in the usual
44042 way. If an argument appears in single quotes, no escaping is done.
44043 </para>
44044 <para>
44045 String expansion is applied to the command line except when it comes from a
44046 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
44047 expansion is applied to each argument in turn rather than to the whole line.
44048 For this reason, any string expansion item that contains white space must be
44049 quoted so as to be contained within a single argument. A setting such as
44050 </para>
44051 <literallayout class="monospaced">
44052 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
44053 </literallayout>
44054 <para>
44055 will not work, because the expansion item gets split between several
44056 arguments. You have to write
44057 </para>
44058 <literallayout class="monospaced">
44059 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
44060 </literallayout>
44061 <para>
44062 to ensure that it is all in one argument. The expansion is done in this way,
44063 argument by argument, so that the number of arguments cannot be changed as a
44064 result of expansion, and quotes or backslashes in inserted variables do not
44065 interact with external quoting. However, this leads to problems if you want to
44066 generate multiple arguments (or the command name plus arguments) from a single
44067 expansion. In this situation, the simplest solution is to use a shell. For
44068 example:
44069 </para>
44070 <literallayout class="monospaced">
44071 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
44072 </literallayout>
44073 <para>
44074 <indexterm role="concept">
44075 <primary>transport</primary>
44076 <secondary>filter</secondary>
44077 </indexterm>
44078 <indexterm role="concept">
44079 <primary>filter</primary>
44080 <secondary>transport filter</secondary>
44081 </indexterm>
44082 <indexterm role="variable">
44083 <primary><varname>$pipe_addresses</varname></primary>
44084 </indexterm>
44085 Special handling takes place when an argument consists of precisely the text
44086 <literal>$pipe_addresses</literal>. This is not a general expansion variable; the only
44087 place this string is recognized is when it appears as an argument for a pipe or
44088 transport filter command. It causes each address that is being handled to be
44089 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
44090 avoids any problems with spaces or shell metacharacters, and is of use when a
44091 <command>pipe</command> transport is handling groups of addresses in a batch.
44092 </para>
44093 <para>
44094 If <option>force_command</option> is enabled on the transport, Special handling takes place
44095 for an argument that consists of precisely the text <literal>$address_pipe</literal>.  It
44096 is handled similarly to <varname>$pipe_addresses</varname> above.  It is expanded and each
44097 argument is inserted in the argument list at that point
44098 <emphasis>as a separate argument</emphasis>.  The <literal>$address_pipe</literal> item does not need to be
44099 the only item in the argument; in fact, if it were then <option>force_command</option>
44100 should behave as a no-op.  Rather, it should be used to adjust the command
44101 run while preserving the argument vector separation.
44102 </para>
44103 <para>
44104 After splitting up into arguments and expansion, the resulting command is run
44105 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
44106 message that is being delivered is supplied on the standard input, and the
44107 standard output and standard error are both connected to a single pipe that is
44108 read by Exim. The <option>max_output</option> option controls how much output the command
44109 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
44110 control what is done with it.
44111 </para>
44112 <para>
44113 Not running the command under a shell (by default) lessens the security risks
44114 in cases when a command from a user&#x2019;s filter file is built out of data that was
44115 taken from an incoming message. If a shell is required, it can of course be
44116 explicitly specified as the command to be run. However, there are circumstances
44117 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
44118 under a shell and cannot easily be modified. To allow for these cases, there is
44119 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
44120 works. Instead of breaking up the command line as just described, it expands it
44121 as a single string and passes the result to <filename>/bin/sh</filename>. The
44122 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
44123 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
44124 </para>
44125 </section>
44126 <section id="SECTpipeenv">
44127 <title>Environment variables</title>
44128 <para>
44129 <indexterm role="concept">
44130 <primary><command>pipe</command> transport</primary>
44131 <secondary>environment for command</secondary>
44132 </indexterm>
44133 <indexterm role="concept">
44134 <primary>environment</primary>
44135 <secondary><command>pipe</command> transport</secondary>
44136 </indexterm>
44137 The environment variables listed below are set up when the command is invoked.
44138 This list is a compromise for maximum compatibility with other MTAs. Note that
44139 the <option>environment</option> option can be used to add additional variables to this
44140 environment. The environment for the <command>pipe</command> transport is not subject
44141 to the <option>add_environment</option> and <option>keep_environment</option> main config options.
44142 </para>
44143 <literallayout>
44144 <literal>DOMAIN            </literal>   the domain of the address
44145 <literal>HOME              </literal>   the home directory, if set
44146 <literal>HOST              </literal>   the host name when called from a router (see below)
44147 <literal>LOCAL_PART        </literal>   see below
44148 <literal>LOCAL_PART_PREFIX </literal>   see below
44149 <literal>LOCAL_PART_SUFFIX </literal>   see below
44150 <literal>LOGNAME           </literal>   see below
44151 <literal>MESSAGE_ID        </literal>   Exim&#x2019;s local ID for the message
44152 <literal>PATH              </literal>   as specified by the <option>path</option> option below
44153 <literal>QUALIFY_DOMAIN    </literal>   the sender qualification domain
44154 <literal>RECIPIENT         </literal>   the complete recipient address
44155 <literal>SENDER            </literal>   the sender of the message (empty if a bounce)
44156 <literal>SHELL             </literal>   <literal>/bin/sh</literal>
44157 <literal>TZ                </literal>   the value of the <option>timezone</option> option, if set
44158 <literal>USER              </literal>   see below
44159 </literallayout>
44160 <para>
44161 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
44162 router, LOCAL_PART is set to the local part of the address. When it is
44163 called as a result of a forward or alias expansion, LOCAL_PART is set to
44164 the local part of the address that was expanded. In both cases, any affixes are
44165 removed from the local part, and made available in LOCAL_PART_PREFIX and
44166 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
44167 same value as LOCAL_PART for compatibility with other MTAs.
44168 </para>
44169 <para>
44170 <indexterm role="concept">
44171 <primary>HOST</primary>
44172 </indexterm>
44173 HOST is set only when a <command>pipe</command> transport is called from a router that
44174 associates hosts with an address, typically when using <command>pipe</command> as a
44175 pseudo-remote transport. HOST is set to the first host name specified by
44176 the router.
44177 </para>
44178 <para>
44179 <indexterm role="concept">
44180 <primary>HOME</primary>
44181 </indexterm>
44182 If the transport&#x2019;s generic <option>home_directory</option> option is set, its value is used
44183 for the HOME environment variable. Otherwise, a home directory may be set
44184 by the router&#x2019;s <option>transport_home_directory</option> option, which defaults to the
44185 user&#x2019;s home directory if <option>check_local_user</option> is set.
44186 </para>
44187 </section>
44188 <section id="SECID142">
44189 <title>Private options for pipe</title>
44190 <para>
44191 <indexterm role="concept">
44192 <primary>options</primary>
44193 <secondary><command>pipe</command> transport</secondary>
44194 </indexterm>
44195 </para>
44196 <para>
44197 <indexterm role="option">
44198 <primary><option>allow_commands</option></primary>
44199 </indexterm>
44200 </para>
44201 <informaltable frame="all">
44202 <tgroup cols="4" colsep="0" rowsep="0">
44203 <colspec colwidth="8*" align="left"/>
44204 <colspec colwidth="6*" align="center"/>
44205 <colspec colwidth="6*" align="center"/>
44206 <colspec colwidth="6*" align="right"/>
44207 <tbody>
44208 <row>
44209 <entry><option>allow_commands</option></entry>
44210 <entry>Use: <emphasis>pipe</emphasis></entry>
44211 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
44212 <entry>Default: <emphasis>unset</emphasis></entry>
44213 </row>
44214 </tbody>
44215 </tgroup>
44216 </informaltable>
44217 <para>
44218 <indexterm role="concept">
44219 <primary><command>pipe</command> transport</primary>
44220 <secondary>permitted commands</secondary>
44221 </indexterm>
44222 The string is expanded, and is then interpreted as a colon-separated list of
44223 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
44224 permitted are those in the <option>allow_commands</option> list. They need not be absolute
44225 paths; the <option>path</option> option is still used for relative paths. If
44226 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
44227 in the <option>allow_commands</option> list, or a name without any slashes that is found on
44228 the path. In other words, if neither <option>allow_commands</option> nor
44229 <option>restrict_to_path</option> is set, there is no restriction on the command, but
44230 otherwise only commands that are permitted by one or the other are allowed. For
44231 example, if
44232 </para>
44233 <literallayout class="monospaced">
44234 allow_commands = /usr/bin/vacation
44235 </literallayout>
44236 <para>
44237 and <option>restrict_to_path</option> is not set, the only permitted command is
44238 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
44239 <option>use_shell</option> is set.
44240 </para>
44241 <para>
44242 <indexterm role="option">
44243 <primary><option>batch_id</option></primary>
44244 </indexterm>
44245 </para>
44246 <informaltable frame="all">
44247 <tgroup cols="4" colsep="0" rowsep="0">
44248 <colspec colwidth="8*" align="left"/>
44249 <colspec colwidth="6*" align="center"/>
44250 <colspec colwidth="6*" align="center"/>
44251 <colspec colwidth="6*" align="right"/>
44252 <tbody>
44253 <row>
44254 <entry><option>batch_id</option></entry>
44255 <entry>Use: <emphasis>pipe</emphasis></entry>
44256 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44257 <entry>Default: <emphasis>unset</emphasis></entry>
44258 </row>
44259 </tbody>
44260 </tgroup>
44261 </informaltable>
44262 <para>
44263 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
44264 </para>
44265 <para>
44266 <indexterm role="option">
44267 <primary><option>batch_max</option></primary>
44268 </indexterm>
44269 </para>
44270 <informaltable frame="all">
44271 <tgroup cols="4" colsep="0" rowsep="0">
44272 <colspec colwidth="8*" align="left"/>
44273 <colspec colwidth="6*" align="center"/>
44274 <colspec colwidth="6*" align="center"/>
44275 <colspec colwidth="6*" align="right"/>
44276 <tbody>
44277 <row>
44278 <entry><option>batch_max</option></entry>
44279 <entry>Use: <emphasis>pipe</emphasis></entry>
44280 <entry>Type: <emphasis>integer</emphasis></entry>
44281 <entry>Default: <emphasis>1</emphasis></entry>
44282 </row>
44283 </tbody>
44284 </tgroup>
44285 </informaltable>
44286 <para>
44287 This limits the number of addresses that can be handled in a single delivery.
44288 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
44289 </para>
44290 <para>
44291 <indexterm role="option">
44292 <primary><option>check_string</option></primary>
44293 </indexterm>
44294 </para>
44295 <informaltable frame="all">
44296 <tgroup cols="4" colsep="0" rowsep="0">
44297 <colspec colwidth="8*" align="left"/>
44298 <colspec colwidth="6*" align="center"/>
44299 <colspec colwidth="6*" align="center"/>
44300 <colspec colwidth="6*" align="right"/>
44301 <tbody>
44302 <row>
44303 <entry><option>check_string</option></entry>
44304 <entry>Use: <emphasis>pipe</emphasis></entry>
44305 <entry>Type: <emphasis>string</emphasis></entry>
44306 <entry>Default: <emphasis>unset</emphasis></entry>
44307 </row>
44308 </tbody>
44309 </tgroup>
44310 </informaltable>
44311 <para>
44312 As <command>pipe</command> writes the message, the start of each line is tested for matching
44313 <option>check_string</option>, and if it does, the initial matching characters are replaced
44314 by the contents of <option>escape_string</option>, provided both are set. The value of
44315 <option>check_string</option> is a literal string, not a regular expression, and the case of
44316 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
44317 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
44318 the SMTP escaping protocol. Any settings made in the configuration file are
44319 ignored.
44320 </para>
44321 <para>
44322 <indexterm role="option">
44323 <primary><option>command</option></primary>
44324 </indexterm>
44325 </para>
44326 <informaltable frame="all">
44327 <tgroup cols="4" colsep="0" rowsep="0">
44328 <colspec colwidth="8*" align="left"/>
44329 <colspec colwidth="6*" align="center"/>
44330 <colspec colwidth="6*" align="center"/>
44331 <colspec colwidth="6*" align="right"/>
44332 <tbody>
44333 <row>
44334 <entry><option>command</option></entry>
44335 <entry>Use: <emphasis>pipe</emphasis></entry>
44336 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44337 <entry>Default: <emphasis>unset</emphasis></entry>
44338 </row>
44339 </tbody>
44340 </tgroup>
44341 </informaltable>
44342 <para>
44343 This option need not be set when <command>pipe</command> is being used to deliver to pipes
44344 obtained directly from address redirections. In other cases, the option must be
44345 set, to provide a command to be run. It need not yield an absolute path (see
44346 the <option>path</option> option below). The command is split up into separate arguments by
44347 Exim, and each argument is separately expanded, as described in section
44348 <xref linkend="SECThowcommandrun"/> above.
44349 </para>
44350 <para>
44351 <indexterm role="option">
44352 <primary><option>environment</option></primary>
44353 </indexterm>
44354 </para>
44355 <informaltable frame="all">
44356 <tgroup cols="4" colsep="0" rowsep="0">
44357 <colspec colwidth="8*" align="left"/>
44358 <colspec colwidth="6*" align="center"/>
44359 <colspec colwidth="6*" align="center"/>
44360 <colspec colwidth="6*" align="right"/>
44361 <tbody>
44362 <row>
44363 <entry><option>environment</option></entry>
44364 <entry>Use: <emphasis>pipe</emphasis></entry>
44365 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44366 <entry>Default: <emphasis>unset</emphasis></entry>
44367 </row>
44368 </tbody>
44369 </tgroup>
44370 </informaltable>
44371 <para>
44372 <indexterm role="concept">
44373 <primary><command>pipe</command> transport</primary>
44374 <secondary>environment for command</secondary>
44375 </indexterm>
44376 <indexterm role="concept">
44377 <primary>environment</primary>
44378 <secondary><command>pipe</command> transport</secondary>
44379 </indexterm>
44380 This option is used to add additional variables to the environment in which the
44381 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
44382 a string which is expanded, and then interpreted as a colon-separated list of
44383 environment settings of the form &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;.
44384 </para>
44385 <para>
44386 <indexterm role="option">
44387 <primary><option>escape_string</option></primary>
44388 </indexterm>
44389 </para>
44390 <informaltable frame="all">
44391 <tgroup cols="4" colsep="0" rowsep="0">
44392 <colspec colwidth="8*" align="left"/>
44393 <colspec colwidth="6*" align="center"/>
44394 <colspec colwidth="6*" align="center"/>
44395 <colspec colwidth="6*" align="right"/>
44396 <tbody>
44397 <row>
44398 <entry><option>escape_string</option></entry>
44399 <entry>Use: <emphasis>pipe</emphasis></entry>
44400 <entry>Type: <emphasis>string</emphasis></entry>
44401 <entry>Default: <emphasis>unset</emphasis></entry>
44402 </row>
44403 </tbody>
44404 </tgroup>
44405 </informaltable>
44406 <para>
44407 See <option>check_string</option> above.
44408 </para>
44409 <para>
44410 <indexterm role="option">
44411 <primary><option>freeze_exec_fail</option></primary>
44412 </indexterm>
44413 </para>
44414 <informaltable frame="all">
44415 <tgroup cols="4" colsep="0" rowsep="0">
44416 <colspec colwidth="8*" align="left"/>
44417 <colspec colwidth="6*" align="center"/>
44418 <colspec colwidth="6*" align="center"/>
44419 <colspec colwidth="6*" align="right"/>
44420 <tbody>
44421 <row>
44422 <entry><option>freeze_exec_fail</option></entry>
44423 <entry>Use: <emphasis>pipe</emphasis></entry>
44424 <entry>Type: <emphasis>boolean</emphasis></entry>
44425 <entry>Default: <emphasis>false</emphasis></entry>
44426 </row>
44427 </tbody>
44428 </tgroup>
44429 </informaltable>
44430 <para>
44431 <indexterm role="concept">
44432 <primary>exec failure</primary>
44433 </indexterm>
44434 <indexterm role="concept">
44435 <primary>failure of exec</primary>
44436 </indexterm>
44437 <indexterm role="concept">
44438 <primary><command>pipe</command> transport</primary>
44439 <secondary>failure of exec</secondary>
44440 </indexterm>
44441 Failure to exec the command in a pipe transport is by default treated like
44442 any other failure while running the command. However, if <option>freeze_exec_fail</option>
44443 is set, failure to exec is treated specially, and causes the message to be
44444 frozen, whatever the setting of <option>ignore_status</option>.
44445 </para>
44446 <para>
44447 <indexterm role="option">
44448 <primary><option>freeze_signal</option></primary>
44449 </indexterm>
44450 </para>
44451 <informaltable frame="all">
44452 <tgroup cols="4" colsep="0" rowsep="0">
44453 <colspec colwidth="8*" align="left"/>
44454 <colspec colwidth="6*" align="center"/>
44455 <colspec colwidth="6*" align="center"/>
44456 <colspec colwidth="6*" align="right"/>
44457 <tbody>
44458 <row>
44459 <entry><option>freeze_signal</option></entry>
44460 <entry>Use: <emphasis>pipe</emphasis></entry>
44461 <entry>Type: <emphasis>boolean</emphasis></entry>
44462 <entry>Default: <emphasis>false</emphasis></entry>
44463 </row>
44464 </tbody>
44465 </tgroup>
44466 </informaltable>
44467 <para>
44468 <indexterm role="concept">
44469 <primary>signal exit</primary>
44470 </indexterm>
44471 <indexterm role="concept">
44472 <primary><command>pipe</command> transport</primary>
44473 <secondary>,</secondary>
44474 </indexterm>
44475 Normally if the process run by a command in a pipe transport exits on a signal,
44476 a bounce message is sent. If <option>freeze_signal</option> is set, the message will be
44477 frozen in Exim&#x2019;s queue instead.
44478 </para>
44479 <para>
44480 <indexterm role="option">
44481 <primary><option>force_command</option></primary>
44482 </indexterm>
44483 </para>
44484 <informaltable frame="all">
44485 <tgroup cols="4" colsep="0" rowsep="0">
44486 <colspec colwidth="8*" align="left"/>
44487 <colspec colwidth="6*" align="center"/>
44488 <colspec colwidth="6*" align="center"/>
44489 <colspec colwidth="6*" align="right"/>
44490 <tbody>
44491 <row>
44492 <entry><option>force_command</option></entry>
44493 <entry>Use: <emphasis>pipe</emphasis></entry>
44494 <entry>Type: <emphasis>boolean</emphasis></entry>
44495 <entry>Default: <emphasis>false</emphasis></entry>
44496 </row>
44497 </tbody>
44498 </tgroup>
44499 </informaltable>
44500 <para>
44501 <indexterm role="concept">
44502 <primary>force command</primary>
44503 </indexterm>
44504 <indexterm role="concept">
44505 <primary><command>pipe</command> transport</primary>
44506 <secondary>,</secondary>
44507 </indexterm>
44508 Normally when a router redirects an address directly to a pipe command
44509 the <option>command</option> option on the transport is ignored.  If <option>force_command</option>
44510 is set, the <option>command</option> option will used. This is especially
44511 useful for forcing a wrapper or additional argument to be added to the
44512 command. For example:
44513 </para>
44514 <literallayout class="monospaced">
44515 command = /usr/bin/remote_exec myhost -- $address_pipe
44516 force_command
44517 </literallayout>
44518 <para>
44519 Note that <varname>$address_pipe</varname> is handled specially in <option>command</option> when
44520 <option>force_command</option> is set, expanding out to the original argument vector as
44521 separate items, similarly to a Unix shell <literal>"$@"</literal> construct.
44522 </para>
44523 <para>
44524 <indexterm role="option">
44525 <primary><option>ignore_status</option></primary>
44526 </indexterm>
44527 </para>
44528 <informaltable frame="all">
44529 <tgroup cols="4" colsep="0" rowsep="0">
44530 <colspec colwidth="8*" align="left"/>
44531 <colspec colwidth="6*" align="center"/>
44532 <colspec colwidth="6*" align="center"/>
44533 <colspec colwidth="6*" align="right"/>
44534 <tbody>
44535 <row>
44536 <entry><option>ignore_status</option></entry>
44537 <entry>Use: <emphasis>pipe</emphasis></entry>
44538 <entry>Type: <emphasis>boolean</emphasis></entry>
44539 <entry>Default: <emphasis>false</emphasis></entry>
44540 </row>
44541 </tbody>
44542 </tgroup>
44543 </informaltable>
44544 <para>
44545 If this option is true, the status returned by the subprocess that is set up to
44546 run the command is ignored, and Exim behaves as if zero had been returned.
44547 Otherwise, a non-zero status or termination by signal causes an error return
44548 from the transport unless the status value is one of those listed in
44549 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
44550 </para>
44551 <para>
44552 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
44553 See the <option>timeout_defer</option> option for how timeouts are handled.
44554 </para>
44555 <para>
44556 <indexterm role="option">
44557 <primary><option>log_defer_output</option></primary>
44558 </indexterm>
44559 </para>
44560 <informaltable frame="all">
44561 <tgroup cols="4" colsep="0" rowsep="0">
44562 <colspec colwidth="8*" align="left"/>
44563 <colspec colwidth="6*" align="center"/>
44564 <colspec colwidth="6*" align="center"/>
44565 <colspec colwidth="6*" align="right"/>
44566 <tbody>
44567 <row>
44568 <entry><option>log_defer_output</option></entry>
44569 <entry>Use: <emphasis>pipe</emphasis></entry>
44570 <entry>Type: <emphasis>boolean</emphasis></entry>
44571 <entry>Default: <emphasis>false</emphasis></entry>
44572 </row>
44573 </tbody>
44574 </tgroup>
44575 </informaltable>
44576 <para>
44577 <indexterm role="concept">
44578 <primary><command>pipe</command> transport</primary>
44579 <secondary>logging output</secondary>
44580 </indexterm>
44581 If this option is set, and the status returned by the command is
44582 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
44583 and any output was produced on stdout or stderr, the first line of it is
44584 written to the main log.
44585 </para>
44586 <para>
44587 <indexterm role="option">
44588 <primary><option>log_fail_output</option></primary>
44589 </indexterm>
44590 </para>
44591 <informaltable frame="all">
44592 <tgroup cols="4" colsep="0" rowsep="0">
44593 <colspec colwidth="8*" align="left"/>
44594 <colspec colwidth="6*" align="center"/>
44595 <colspec colwidth="6*" align="center"/>
44596 <colspec colwidth="6*" align="right"/>
44597 <tbody>
44598 <row>
44599 <entry><option>log_fail_output</option></entry>
44600 <entry>Use: <emphasis>pipe</emphasis></entry>
44601 <entry>Type: <emphasis>boolean</emphasis></entry>
44602 <entry>Default: <emphasis>false</emphasis></entry>
44603 </row>
44604 </tbody>
44605 </tgroup>
44606 </informaltable>
44607 <para>
44608 If this option is set, and the command returns any output on stdout or
44609 stderr, and also ends with a return code that is neither zero nor one of
44610 the return codes listed in <option>temp_errors</option> (that is, the delivery
44611 failed), the first line of output is written to the main log. This
44612 option and <option>log_output</option> are mutually exclusive.  Only one of them may
44613 be set.
44614 </para>
44615 <para>
44616 <indexterm role="option">
44617 <primary><option>log_output</option></primary>
44618 </indexterm>
44619 </para>
44620 <informaltable frame="all">
44621 <tgroup cols="4" colsep="0" rowsep="0">
44622 <colspec colwidth="8*" align="left"/>
44623 <colspec colwidth="6*" align="center"/>
44624 <colspec colwidth="6*" align="center"/>
44625 <colspec colwidth="6*" align="right"/>
44626 <tbody>
44627 <row>
44628 <entry><option>log_output</option></entry>
44629 <entry>Use: <emphasis>pipe</emphasis></entry>
44630 <entry>Type: <emphasis>boolean</emphasis></entry>
44631 <entry>Default: <emphasis>false</emphasis></entry>
44632 </row>
44633 </tbody>
44634 </tgroup>
44635 </informaltable>
44636 <para>
44637 If this option is set and the command returns any output on stdout or
44638 stderr, the first line of output is written to the main log, whatever
44639 the return code. This option and <option>log_fail_output</option> are mutually
44640 exclusive. Only one of them may be set.
44641 </para>
44642 <para>
44643 <indexterm role="option">
44644 <primary><option>max_output</option></primary>
44645 </indexterm>
44646 </para>
44647 <informaltable frame="all">
44648 <tgroup cols="4" colsep="0" rowsep="0">
44649 <colspec colwidth="8*" align="left"/>
44650 <colspec colwidth="6*" align="center"/>
44651 <colspec colwidth="6*" align="center"/>
44652 <colspec colwidth="6*" align="right"/>
44653 <tbody>
44654 <row>
44655 <entry><option>max_output</option></entry>
44656 <entry>Use: <emphasis>pipe</emphasis></entry>
44657 <entry>Type: <emphasis>integer</emphasis></entry>
44658 <entry>Default: <emphasis>20K</emphasis></entry>
44659 </row>
44660 </tbody>
44661 </tgroup>
44662 </informaltable>
44663 <para>
44664 This specifies the maximum amount of output that the command may produce on its
44665 standard output and standard error file combined. If the limit is exceeded, the
44666 process running the command is killed. This is intended as a safety measure to
44667 catch runaway processes. The limit is applied independently of the settings of
44668 the options that control what is done with such output (for example,
44669 <option>return_output</option>). Because of buffering effects, the amount of output may
44670 exceed the limit by a small amount before Exim notices.
44671 </para>
44672 <para>
44673 <indexterm role="option">
44674 <primary><option>message_prefix</option></primary>
44675 </indexterm>
44676 </para>
44677 <informaltable frame="all">
44678 <tgroup cols="4" colsep="0" rowsep="0">
44679 <colspec colwidth="8*" align="left"/>
44680 <colspec colwidth="6*" align="center"/>
44681 <colspec colwidth="6*" align="center"/>
44682 <colspec colwidth="6*" align="right"/>
44683 <tbody>
44684 <row>
44685 <entry><option>message_prefix</option></entry>
44686 <entry>Use: <emphasis>pipe</emphasis></entry>
44687 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44688 <entry>Default: <emphasis>see below</emphasis></entry>
44689 </row>
44690 </tbody>
44691 </tgroup>
44692 </informaltable>
44693 <para>
44694 The string specified here is expanded and output at the start of every message.
44695 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
44696 </para>
44697 <literallayout class="monospaced">
44698 message_prefix = \
44699   From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
44700   ${tod_bsdinbox}\n
44701 </literallayout>
44702 <para>
44703 <indexterm role="concept">
44704 <primary>Cyrus</primary>
44705 </indexterm>
44706 <indexterm role="concept">
44707 <primary><option>tmail</option></primary>
44708 </indexterm>
44709 <indexterm role="concept">
44710 <primary><quote>From</quote> line</primary>
44711 </indexterm>
44712 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
44713 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
44714 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
44715 setting
44716 </para>
44717 <literallayout class="monospaced">
44718 message_prefix =
44719 </literallayout>
44720 <para>
44721 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
44722 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
44723 </para>
44724 <para>
44725 <indexterm role="option">
44726 <primary><option>message_suffix</option></primary>
44727 </indexterm>
44728 </para>
44729 <informaltable frame="all">
44730 <tgroup cols="4" colsep="0" rowsep="0">
44731 <colspec colwidth="8*" align="left"/>
44732 <colspec colwidth="6*" align="center"/>
44733 <colspec colwidth="6*" align="center"/>
44734 <colspec colwidth="6*" align="right"/>
44735 <tbody>
44736 <row>
44737 <entry><option>message_suffix</option></entry>
44738 <entry>Use: <emphasis>pipe</emphasis></entry>
44739 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44740 <entry>Default: <emphasis>see below</emphasis></entry>
44741 </row>
44742 </tbody>
44743 </tgroup>
44744 </informaltable>
44745 <para>
44746 The string specified here is expanded and output at the end of every message.
44747 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
44748 The suffix can be suppressed by setting
44749 </para>
44750 <literallayout class="monospaced">
44751 message_suffix =
44752 </literallayout>
44753 <para>
44754 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
44755 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
44756 </para>
44757 <para>
44758 <indexterm role="option">
44759 <primary><option>path</option></primary>
44760 </indexterm>
44761 </para>
44762 <informaltable frame="all">
44763 <tgroup cols="4" colsep="0" rowsep="0">
44764 <colspec colwidth="8*" align="left"/>
44765 <colspec colwidth="6*" align="center"/>
44766 <colspec colwidth="6*" align="center"/>
44767 <colspec colwidth="6*" align="right"/>
44768 <tbody>
44769 <row>
44770 <entry><option>path</option></entry>
44771 <entry>Use: <emphasis>pipe</emphasis></entry>
44772 <entry>Type: <emphasis>string</emphasis></entry>
44773 <entry>Default: <emphasis>see below</emphasis></entry>
44774 </row>
44775 </tbody>
44776 </tgroup>
44777 </informaltable>
44778 <para>
44779 This option specifies the string that is set up in the PATH environment
44780 variable of the subprocess. The default is:
44781 </para>
44782 <literallayout class="monospaced">
44783 /bin:/usr/bin
44784 </literallayout>
44785 <para>
44786 If the <option>command</option> option does not yield an absolute path name, the command is
44787 sought in the PATH directories, in the usual way. <emphasis role="bold">Warning</emphasis>: This does not
44788 apply to a command specified as a transport filter.
44789 </para>
44790 <para>
44791 <indexterm role="option">
44792 <primary><option>permit_coredump</option></primary>
44793 </indexterm>
44794 </para>
44795 <informaltable frame="all">
44796 <tgroup cols="4" colsep="0" rowsep="0">
44797 <colspec colwidth="8*" align="left"/>
44798 <colspec colwidth="6*" align="center"/>
44799 <colspec colwidth="6*" align="center"/>
44800 <colspec colwidth="6*" align="right"/>
44801 <tbody>
44802 <row>
44803 <entry><option>permit_coredump</option></entry>
44804 <entry>Use: <emphasis>pipe</emphasis></entry>
44805 <entry>Type: <emphasis>boolean</emphasis></entry>
44806 <entry>Default: <emphasis>false</emphasis></entry>
44807 </row>
44808 </tbody>
44809 </tgroup>
44810 </informaltable>
44811 <para>
44812 Normally Exim inhibits core-dumps during delivery.  If you have a need to get
44813 a core-dump of a pipe command, enable this command.  This enables core-dumps
44814 during delivery and affects both the Exim binary and the pipe command run.
44815 It is recommended that this option remain off unless and until you have a need
44816 for it and that this only be enabled when needed, as the risk of excessive
44817 resource consumption can be quite high.  Note also that Exim is typically
44818 installed as a setuid binary and most operating systems will inhibit coredumps
44819 of these by default, so further OS-specific action may be required.
44820 </para>
44821 <para>
44822 <indexterm role="option">
44823 <primary><option>pipe_as_creator</option></primary>
44824 </indexterm>
44825 </para>
44826 <informaltable frame="all">
44827 <tgroup cols="4" colsep="0" rowsep="0">
44828 <colspec colwidth="8*" align="left"/>
44829 <colspec colwidth="6*" align="center"/>
44830 <colspec colwidth="6*" align="center"/>
44831 <colspec colwidth="6*" align="right"/>
44832 <tbody>
44833 <row>
44834 <entry><option>pipe_as_creator</option></entry>
44835 <entry>Use: <emphasis>pipe</emphasis></entry>
44836 <entry>Type: <emphasis>boolean</emphasis></entry>
44837 <entry>Default: <emphasis>false</emphasis></entry>
44838 </row>
44839 </tbody>
44840 </tgroup>
44841 </informaltable>
44842 <para>
44843 <indexterm role="concept">
44844 <primary>uid (user id)</primary>
44845 <secondary>local delivery</secondary>
44846 </indexterm>
44847 If the generic <option>user</option> option is not set and this option is true, the delivery
44848 process is run under the uid that was in force when Exim was originally called
44849 to accept the message. If the group id is not otherwise set (via the generic
44850 <option>group</option> option), the gid that was in force when Exim was originally called to
44851 accept the message is used.
44852 </para>
44853 <para>
44854 <indexterm role="option">
44855 <primary><option>restrict_to_path</option></primary>
44856 </indexterm>
44857 </para>
44858 <informaltable frame="all">
44859 <tgroup cols="4" colsep="0" rowsep="0">
44860 <colspec colwidth="8*" align="left"/>
44861 <colspec colwidth="6*" align="center"/>
44862 <colspec colwidth="6*" align="center"/>
44863 <colspec colwidth="6*" align="right"/>
44864 <tbody>
44865 <row>
44866 <entry><option>restrict_to_path</option></entry>
44867 <entry>Use: <emphasis>pipe</emphasis></entry>
44868 <entry>Type: <emphasis>boolean</emphasis></entry>
44869 <entry>Default: <emphasis>false</emphasis></entry>
44870 </row>
44871 </tbody>
44872 </tgroup>
44873 </informaltable>
44874 <para>
44875 When this option is set, any command name not listed in <option>allow_commands</option> must
44876 contain no slashes. The command is searched for only in the directories listed
44877 in the <option>path</option> option. This option is intended for use in the case when a pipe
44878 command has been generated from a user&#x2019;s <filename>.forward</filename> file. This is usually
44879 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
44880 </para>
44881 <para>
44882 <indexterm role="option">
44883 <primary><option>return_fail_output</option></primary>
44884 </indexterm>
44885 </para>
44886 <informaltable frame="all">
44887 <tgroup cols="4" colsep="0" rowsep="0">
44888 <colspec colwidth="8*" align="left"/>
44889 <colspec colwidth="6*" align="center"/>
44890 <colspec colwidth="6*" align="center"/>
44891 <colspec colwidth="6*" align="right"/>
44892 <tbody>
44893 <row>
44894 <entry><option>return_fail_output</option></entry>
44895 <entry>Use: <emphasis>pipe</emphasis></entry>
44896 <entry>Type: <emphasis>boolean</emphasis></entry>
44897 <entry>Default: <emphasis>false</emphasis></entry>
44898 </row>
44899 </tbody>
44900 </tgroup>
44901 </informaltable>
44902 <para>
44903 If this option is true, and the command produced any output and ended with a
44904 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
44905 is, the delivery failed), the output is returned in the bounce message.
44906 However, if the message has a null sender (that is, it is itself a bounce
44907 message), output from the command is discarded. This option and
44908 <option>return_output</option> are mutually exclusive. Only one of them may be set.
44909 </para>
44910 <para>
44911 <indexterm role="option">
44912 <primary><option>return_output</option></primary>
44913 </indexterm>
44914 </para>
44915 <informaltable frame="all">
44916 <tgroup cols="4" colsep="0" rowsep="0">
44917 <colspec colwidth="8*" align="left"/>
44918 <colspec colwidth="6*" align="center"/>
44919 <colspec colwidth="6*" align="center"/>
44920 <colspec colwidth="6*" align="right"/>
44921 <tbody>
44922 <row>
44923 <entry><option>return_output</option></entry>
44924 <entry>Use: <emphasis>pipe</emphasis></entry>
44925 <entry>Type: <emphasis>boolean</emphasis></entry>
44926 <entry>Default: <emphasis>false</emphasis></entry>
44927 </row>
44928 </tbody>
44929 </tgroup>
44930 </informaltable>
44931 <para>
44932 If this option is true, and the command produced any output, the delivery is
44933 deemed to have failed whatever the return code from the command, and the output
44934 is returned in the bounce message. Otherwise, the output is just discarded.
44935 However, if the message has a null sender (that is, it is a bounce message),
44936 output from the command is always discarded, whatever the setting of this
44937 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
44938 of them may be set.
44939 </para>
44940 <para>
44941 <indexterm role="option">
44942 <primary><option>temp_errors</option></primary>
44943 </indexterm>
44944 </para>
44945 <informaltable frame="all">
44946 <tgroup cols="4" colsep="0" rowsep="0">
44947 <colspec colwidth="8*" align="left"/>
44948 <colspec colwidth="6*" align="center"/>
44949 <colspec colwidth="6*" align="center"/>
44950 <colspec colwidth="6*" align="right"/>
44951 <tbody>
44952 <row>
44953 <entry><option>temp_errors</option></entry>
44954 <entry>Use: <emphasis>pipe</emphasis></entry>
44955 <entry>Type: <emphasis>string list</emphasis></entry>
44956 <entry>Default: <emphasis>see below</emphasis></entry>
44957 </row>
44958 </tbody>
44959 </tgroup>
44960 </informaltable>
44961 <para>
44962 <indexterm role="concept">
44963 <primary><command>pipe</command> transport</primary>
44964 <secondary>temporary failure</secondary>
44965 </indexterm>
44966 This option contains either a colon-separated list of numbers, or a single
44967 asterisk. If <option>ignore_status</option> is false
44968 and <option>return_output</option> is not set,
44969 and the command exits with a non-zero return code, the failure is treated as
44970 temporary and the delivery is deferred if the return code matches one of the
44971 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
44972 codes are treated as permanent errors. The default setting contains the codes
44973 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
44974 compiled on a system that does not define these macros, it assumes values of 75
44975 and 73, respectively.
44976 </para>
44977 <para>
44978 <indexterm role="option">
44979 <primary><option>timeout</option></primary>
44980 </indexterm>
44981 </para>
44982 <informaltable frame="all">
44983 <tgroup cols="4" colsep="0" rowsep="0">
44984 <colspec colwidth="8*" align="left"/>
44985 <colspec colwidth="6*" align="center"/>
44986 <colspec colwidth="6*" align="center"/>
44987 <colspec colwidth="6*" align="right"/>
44988 <tbody>
44989 <row>
44990 <entry><option>timeout</option></entry>
44991 <entry>Use: <emphasis>pipe</emphasis></entry>
44992 <entry>Type: <emphasis>time</emphasis></entry>
44993 <entry>Default: <emphasis>1h</emphasis></entry>
44994 </row>
44995 </tbody>
44996 </tgroup>
44997 </informaltable>
44998 <para>
44999 If the command fails to complete within this time, it is killed. This normally
45000 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
45001 specifies no timeout. In order to ensure that any subprocesses created by the
45002 command are also killed, Exim makes the initial process a process group leader,
45003 and kills the whole process group on a timeout. However, this can be defeated
45004 if one of the processes starts a new process group.
45005 </para>
45006 <para>
45007 <indexterm role="option">
45008 <primary><option>timeout_defer</option></primary>
45009 </indexterm>
45010 </para>
45011 <informaltable frame="all">
45012 <tgroup cols="4" colsep="0" rowsep="0">
45013 <colspec colwidth="8*" align="left"/>
45014 <colspec colwidth="6*" align="center"/>
45015 <colspec colwidth="6*" align="center"/>
45016 <colspec colwidth="6*" align="right"/>
45017 <tbody>
45018 <row>
45019 <entry><option>timeout_defer</option></entry>
45020 <entry>Use: <emphasis>pipe</emphasis></entry>
45021 <entry>Type: <emphasis>boolean</emphasis></entry>
45022 <entry>Default: <emphasis>false</emphasis></entry>
45023 </row>
45024 </tbody>
45025 </tgroup>
45026 </informaltable>
45027 <para>
45028 A timeout in a <command>pipe</command> transport, either in the command that the transport
45029 runs, or in a transport filter that is associated with it, is by default
45030 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
45031 is set true, both kinds of timeout become temporary errors, causing the
45032 delivery to be deferred.
45033 </para>
45034 <para>
45035 <indexterm role="option">
45036 <primary><option>umask</option></primary>
45037 </indexterm>
45038 </para>
45039 <informaltable frame="all">
45040 <tgroup cols="4" colsep="0" rowsep="0">
45041 <colspec colwidth="8*" align="left"/>
45042 <colspec colwidth="6*" align="center"/>
45043 <colspec colwidth="6*" align="center"/>
45044 <colspec colwidth="6*" align="right"/>
45045 <tbody>
45046 <row>
45047 <entry><option>umask</option></entry>
45048 <entry>Use: <emphasis>pipe</emphasis></entry>
45049 <entry>Type: <emphasis>octal integer</emphasis></entry>
45050 <entry>Default: <emphasis>022</emphasis></entry>
45051 </row>
45052 </tbody>
45053 </tgroup>
45054 </informaltable>
45055 <para>
45056 This specifies the umask setting for the subprocess that runs the command.
45057 </para>
45058 <para>
45059 <indexterm role="option">
45060 <primary><option>use_bsmtp</option></primary>
45061 </indexterm>
45062 </para>
45063 <informaltable frame="all">
45064 <tgroup cols="4" colsep="0" rowsep="0">
45065 <colspec colwidth="8*" align="left"/>
45066 <colspec colwidth="6*" align="center"/>
45067 <colspec colwidth="6*" align="center"/>
45068 <colspec colwidth="6*" align="right"/>
45069 <tbody>
45070 <row>
45071 <entry><option>use_bsmtp</option></entry>
45072 <entry>Use: <emphasis>pipe</emphasis></entry>
45073 <entry>Type: <emphasis>boolean</emphasis></entry>
45074 <entry>Default: <emphasis>false</emphasis></entry>
45075 </row>
45076 </tbody>
45077 </tgroup>
45078 </informaltable>
45079 <para>
45080 <indexterm role="concept">
45081 <primary>envelope sender</primary>
45082 </indexterm>
45083 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
45084 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
45085 commands. If you want to include a leading HELO command with such messages,
45086 you can do so by setting the <option>message_prefix</option> option. See section
45087 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
45088 </para>
45089 <para>
45090 <indexterm role="option">
45091 <primary><option>use_classresources</option></primary>
45092 </indexterm>
45093 </para>
45094 <informaltable frame="all">
45095 <tgroup cols="4" colsep="0" rowsep="0">
45096 <colspec colwidth="8*" align="left"/>
45097 <colspec colwidth="6*" align="center"/>
45098 <colspec colwidth="6*" align="center"/>
45099 <colspec colwidth="6*" align="right"/>
45100 <tbody>
45101 <row>
45102 <entry><option>use_classresources</option></entry>
45103 <entry>Use: <emphasis>pipe</emphasis></entry>
45104 <entry>Type: <emphasis>boolean</emphasis></entry>
45105 <entry>Default: <emphasis>false</emphasis></entry>
45106 </row>
45107 </tbody>
45108 </tgroup>
45109 </informaltable>
45110 <para>
45111 <indexterm role="concept">
45112 <primary>class resources (BSD)</primary>
45113 </indexterm>
45114 This option is available only when Exim is running on FreeBSD, NetBSD, or
45115 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
45116 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
45117 limits for the uid under which the pipe is to run are obtained from the login
45118 class database.
45119 </para>
45120 <para>
45121 <indexterm role="option">
45122 <primary><option>use_crlf</option></primary>
45123 </indexterm>
45124 </para>
45125 <informaltable frame="all">
45126 <tgroup cols="4" colsep="0" rowsep="0">
45127 <colspec colwidth="8*" align="left"/>
45128 <colspec colwidth="6*" align="center"/>
45129 <colspec colwidth="6*" align="center"/>
45130 <colspec colwidth="6*" align="right"/>
45131 <tbody>
45132 <row>
45133 <entry><option>use_crlf</option></entry>
45134 <entry>Use: <emphasis>pipe</emphasis></entry>
45135 <entry>Type: <emphasis>boolean</emphasis></entry>
45136 <entry>Default: <emphasis>false</emphasis></entry>
45137 </row>
45138 </tbody>
45139 </tgroup>
45140 </informaltable>
45141 <para>
45142 <indexterm role="concept">
45143 <primary>carriage return</primary>
45144 </indexterm>
45145 <indexterm role="concept">
45146 <primary>linefeed</primary>
45147 </indexterm>
45148 This option causes lines to be terminated with the two-character CRLF sequence
45149 (carriage return, linefeed) instead of just a linefeed character. In the case
45150 of batched SMTP, the byte sequence written to the pipe is then an exact image
45151 of what would be sent down a real SMTP connection.
45152 </para>
45153 <para>
45154 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
45155 written verbatim, so must contain their own carriage return characters if these
45156 are needed. When <option>use_bsmtp</option> is not set, the default values for both
45157 <option>message_prefix</option> and <option>message_suffix</option> end with a single linefeed, so their
45158 values must be changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
45159 </para>
45160 <para>
45161 <indexterm role="option">
45162 <primary><option>use_shell</option></primary>
45163 </indexterm>
45164 </para>
45165 <informaltable frame="all">
45166 <tgroup cols="4" colsep="0" rowsep="0">
45167 <colspec colwidth="8*" align="left"/>
45168 <colspec colwidth="6*" align="center"/>
45169 <colspec colwidth="6*" align="center"/>
45170 <colspec colwidth="6*" align="right"/>
45171 <tbody>
45172 <row>
45173 <entry><option>use_shell</option></entry>
45174 <entry>Use: <emphasis>pipe</emphasis></entry>
45175 <entry>Type: <emphasis>boolean</emphasis></entry>
45176 <entry>Default: <emphasis>false</emphasis></entry>
45177 </row>
45178 </tbody>
45179 </tgroup>
45180 </informaltable>
45181 <para>
45182 <indexterm role="variable">
45183 <primary><varname>$pipe_addresses</varname></primary>
45184 </indexterm>
45185 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
45186 instead of being run directly from the transport, as described in section
45187 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
45188 where the command is expected to be run under a shell and cannot easily be
45189 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
45190 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
45191 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
45192 its <option>-c</option> option.
45193 </para>
45194 </section>
45195 <section id="SECID143">
45196 <title>Using an external local delivery agent</title>
45197 <para>
45198 <indexterm role="concept">
45199 <primary>local delivery</primary>
45200 <secondary>using an external agent</secondary>
45201 </indexterm>
45202 <indexterm role="concept">
45203 <primary><emphasis>procmail</emphasis></primary>
45204 </indexterm>
45205 <indexterm role="concept">
45206 <primary>external local delivery</primary>
45207 </indexterm>
45208 <indexterm role="concept">
45209 <primary>delivery</primary>
45210 <secondary><emphasis>procmail</emphasis></secondary>
45211 </indexterm>
45212 <indexterm role="concept">
45213 <primary>delivery</primary>
45214 <secondary>by external agent</secondary>
45215 </indexterm>
45216 The <command>pipe</command> transport can be used to pass all messages that require local
45217 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
45218 this, care must be taken to ensure that the pipe is run under an appropriate
45219 uid and gid. In some configurations one wants this to be a uid that is trusted
45220 by the delivery agent to supply the correct sender of the message. It may be
45221 necessary to recompile or reconfigure the delivery agent so that it trusts an
45222 appropriate user. The following is an example transport and router
45223 configuration for <option>procmail</option>:
45224 </para>
45225 <literallayout class="monospaced">
45226 # transport
45227 procmail_pipe:
45228   driver = pipe
45229   command = /usr/local/bin/procmail -d $local_part
45230   return_path_add
45231   delivery_date_add
45232   envelope_to_add
45233   check_string = "From "
45234   escape_string = "&gt;From "
45235   umask = 077
45236   user = $local_part
45237   group = mail
45238
45239 # router
45240 procmail:
45241   driver = accept
45242   check_local_user
45243   transport = procmail_pipe
45244 </literallayout>
45245 <para>
45246 In this example, the pipe is run as the local user, but with the group set to
45247 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
45248 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
45249 user to supply a correct sender address. If you do not specify either a
45250 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
45251 home directory is the user&#x2019;s home directory by default.
45252 </para>
45253 <para>
45254 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
45255 </para>
45256 <literallayout class="monospaced">
45257 IFS=" "
45258 </literallayout>
45259 <para>
45260 as shown in some <option>procmail</option> documentation, because Exim does not by default
45261 use a shell to run pipe commands.
45262 </para>
45263 <para>
45264 <indexterm role="concept">
45265 <primary>Cyrus</primary>
45266 </indexterm>
45267 The next example shows a transport and a router for a system where local
45268 deliveries are handled by the Cyrus IMAP server.
45269 </para>
45270 <literallayout class="monospaced">
45271 # transport
45272 local_delivery_cyrus:
45273   driver = pipe
45274   command = /usr/cyrus/bin/deliver \
45275             -m ${substr_1:$local_part_suffix} -- $local_part
45276   user = cyrus
45277   group = mail
45278   return_output
45279   log_output
45280   message_prefix =
45281   message_suffix =
45282
45283 # router
45284 local_user_cyrus:
45285   driver = accept
45286   check_local_user
45287   local_part_suffix = .*
45288   transport = local_delivery_cyrus
45289 </literallayout>
45290 <para>
45291 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
45292 <option>return_output</option> to cause any text written by Cyrus to be returned to the
45293 sender.
45294 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
45295 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
45296 </para>
45297 </section>
45298 </chapter>
45299
45300 <chapter id="CHAPsmtptrans">
45301 <title>The smtp transport</title>
45302 <para>
45303 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
45304 <primary>transports</primary>
45305 <secondary><command>smtp</command></secondary>
45306 </indexterm>
45307 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
45308 <primary><command>smtp</command> transport</primary>
45309 </indexterm>
45310 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
45311 or LMTP protocol. The list of hosts to try can either be taken from the address
45312 that is being processed (having been set up by the router), or specified
45313 explicitly for the transport. Timeout and retry processing (see chapter
45314 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
45315 </para>
45316 <section id="SECID144">
45317 <title>Multiple messages on a single connection</title>
45318 <para>
45319 The sending of multiple messages over a single TCP/IP connection can arise in
45320 two ways:
45321 </para>
45322 <itemizedlist>
45323 <listitem>
45324 <para>
45325 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
45326 routed to the same host, more than one copy of the message has to be sent to
45327 that host. In this situation, multiple copies may be sent in a single run of
45328 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
45329 does when it has too many addresses to send in one message also depends on the
45330 value of the global <option>remote_max_parallel</option> option. Details are given in
45331 section <xref linkend="SECToutSMTPTCP"/>.)
45332 </para>
45333 </listitem>
45334 <listitem>
45335 <para>
45336 <indexterm role="concept">
45337 <primary>hints database</primary>
45338 <secondary>remembering routing</secondary>
45339 </indexterm>
45340 When a message has been successfully delivered over a TCP/IP connection, Exim
45341 looks in its hints database to see if there are any other messages awaiting a
45342 connection to the same host. If there are, a new delivery process is started
45343 for one of them, and the current TCP/IP connection is passed on to it. The new
45344 process may in turn send multiple copies and possibly create yet another
45345 process.
45346 </para>
45347 </listitem>
45348 </itemizedlist>
45349 <para>
45350 For each copy sent over the same TCP/IP connection, a sequence counter is
45351 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
45352 no further messages are sent over that connection.
45353 </para>
45354 </section>
45355 <section id="SECID145">
45356 <title>Use of the $host and $host_address variables</title>
45357 <para>
45358 <indexterm role="variable">
45359 <primary><varname>$host</varname></primary>
45360 </indexterm>
45361 <indexterm role="variable">
45362 <primary><varname>$host_address</varname></primary>
45363 </indexterm>
45364 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
45365 <varname>$host_address</varname> are the name and IP address of the first host on the host list
45366 passed by the router. However, when the transport is about to connect to a
45367 specific host, and while it is connected to that host, <varname>$host</varname> and
45368 <varname>$host_address</varname> are set to the values for that host. These are the values
45369 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
45370 <option>serialize_hosts</option>, and the various TLS options are expanded.
45371 </para>
45372 </section>
45373 <section id="usecippeer">
45374 <title>Use of $tls_cipher and $tls_peerdn</title>
45375 <para>
45376 <indexterm role="variable">
45377 <primary><varname>$tls_bits</varname></primary>
45378 </indexterm>
45379 <indexterm role="variable">
45380 <primary><varname>$tls_cipher</varname></primary>
45381 </indexterm>
45382 <indexterm role="variable">
45383 <primary><varname>$tls_peerdn</varname></primary>
45384 </indexterm>
45385 <indexterm role="variable">
45386 <primary><varname>$tls_sni</varname></primary>
45387 </indexterm>
45388 At the start of a run of the <command>smtp</command> transport, the values of <varname>$tls_bits</varname>,
45389 <varname>$tls_cipher</varname>, <varname>$tls_peerdn</varname> and <varname>$tls_sni</varname>
45390 are the values that were set when the message was received.
45391 These are the values that are used for options that are expanded before any
45392 SMTP connections are made. Just before each connection is made, these four
45393 variables are emptied. If TLS is subsequently started, they are set to the
45394 appropriate values for the outgoing connection, and these are the values that
45395 are in force when any authenticators are run and when the
45396 <option>authenticated_sender</option> option is expanded.
45397 </para>
45398 <para>
45399 These variables are deprecated in favour of <varname>$tls_in_cipher</varname> et. al.
45400 and will be removed in a future release.
45401 </para>
45402 </section>
45403 <section id="SECID146">
45404 <title>Private options for smtp</title>
45405 <para>
45406 <indexterm role="concept">
45407 <primary>options</primary>
45408 <secondary><command>smtp</command> transport</secondary>
45409 </indexterm>
45410 The private options of the <command>smtp</command> transport are as follows:
45411 </para>
45412 <para>
45413 <indexterm role="option">
45414 <primary><option>address_retry_include_sender</option></primary>
45415 </indexterm>
45416 </para>
45417 <informaltable frame="all">
45418 <tgroup cols="4" colsep="0" rowsep="0">
45419 <colspec colwidth="8*" align="left"/>
45420 <colspec colwidth="6*" align="center"/>
45421 <colspec colwidth="6*" align="center"/>
45422 <colspec colwidth="6*" align="right"/>
45423 <tbody>
45424 <row>
45425 <entry><option>address_retry_include_sender</option></entry>
45426 <entry>Use: <emphasis>smtp</emphasis></entry>
45427 <entry>Type: <emphasis>boolean</emphasis></entry>
45428 <entry>Default: <emphasis>true</emphasis></entry>
45429 </row>
45430 </tbody>
45431 </tgroup>
45432 </informaltable>
45433 <para>
45434 <indexterm role="concept">
45435 <primary>4<emphasis>xx</emphasis> responses</primary>
45436 <secondary>retrying after</secondary>
45437 </indexterm>
45438 When an address is delayed because of a 4<emphasis>xx</emphasis> response to a RCPT command, it
45439 is the combination of sender and recipient that is delayed in subsequent queue
45440 runs until the retry time is reached. You can delay the recipient without
45441 reference to the sender (which is what earlier versions of Exim did), by
45442 setting <option>address_retry_include_sender</option> false. However, this can lead to
45443 problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT commands.
45444 </para>
45445 <para>
45446 <indexterm role="option">
45447 <primary><option>allow_localhost</option></primary>
45448 </indexterm>
45449 </para>
45450 <informaltable frame="all">
45451 <tgroup cols="4" colsep="0" rowsep="0">
45452 <colspec colwidth="8*" align="left"/>
45453 <colspec colwidth="6*" align="center"/>
45454 <colspec colwidth="6*" align="center"/>
45455 <colspec colwidth="6*" align="right"/>
45456 <tbody>
45457 <row>
45458 <entry><option>allow_localhost</option></entry>
45459 <entry>Use: <emphasis>smtp</emphasis></entry>
45460 <entry>Type: <emphasis>boolean</emphasis></entry>
45461 <entry>Default: <emphasis>false</emphasis></entry>
45462 </row>
45463 </tbody>
45464 </tgroup>
45465 </informaltable>
45466 <para>
45467 <indexterm role="concept">
45468 <primary>local host</primary>
45469 <secondary>sending to</secondary>
45470 </indexterm>
45471 <indexterm role="concept">
45472 <primary>fallback</primary>
45473 <secondary>hosts specified on transport</secondary>
45474 </indexterm>
45475 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
45476 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
45477 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
45478 the delivery anyway. This should be used only in special cases when the
45479 configuration ensures that no looping will result (for example, a differently
45480 configured Exim is listening on the port to which the message is sent).
45481 </para>
45482 <para>
45483 <indexterm role="option">
45484 <primary><option>authenticated_sender</option></primary>
45485 </indexterm>
45486 </para>
45487 <informaltable frame="all">
45488 <tgroup cols="4" colsep="0" rowsep="0">
45489 <colspec colwidth="8*" align="left"/>
45490 <colspec colwidth="6*" align="center"/>
45491 <colspec colwidth="6*" align="center"/>
45492 <colspec colwidth="6*" align="right"/>
45493 <tbody>
45494 <row>
45495 <entry><option>authenticated_sender</option></entry>
45496 <entry>Use: <emphasis>smtp</emphasis></entry>
45497 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45498 <entry>Default: <emphasis>unset</emphasis></entry>
45499 </row>
45500 </tbody>
45501 </tgroup>
45502 </informaltable>
45503 <para>
45504 <indexterm role="concept">
45505 <primary>Cyrus</primary>
45506 </indexterm>
45507 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
45508 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
45509 overriding any existing authenticated sender value. If the string expansion is
45510 forced to fail, the option is ignored. Other expansion failures cause delivery
45511 to be deferred. If the result of expansion is an empty string, that is also
45512 ignored.
45513 </para>
45514 <para>
45515 The expansion happens after the outgoing connection has been made and TLS
45516 started, if required. This means that the <varname>$host</varname>, <varname>$host_address</varname>,
45517 <varname>$tls_out_cipher</varname>, and <varname>$tls_out_peerdn</varname> variables are set according to the
45518 particular connection.
45519 </para>
45520 <para>
45521 If the SMTP session is not authenticated, the expansion of
45522 <option>authenticated_sender</option> still happens (and can cause the delivery to be
45523 deferred if it fails), but no AUTH= item is added to MAIL commands
45524 unless <option>authenticated_sender_force</option> is true.
45525 </para>
45526 <para>
45527 This option allows you to use the <command>smtp</command> transport in LMTP mode to
45528 deliver mail to Cyrus IMAP and provide the proper local part as the
45529 <quote>authenticated sender</quote>, via a setting such as:
45530 </para>
45531 <literallayout class="monospaced">
45532 authenticated_sender = $local_part
45533 </literallayout>
45534 <para>
45535 This removes the need for IMAP subfolders to be assigned special ACLs to
45536 allow direct delivery to those subfolders.
45537 </para>
45538 <para>
45539 Because of expected uses such as that just described for Cyrus (when no
45540 domain is involved), there is no checking on the syntax of the provided
45541 value.
45542 </para>
45543 <para>
45544 <indexterm role="option">
45545 <primary><option>authenticated_sender_force</option></primary>
45546 </indexterm>
45547 </para>
45548 <informaltable frame="all">
45549 <tgroup cols="4" colsep="0" rowsep="0">
45550 <colspec colwidth="8*" align="left"/>
45551 <colspec colwidth="6*" align="center"/>
45552 <colspec colwidth="6*" align="center"/>
45553 <colspec colwidth="6*" align="right"/>
45554 <tbody>
45555 <row>
45556 <entry><option>authenticated_sender_force</option></entry>
45557 <entry>Use: <emphasis>smtp</emphasis></entry>
45558 <entry>Type: <emphasis>boolean</emphasis></entry>
45559 <entry>Default: <emphasis>false</emphasis></entry>
45560 </row>
45561 </tbody>
45562 </tgroup>
45563 </informaltable>
45564 <para>
45565 If this option is set true, the <option>authenticated_sender</option> option&#x2019;s value
45566 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
45567 authenticated as a client.
45568 </para>
45569 <para>
45570 <indexterm role="option">
45571 <primary><option>command_timeout</option></primary>
45572 </indexterm>
45573 </para>
45574 <informaltable frame="all">
45575 <tgroup cols="4" colsep="0" rowsep="0">
45576 <colspec colwidth="8*" align="left"/>
45577 <colspec colwidth="6*" align="center"/>
45578 <colspec colwidth="6*" align="center"/>
45579 <colspec colwidth="6*" align="right"/>
45580 <tbody>
45581 <row>
45582 <entry><option>command_timeout</option></entry>
45583 <entry>Use: <emphasis>smtp</emphasis></entry>
45584 <entry>Type: <emphasis>time</emphasis></entry>
45585 <entry>Default: <emphasis>5m</emphasis></entry>
45586 </row>
45587 </tbody>
45588 </tgroup>
45589 </informaltable>
45590 <para>
45591 This sets a timeout for receiving a response to an SMTP command that has been
45592 sent out. It is also used when waiting for the initial banner line from the
45593 remote host. Its value must not be zero.
45594 </para>
45595 <para>
45596 <indexterm role="option">
45597 <primary><option>connect_timeout</option></primary>
45598 </indexterm>
45599 </para>
45600 <informaltable frame="all">
45601 <tgroup cols="4" colsep="0" rowsep="0">
45602 <colspec colwidth="8*" align="left"/>
45603 <colspec colwidth="6*" align="center"/>
45604 <colspec colwidth="6*" align="center"/>
45605 <colspec colwidth="6*" align="right"/>
45606 <tbody>
45607 <row>
45608 <entry><option>connect_timeout</option></entry>
45609 <entry>Use: <emphasis>smtp</emphasis></entry>
45610 <entry>Type: <emphasis>time</emphasis></entry>
45611 <entry>Default: <emphasis>5m</emphasis></entry>
45612 </row>
45613 </tbody>
45614 </tgroup>
45615 </informaltable>
45616 <para>
45617 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
45618 to a remote host. A setting of zero allows the system timeout (typically
45619 several minutes) to act. To have any effect, the value of this option must be
45620 less than the system timeout. However, it has been observed that on some
45621 systems there is no system timeout, which is why the default value for this
45622 option is 5 minutes, a value recommended by RFC 1123.
45623 </para>
45624 <para>
45625 <indexterm role="option">
45626 <primary><option>connection_max_messages</option></primary>
45627 </indexterm>
45628 </para>
45629 <informaltable frame="all">
45630 <tgroup cols="4" colsep="0" rowsep="0">
45631 <colspec colwidth="8*" align="left"/>
45632 <colspec colwidth="6*" align="center"/>
45633 <colspec colwidth="6*" align="center"/>
45634 <colspec colwidth="6*" align="right"/>
45635 <tbody>
45636 <row>
45637 <entry><option>connection_max_messages</option></entry>
45638 <entry>Use: <emphasis>smtp</emphasis></entry>
45639 <entry>Type: <emphasis>integer</emphasis></entry>
45640 <entry>Default: <emphasis>500</emphasis></entry>
45641 </row>
45642 </tbody>
45643 </tgroup>
45644 </informaltable>
45645 <para>
45646 <indexterm role="concept">
45647 <primary>SMTP</primary>
45648 <secondary>passed connection</secondary>
45649 </indexterm>
45650 <indexterm role="concept">
45651 <primary>SMTP</primary>
45652 <secondary>multiple deliveries</secondary>
45653 </indexterm>
45654 <indexterm role="concept">
45655 <primary>multiple SMTP deliveries</primary>
45656 </indexterm>
45657 This controls the maximum number of separate message deliveries that are sent
45658 over a single TCP/IP connection. If the value is zero, there is no limit.
45659 For testing purposes, this value can be overridden by the <option>-oB</option> command line
45660 option.
45661 </para>
45662 <para>
45663 <indexterm role="option">
45664 <primary><option>data_timeout</option></primary>
45665 </indexterm>
45666 </para>
45667 <informaltable frame="all">
45668 <tgroup cols="4" colsep="0" rowsep="0">
45669 <colspec colwidth="8*" align="left"/>
45670 <colspec colwidth="6*" align="center"/>
45671 <colspec colwidth="6*" align="center"/>
45672 <colspec colwidth="6*" align="right"/>
45673 <tbody>
45674 <row>
45675 <entry><option>data_timeout</option></entry>
45676 <entry>Use: <emphasis>smtp</emphasis></entry>
45677 <entry>Type: <emphasis>time</emphasis></entry>
45678 <entry>Default: <emphasis>5m</emphasis></entry>
45679 </row>
45680 </tbody>
45681 </tgroup>
45682 </informaltable>
45683 <para>
45684 This sets a timeout for the transmission of each block in the data portion of
45685 the message. As a result, the overall timeout for a message depends on the size
45686 of the message. Its value must not be zero. See also <option>final_timeout</option>.
45687 </para>
45688 <para>
45689 <indexterm role="option">
45690 <primary><option>dkim_domain</option></primary>
45691 </indexterm>
45692 </para>
45693 <informaltable frame="all">
45694 <tgroup cols="4" colsep="0" rowsep="0">
45695 <colspec colwidth="8*" align="left"/>
45696 <colspec colwidth="6*" align="center"/>
45697 <colspec colwidth="6*" align="center"/>
45698 <colspec colwidth="6*" align="right"/>
45699 <tbody>
45700 <row>
45701 <entry><option>dkim_domain</option></entry>
45702 <entry>Use: <emphasis>smtp</emphasis></entry>
45703 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45704 <entry>Default: <emphasis>unset</emphasis></entry>
45705 </row>
45706 </tbody>
45707 </tgroup>
45708 </informaltable>
45709 <para>
45710 <indexterm role="option">
45711 <primary><option>dkim_selector</option></primary>
45712 </indexterm>
45713 </para>
45714 <informaltable frame="all">
45715 <tgroup cols="4" colsep="0" rowsep="0">
45716 <colspec colwidth="8*" align="left"/>
45717 <colspec colwidth="6*" align="center"/>
45718 <colspec colwidth="6*" align="center"/>
45719 <colspec colwidth="6*" align="right"/>
45720 <tbody>
45721 <row>
45722 <entry><option>dkim_selector</option></entry>
45723 <entry>Use: <emphasis>smtp</emphasis></entry>
45724 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45725 <entry>Default: <emphasis>unset</emphasis></entry>
45726 </row>
45727 </tbody>
45728 </tgroup>
45729 </informaltable>
45730 <para>
45731 <indexterm role="option">
45732 <primary><option>dkim_private_key</option></primary>
45733 </indexterm>
45734 </para>
45735 <informaltable frame="all">
45736 <tgroup cols="4" colsep="0" rowsep="0">
45737 <colspec colwidth="8*" align="left"/>
45738 <colspec colwidth="6*" align="center"/>
45739 <colspec colwidth="6*" align="center"/>
45740 <colspec colwidth="6*" align="right"/>
45741 <tbody>
45742 <row>
45743 <entry><option>dkim_private_key</option></entry>
45744 <entry>Use: <emphasis>smtp</emphasis></entry>
45745 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45746 <entry>Default: <emphasis>unset</emphasis></entry>
45747 </row>
45748 </tbody>
45749 </tgroup>
45750 </informaltable>
45751 <para>
45752 <indexterm role="option">
45753 <primary><option>dkim_canon</option></primary>
45754 </indexterm>
45755 </para>
45756 <informaltable frame="all">
45757 <tgroup cols="4" colsep="0" rowsep="0">
45758 <colspec colwidth="8*" align="left"/>
45759 <colspec colwidth="6*" align="center"/>
45760 <colspec colwidth="6*" align="center"/>
45761 <colspec colwidth="6*" align="right"/>
45762 <tbody>
45763 <row>
45764 <entry><option>dkim_canon</option></entry>
45765 <entry>Use: <emphasis>smtp</emphasis></entry>
45766 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45767 <entry>Default: <emphasis>unset</emphasis></entry>
45768 </row>
45769 </tbody>
45770 </tgroup>
45771 </informaltable>
45772 <para>
45773 <indexterm role="option">
45774 <primary><option>dkim_strict</option></primary>
45775 </indexterm>
45776 </para>
45777 <informaltable frame="all">
45778 <tgroup cols="4" colsep="0" rowsep="0">
45779 <colspec colwidth="8*" align="left"/>
45780 <colspec colwidth="6*" align="center"/>
45781 <colspec colwidth="6*" align="center"/>
45782 <colspec colwidth="6*" align="right"/>
45783 <tbody>
45784 <row>
45785 <entry><option>dkim_strict</option></entry>
45786 <entry>Use: <emphasis>smtp</emphasis></entry>
45787 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45788 <entry>Default: <emphasis>unset</emphasis></entry>
45789 </row>
45790 </tbody>
45791 </tgroup>
45792 </informaltable>
45793 <para>
45794 <indexterm role="option">
45795 <primary><option>dkim_sign_headers</option></primary>
45796 </indexterm>
45797 </para>
45798 <informaltable frame="all">
45799 <tgroup cols="4" colsep="0" rowsep="0">
45800 <colspec colwidth="8*" align="left"/>
45801 <colspec colwidth="6*" align="center"/>
45802 <colspec colwidth="6*" align="center"/>
45803 <colspec colwidth="6*" align="right"/>
45804 <tbody>
45805 <row>
45806 <entry><option>dkim_sign_headers</option></entry>
45807 <entry>Use: <emphasis>smtp</emphasis></entry>
45808 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45809 <entry>Default: <emphasis>unset</emphasis></entry>
45810 </row>
45811 </tbody>
45812 </tgroup>
45813 </informaltable>
45814 <para>
45815 DKIM signing options.  For details see <xref linkend="SECDKIMSIGN"/>.
45816 </para>
45817 <para>
45818 <indexterm role="option">
45819 <primary><option>delay_after_cutoff</option></primary>
45820 </indexterm>
45821 </para>
45822 <informaltable frame="all">
45823 <tgroup cols="4" colsep="0" rowsep="0">
45824 <colspec colwidth="8*" align="left"/>
45825 <colspec colwidth="6*" align="center"/>
45826 <colspec colwidth="6*" align="center"/>
45827 <colspec colwidth="6*" align="right"/>
45828 <tbody>
45829 <row>
45830 <entry><option>delay_after_cutoff</option></entry>
45831 <entry>Use: <emphasis>smtp</emphasis></entry>
45832 <entry>Type: <emphasis>boolean</emphasis></entry>
45833 <entry>Default: <emphasis>true</emphasis></entry>
45834 </row>
45835 </tbody>
45836 </tgroup>
45837 </informaltable>
45838 <para>
45839 This option controls what happens when all remote IP addresses for a given
45840 domain have been inaccessible for so long that they have passed their retry
45841 cutoff times.
45842 </para>
45843 <para>
45844 In the default state, if the next retry time has not been reached for any of
45845 them, the address is bounced without trying any deliveries. In other words,
45846 Exim delays retrying an IP address after the final cutoff time until a new
45847 retry time is reached, and can therefore bounce an address without ever trying
45848 a delivery, when machines have been down for a long time. Some people are
45849 unhappy at this prospect, so...
45850 </para>
45851 <para>
45852 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
45853 addresses are past their final cutoff time, Exim tries to deliver to those
45854 IP addresses that have not been tried since the message arrived. If there are
45855 none, of if they all fail, the address is bounced. In other words, it does not
45856 delay when a new message arrives, but immediately tries those expired IP
45857 addresses that haven&#x2019;t been tried since the message arrived. If there is a
45858 continuous stream of messages for the dead hosts, unsetting
45859 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
45860 to them.
45861 </para>
45862 <para>
45863 <indexterm role="option">
45864 <primary><option>dns_qualify_single</option></primary>
45865 </indexterm>
45866 </para>
45867 <informaltable frame="all">
45868 <tgroup cols="4" colsep="0" rowsep="0">
45869 <colspec colwidth="8*" align="left"/>
45870 <colspec colwidth="6*" align="center"/>
45871 <colspec colwidth="6*" align="center"/>
45872 <colspec colwidth="6*" align="right"/>
45873 <tbody>
45874 <row>
45875 <entry><option>dns_qualify_single</option></entry>
45876 <entry>Use: <emphasis>smtp</emphasis></entry>
45877 <entry>Type: <emphasis>boolean</emphasis></entry>
45878 <entry>Default: <emphasis>true</emphasis></entry>
45879 </row>
45880 </tbody>
45881 </tgroup>
45882 </informaltable>
45883 <para>
45884 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
45885 and the <option>gethostbyname</option> option is false,
45886 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
45887 in chapter <xref linkend="CHAPdnslookup"/> for more details.
45888 </para>
45889 <para>
45890 <indexterm role="option">
45891 <primary><option>dns_search_parents</option></primary>
45892 </indexterm>
45893 </para>
45894 <informaltable frame="all">
45895 <tgroup cols="4" colsep="0" rowsep="0">
45896 <colspec colwidth="8*" align="left"/>
45897 <colspec colwidth="6*" align="center"/>
45898 <colspec colwidth="6*" align="center"/>
45899 <colspec colwidth="6*" align="right"/>
45900 <tbody>
45901 <row>
45902 <entry><option>dns_search_parents</option></entry>
45903 <entry>Use: <emphasis>smtp</emphasis></entry>
45904 <entry>Type: <emphasis>boolean</emphasis></entry>
45905 <entry>Default: <emphasis>false</emphasis></entry>
45906 </row>
45907 </tbody>
45908 </tgroup>
45909 </informaltable>
45910 <para>
45911 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
45912 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
45913 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
45914 details.
45915 </para>
45916 <para>
45917 <indexterm role="option">
45918 <primary><option>dnssec_request_domains</option></primary>
45919 </indexterm>
45920 </para>
45921 <informaltable frame="all">
45922 <tgroup cols="4" colsep="0" rowsep="0">
45923 <colspec colwidth="8*" align="left"/>
45924 <colspec colwidth="6*" align="center"/>
45925 <colspec colwidth="6*" align="center"/>
45926 <colspec colwidth="6*" align="right"/>
45927 <tbody>
45928 <row>
45929 <entry><option>dnssec_request_domains</option></entry>
45930 <entry>Use: <emphasis>smtp</emphasis></entry>
45931 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
45932 <entry>Default: <emphasis>unset</emphasis></entry>
45933 </row>
45934 </tbody>
45935 </tgroup>
45936 </informaltable>
45937 <para>
45938 <indexterm role="concept">
45939 <primary>MX record</primary>
45940 <secondary>security</secondary>
45941 </indexterm>
45942 <indexterm role="concept">
45943 <primary>DNSSEC</primary>
45944 <secondary>MX lookup</secondary>
45945 </indexterm>
45946 <indexterm role="concept">
45947 <primary>security</primary>
45948 <secondary>MX lookup</secondary>
45949 </indexterm>
45950 <indexterm role="concept">
45951 <primary>DNS</primary>
45952 <secondary>DNSSEC</secondary>
45953 </indexterm>
45954 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
45955 the dnssec request bit set.
45956 This applies to all of the SRV, MX, AAAA, A lookup sequence.
45957 </para>
45958 <para>
45959 <indexterm role="option">
45960 <primary><option>dnssec_require_domains</option></primary>
45961 </indexterm>
45962 </para>
45963 <informaltable frame="all">
45964 <tgroup cols="4" colsep="0" rowsep="0">
45965 <colspec colwidth="8*" align="left"/>
45966 <colspec colwidth="6*" align="center"/>
45967 <colspec colwidth="6*" align="center"/>
45968 <colspec colwidth="6*" align="right"/>
45969 <tbody>
45970 <row>
45971 <entry><option>dnssec_require_domains</option></entry>
45972 <entry>Use: <emphasis>smtp</emphasis></entry>
45973 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
45974 <entry>Default: <emphasis>unset</emphasis></entry>
45975 </row>
45976 </tbody>
45977 </tgroup>
45978 </informaltable>
45979 <para>
45980 <indexterm role="concept">
45981 <primary>MX record</primary>
45982 <secondary>security</secondary>
45983 </indexterm>
45984 <indexterm role="concept">
45985 <primary>DNSSEC</primary>
45986 <secondary>MX lookup</secondary>
45987 </indexterm>
45988 <indexterm role="concept">
45989 <primary>security</primary>
45990 <secondary>MX lookup</secondary>
45991 </indexterm>
45992 <indexterm role="concept">
45993 <primary>DNS</primary>
45994 <secondary>DNSSEC</secondary>
45995 </indexterm>
45996 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
45997 the dnssec request bit set.  Any returns not having the Authenticated Data bit
45998 (AD bit) set will be ignored and logged as a host-lookup failure.
45999 This applies to all of the SRV, MX, AAAA, A lookup sequence.
46000 </para>
46001 <para>
46002 <indexterm role="option">
46003 <primary><option>dscp</option></primary>
46004 </indexterm>
46005 </para>
46006 <informaltable frame="all">
46007 <tgroup cols="4" colsep="0" rowsep="0">
46008 <colspec colwidth="8*" align="left"/>
46009 <colspec colwidth="6*" align="center"/>
46010 <colspec colwidth="6*" align="center"/>
46011 <colspec colwidth="6*" align="right"/>
46012 <tbody>
46013 <row>
46014 <entry><option>dscp</option></entry>
46015 <entry>Use: <emphasis>smtp</emphasis></entry>
46016 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46017 <entry>Default: <emphasis>unset</emphasis></entry>
46018 </row>
46019 </tbody>
46020 </tgroup>
46021 </informaltable>
46022 <para>
46023 <indexterm role="concept">
46024 <primary>DCSP</primary>
46025 <secondary>outbound</secondary>
46026 </indexterm>
46027 This option causes the DSCP value associated with a socket to be set to one
46028 of a number of fixed strings or to numeric value.
46029 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
46030 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
46031 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
46032 </para>
46033 <para>
46034 The outbound packets from Exim will be marked with this value in the header
46035 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
46036 that these values will have any effect, not be stripped by networking
46037 equipment, or do much of anything without cooperation with your Network
46038 Engineer and those of all network operators between the source and destination.
46039 </para>
46040 <para>
46041 <indexterm role="option">
46042 <primary><option>fallback_hosts</option></primary>
46043 </indexterm>
46044 </para>
46045 <informaltable frame="all">
46046 <tgroup cols="4" colsep="0" rowsep="0">
46047 <colspec colwidth="8*" align="left"/>
46048 <colspec colwidth="6*" align="center"/>
46049 <colspec colwidth="6*" align="center"/>
46050 <colspec colwidth="6*" align="right"/>
46051 <tbody>
46052 <row>
46053 <entry><option>fallback_hosts</option></entry>
46054 <entry>Use: <emphasis>smtp</emphasis></entry>
46055 <entry>Type: <emphasis>string list</emphasis></entry>
46056 <entry>Default: <emphasis>unset</emphasis></entry>
46057 </row>
46058 </tbody>
46059 </tgroup>
46060 </informaltable>
46061 <para>
46062 <indexterm role="concept">
46063 <primary>fallback</primary>
46064 <secondary>hosts specified on transport</secondary>
46065 </indexterm>
46066 String expansion is not applied to this option. The argument must be a
46067 colon-separated list of host names or IP addresses, optionally also including
46068 port numbers, though the separator can be changed, as described in section
46069 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
46070 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
46071 in section <xref linkend="SECTformatonehostitem"/>.
46072 </para>
46073 <para>
46074 Fallback hosts can also be specified on routers, which associate them with the
46075 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
46076 <option>fallback_hosts</option> specified on the transport is used only if the address does
46077 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
46078 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
46079 However, <option>hosts_randomize</option> does apply to fallback host lists.
46080 </para>
46081 <para>
46082 If Exim is unable to deliver to any of the hosts for a particular address, and
46083 the errors are not permanent rejections, the address is put on a separate
46084 transport queue with its host list replaced by the fallback hosts, unless the
46085 address was routed via MX records and the current host was in the original MX
46086 list. In that situation, the fallback host list is not used.
46087 </para>
46088 <para>
46089 Once normal deliveries are complete, the fallback queue is delivered by
46090 re-running the same transports with the new host lists. If several failing
46091 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
46092 copy of the message is sent.
46093 </para>
46094 <para>
46095 The resolution of the host names on the fallback list is controlled by the
46096 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
46097 both to cases when the host list comes with the address and when it is taken
46098 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
46099 fails</quote> facility.
46100 </para>
46101 <para>
46102 <indexterm role="option">
46103 <primary><option>final_timeout</option></primary>
46104 </indexterm>
46105 </para>
46106 <informaltable frame="all">
46107 <tgroup cols="4" colsep="0" rowsep="0">
46108 <colspec colwidth="8*" align="left"/>
46109 <colspec colwidth="6*" align="center"/>
46110 <colspec colwidth="6*" align="center"/>
46111 <colspec colwidth="6*" align="right"/>
46112 <tbody>
46113 <row>
46114 <entry><option>final_timeout</option></entry>
46115 <entry>Use: <emphasis>smtp</emphasis></entry>
46116 <entry>Type: <emphasis>time</emphasis></entry>
46117 <entry>Default: <emphasis>10m</emphasis></entry>
46118 </row>
46119 </tbody>
46120 </tgroup>
46121 </informaltable>
46122 <para>
46123 This is the timeout that applies while waiting for the response to the final
46124 line containing just <quote>.</quote> that terminates a message. Its value must not be
46125 zero.
46126 </para>
46127 <para>
46128 <indexterm role="option">
46129 <primary><option>gethostbyname</option></primary>
46130 </indexterm>
46131 </para>
46132 <informaltable frame="all">
46133 <tgroup cols="4" colsep="0" rowsep="0">
46134 <colspec colwidth="8*" align="left"/>
46135 <colspec colwidth="6*" align="center"/>
46136 <colspec colwidth="6*" align="center"/>
46137 <colspec colwidth="6*" align="right"/>
46138 <tbody>
46139 <row>
46140 <entry><option>gethostbyname</option></entry>
46141 <entry>Use: <emphasis>smtp</emphasis></entry>
46142 <entry>Type: <emphasis>boolean</emphasis></entry>
46143 <entry>Default: <emphasis>false</emphasis></entry>
46144 </row>
46145 </tbody>
46146 </tgroup>
46147 </informaltable>
46148 <para>
46149 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
46150 being used, names are looked up using <function>gethostbyname()</function>
46151 (or <function>getipnodebyname()</function> when available)
46152 instead of using the DNS. Of course, that function may in fact use the DNS, but
46153 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
46154 </para>
46155 <para>
46156 <indexterm role="option">
46157 <primary><option>gnutls_compat_mode</option></primary>
46158 </indexterm>
46159 </para>
46160 <informaltable frame="all">
46161 <tgroup cols="4" colsep="0" rowsep="0">
46162 <colspec colwidth="8*" align="left"/>
46163 <colspec colwidth="6*" align="center"/>
46164 <colspec colwidth="6*" align="center"/>
46165 <colspec colwidth="6*" align="right"/>
46166 <tbody>
46167 <row>
46168 <entry><option>gnutls_compat_mode</option></entry>
46169 <entry>Use: <emphasis>smtp</emphasis></entry>
46170 <entry>Type: <emphasis>boolean</emphasis></entry>
46171 <entry>Default: <emphasis>unset</emphasis></entry>
46172 </row>
46173 </tbody>
46174 </tgroup>
46175 </informaltable>
46176 <para>
46177 This option controls whether GnuTLS is used in compatibility mode in an Exim
46178 server. This reduces security slightly, but improves interworking with older
46179 implementations of TLS.
46180 </para>
46181 <para>
46182 <indexterm role="option">
46183 <primary><option>helo_data</option></primary>
46184 </indexterm>
46185 </para>
46186 <informaltable frame="all">
46187 <tgroup cols="4" colsep="0" rowsep="0">
46188 <colspec colwidth="8*" align="left"/>
46189 <colspec colwidth="6*" align="center"/>
46190 <colspec colwidth="6*" align="center"/>
46191 <colspec colwidth="6*" align="right"/>
46192 <tbody>
46193 <row>
46194 <entry><option>helo_data</option></entry>
46195 <entry>Use: <emphasis>smtp</emphasis></entry>
46196 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46197 <entry>Default: <emphasis>see below</emphasis></entry>
46198 </row>
46199 </tbody>
46200 </tgroup>
46201 </informaltable>
46202 <para>
46203 <indexterm role="concept">
46204 <primary>HELO</primary>
46205 <secondary>argument, setting</secondary>
46206 </indexterm>
46207 <indexterm role="concept">
46208 <primary>EHLO</primary>
46209 <secondary>argument, setting</secondary>
46210 </indexterm>
46211 <indexterm role="concept">
46212 <primary>LHLO argument setting</primary>
46213 </indexterm>
46214 The value of this option is expanded after a connection to a another host has
46215 been set up. The result is used as the argument for the EHLO, HELO, or LHLO
46216 command that starts the outgoing SMTP or LMTP session. The default value of the
46217 option is:
46218 </para>
46219 <literallayout class="monospaced">
46220 $primary_hostname
46221 </literallayout>
46222 <para>
46223 During the expansion, the variables <varname>$host</varname> and <varname>$host_address</varname> are set to
46224 the identity of the remote host, and the variables <varname>$sending_ip_address</varname> and
46225 <varname>$sending_port</varname> are set to the local IP address and port number that are being
46226 used. These variables can be used to generate different values for different
46227 servers or different local IP addresses. For example, if you want the string
46228 that is used for <option>helo_data</option> to be obtained by a DNS lookup of the outgoing
46229 interface address, you could use this:
46230 </para>
46231 <literallayout class="monospaced">
46232 helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}\
46233   {$primary_hostname}}
46234 </literallayout>
46235 <para>
46236 The use of <option>helo_data</option> applies both to sending messages and when doing
46237 callouts.
46238 </para>
46239 <para>
46240 <indexterm role="option">
46241 <primary><option>hosts</option></primary>
46242 </indexterm>
46243 </para>
46244 <informaltable frame="all">
46245 <tgroup cols="4" colsep="0" rowsep="0">
46246 <colspec colwidth="8*" align="left"/>
46247 <colspec colwidth="6*" align="center"/>
46248 <colspec colwidth="6*" align="center"/>
46249 <colspec colwidth="6*" align="right"/>
46250 <tbody>
46251 <row>
46252 <entry><option>hosts</option></entry>
46253 <entry>Use: <emphasis>smtp</emphasis></entry>
46254 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
46255 <entry>Default: <emphasis>unset</emphasis></entry>
46256 </row>
46257 </tbody>
46258 </tgroup>
46259 </informaltable>
46260 <para>
46261 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
46262 finds the hosts by looking up the address domain in the DNS, or by
46263 <command>manualroute</command>, which has lists of hosts in its configuration. However,
46264 email addresses can be passed to the <command>smtp</command> transport by any router, and not
46265 all of them can provide an associated list of hosts.
46266 </para>
46267 <para>
46268 The <option>hosts</option> option specifies a list of hosts to be used if the address being
46269 processed does not have any hosts associated with it. The hosts specified by
46270 <option>hosts</option> are also used, whether or not the address has its own hosts, if
46271 <option>hosts_override</option> is set.
46272 </para>
46273 <para>
46274 The string is first expanded, before being interpreted as a colon-separated
46275 list of host names or IP addresses, possibly including port numbers. The
46276 separator may be changed to something other than colon, as described in section
46277 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
46278 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
46279 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
46280 of the <command>manualroute</command> router is not available here.
46281 </para>
46282 <para>
46283 If the expansion fails, delivery is deferred. Unless the failure was caused by
46284 the inability to complete a lookup, the error is logged to the panic log as
46285 well as the main log. Host names are looked up either by searching directly for
46286 address records in the DNS or by calling <function>gethostbyname()</function> (or
46287 <function>getipnodebyname()</function> when available), depending on the setting of the
46288 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
46289 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
46290 address are used.
46291 </para>
46292 <para>
46293 During delivery, the hosts are tried in order, subject to their retry status,
46294 unless <option>hosts_randomize</option> is set.
46295 </para>
46296 <para>
46297 <indexterm role="option">
46298 <primary><option>hosts_avoid_esmtp</option></primary>
46299 </indexterm>
46300 </para>
46301 <informaltable frame="all">
46302 <tgroup cols="4" colsep="0" rowsep="0">
46303 <colspec colwidth="8*" align="left"/>
46304 <colspec colwidth="6*" align="center"/>
46305 <colspec colwidth="6*" align="center"/>
46306 <colspec colwidth="6*" align="right"/>
46307 <tbody>
46308 <row>
46309 <entry><option>hosts_avoid_esmtp</option></entry>
46310 <entry>Use: <emphasis>smtp</emphasis></entry>
46311 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46312 <entry>Default: <emphasis>unset</emphasis></entry>
46313 </row>
46314 </tbody>
46315 </tgroup>
46316 </informaltable>
46317 <para>
46318 <indexterm role="concept">
46319 <primary>ESMTP, avoiding use of</primary>
46320 </indexterm>
46321 <indexterm role="concept">
46322 <primary>HELO</primary>
46323 <secondary>forcing use of</secondary>
46324 </indexterm>
46325 <indexterm role="concept">
46326 <primary>EHLO</primary>
46327 <secondary>avoiding use of</secondary>
46328 </indexterm>
46329 <indexterm role="concept">
46330 <primary>PIPELINING</primary>
46331 <secondary>avoiding the use of</secondary>
46332 </indexterm>
46333 This option is for use with broken hosts that announce ESMTP facilities (for
46334 example, PIPELINING) and then fail to implement them properly. When a host
46335 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
46336 start of the SMTP session. This means that it cannot use any of the ESMTP
46337 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
46338 </para>
46339 <para>
46340 <indexterm role="option">
46341 <primary><option>hosts_avoid_pipelining</option></primary>
46342 </indexterm>
46343 </para>
46344 <informaltable frame="all">
46345 <tgroup cols="4" colsep="0" rowsep="0">
46346 <colspec colwidth="8*" align="left"/>
46347 <colspec colwidth="6*" align="center"/>
46348 <colspec colwidth="6*" align="center"/>
46349 <colspec colwidth="6*" align="right"/>
46350 <tbody>
46351 <row>
46352 <entry><option>hosts_avoid_pipelining</option></entry>
46353 <entry>Use: <emphasis>smtp</emphasis></entry>
46354 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46355 <entry>Default: <emphasis>unset</emphasis></entry>
46356 </row>
46357 </tbody>
46358 </tgroup>
46359 </informaltable>
46360 <para>
46361 <indexterm role="concept">
46362 <primary>PIPELINING</primary>
46363 <secondary>avoiding the use of</secondary>
46364 </indexterm>
46365 Exim will not use the SMTP PIPELINING extension when delivering to any host
46366 that matches this list, even if the server host advertises PIPELINING support.
46367 </para>
46368 <para>
46369 <indexterm role="option">
46370 <primary><option>hosts_avoid_tls</option></primary>
46371 </indexterm>
46372 </para>
46373 <informaltable frame="all">
46374 <tgroup cols="4" colsep="0" rowsep="0">
46375 <colspec colwidth="8*" align="left"/>
46376 <colspec colwidth="6*" align="center"/>
46377 <colspec colwidth="6*" align="center"/>
46378 <colspec colwidth="6*" align="right"/>
46379 <tbody>
46380 <row>
46381 <entry><option>hosts_avoid_tls</option></entry>
46382 <entry>Use: <emphasis>smtp</emphasis></entry>
46383 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46384 <entry>Default: <emphasis>unset</emphasis></entry>
46385 </row>
46386 </tbody>
46387 </tgroup>
46388 </informaltable>
46389 <para>
46390 <indexterm role="concept">
46391 <primary>TLS</primary>
46392 <secondary>avoiding for certain hosts</secondary>
46393 </indexterm>
46394 Exim will not try to start a TLS session when delivering to any host that
46395 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
46396 </para>
46397 <para>
46398 <indexterm role="option">
46399 <primary><option>hosts_verify_avoid_tls</option></primary>
46400 </indexterm>
46401 </para>
46402 <informaltable frame="all">
46403 <tgroup cols="4" colsep="0" rowsep="0">
46404 <colspec colwidth="8*" align="left"/>
46405 <colspec colwidth="6*" align="center"/>
46406 <colspec colwidth="6*" align="center"/>
46407 <colspec colwidth="6*" align="right"/>
46408 <tbody>
46409 <row>
46410 <entry><option>hosts_verify_avoid_tls</option></entry>
46411 <entry>Use: <emphasis>smtp</emphasis></entry>
46412 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46413 <entry>Default: <emphasis>unset</emphasis></entry>
46414 </row>
46415 </tbody>
46416 </tgroup>
46417 </informaltable>
46418 <para>
46419 <indexterm role="concept">
46420 <primary>TLS</primary>
46421 <secondary>avoiding for certain hosts</secondary>
46422 </indexterm>
46423 Exim will not try to start a TLS session for a verify callout,
46424 or when delivering in cutthrough mode,
46425 to any host that matches this list.
46426 </para>
46427 <para>
46428 <indexterm role="option">
46429 <primary><option>hosts_max_try</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>hosts_max_try</option></entry>
46441 <entry>Use: <emphasis>smtp</emphasis></entry>
46442 <entry>Type: <emphasis>integer</emphasis></entry>
46443 <entry>Default: <emphasis>5</emphasis></entry>
46444 </row>
46445 </tbody>
46446 </tgroup>
46447 </informaltable>
46448 <para>
46449 <indexterm role="concept">
46450 <primary>host</primary>
46451 <secondary>maximum number to try</secondary>
46452 </indexterm>
46453 <indexterm role="concept">
46454 <primary>limit</primary>
46455 <secondary>number of hosts tried</secondary>
46456 </indexterm>
46457 <indexterm role="concept">
46458 <primary>limit</primary>
46459 <secondary>number of MX tried</secondary>
46460 </indexterm>
46461 <indexterm role="concept">
46462 <primary>MX record</primary>
46463 <secondary>maximum tried</secondary>
46464 </indexterm>
46465 This option limits the number of IP addresses that are tried for any one
46466 delivery in cases where there are temporary delivery errors. Section
46467 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
46468 </para>
46469 <para>
46470 <indexterm role="option">
46471 <primary><option>hosts_max_try_hardlimit</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>hosts_max_try_hardlimit</option></entry>
46483 <entry>Use: <emphasis>smtp</emphasis></entry>
46484 <entry>Type: <emphasis>integer</emphasis></entry>
46485 <entry>Default: <emphasis>50</emphasis></entry>
46486 </row>
46487 </tbody>
46488 </tgroup>
46489 </informaltable>
46490 <para>
46491 This is an additional check on the maximum number of IP addresses that Exim
46492 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
46493 why it exists.
46494 </para>
46495 <para>
46496 <indexterm role="option">
46497 <primary><option>hosts_nopass_tls</option></primary>
46498 </indexterm>
46499 </para>
46500 <informaltable frame="all">
46501 <tgroup cols="4" colsep="0" rowsep="0">
46502 <colspec colwidth="8*" align="left"/>
46503 <colspec colwidth="6*" align="center"/>
46504 <colspec colwidth="6*" align="center"/>
46505 <colspec colwidth="6*" align="right"/>
46506 <tbody>
46507 <row>
46508 <entry><option>hosts_nopass_tls</option></entry>
46509 <entry>Use: <emphasis>smtp</emphasis></entry>
46510 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46511 <entry>Default: <emphasis>unset</emphasis></entry>
46512 </row>
46513 </tbody>
46514 </tgroup>
46515 </informaltable>
46516 <para>
46517 <indexterm role="concept">
46518 <primary>TLS</primary>
46519 <secondary>passing connection</secondary>
46520 </indexterm>
46521 <indexterm role="concept">
46522 <primary>multiple SMTP deliveries</primary>
46523 </indexterm>
46524 <indexterm role="concept">
46525 <primary>TLS</primary>
46526 <secondary>multiple message deliveries</secondary>
46527 </indexterm>
46528 For any host that matches this list, a connection on which a TLS session has
46529 been started will not be passed to a new delivery process for sending another
46530 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
46531 explanation of when this might be needed.
46532 </para>
46533 <para>
46534 <indexterm role="option">
46535 <primary><option>hosts_override</option></primary>
46536 </indexterm>
46537 </para>
46538 <informaltable frame="all">
46539 <tgroup cols="4" colsep="0" rowsep="0">
46540 <colspec colwidth="8*" align="left"/>
46541 <colspec colwidth="6*" align="center"/>
46542 <colspec colwidth="6*" align="center"/>
46543 <colspec colwidth="6*" align="right"/>
46544 <tbody>
46545 <row>
46546 <entry><option>hosts_override</option></entry>
46547 <entry>Use: <emphasis>smtp</emphasis></entry>
46548 <entry>Type: <emphasis>boolean</emphasis></entry>
46549 <entry>Default: <emphasis>false</emphasis></entry>
46550 </row>
46551 </tbody>
46552 </tgroup>
46553 </informaltable>
46554 <para>
46555 If this option is set and the <option>hosts</option> option is also set, any hosts that are
46556 attached to the address are ignored, and instead the hosts specified by the
46557 <option>hosts</option> option are always used. This option does not apply to
46558 <option>fallback_hosts</option>.
46559 </para>
46560 <para>
46561 <indexterm role="option">
46562 <primary><option>hosts_randomize</option></primary>
46563 </indexterm>
46564 </para>
46565 <informaltable frame="all">
46566 <tgroup cols="4" colsep="0" rowsep="0">
46567 <colspec colwidth="8*" align="left"/>
46568 <colspec colwidth="6*" align="center"/>
46569 <colspec colwidth="6*" align="center"/>
46570 <colspec colwidth="6*" align="right"/>
46571 <tbody>
46572 <row>
46573 <entry><option>hosts_randomize</option></entry>
46574 <entry>Use: <emphasis>smtp</emphasis></entry>
46575 <entry>Type: <emphasis>boolean</emphasis></entry>
46576 <entry>Default: <emphasis>false</emphasis></entry>
46577 </row>
46578 </tbody>
46579 </tgroup>
46580 </informaltable>
46581 <para>
46582 <indexterm role="concept">
46583 <primary>randomized host list</primary>
46584 </indexterm>
46585 <indexterm role="concept">
46586 <primary>host</primary>
46587 <secondary>list of; randomized</secondary>
46588 </indexterm>
46589 <indexterm role="concept">
46590 <primary>fallback</primary>
46591 <secondary>randomized hosts</secondary>
46592 </indexterm>
46593 If this option is set, and either the list of hosts is taken from the
46594 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
46595 were not obtained from MX records (this includes fallback hosts from the
46596 router), and were not randomized by the router, the order of trying the hosts
46597 is randomized each time the transport runs. Randomizing the order of a host
46598 list can be used to do crude load sharing.
46599 </para>
46600 <para>
46601 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
46602 order is separately randomized. This makes it possible to set up MX-like
46603 behaviour. The boundaries between groups are indicated by an item that is just
46604 <literal>+</literal> in the host list. For example:
46605 </para>
46606 <literallayout class="monospaced">
46607 hosts = host1:host2:host3:+:host4:host5
46608 </literallayout>
46609 <para>
46610 The order of the first three hosts and the order of the last two hosts is
46611 randomized for each use, but the first three always end up before the last two.
46612 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
46613 </para>
46614 <para>
46615 <indexterm role="option">
46616 <primary><option>hosts_require_auth</option></primary>
46617 </indexterm>
46618 </para>
46619 <informaltable frame="all">
46620 <tgroup cols="4" colsep="0" rowsep="0">
46621 <colspec colwidth="8*" align="left"/>
46622 <colspec colwidth="6*" align="center"/>
46623 <colspec colwidth="6*" align="center"/>
46624 <colspec colwidth="6*" align="right"/>
46625 <tbody>
46626 <row>
46627 <entry><option>hosts_require_auth</option></entry>
46628 <entry>Use: <emphasis>smtp</emphasis></entry>
46629 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46630 <entry>Default: <emphasis>unset</emphasis></entry>
46631 </row>
46632 </tbody>
46633 </tgroup>
46634 </informaltable>
46635 <para>
46636 <indexterm role="concept">
46637 <primary>authentication</primary>
46638 <secondary>required by client</secondary>
46639 </indexterm>
46640 This option provides a list of servers for which authentication must succeed
46641 before Exim will try to transfer a message. If authentication fails for
46642 servers which are not in this list, Exim tries to send unauthenticated. If
46643 authentication fails for one of these servers, delivery is deferred. This
46644 temporary error is detectable in the retry rules, so it can be turned into a
46645 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
46646 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
46647 </para>
46648 <para>
46649 <indexterm role="option">
46650 <primary><option>hosts_request_ocsp</option></primary>
46651 </indexterm>
46652 </para>
46653 <informaltable frame="all">
46654 <tgroup cols="4" colsep="0" rowsep="0">
46655 <colspec colwidth="8*" align="left"/>
46656 <colspec colwidth="6*" align="center"/>
46657 <colspec colwidth="6*" align="center"/>
46658 <colspec colwidth="6*" align="right"/>
46659 <tbody>
46660 <row>
46661 <entry><option>hosts_request_ocsp</option></entry>
46662 <entry>Use: <emphasis>smtp</emphasis></entry>
46663 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46664 <entry>Default: <emphasis>*</emphasis></entry>
46665 </row>
46666 </tbody>
46667 </tgroup>
46668 </informaltable>
46669 <para>
46670 <indexterm role="concept">
46671 <primary>TLS</primary>
46672 <secondary>requiring for certain servers</secondary>
46673 </indexterm>
46674 Exim will request a Certificate Status on a
46675 TLS session for any host that matches this list.
46676 <option>tls_verify_certificates</option> should also be set for the transport.
46677 </para>
46678 <para>
46679 <indexterm role="option">
46680 <primary><option>hosts_require_ocsp</option></primary>
46681 </indexterm>
46682 </para>
46683 <informaltable frame="all">
46684 <tgroup cols="4" colsep="0" rowsep="0">
46685 <colspec colwidth="8*" align="left"/>
46686 <colspec colwidth="6*" align="center"/>
46687 <colspec colwidth="6*" align="center"/>
46688 <colspec colwidth="6*" align="right"/>
46689 <tbody>
46690 <row>
46691 <entry><option>hosts_require_ocsp</option></entry>
46692 <entry>Use: <emphasis>smtp</emphasis></entry>
46693 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46694 <entry>Default: <emphasis>unset</emphasis></entry>
46695 </row>
46696 </tbody>
46697 </tgroup>
46698 </informaltable>
46699 <para>
46700 <indexterm role="concept">
46701 <primary>TLS</primary>
46702 <secondary>requiring for certain servers</secondary>
46703 </indexterm>
46704 Exim will request, and check for a valid Certificate Status being given, on a
46705 TLS session for any host that matches this list.
46706 <option>tls_verify_certificates</option> should also be set for the transport.
46707 </para>
46708 <para>
46709 <indexterm role="option">
46710 <primary><option>hosts_require_tls</option></primary>
46711 </indexterm>
46712 </para>
46713 <informaltable frame="all">
46714 <tgroup cols="4" colsep="0" rowsep="0">
46715 <colspec colwidth="8*" align="left"/>
46716 <colspec colwidth="6*" align="center"/>
46717 <colspec colwidth="6*" align="center"/>
46718 <colspec colwidth="6*" align="right"/>
46719 <tbody>
46720 <row>
46721 <entry><option>hosts_require_tls</option></entry>
46722 <entry>Use: <emphasis>smtp</emphasis></entry>
46723 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46724 <entry>Default: <emphasis>unset</emphasis></entry>
46725 </row>
46726 </tbody>
46727 </tgroup>
46728 </informaltable>
46729 <para>
46730 <indexterm role="concept">
46731 <primary>TLS</primary>
46732 <secondary>requiring for certain servers</secondary>
46733 </indexterm>
46734 Exim will insist on using a TLS session when delivering to any host that
46735 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
46736 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
46737 incoming messages, use an appropriate ACL.
46738 </para>
46739 <para>
46740 <indexterm role="option">
46741 <primary><option>hosts_try_auth</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>hosts_try_auth</option></entry>
46753 <entry>Use: <emphasis>smtp</emphasis></entry>
46754 <entry>Type: <emphasis>host 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>authentication</primary>
46763 <secondary>optional in client</secondary>
46764 </indexterm>
46765 This option provides a list of servers to which, provided they announce
46766 authentication support, Exim will attempt to authenticate as a client when it
46767 connects. If authentication fails, Exim will try to transfer the message
46768 unauthenticated. See also <option>hosts_require_auth</option>, and chapter
46769 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
46770 </para>
46771 <para>
46772 <indexterm role="option">
46773 <primary><option>hosts_try_prdr</option></primary>
46774 </indexterm>
46775 </para>
46776 <informaltable frame="all">
46777 <tgroup cols="4" colsep="0" rowsep="0">
46778 <colspec colwidth="8*" align="left"/>
46779 <colspec colwidth="6*" align="center"/>
46780 <colspec colwidth="6*" align="center"/>
46781 <colspec colwidth="6*" align="right"/>
46782 <tbody>
46783 <row>
46784 <entry><option>hosts_try_prdr</option></entry>
46785 <entry>Use: <emphasis>smtp</emphasis></entry>
46786 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46787 <entry>Default: <emphasis>*</emphasis></entry>
46788 </row>
46789 </tbody>
46790 </tgroup>
46791 </informaltable>
46792 <para>
46793 <indexterm role="concept">
46794 <primary>PRDR</primary>
46795 <secondary>enabling, optional in client</secondary>
46796 </indexterm>
46797 This option provides a list of servers to which, provided they announce
46798 PRDR support, Exim will attempt to negotiate PRDR
46799 for multi-recipient messages.
46800 The option can usually be left as default.
46801 </para>
46802 <para>
46803 <indexterm role="option">
46804 <primary><option>interface</option></primary>
46805 </indexterm>
46806 </para>
46807 <informaltable frame="all">
46808 <tgroup cols="4" colsep="0" rowsep="0">
46809 <colspec colwidth="8*" align="left"/>
46810 <colspec colwidth="6*" align="center"/>
46811 <colspec colwidth="6*" align="center"/>
46812 <colspec colwidth="6*" align="right"/>
46813 <tbody>
46814 <row>
46815 <entry><option>interface</option></entry>
46816 <entry>Use: <emphasis>smtp</emphasis></entry>
46817 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
46818 <entry>Default: <emphasis>unset</emphasis></entry>
46819 </row>
46820 </tbody>
46821 </tgroup>
46822 </informaltable>
46823 <para>
46824 <indexterm role="concept">
46825 <primary>bind IP address</primary>
46826 </indexterm>
46827 <indexterm role="concept">
46828 <primary>IP address</primary>
46829 <secondary>binding</secondary>
46830 </indexterm>
46831 <indexterm role="variable">
46832 <primary><varname>$host</varname></primary>
46833 </indexterm>
46834 <indexterm role="variable">
46835 <primary><varname>$host_address</varname></primary>
46836 </indexterm>
46837 This option specifies which interface to bind to when making an outgoing SMTP
46838 call. The value is an IP address, not an interface name such as
46839 <literal>eth0</literal>. Do not confuse this with the interface address that was used when a
46840 message was received, which is in <varname>$received_ip_address</varname>, formerly known as
46841 <varname>$interface_address</varname>. The name was changed to minimize confusion with the
46842 outgoing interface address. There is no variable that contains an outgoing
46843 interface address because, unless it is set by this option, its value is
46844 unknown.
46845 </para>
46846 <para>
46847 During the expansion of the <option>interface</option> option the variables <varname>$host</varname> and
46848 <varname>$host_address</varname> refer to the host to which a connection is about to be made
46849 during the expansion of the string. Forced expansion failure, or an empty
46850 string result causes the option to be ignored. Otherwise, after expansion, the
46851 string must be a list of IP addresses, colon-separated by default, but the
46852 separator can be changed in the usual way. For example:
46853 </para>
46854 <literallayout class="monospaced">
46855 interface = &lt;; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
46856 </literallayout>
46857 <para>
46858 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
46859 connection. If none of them are the correct type, the option is ignored. If
46860 <option>interface</option> is not set, or is ignored, the system&#x2019;s IP functions choose which
46861 interface to use if the host has more than one.
46862 </para>
46863 <para>
46864 <indexterm role="option">
46865 <primary><option>keepalive</option></primary>
46866 </indexterm>
46867 </para>
46868 <informaltable frame="all">
46869 <tgroup cols="4" colsep="0" rowsep="0">
46870 <colspec colwidth="8*" align="left"/>
46871 <colspec colwidth="6*" align="center"/>
46872 <colspec colwidth="6*" align="center"/>
46873 <colspec colwidth="6*" align="right"/>
46874 <tbody>
46875 <row>
46876 <entry><option>keepalive</option></entry>
46877 <entry>Use: <emphasis>smtp</emphasis></entry>
46878 <entry>Type: <emphasis>boolean</emphasis></entry>
46879 <entry>Default: <emphasis>true</emphasis></entry>
46880 </row>
46881 </tbody>
46882 </tgroup>
46883 </informaltable>
46884 <para>
46885 <indexterm role="concept">
46886 <primary>keepalive</primary>
46887 <secondary>on outgoing connection</secondary>
46888 </indexterm>
46889 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
46890 connections. When set, it causes the kernel to probe idle connections
46891 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
46892 of the connection should send a acknowledgment if the connection is still okay
46893 or a reset if the connection has been aborted. The reason for doing this is
46894 that it has the beneficial effect of freeing up certain types of connection
46895 that can get stuck when the remote host is disconnected without tidying up the
46896 TCP/IP call properly. The keepalive mechanism takes several hours to detect
46897 unreachable hosts.
46898 </para>
46899 <para>
46900 <indexterm role="option">
46901 <primary><option>lmtp_ignore_quota</option></primary>
46902 </indexterm>
46903 </para>
46904 <informaltable frame="all">
46905 <tgroup cols="4" colsep="0" rowsep="0">
46906 <colspec colwidth="8*" align="left"/>
46907 <colspec colwidth="6*" align="center"/>
46908 <colspec colwidth="6*" align="center"/>
46909 <colspec colwidth="6*" align="right"/>
46910 <tbody>
46911 <row>
46912 <entry><option>lmtp_ignore_quota</option></entry>
46913 <entry>Use: <emphasis>smtp</emphasis></entry>
46914 <entry>Type: <emphasis>boolean</emphasis></entry>
46915 <entry>Default: <emphasis>false</emphasis></entry>
46916 </row>
46917 </tbody>
46918 </tgroup>
46919 </informaltable>
46920 <para>
46921 <indexterm role="concept">
46922 <primary>LMTP</primary>
46923 <secondary>ignoring quota errors</secondary>
46924 </indexterm>
46925 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
46926 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
46927 has advertised support for IGNOREQUOTA in its response to the LHLO command.
46928 </para>
46929 <para>
46930 <indexterm role="option">
46931 <primary><option>max_rcpt</option></primary>
46932 </indexterm>
46933 </para>
46934 <informaltable frame="all">
46935 <tgroup cols="4" colsep="0" rowsep="0">
46936 <colspec colwidth="8*" align="left"/>
46937 <colspec colwidth="6*" align="center"/>
46938 <colspec colwidth="6*" align="center"/>
46939 <colspec colwidth="6*" align="right"/>
46940 <tbody>
46941 <row>
46942 <entry><option>max_rcpt</option></entry>
46943 <entry>Use: <emphasis>smtp</emphasis></entry>
46944 <entry>Type: <emphasis>integer</emphasis></entry>
46945 <entry>Default: <emphasis>100</emphasis></entry>
46946 </row>
46947 </tbody>
46948 </tgroup>
46949 </informaltable>
46950 <para>
46951 <indexterm role="concept">
46952 <primary>RCPT</primary>
46953 <secondary>maximum number of outgoing</secondary>
46954 </indexterm>
46955 This option limits the number of RCPT commands that are sent in a single
46956 SMTP message transaction. Each set of addresses is treated independently, and
46957 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
46958 permits this.
46959 </para>
46960 <para>
46961 <indexterm role="option">
46962 <primary><option>multi_domain</option></primary>
46963 </indexterm>
46964 </para>
46965 <informaltable frame="all">
46966 <tgroup cols="4" colsep="0" rowsep="0">
46967 <colspec colwidth="8*" align="left"/>
46968 <colspec colwidth="6*" align="center"/>
46969 <colspec colwidth="6*" align="center"/>
46970 <colspec colwidth="6*" align="right"/>
46971 <tbody>
46972 <row>
46973 <entry><option>multi_domain</option></entry>
46974 <entry>Use: <emphasis>smtp</emphasis></entry>
46975 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
46976 <entry>Default: <emphasis>true</emphasis></entry>
46977 </row>
46978 </tbody>
46979 </tgroup>
46980 </informaltable>
46981 <para>
46982 <indexterm role="variable">
46983 <primary><varname>$domain</varname></primary>
46984 </indexterm>
46985 When this option is set, the <command>smtp</command> transport can handle a number of
46986 addresses containing a mixture of different domains provided they all resolve
46987 to the same list of hosts. Turning the option off restricts the transport to
46988 handling only one domain at a time. This is useful if you want to use
46989 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
46990 is a single domain involved in a remote delivery.
46991 </para>
46992 <para>
46993 It is expanded per-address and can depend on any of
46994 <varname>$address_data</varname>, <varname>$domain_data</varname>, <varname>$local_part_data</varname>,
46995 <varname>$host</varname>, <varname>$host_address</varname> and <varname>$host_port</varname>.
46996 </para>
46997 <para>
46998 <indexterm role="option">
46999 <primary><option>port</option></primary>
47000 </indexterm>
47001 </para>
47002 <informaltable frame="all">
47003 <tgroup cols="4" colsep="0" rowsep="0">
47004 <colspec colwidth="8*" align="left"/>
47005 <colspec colwidth="6*" align="center"/>
47006 <colspec colwidth="6*" align="center"/>
47007 <colspec colwidth="6*" align="right"/>
47008 <tbody>
47009 <row>
47010 <entry><option>port</option></entry>
47011 <entry>Use: <emphasis>smtp</emphasis></entry>
47012 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47013 <entry>Default: <emphasis>see below</emphasis></entry>
47014 </row>
47015 </tbody>
47016 </tgroup>
47017 </informaltable>
47018 <para>
47019 <indexterm role="concept">
47020 <primary>port</primary>
47021 <secondary>sending TCP/IP</secondary>
47022 </indexterm>
47023 <indexterm role="concept">
47024 <primary>TCP/IP</primary>
47025 <secondary>setting outgoing port</secondary>
47026 </indexterm>
47027 This option specifies the TCP/IP port on the server to which Exim connects.
47028 <emphasis role="bold">Note:</emphasis> Do not confuse this with the port that was used when a message was
47029 received, which is in <varname>$received_port</varname>, formerly known as <varname>$interface_port</varname>.
47030 The name was changed to minimize confusion with the outgoing port. There is no
47031 variable that contains an outgoing port.
47032 </para>
47033 <para>
47034 If the value of this option begins with a digit it is taken as a port number;
47035 otherwise it is looked up using <function>getservbyname()</function>. The default value is
47036 normally <quote>smtp</quote>, but if <option>protocol</option> is set to <quote>lmtp</quote>, the default is
47037 <quote>lmtp</quote>. If the expansion fails, or if a port number cannot be found, delivery
47038 is deferred.
47039 </para>
47040 <para>
47041 <indexterm role="option">
47042 <primary><option>protocol</option></primary>
47043 </indexterm>
47044 </para>
47045 <informaltable frame="all">
47046 <tgroup cols="4" colsep="0" rowsep="0">
47047 <colspec colwidth="8*" align="left"/>
47048 <colspec colwidth="6*" align="center"/>
47049 <colspec colwidth="6*" align="center"/>
47050 <colspec colwidth="6*" align="right"/>
47051 <tbody>
47052 <row>
47053 <entry><option>protocol</option></entry>
47054 <entry>Use: <emphasis>smtp</emphasis></entry>
47055 <entry>Type: <emphasis>string</emphasis></entry>
47056 <entry>Default: <emphasis>smtp</emphasis></entry>
47057 </row>
47058 </tbody>
47059 </tgroup>
47060 </informaltable>
47061 <para>
47062 <indexterm role="concept">
47063 <primary>LMTP</primary>
47064 <secondary>over TCP/IP</secondary>
47065 </indexterm>
47066 <indexterm role="concept">
47067 <primary>ssmtp protocol</primary>
47068 <secondary>outbound</secondary>
47069 </indexterm>
47070 <indexterm role="concept">
47071 <primary>TLS</primary>
47072 <secondary>SSL-on-connect outbound</secondary>
47073 </indexterm>
47074 <indexterm role="variable">
47075 <primary><varname>$port</varname></primary>
47076 </indexterm>
47077 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
47078 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
47079 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
47080 deliveries into closed message stores. Exim also has support for running LMTP
47081 over a pipe to a local process &ndash; see chapter <xref linkend="CHAPLMTP"/>.
47082 </para>
47083 <para>
47084 If this option is set to <quote>smtps</quote>, the default value for the <option>port</option> option
47085 changes to <quote>smtps</quote>, and the transport initiates TLS immediately after
47086 connecting, as an outbound SSL-on-connect, instead of using STARTTLS to upgrade.
47087 The Internet standards bodies strongly discourage use of this mode.
47088 </para>
47089 <para>
47090 <indexterm role="option">
47091 <primary><option>retry_include_ip_address</option></primary>
47092 </indexterm>
47093 </para>
47094 <informaltable frame="all">
47095 <tgroup cols="4" colsep="0" rowsep="0">
47096 <colspec colwidth="8*" align="left"/>
47097 <colspec colwidth="6*" align="center"/>
47098 <colspec colwidth="6*" align="center"/>
47099 <colspec colwidth="6*" align="right"/>
47100 <tbody>
47101 <row>
47102 <entry><option>retry_include_ip_address</option></entry>
47103 <entry>Use: <emphasis>smtp</emphasis></entry>
47104 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
47105 <entry>Default: <emphasis>true</emphasis></entry>
47106 </row>
47107 </tbody>
47108 </tgroup>
47109 </informaltable>
47110 <para>
47111 Exim normally includes both the host name and the IP address in the key it
47112 constructs for indexing retry data after a temporary delivery failure. This
47113 means that when one of several IP addresses for a host is failing, it gets
47114 tried periodically (controlled by the retry rules), but use of the other IP
47115 addresses is not affected.
47116 </para>
47117 <para>
47118 However, in some dialup environments hosts are assigned a different IP address
47119 each time they connect. In this situation the use of the IP address as part of
47120 the retry key leads to undesirable behaviour. Setting this option false causes
47121 Exim to use only the host name.
47122 Since it is expanded it can be made to depend on the host or domain.
47123 </para>
47124 <para>
47125 <indexterm role="option">
47126 <primary><option>serialize_hosts</option></primary>
47127 </indexterm>
47128 </para>
47129 <informaltable frame="all">
47130 <tgroup cols="4" colsep="0" rowsep="0">
47131 <colspec colwidth="8*" align="left"/>
47132 <colspec colwidth="6*" align="center"/>
47133 <colspec colwidth="6*" align="center"/>
47134 <colspec colwidth="6*" align="right"/>
47135 <tbody>
47136 <row>
47137 <entry><option>serialize_hosts</option></entry>
47138 <entry>Use: <emphasis>smtp</emphasis></entry>
47139 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47140 <entry>Default: <emphasis>unset</emphasis></entry>
47141 </row>
47142 </tbody>
47143 </tgroup>
47144 </informaltable>
47145 <para>
47146 <indexterm role="concept">
47147 <primary>serializing connections</primary>
47148 </indexterm>
47149 <indexterm role="concept">
47150 <primary>host</primary>
47151 <secondary>serializing connections</secondary>
47152 </indexterm>
47153 Because Exim operates in a distributed manner, if several messages for the same
47154 host arrive at around the same time, more than one simultaneous connection to
47155 the remote host can occur. This is not usually a problem except when there is a
47156 slow link between the hosts. In that situation it may be helpful to restrict
47157 Exim to one connection at a time. This can be done by setting
47158 <option>serialize_hosts</option> to match the relevant hosts.
47159 </para>
47160 <para>
47161 <indexterm role="concept">
47162 <primary>hints database</primary>
47163 <secondary>serializing deliveries to a host</secondary>
47164 </indexterm>
47165 Exim implements serialization by means of a hints database in which a record is
47166 written whenever a process connects to one of the restricted hosts. The record
47167 is deleted when the connection is completed. Obviously there is scope for
47168 records to get left lying around if there is a system or program crash. To
47169 guard against this, Exim ignores any records that are more than six hours old.
47170 </para>
47171 <para>
47172 If you set up this kind of serialization, you should also arrange to delete the
47173 relevant hints database whenever your system reboots. The names of the files
47174 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
47175 may be one or two files, depending on the type of DBM in use. The same files
47176 are used for ETRN serialization.
47177 </para>
47178 <para revisionflag="changed">
47179 See also the <option>max_parallel</option> generic transport option.
47180 </para>
47181 <para>
47182 <indexterm role="option">
47183 <primary><option>size_addition</option></primary>
47184 </indexterm>
47185 </para>
47186 <informaltable frame="all">
47187 <tgroup cols="4" colsep="0" rowsep="0">
47188 <colspec colwidth="8*" align="left"/>
47189 <colspec colwidth="6*" align="center"/>
47190 <colspec colwidth="6*" align="center"/>
47191 <colspec colwidth="6*" align="right"/>
47192 <tbody>
47193 <row>
47194 <entry><option>size_addition</option></entry>
47195 <entry>Use: <emphasis>smtp</emphasis></entry>
47196 <entry>Type: <emphasis>integer</emphasis></entry>
47197 <entry>Default: <emphasis>1024</emphasis></entry>
47198 </row>
47199 </tbody>
47200 </tgroup>
47201 </informaltable>
47202 <para>
47203 <indexterm role="concept">
47204 <primary>SMTP</primary>
47205 <secondary>SIZE</secondary>
47206 </indexterm>
47207 <indexterm role="concept">
47208 <primary>message</primary>
47209 <secondary>size issue for transport filter</secondary>
47210 </indexterm>
47211 <indexterm role="concept">
47212 <primary>size</primary>
47213 <secondary>of message</secondary>
47214 </indexterm>
47215 <indexterm role="concept">
47216 <primary>transport</primary>
47217 <secondary>filter</secondary>
47218 </indexterm>
47219 <indexterm role="concept">
47220 <primary>filter</primary>
47221 <secondary>transport filter</secondary>
47222 </indexterm>
47223 If a remote SMTP server indicates that it supports the SIZE option of the
47224 MAIL command, Exim uses this to pass over the message size at the start of
47225 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
47226 sends, to allow for headers and other text that may be added during delivery by
47227 configuration options or in a transport filter. It may be necessary to increase
47228 this if a lot of text is added to messages.
47229 </para>
47230 <para>
47231 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
47232 the use of the SIZE option altogether.
47233 </para>
47234 <para revisionflag="changed">
47235 <indexterm role="option">
47236 <primary><option>socks_proxy</option></primary>
47237 </indexterm>
47238 </para>
47239 <informaltable frame="all" revisionflag="changed">
47240 <tgroup cols="4" colsep="0" rowsep="0">
47241 <colspec colwidth="8*" align="left"/>
47242 <colspec colwidth="6*" align="center"/>
47243 <colspec colwidth="6*" align="center"/>
47244 <colspec colwidth="6*" align="right"/>
47245 <tbody>
47246 <row>
47247 <entry><option>socks_proxy</option></entry>
47248 <entry>Use: <emphasis>smtp</emphasis></entry>
47249 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47250 <entry>Default: <emphasis>unset</emphasis></entry>
47251 </row>
47252 </tbody>
47253 </tgroup>
47254 </informaltable>
47255 <para revisionflag="changed">
47256 <indexterm role="concept">
47257 <primary>proxy</primary>
47258 <secondary>SOCKS</secondary>
47259 </indexterm>
47260 This option enables use of SOCKS proxies for connections made by the
47261 transport.  For details see <xref linkend="SECTproxySOCKS"/>.
47262 </para>
47263 <para>
47264 <indexterm role="option">
47265 <primary><option>tls_certificate</option></primary>
47266 </indexterm>
47267 </para>
47268 <informaltable frame="all">
47269 <tgroup cols="4" colsep="0" rowsep="0">
47270 <colspec colwidth="8*" align="left"/>
47271 <colspec colwidth="6*" align="center"/>
47272 <colspec colwidth="6*" align="center"/>
47273 <colspec colwidth="6*" align="right"/>
47274 <tbody>
47275 <row>
47276 <entry><option>tls_certificate</option></entry>
47277 <entry>Use: <emphasis>smtp</emphasis></entry>
47278 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47279 <entry>Default: <emphasis>unset</emphasis></entry>
47280 </row>
47281 </tbody>
47282 </tgroup>
47283 </informaltable>
47284 <para>
47285 <indexterm role="concept">
47286 <primary>TLS</primary>
47287 <secondary>client certificate, location of</secondary>
47288 </indexterm>
47289 <indexterm role="concept">
47290 <primary>certificate</primary>
47291 <secondary>client, location of</secondary>
47292 </indexterm>
47293 <indexterm role="variable">
47294 <primary><varname>$host</varname></primary>
47295 </indexterm>
47296 <indexterm role="variable">
47297 <primary><varname>$host_address</varname></primary>
47298 </indexterm>
47299 The value of this option must be the absolute path to a file which contains the
47300 client&#x2019;s certificate, for possible use when sending a message over an encrypted
47301 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
47302 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
47303 details of TLS.
47304 </para>
47305 <para>
47306 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
47307 certificate when sending messages as a client. The global option of the same
47308 name specifies the certificate for Exim as a server; it is not automatically
47309 assumed that the same certificate should be used when Exim is operating as a
47310 client.
47311 </para>
47312 <para>
47313 <indexterm role="option">
47314 <primary><option>tls_crl</option></primary>
47315 </indexterm>
47316 </para>
47317 <informaltable frame="all">
47318 <tgroup cols="4" colsep="0" rowsep="0">
47319 <colspec colwidth="8*" align="left"/>
47320 <colspec colwidth="6*" align="center"/>
47321 <colspec colwidth="6*" align="center"/>
47322 <colspec colwidth="6*" align="right"/>
47323 <tbody>
47324 <row>
47325 <entry><option>tls_crl</option></entry>
47326 <entry>Use: <emphasis>smtp</emphasis></entry>
47327 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47328 <entry>Default: <emphasis>unset</emphasis></entry>
47329 </row>
47330 </tbody>
47331 </tgroup>
47332 </informaltable>
47333 <para>
47334 <indexterm role="concept">
47335 <primary>TLS</primary>
47336 <secondary>client certificate revocation list</secondary>
47337 </indexterm>
47338 <indexterm role="concept">
47339 <primary>certificate</primary>
47340 <secondary>revocation list for client</secondary>
47341 </indexterm>
47342 This option specifies a certificate revocation list. The expanded value must
47343 be the name of a file that contains a CRL in PEM format.
47344 </para>
47345 <para>
47346 <indexterm role="option">
47347 <primary><option>tls_dh_min_bits</option></primary>
47348 </indexterm>
47349 </para>
47350 <informaltable frame="all">
47351 <tgroup cols="4" colsep="0" rowsep="0">
47352 <colspec colwidth="8*" align="left"/>
47353 <colspec colwidth="6*" align="center"/>
47354 <colspec colwidth="6*" align="center"/>
47355 <colspec colwidth="6*" align="right"/>
47356 <tbody>
47357 <row>
47358 <entry><option>tls_dh_min_bits</option></entry>
47359 <entry>Use: <emphasis>smtp</emphasis></entry>
47360 <entry>Type: <emphasis>integer</emphasis></entry>
47361 <entry>Default: <emphasis>1024</emphasis></entry>
47362 </row>
47363 </tbody>
47364 </tgroup>
47365 </informaltable>
47366 <para>
47367 <indexterm role="concept">
47368 <primary>TLS</primary>
47369 <secondary>Diffie-Hellman minimum acceptable size</secondary>
47370 </indexterm>
47371 When establishing a TLS session, if a ciphersuite which uses Diffie-Hellman
47372 key agreement is negotiated, the server will provide a large prime number
47373 for use.  This option establishes the minimum acceptable size of that number.
47374 If the parameter offered by the server is too small, then the TLS handshake
47375 will fail.
47376 </para>
47377 <para>
47378 Only supported when using GnuTLS.
47379 </para>
47380 <para>
47381 <indexterm role="option">
47382 <primary><option>tls_privatekey</option></primary>
47383 </indexterm>
47384 </para>
47385 <informaltable frame="all">
47386 <tgroup cols="4" colsep="0" rowsep="0">
47387 <colspec colwidth="8*" align="left"/>
47388 <colspec colwidth="6*" align="center"/>
47389 <colspec colwidth="6*" align="center"/>
47390 <colspec colwidth="6*" align="right"/>
47391 <tbody>
47392 <row>
47393 <entry><option>tls_privatekey</option></entry>
47394 <entry>Use: <emphasis>smtp</emphasis></entry>
47395 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47396 <entry>Default: <emphasis>unset</emphasis></entry>
47397 </row>
47398 </tbody>
47399 </tgroup>
47400 </informaltable>
47401 <para>
47402 <indexterm role="concept">
47403 <primary>TLS</primary>
47404 <secondary>client private key, location of</secondary>
47405 </indexterm>
47406 <indexterm role="variable">
47407 <primary><varname>$host</varname></primary>
47408 </indexterm>
47409 <indexterm role="variable">
47410 <primary><varname>$host_address</varname></primary>
47411 </indexterm>
47412 The value of this option must be the absolute path to a file which contains the
47413 client&#x2019;s private key. This is used when sending a message over an encrypted
47414 connection using a client certificate. The values of <varname>$host</varname> and
47415 <varname>$host_address</varname> are set to the name and address of the server during the
47416 expansion. If this option is unset, or the expansion is forced to fail, or the
47417 result is an empty string, the private key is assumed to be in the same file as
47418 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
47419 </para>
47420 <para>
47421 <indexterm role="option">
47422 <primary><option>tls_require_ciphers</option></primary>
47423 </indexterm>
47424 </para>
47425 <informaltable frame="all">
47426 <tgroup cols="4" colsep="0" rowsep="0">
47427 <colspec colwidth="8*" align="left"/>
47428 <colspec colwidth="6*" align="center"/>
47429 <colspec colwidth="6*" align="center"/>
47430 <colspec colwidth="6*" align="right"/>
47431 <tbody>
47432 <row>
47433 <entry><option>tls_require_ciphers</option></entry>
47434 <entry>Use: <emphasis>smtp</emphasis></entry>
47435 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47436 <entry>Default: <emphasis>unset</emphasis></entry>
47437 </row>
47438 </tbody>
47439 </tgroup>
47440 </informaltable>
47441 <para>
47442 <indexterm role="concept">
47443 <primary>TLS</primary>
47444 <secondary>requiring specific ciphers</secondary>
47445 </indexterm>
47446 <indexterm role="concept">
47447 <primary>cipher</primary>
47448 <secondary>requiring specific</secondary>
47449 </indexterm>
47450 <indexterm role="variable">
47451 <primary><varname>$host</varname></primary>
47452 </indexterm>
47453 <indexterm role="variable">
47454 <primary><varname>$host_address</varname></primary>
47455 </indexterm>
47456 The value of this option must be a list of permitted cipher suites, for use
47457 when setting up an outgoing encrypted connection. (There is a global option of
47458 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
47459 <varname>$host_address</varname> are set to the name and address of the server during the
47460 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
47461 is used in different ways by OpenSSL and GnuTLS (see sections
47462 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
47463 ciphers is a preference order.
47464 </para>
47465 <para>
47466 <indexterm role="option">
47467 <primary><option>tls_sni</option></primary>
47468 </indexterm>
47469 </para>
47470 <informaltable frame="all">
47471 <tgroup cols="4" colsep="0" rowsep="0">
47472 <colspec colwidth="8*" align="left"/>
47473 <colspec colwidth="6*" align="center"/>
47474 <colspec colwidth="6*" align="center"/>
47475 <colspec colwidth="6*" align="right"/>
47476 <tbody>
47477 <row>
47478 <entry><option>tls_sni</option></entry>
47479 <entry>Use: <emphasis>smtp</emphasis></entry>
47480 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47481 <entry>Default: <emphasis>unset</emphasis></entry>
47482 </row>
47483 </tbody>
47484 </tgroup>
47485 </informaltable>
47486 <para>
47487 <indexterm role="concept">
47488 <primary>TLS</primary>
47489 <secondary>Server Name Indication</secondary>
47490 </indexterm>
47491 <indexterm role="variable">
47492 <primary><varname>$tls_sni</varname></primary>
47493 </indexterm>
47494 If this option is set then it sets the $tls_out_sni variable and causes any
47495 TLS session to pass this value as the Server Name Indication extension to
47496 the remote side, which can be used by the remote side to select an appropriate
47497 certificate and private key for the session.
47498 </para>
47499 <para>
47500 See <xref linkend="SECTtlssni"/> for more information.
47501 </para>
47502 <para>
47503 Note that for OpenSSL, this feature requires a build of OpenSSL that supports
47504 TLS extensions.
47505 </para>
47506 <para>
47507 <indexterm role="option">
47508 <primary><option>tls_tempfail_tryclear</option></primary>
47509 </indexterm>
47510 </para>
47511 <informaltable frame="all">
47512 <tgroup cols="4" colsep="0" rowsep="0">
47513 <colspec colwidth="8*" align="left"/>
47514 <colspec colwidth="6*" align="center"/>
47515 <colspec colwidth="6*" align="center"/>
47516 <colspec colwidth="6*" align="right"/>
47517 <tbody>
47518 <row>
47519 <entry><option>tls_tempfail_tryclear</option></entry>
47520 <entry>Use: <emphasis>smtp</emphasis></entry>
47521 <entry>Type: <emphasis>boolean</emphasis></entry>
47522 <entry>Default: <emphasis>true</emphasis></entry>
47523 </row>
47524 </tbody>
47525 </tgroup>
47526 </informaltable>
47527 <para>
47528 <indexterm role="concept">
47529 <primary>4<emphasis>xx</emphasis> responses</primary>
47530 <secondary>to STARTTLS</secondary>
47531 </indexterm>
47532 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
47533 setting up a TLS session, this option determines whether or not Exim should try
47534 to deliver the message unencrypted. If it is set false, delivery to the
47535 current host is deferred; if there are other hosts, they are tried. If this
47536 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
47537 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
47538 TLS negotiation fails, Exim closes the current connection (because it is in an
47539 unknown state), opens a new one to the same host, and then tries the delivery
47540 in clear.
47541 </para>
47542 <para>
47543 <indexterm role="option">
47544 <primary><option>tls_try_verify_hosts</option></primary>
47545 </indexterm>
47546 </para>
47547 <informaltable frame="all">
47548 <tgroup cols="4" colsep="0" rowsep="0">
47549 <colspec colwidth="8*" align="left"/>
47550 <colspec colwidth="6*" align="center"/>
47551 <colspec colwidth="6*" align="center"/>
47552 <colspec colwidth="6*" align="right"/>
47553 <tbody>
47554 <row>
47555 <entry><option>tls_try_verify_hosts</option></entry>
47556 <entry>Use: <emphasis>smtp</emphasis></entry>
47557 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47558 <entry>Default: <emphasis>*</emphasis></entry>
47559 </row>
47560 </tbody>
47561 </tgroup>
47562 </informaltable>
47563 <para>
47564 <indexterm role="concept">
47565 <primary>TLS</primary>
47566 <secondary>server certificate verification</secondary>
47567 </indexterm>
47568 <indexterm role="concept">
47569 <primary>certificate</primary>
47570 <secondary>verification of server</secondary>
47571 </indexterm>
47572 This option gives a list of hosts for which, on encrypted connections,
47573 certificate verification will be tried but need not succeed.
47574 The <option>tls_verify_certificates</option> option must also be set.
47575 Note that unless the host is in this list
47576 TLS connections will be denied to hosts using self-signed certificates
47577 when <option>tls_verify_certificates</option> is matched.
47578 The <varname>$tls_out_certificate_verified</varname> variable is set when
47579 certificate verification succeeds.
47580 </para>
47581 <para>
47582 <indexterm role="option">
47583 <primary><option>tls_verify_cert_hostnames</option></primary>
47584 </indexterm>
47585 </para>
47586 <informaltable frame="all">
47587 <tgroup cols="4" colsep="0" rowsep="0">
47588 <colspec colwidth="8*" align="left"/>
47589 <colspec colwidth="6*" align="center"/>
47590 <colspec colwidth="6*" align="center"/>
47591 <colspec colwidth="6*" align="right"/>
47592 <tbody>
47593 <row>
47594 <entry><option>tls_verify_cert_hostnames</option></entry>
47595 <entry>Use: <emphasis>smtp</emphasis></entry>
47596 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47597 <entry>Default: <emphasis>*</emphasis></entry>
47598 </row>
47599 </tbody>
47600 </tgroup>
47601 </informaltable>
47602 <para>
47603 <indexterm role="concept">
47604 <primary>TLS</primary>
47605 <secondary>server certificate hostname verification</secondary>
47606 </indexterm>
47607 <indexterm role="concept">
47608 <primary>certificate</primary>
47609 <secondary>verification of server</secondary>
47610 </indexterm>
47611 This option give a list of hosts for which,
47612 while verifying the server certificate,
47613 checks will be included on the host name
47614 (note that this will generally be the result of a DNS MX lookup)
47615 versus Subject and Subject-Alternate-Name fields.  Wildcard names are permitted
47616 limited to being the initial component of a 3-or-more component FQDN.
47617 </para>
47618 <para>
47619 There is no equivalent checking on client certificates.
47620 </para>
47621 <para>
47622 <indexterm role="option">
47623 <primary><option>tls_verify_certificates</option></primary>
47624 </indexterm>
47625 </para>
47626 <informaltable frame="all">
47627 <tgroup cols="4" colsep="0" rowsep="0">
47628 <colspec colwidth="8*" align="left"/>
47629 <colspec colwidth="6*" align="center"/>
47630 <colspec colwidth="6*" align="center"/>
47631 <colspec colwidth="6*" align="right"/>
47632 <tbody>
47633 <row>
47634 <entry><option>tls_verify_certificates</option></entry>
47635 <entry>Use: <emphasis>smtp</emphasis></entry>
47636 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47637 <entry>Default: <emphasis>system</emphasis></entry>
47638 </row>
47639 </tbody>
47640 </tgroup>
47641 </informaltable>
47642 <para>
47643 <indexterm role="concept">
47644 <primary>TLS</primary>
47645 <secondary>server certificate verification</secondary>
47646 </indexterm>
47647 <indexterm role="concept">
47648 <primary>certificate</primary>
47649 <secondary>verification of server</secondary>
47650 </indexterm>
47651 <indexterm role="variable">
47652 <primary><varname>$host</varname></primary>
47653 </indexterm>
47654 <indexterm role="variable">
47655 <primary><varname>$host_address</varname></primary>
47656 </indexterm>
47657 The value of this option must be either the
47658 word "system"
47659 or the absolute path to
47660 a file or directory containing permitted certificates for servers,
47661 for use when setting up an encrypted connection.
47662 </para>
47663 <para>
47664 The "system" value for the option will use a location compiled into the SSL library.
47665 This is not available for GnuTLS versions preceding 3.0.20; a value of "system"
47666 is taken as empty and an explicit location
47667 must be specified.
47668 </para>
47669 <para>
47670 The use of a directory for the option value is not available for GnuTLS versions
47671 preceding 3.3.6 and a single file must be used.
47672 </para>
47673 <para>
47674 With OpenSSL the certificates specified
47675 explicitly
47676 either by file or directory
47677 are added to those given by the system default location.
47678 </para>
47679 <para>
47680 The values of <varname>$host</varname> and
47681 <varname>$host_address</varname> are set to the name and address of the server during the
47682 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
47683 </para>
47684 <para>
47685 For back-compatibility,
47686 if neither tls_verify_hosts nor tls_try_verify_hosts are set
47687 (a single-colon empty list counts as being set)
47688 and certificate verification fails the TLS connection is closed.
47689 </para>
47690 <para>
47691 <indexterm role="option">
47692 <primary><option>tls_verify_hosts</option></primary>
47693 </indexterm>
47694 </para>
47695 <informaltable frame="all">
47696 <tgroup cols="4" colsep="0" rowsep="0">
47697 <colspec colwidth="8*" align="left"/>
47698 <colspec colwidth="6*" align="center"/>
47699 <colspec colwidth="6*" align="center"/>
47700 <colspec colwidth="6*" align="right"/>
47701 <tbody>
47702 <row>
47703 <entry><option>tls_verify_hosts</option></entry>
47704 <entry>Use: <emphasis>smtp</emphasis></entry>
47705 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47706 <entry>Default: <emphasis>unset</emphasis></entry>
47707 </row>
47708 </tbody>
47709 </tgroup>
47710 </informaltable>
47711 <para>
47712 <indexterm role="concept">
47713 <primary>TLS</primary>
47714 <secondary>server certificate verification</secondary>
47715 </indexterm>
47716 <indexterm role="concept">
47717 <primary>certificate</primary>
47718 <secondary>verification of server</secondary>
47719 </indexterm>
47720 This option gives a list of hosts for which, on encrypted connections,
47721 certificate verification must succeed.
47722 The <option>tls_verify_certificates</option> option must also be set.
47723 If both this option and <option>tls_try_verify_hosts</option> are unset
47724 operation is as if this option selected all hosts.
47725 </para>
47726 </section>
47727 <section id="SECTvalhosmax">
47728 <title>How the limits for the number of hosts to try are used</title>
47729 <para>
47730 <indexterm role="concept">
47731 <primary>host</primary>
47732 <secondary>maximum number to try</secondary>
47733 </indexterm>
47734 <indexterm role="concept">
47735 <primary>limit</primary>
47736 <secondary>hosts; maximum number tried</secondary>
47737 </indexterm>
47738 There are two options that are concerned with the number of hosts that are
47739 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
47740 <option>hosts_max_try_hardlimit</option>.
47741 </para>
47742 <para>
47743 The <option>hosts_max_try</option> option limits the number of hosts that are tried
47744 for a single delivery. However, despite the term <quote>host</quote> in its name, the
47745 option actually applies to each IP address independently. In other words, a
47746 multihomed host is treated as several independent hosts, just as it is for
47747 retrying.
47748 </para>
47749 <para>
47750 Many of the larger ISPs have multiple MX records which often point to
47751 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
47752 created as a result of routing one of these domains.
47753 </para>
47754 <para>
47755 Trying every single IP address on such a long list does not seem sensible; if
47756 several at the top of the list fail, it is reasonable to assume there is some
47757 problem that is likely to affect all of them. Roughly speaking, the value of
47758 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
47759 delivery. However, the logic cannot be quite that simple.
47760 </para>
47761 <para>
47762 Firstly, IP addresses that are skipped because their retry times have not
47763 arrived do not count, and in addition, addresses that are past their retry
47764 limits are also not counted, even when they are tried. This means that when
47765 some IP addresses are past their retry limits, more than the value of
47766 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
47767 that all IP addresses are considered before timing out an email address (but
47768 see below for an exception).
47769 </para>
47770 <para>
47771 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
47772 list to see if there is a subsequent host with a different (higher valued) MX.
47773 If there is, that host is considered next, and the current IP address is used
47774 but not counted. This behaviour helps in the case of a domain with a retry rule
47775 that hardly ever delays any hosts, as is now explained:
47776 </para>
47777 <para>
47778 Consider the case of a long list of hosts with one MX value, and a few with a
47779 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
47780 hosts at the top of the list are tried at first. With the default retry rule,
47781 which specifies increasing retry times, the higher MX hosts are eventually
47782 tried when those at the top of the list are skipped because they have not
47783 reached their retry times.
47784 </para>
47785 <para>
47786 However, it is common practice to put a fixed short retry time on domains for
47787 large ISPs, on the grounds that their servers are rarely down for very long.
47788 Unfortunately, these are exactly the domains that tend to resolve to long lists
47789 of hosts. The short retry time means that the lowest MX hosts are tried every
47790 time. The attempts may be in a different order because of random sorting, but
47791 without the special MX check, the higher MX hosts would never be tried until
47792 all the lower MX hosts had timed out (which might be several days), because
47793 there are always some lower MX hosts that have reached their retry times. With
47794 the special check, Exim considers at least one IP address from each MX value at
47795 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
47796 reached.
47797 </para>
47798 <para>
47799 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
47800 particular, Exim normally eventually tries all the IP addresses before timing
47801 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
47802 reasonable thing to do. Recently, however, some lunatic DNS configurations have
47803 been set up with hundreds of IP addresses for some domains. It can
47804 take a very long time indeed for an address to time out in these cases.
47805 </para>
47806 <para>
47807 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
47808 Exim never tries more than this number of IP addresses; if it hits this limit
47809 and they are all timed out, the email address is bounced, even though not all
47810 possible IP addresses have been tried.
47811 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
47812 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
47813 </para>
47814 </section>
47815 </chapter>
47816
47817 <chapter id="CHAPrewrite">
47818 <title>Address rewriting</title>
47819 <para>
47820 <indexterm role="concept" id="IIDaddrew" class="startofrange">
47821 <primary>rewriting</primary>
47822 <secondary>addresses</secondary>
47823 </indexterm>
47824 There are some circumstances in which Exim automatically rewrites domains in
47825 addresses. The two most common are when an address is given without a domain
47826 (referred to as an <quote>unqualified address</quote>) or when an address contains an
47827 abbreviated domain that is expanded by DNS lookup.
47828 </para>
47829 <para>
47830 Unqualified envelope addresses are accepted only for locally submitted
47831 messages, or for messages that are received from hosts matching
47832 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
47833 appropriate. Unqualified addresses in header lines are qualified if they are in
47834 locally submitted messages, or messages from hosts that are permitted to send
47835 unqualified envelope addresses. Otherwise, unqualified addresses in header
47836 lines are neither qualified nor rewritten.
47837 </para>
47838 <para>
47839 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
47840 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
47841 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
47842 do this. The new RFCs do not contain this suggestion.
47843 </para>
47844 <section id="SECID147">
47845 <title>Explicitly configured address rewriting</title>
47846 <para>
47847 This chapter describes the rewriting rules that can be used in the
47848 main rewrite section of the configuration file, and also in the generic
47849 <option>headers_rewrite</option> option that can be set on any transport.
47850 </para>
47851 <para>
47852 Some people believe that configured address rewriting is a Mortal Sin.
47853 Others believe that life is not possible without it. Exim provides the
47854 facility; you do not have to use it.
47855 </para>
47856 <para>
47857 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
47858 configuration file are applied to addresses in incoming messages, both envelope
47859 addresses and addresses in header lines. Each rule specifies the types of
47860 address to which it applies.
47861 </para>
47862 <para>
47863 Whether or not addresses in header lines are rewritten depends on the origin of
47864 the headers and the type of rewriting. Global rewriting, that is, rewriting
47865 rules from the rewrite section of the configuration file, is applied only to
47866 those headers that were received with the message. Header lines that are added
47867 by ACLs or by a system filter or by individual routers or transports (which
47868 are specific to individual recipient addresses) are not rewritten by the global
47869 rules.
47870 </para>
47871 <para>
47872 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
47873 applies all headers except those added by routers and transports. That is, as
47874 well as the headers that were received with the message, it also applies to
47875 headers that were added by an ACL or a system filter.
47876 </para>
47877 <para>
47878 In general, rewriting addresses from your own system or domain has some
47879 legitimacy. Rewriting other addresses should be done only with great care and
47880 in special circumstances. The author of Exim believes that rewriting should be
47881 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
47882 Although it can sometimes be used as a routing tool, this is very strongly
47883 discouraged.
47884 </para>
47885 <para>
47886 There are two commonly encountered circumstances where rewriting is used, as
47887 illustrated by these examples:
47888 </para>
47889 <itemizedlist>
47890 <listitem>
47891 <para>
47892 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
47893 exchange mail with each other behind a firewall, but there is only a single
47894 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
47895 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
47896 </para>
47897 </listitem>
47898 <listitem>
47899 <para>
47900 A host rewrites the local parts of its own users so that, for example,
47901 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
47902 </para>
47903 </listitem>
47904 </itemizedlist>
47905 </section>
47906 <section id="SECID148">
47907 <title>When does rewriting happen?</title>
47908 <para>
47909 <indexterm role="concept">
47910 <primary>rewriting</primary>
47911 <secondary>timing of</secondary>
47912 </indexterm>
47913 <indexterm role="concept">
47914 <primary>access control lists (ACLs)</primary>
47915 <secondary>rewriting addresses in</secondary>
47916 </indexterm>
47917 Configured address rewriting can take place at several different stages of a
47918 message&#x2019;s processing.
47919 </para>
47920 <para>
47921 <indexterm role="variable">
47922 <primary><varname>$sender_address</varname></primary>
47923 </indexterm>
47924 At the start of an ACL for MAIL, the sender address may have been rewritten
47925 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
47926 ordinary rewrite rules have yet been applied. If, however, the sender address
47927 is verified in the ACL, it is rewritten before verification, and remains
47928 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
47929 rewritten address. This also applies if sender verification happens in a
47930 RCPT ACL. Otherwise, when the sender address is not verified, it is
47931 rewritten as soon as a message&#x2019;s header lines have been received.
47932 </para>
47933 <para>
47934 <indexterm role="variable">
47935 <primary><varname>$domain</varname></primary>
47936 </indexterm>
47937 <indexterm role="variable">
47938 <primary><varname>$local_part</varname></primary>
47939 </indexterm>
47940 Similarly, at the start of an ACL for RCPT, the current recipient&#x2019;s address
47941 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
47942 rewrite rules have yet been applied to it. However, the behaviour is different
47943 from the sender address when a recipient is verified. The address is rewritten
47944 for the verification, but the rewriting is not remembered at this stage. The
47945 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
47946 as they were before (that is, they contain the unrewritten &ndash; except for
47947 SMTP-time rewriting &ndash; address).
47948 </para>
47949 <para>
47950 As soon as a message&#x2019;s header lines have been received, all the envelope
47951 recipient addresses are permanently rewritten, and rewriting is also applied to
47952 the addresses in the header lines (if configured). This happens before adding
47953 any header lines that were specified in MAIL or RCPT ACLs, and
47954 <indexterm role="concept">
47955 <primary><function>local_scan()</function> function</primary>
47956 <secondary>address rewriting; timing of</secondary>
47957 </indexterm>
47958 before the DATA ACL and <function>local_scan()</function> functions are run.
47959 </para>
47960 <para>
47961 When an address is being routed, either for delivery or for verification,
47962 rewriting is applied immediately to child addresses that are generated by
47963 redirection, unless <option>no_rewrite</option> is set on the router.
47964 </para>
47965 <para>
47966 <indexterm role="concept">
47967 <primary>envelope sender</primary>
47968 <secondary>rewriting at transport time</secondary>
47969 </indexterm>
47970 <indexterm role="concept">
47971 <primary>rewriting</primary>
47972 <secondary>at transport time</secondary>
47973 </indexterm>
47974 <indexterm role="concept">
47975 <primary>header lines</primary>
47976 <secondary>rewriting at transport time</secondary>
47977 </indexterm>
47978 At transport time, additional rewriting of addresses in header lines can be
47979 specified by setting the generic <option>headers_rewrite</option> option on a transport.
47980 This option contains rules that are identical in form to those in the rewrite
47981 section of the configuration file. They are applied to the original message
47982 header lines and any that were added by ACLs or a system filter. They are not
47983 applied to header lines that are added by routers or the transport.
47984 </para>
47985 <para>
47986 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
47987 transport option. However, it is not possible to rewrite envelope recipients at
47988 transport time.
47989 </para>
47990 </section>
47991 <section id="SECID149">
47992 <title>Testing the rewriting rules that apply on input</title>
47993 <para>
47994 <indexterm role="concept">
47995 <primary>rewriting</primary>
47996 <secondary>testing</secondary>
47997 </indexterm>
47998 <indexterm role="concept">
47999 <primary>testing</primary>
48000 <secondary>rewriting</secondary>
48001 </indexterm>
48002 Exim&#x2019;s input rewriting configuration appears in a part of the run time
48003 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
48004 <option>-brw</option> command line option. This takes an address (which can be a full RFC
48005 2822 address) as its argument. The output is a list of how the address would be
48006 transformed by the rewriting rules for each of the different places it might
48007 appear in an incoming message, that is, for each different header and for the
48008 envelope sender and recipient fields. For example,
48009 </para>
48010 <literallayout class="monospaced">
48011 exim -brw ph10@exim.workshop.example
48012 </literallayout>
48013 <para>
48014 might produce the output
48015 </para>
48016 <literallayout class="monospaced">
48017 sender: Philip.Hazel@exim.workshop.example
48018 from: Philip.Hazel@exim.workshop.example
48019 to: ph10@exim.workshop.example
48020 cc: ph10@exim.workshop.example
48021 bcc: ph10@exim.workshop.example
48022 reply-to: Philip.Hazel@exim.workshop.example
48023 env-from: Philip.Hazel@exim.workshop.example
48024 env-to: ph10@exim.workshop.example
48025 </literallayout>
48026 <para>
48027 which shows that rewriting has been set up for that address when used in any of
48028 the source fields, but not when it appears as a recipient address. At the
48029 present time, there is no equivalent way of testing rewriting rules that are
48030 set for a particular transport.
48031 </para>
48032 </section>
48033 <section id="SECID150">
48034 <title>Rewriting rules</title>
48035 <para>
48036 <indexterm role="concept">
48037 <primary>rewriting</primary>
48038 <secondary>rules</secondary>
48039 </indexterm>
48040 The rewrite section of the configuration file consists of lines of rewriting
48041 rules in the form
48042 </para>
48043 <literallayout>
48044 &lt;<emphasis>source pattern</emphasis>&gt;  &lt;<emphasis>replacement</emphasis>&gt;  &lt;<emphasis>flags</emphasis>&gt;
48045 </literallayout>
48046 <para>
48047 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
48048 transport option are given as a colon-separated list. Each item in the list
48049 takes the same form as a line in the main rewriting configuration (except that
48050 any colons must be doubled, of course).
48051 </para>
48052 <para>
48053 The formats of source patterns and replacement strings are described below.
48054 Each is terminated by white space, unless enclosed in double quotes, in which
48055 case normal quoting conventions apply inside the quotes. The flags are single
48056 characters which may appear in any order. Spaces and tabs between them are
48057 ignored.
48058 </para>
48059 <para>
48060 For each address that could potentially be rewritten, the rules are scanned in
48061 order, and replacements for the address from earlier rules can themselves be
48062 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
48063 </para>
48064 <para>
48065 The order in which addresses are rewritten is undefined, may change between
48066 releases, and must not be relied on, with one exception: when a message is
48067 received, the envelope sender is always rewritten first, before any header
48068 lines are rewritten. For example, the replacement string for a rewrite of an
48069 address in <emphasis>To:</emphasis> must not assume that the message&#x2019;s address in <emphasis>From:</emphasis> has
48070 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
48071 that the envelope sender has already been rewritten.
48072 </para>
48073 <para>
48074 <indexterm role="variable">
48075 <primary><varname>$domain</varname></primary>
48076 </indexterm>
48077 <indexterm role="variable">
48078 <primary><varname>$local_part</varname></primary>
48079 </indexterm>
48080 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
48081 string to refer to the address that is being rewritten. Note that lookup-driven
48082 rewriting can be done by a rule of the form
48083 </para>
48084 <literallayout class="monospaced">
48085 *@*   ${lookup ...
48086 </literallayout>
48087 <para>
48088 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
48089 refer to the address that is being rewritten.
48090 </para>
48091 </section>
48092 <section id="SECID151">
48093 <title>Rewriting patterns</title>
48094 <para>
48095 <indexterm role="concept">
48096 <primary>rewriting</primary>
48097 <secondary>patterns</secondary>
48098 </indexterm>
48099 <indexterm role="concept">
48100 <primary>address list</primary>
48101 <secondary>in a rewriting pattern</secondary>
48102 </indexterm>
48103 The source pattern in a rewriting rule is any item which may appear in an
48104 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
48105 single-item address list, which means that it is expanded before being tested
48106 against the address. As always, if you use a regular expression as a pattern,
48107 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
48108 facility to suppress string expansion within the regular expression.
48109 </para>
48110 <para>
48111 Domains in patterns should be given in lower case. Local parts in patterns are
48112 case-sensitive. If you want to do case-insensitive matching of local parts, you
48113 can use a regular expression that starts with <literal>^(?i)</literal>.
48114 </para>
48115 <para>
48116 <indexterm role="concept">
48117 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
48118 <secondary>in rewriting rules</secondary>
48119 </indexterm>
48120 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
48121 depending on the type of match which occurred. These can be used in the
48122 replacement string to insert portions of the incoming address. <varname>$0</varname> always
48123 refers to the complete incoming address. When a regular expression is used, the
48124 numerical variables are set from its capturing subexpressions. For other types
48125 of pattern they are set as follows:
48126 </para>
48127 <itemizedlist>
48128 <listitem>
48129 <para>
48130 If a local part or domain starts with an asterisk, the numerical variables
48131 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
48132 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
48133 pattern
48134 </para>
48135 <literallayout class="monospaced">
48136 *queen@*.fict.example
48137 </literallayout>
48138 <para>
48139 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
48140 </para>
48141 <literallayout class="monospaced">
48142 $0 = hearts-queen@wonderland.fict.example
48143 $1 = hearts-
48144 $2 = wonderland
48145 </literallayout>
48146 <para>
48147 Note that if the local part does not start with an asterisk, but the domain
48148 does, it is <varname>$1</varname> that contains the wild part of the domain.
48149 </para>
48150 </listitem>
48151 <listitem>
48152 <para>
48153 If the domain part of the pattern is a partial lookup, the wild and fixed parts
48154 of the domain are placed in the next available numerical variables. Suppose,
48155 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
48156 rewriting rule of the form
48157 </para>
48158 <literallayout>
48159 <literal>*@partial-dbm;/some/dbm/file</literal>    &lt;<emphasis>replacement string</emphasis>&gt;
48160 </literallayout>
48161 <para>
48162 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
48163 </para>
48164 <literallayout class="monospaced">
48165 $1 = foo
48166 $2 = bar
48167 $3 = baz.example
48168 </literallayout>
48169 <para>
48170 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
48171 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
48172 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
48173 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
48174 whole domain. For non-partial domain lookups, no numerical variables are set.
48175 </para>
48176 </listitem>
48177 </itemizedlist>
48178 </section>
48179 <section id="SECID152">
48180 <title>Rewriting replacements</title>
48181 <para>
48182 <indexterm role="concept">
48183 <primary>rewriting</primary>
48184 <secondary>replacements</secondary>
48185 </indexterm>
48186 If the replacement string for a rule is a single asterisk, addresses that
48187 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
48188 rewriting rules are scanned. For example,
48189 </para>
48190 <literallayout class="monospaced">
48191 hatta@lookingglass.fict.example  *  f
48192 </literallayout>
48193 <para>
48194 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
48195 <emphasis>From:</emphasis> headers.
48196 </para>
48197 <para>
48198 <indexterm role="variable">
48199 <primary><varname>$domain</varname></primary>
48200 </indexterm>
48201 <indexterm role="variable">
48202 <primary><varname>$local_part</varname></primary>
48203 </indexterm>
48204 If the replacement string is not a single asterisk, it is expanded, and must
48205 yield a fully qualified address. Within the expansion, the variables
48206 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
48207 Any letters they contain retain their original case &ndash; they are not lower
48208 cased. The numerical variables are set up according to the type of pattern that
48209 matched the address, as described above. If the expansion is forced to fail by
48210 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
48211 current rule is abandoned, but subsequent rules may take effect. Any other
48212 expansion failure causes the entire rewriting operation to be abandoned, and an
48213 entry written to the panic log.
48214 </para>
48215 </section>
48216 <section id="SECID153">
48217 <title>Rewriting flags</title>
48218 <para>
48219 There are three different kinds of flag that may appear on rewriting rules:
48220 </para>
48221 <itemizedlist>
48222 <listitem>
48223 <para>
48224 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
48225 c, f, h, r, s, t.
48226 </para>
48227 </listitem>
48228 <listitem>
48229 <para>
48230 A flag that specifies rewriting at SMTP time: S.
48231 </para>
48232 </listitem>
48233 <listitem>
48234 <para>
48235 Flags that control the rewriting process: Q, q, R, w.
48236 </para>
48237 </listitem>
48238 </itemizedlist>
48239 <para>
48240 For rules that are part of the <option>headers_rewrite</option> generic transport option,
48241 E, F, T, and S are not permitted.
48242 </para>
48243 </section>
48244 <section id="SECID154">
48245 <title>Flags specifying which headers and envelope addresses to rewrite</title>
48246 <para>
48247 <indexterm role="concept">
48248 <primary>rewriting</primary>
48249 <secondary>flags</secondary>
48250 </indexterm>
48251 If none of the following flag letters, nor the <quote>S</quote> flag (see section
48252 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
48253 and to both the sender and recipient fields of the envelope, whereas a
48254 transport-time rewriting rule just applies to all headers. Otherwise, the
48255 rewriting rule is skipped unless the relevant addresses are being processed.
48256 </para>
48257 <literallayout>
48258 <literal>E</literal>       rewrite all envelope fields
48259 <literal>F</literal>       rewrite the envelope From field
48260 <literal>T</literal>       rewrite the envelope To field
48261 <literal>b</literal>       rewrite the <emphasis>Bcc:</emphasis> header
48262 <literal>c</literal>       rewrite the <emphasis>Cc:</emphasis> header
48263 <literal>f</literal>       rewrite the <emphasis>From:</emphasis> header
48264 <literal>h</literal>       rewrite all headers
48265 <literal>r</literal>       rewrite the <emphasis>Reply-To:</emphasis> header
48266 <literal>s</literal>       rewrite the <emphasis>Sender:</emphasis> header
48267 <literal>t</literal>       rewrite the <emphasis>To:</emphasis> header
48268 </literallayout>
48269 <para>
48270 "All headers" means all of the headers listed above that can be selected
48271 individually, plus their <emphasis>Resent-</emphasis> versions. It does not include
48272 other headers such as <emphasis>Subject:</emphasis> etc.
48273 </para>
48274 <para>
48275 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
48276 restrict this to special known cases in your own domains.
48277 </para>
48278 </section>
48279 <section id="SECTrewriteS">
48280 <title>The SMTP-time rewriting flag</title>
48281 <para>
48282 <indexterm role="concept">
48283 <primary>SMTP</primary>
48284 <secondary>rewriting malformed addresses</secondary>
48285 </indexterm>
48286 <indexterm role="concept">
48287 <primary>RCPT</primary>
48288 <secondary>rewriting argument of</secondary>
48289 </indexterm>
48290 <indexterm role="concept">
48291 <primary>MAIL</primary>
48292 <secondary>rewriting argument of</secondary>
48293 </indexterm>
48294 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
48295 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
48296 before any other processing; even before syntax checking. The pattern is
48297 required to be a regular expression, and it is matched against the whole of the
48298 data for the command, including any surrounding angle brackets.
48299 </para>
48300 <para>
48301 <indexterm role="variable">
48302 <primary><varname>$domain</varname></primary>
48303 </indexterm>
48304 <indexterm role="variable">
48305 <primary><varname>$local_part</varname></primary>
48306 </indexterm>
48307 This form of rewrite rule allows for the handling of addresses that are not
48308 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
48309 input). Because the input is not required to be a syntactically valid address,
48310 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
48311 expansion of the replacement string. The result of rewriting replaces the
48312 original address in the MAIL or RCPT command.
48313 </para>
48314 </section>
48315 <section id="SECID155">
48316 <title>Flags controlling the rewriting process</title>
48317 <para>
48318 There are four flags which control the way the rewriting process works. These
48319 take effect only when a rule is invoked, that is, when the address is of the
48320 correct type (matches the flags) and matches the pattern:
48321 </para>
48322 <itemizedlist>
48323 <listitem>
48324 <para>
48325 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
48326 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
48327 absence of <quote>Q</quote> the rewritten address must always include a domain.
48328 </para>
48329 </listitem>
48330 <listitem>
48331 <para>
48332 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
48333 even if no rewriting actually takes place because of a <quote>fail</quote> in the
48334 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
48335 (does not match the flags) or does not match the pattern.
48336 </para>
48337 </listitem>
48338 <listitem>
48339 <para>
48340 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
48341 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
48342 rewriting once it fails to match (after at least one successful rewrite).
48343 </para>
48344 </listitem>
48345 <listitem>
48346 <para>
48347 <indexterm role="concept">
48348 <primary>rewriting</primary>
48349 <secondary>whole addresses</secondary>
48350 </indexterm>
48351 When an address in a header is rewritten, the rewriting normally applies only
48352 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
48353 left unchanged. For example, rewriting might change
48354 </para>
48355 <literallayout class="monospaced">
48356 From: Ford Prefect &lt;fp42@restaurant.hitch.fict.example&gt;
48357 </literallayout>
48358 <para>
48359 into
48360 </para>
48361 <literallayout class="monospaced">
48362 From: Ford Prefect &lt;prefectf@hitch.fict.example&gt;
48363 </literallayout>
48364 <para>
48365 <indexterm role="concept">
48366 <primary>RFC 2047</primary>
48367 </indexterm>
48368 Sometimes there is a need to replace the whole address item, and this can be
48369 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
48370 causes an address in a header line to be rewritten, the entire address is
48371 replaced, not just the working part. The replacement must be a complete RFC
48372 2822 address, including the angle brackets if necessary. If text outside angle
48373 brackets contains a character whose value is greater than 126 or less than 32
48374 (except for tab), the text is encoded according to RFC 2047. The character set
48375 is taken from <option>headers_charset</option>, which gets its default at build time.
48376 </para>
48377 <para>
48378 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
48379 rewritten, all but the working part of the replacement address is discarded.
48380 </para>
48381 </listitem>
48382 </itemizedlist>
48383 </section>
48384 <section id="SECID156">
48385 <title>Rewriting examples</title>
48386 <para>
48387 Here is an example of the two common rewriting paradigms:
48388 </para>
48389 <literallayout class="monospaced">
48390 *@*.hitch.fict.example  $1@hitch.fict.example
48391 *@hitch.fict.example    ${lookup{$1}dbm{/etc/realnames}\
48392                      {$value}fail}@hitch.fict.example bctfrF
48393 </literallayout>
48394 <para>
48395 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
48396 the string expansion to fail if the lookup does not succeed. In this context it
48397 has the effect of leaving the original address unchanged, but Exim goes on to
48398 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
48399 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
48400 explicitly, which would cause the rewritten address to be the same as before,
48401 at the cost of a small bit of processing. Not supplying either of these is an
48402 error, since the rewritten address would then contain no local part.
48403 </para>
48404 <para>
48405 The first example above replaces the domain with a superior, more general
48406 domain. This may not be desirable for certain local parts. If the rule
48407 </para>
48408 <literallayout class="monospaced">
48409 root@*.hitch.fict.example  *
48410 </literallayout>
48411 <para>
48412 were inserted before the first rule, rewriting would be suppressed for the
48413 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
48414 </para>
48415 <para>
48416 Rewriting can be made conditional on a number of tests, by making use of
48417 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
48418 messages that originate outside the local host:
48419 </para>
48420 <literallayout class="monospaced">
48421 *@*.hitch.fict.example  "${if !eq {$sender_host_address}{}\
48422                          {$1@hitch.fict.example}fail}"
48423 </literallayout>
48424 <para>
48425 The replacement string is quoted in this example because it contains white
48426 space.
48427 </para>
48428 <para>
48429 <indexterm role="concept">
48430 <primary>rewriting</primary>
48431 <secondary>bang paths</secondary>
48432 </indexterm>
48433 <indexterm role="concept">
48434 <primary>bang paths</primary>
48435 <secondary>rewriting</secondary>
48436 </indexterm>
48437 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
48438 an address it treats it as an unqualified local part which it qualifies with
48439 the local qualification domain (if the source of the message is local or if the
48440 remote host is permitted to send unqualified addresses). Rewriting can
48441 sometimes be used to handle simple bang paths with a fixed number of
48442 components. For example, the rule
48443 </para>
48444 <literallayout class="monospaced">
48445 \N^([^!]+)!(.*)@your.domain.example$\N   $2@$1
48446 </literallayout>
48447 <para>
48448 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
48449 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
48450 a global rewriting rule for envelope addresses. It can provide a backdoor
48451 method for using your system as a relay, because the incoming addresses appear
48452 to be local. If the bang path addresses are received via SMTP, it is safer to
48453 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
48454 can be done on the rewritten addresses.
48455 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
48456 </para>
48457 </section>
48458 </chapter>
48459
48460 <chapter id="CHAPretry">
48461 <title>Retry configuration</title>
48462 <para>
48463 <indexterm role="concept" id="IIDretconf1" class="startofrange">
48464 <primary>retry</primary>
48465 <secondary>configuration, description of</secondary>
48466 </indexterm>
48467 <indexterm role="concept" id="IIDregconf2" class="startofrange">
48468 <primary>configuration file</primary>
48469 <secondary>retry section</secondary>
48470 </indexterm>
48471 The <quote>retry</quote> section of the runtime configuration file contains a list of
48472 retry rules that control how often Exim tries to deliver messages that cannot
48473 be delivered at the first attempt. If there are no retry rules (the section is
48474 empty or not present), there are no retries. In this situation, temporary
48475 errors are treated as permanent. The default configuration contains a single,
48476 general-purpose retry rule (see section <xref linkend="SECID57"/>). The <option>-brt</option> command
48477 line option can be used to test which retry rule will be used for a given
48478 address, domain and error.
48479 </para>
48480 <para>
48481 The most common cause of retries is temporary failure to deliver to a remote
48482 host because the host is down, or inaccessible because of a network problem.
48483 Exim&#x2019;s retry processing in this case is applied on a per-host (strictly, per IP
48484 address) basis, not on a per-message basis. Thus, if one message has recently
48485 been delayed, delivery of a new message to the same host is not immediately
48486 tried, but waits for the host&#x2019;s retry time to arrive. If the <option>retry_defer</option>
48487 log selector is set, the message
48488 <indexterm role="concept">
48489 <primary>retry</primary>
48490 <secondary>time not reached</secondary>
48491 </indexterm>
48492 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
48493 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
48494 the handling of errors during remote deliveries.
48495 </para>
48496 <para>
48497 Retry processing applies to routing as well as to delivering, except as covered
48498 in the next paragraph. The retry rules do not distinguish between these
48499 actions. It is not possible, for example, to specify different behaviour for
48500 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
48501 the host <emphasis>snark.fict.example</emphasis>. I didn&#x2019;t think anyone would ever need this
48502 added complication, so did not implement it. However, although they share the
48503 same retry rule, the actual retry times for routing and transporting a given
48504 domain are maintained independently.
48505 </para>
48506 <para>
48507 When a delivery is not part of a queue run (typically an immediate delivery on
48508 receipt of a message), the routers are always run, and local deliveries are
48509 always attempted, even if retry times are set for them. This makes for better
48510 behaviour if one particular message is causing problems (for example, causing
48511 quota overflow, or provoking an error in a filter file). If such a delivery
48512 suffers a temporary failure, the retry data is updated as normal, and
48513 subsequent delivery attempts from queue runs occur only when the retry time for
48514 the local address is reached.
48515 </para>
48516 <section id="SECID157">
48517 <title>Changing retry rules</title>
48518 <para>
48519 If you change the retry rules in your configuration, you should consider
48520 whether or not to delete the retry data that is stored in Exim&#x2019;s spool area in
48521 files with names like <filename>db/retry</filename>. Deleting any of Exim&#x2019;s hints files is
48522 always safe; that is why they are called <quote>hints</quote>.
48523 </para>
48524 <para>
48525 The hints retry data contains suggested retry times based on the previous
48526 rules. In the case of a long-running problem with a remote host, it might
48527 record the fact that the host has timed out. If your new rules increase the
48528 timeout time for such a host, you should definitely remove the old retry data
48529 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
48530 messages that it should now be retaining.
48531 </para>
48532 </section>
48533 <section id="SECID158">
48534 <title>Format of retry rules</title>
48535 <para>
48536 <indexterm role="concept">
48537 <primary>retry</primary>
48538 <secondary>rules</secondary>
48539 </indexterm>
48540 Each retry rule occupies one line and consists of three or four parts,
48541 separated by white space: a pattern, an error name, an optional list of sender
48542 addresses, and a list of retry parameters. The pattern and sender lists must be
48543 enclosed in double quotes if they contain white space. The rules are searched
48544 in order until one is found where the pattern, error name, and sender list (if
48545 present) match the failing host or address, the error that occurred, and the
48546 message&#x2019;s sender, respectively.
48547 </para>
48548 <para>
48549 The pattern is any single item that may appear in an address list (see section
48550 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
48551 which means that it is expanded before being tested against the address that
48552 has been delayed. A negated address list item is permitted. Address
48553 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
48554 which makes it possible for many retry rules to start with just a domain. For
48555 example,
48556 </para>
48557 <literallayout class="monospaced">
48558 lookingglass.fict.example        *  F,24h,30m;
48559 </literallayout>
48560 <para>
48561 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
48562 whereas
48563 </para>
48564 <literallayout class="monospaced">
48565 alice@lookingglass.fict.example  *  F,24h,30m;
48566 </literallayout>
48567 <para>
48568 applies only to temporary failures involving the local part <option>alice</option>.
48569 In practice, almost all rules start with a domain name pattern without a local
48570 part.
48571 </para>
48572 <para>
48573 <indexterm role="concept">
48574 <primary>regular expressions</primary>
48575 <secondary>in retry rules</secondary>
48576 </indexterm>
48577 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a retry rule pattern, it
48578 must match a complete address, not just a domain, because that is how regular
48579 expressions work in address lists.
48580 </para>
48581 <literallayout>
48582 <literal>^\Nxyz\d+\.abc\.example$\N        *  G,1h,10m,2</literal>     <option>Wrong</option>
48583 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N  *  G,1h,10m,2</literal>     <option>Right</option>
48584 </literallayout>
48585 </section>
48586 <section id="SECID159">
48587 <title>Choosing which retry rule to use for address errors</title>
48588 <para>
48589 When Exim is looking for a retry rule after a routing attempt has failed (for
48590 example, after a DNS timeout), each line in the retry configuration is tested
48591 against the complete address only if <option>retry_use_local_part</option> is set for the
48592 router. Otherwise, only the domain is used, except when matching against a
48593 regular expression, when the local part of the address is replaced with <quote>*</quote>.
48594 A domain on its own can match a domain pattern, or a pattern that starts with
48595 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
48596 <option>check_local_user</option> is true, and false for other routers.
48597 </para>
48598 <para>
48599 Similarly, when Exim is looking for a retry rule after a local delivery has
48600 failed (for example, after a mailbox full error), each line in the retry
48601 configuration is tested against the complete address only if
48602 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
48603 local transports).
48604 </para>
48605 <para>
48606 <indexterm role="concept">
48607 <primary>4<emphasis>xx</emphasis> responses</primary>
48608 <secondary>retry rules for</secondary>
48609 </indexterm>
48610 However, when Exim is looking for a retry rule after a remote delivery attempt
48611 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
48612 whole address is always used as the key when searching the retry rules. The
48613 rule that is found is used to create a retry time for the combination of the
48614 failing address and the message&#x2019;s sender. It is the combination of sender and
48615 recipient that is delayed in subsequent queue runs until its retry time is
48616 reached. You can delay the recipient without regard to the sender by setting
48617 <option>address_retry_include_sender</option> false in the <command>smtp</command> transport but this can
48618 lead to problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT
48619 commands.
48620 </para>
48621 </section>
48622 <section id="SECID160">
48623 <title>Choosing which retry rule to use for host and message errors</title>
48624 <para>
48625 For a temporary error that is not related to an individual address (for
48626 example, a connection timeout), each line in the retry configuration is checked
48627 twice. First, the name of the remote host is used as a domain name (preceded by
48628 <quote>*@</quote> when matching a regular expression). If this does not match the line,
48629 the domain from the email address is tried in a similar fashion. For example,
48630 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
48631 </para>
48632 <literallayout class="monospaced">
48633 a.b.c.example  MX  5  x.y.z.example
48634                MX  6  p.q.r.example
48635                MX  7  m.n.o.example
48636 </literallayout>
48637 <para>
48638 and the retry rules are
48639 </para>
48640 <literallayout class="monospaced">
48641 p.q.r.example    *      F,24h,30m;
48642 a.b.c.example    *      F,4d,45m;
48643 </literallayout>
48644 <para>
48645 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
48646 first rule matches neither the host nor the domain, so Exim looks at the second
48647 rule. This does not match the host, but it does match the domain, so it is used
48648 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
48649 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
48650 first retry rule is used, because it matches the host.
48651 </para>
48652 <para>
48653 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
48654 first rule to determine retry times, but for all the other hosts for the domain
48655 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
48656 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
48657 </para>
48658 <para>
48659 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
48660 However, if a message is routed directly to an IP address without the use of a
48661 host name, for example, if a <command>manualroute</command> router contains a setting such as:
48662 </para>
48663 <literallayout class="monospaced">
48664 route_list = *.a.example  192.168.34.23
48665 </literallayout>
48666 <para>
48667 then the <quote>host name</quote> that is used when searching for a retry rule is the
48668 textual form of the IP address.
48669 </para>
48670 </section>
48671 <section id="SECID161">
48672 <title>Retry rules for specific errors</title>
48673 <para>
48674 <indexterm role="concept">
48675 <primary>retry</primary>
48676 <secondary>specific errors; specifying</secondary>
48677 </indexterm>
48678 The second field in a retry rule is the name of a particular error, or an
48679 asterisk, which matches any error. The errors that can be tested for are:
48680 </para>
48681 <variablelist>
48682 <varlistentry>
48683 <term><option>auth_failed</option></term>
48684 <listitem>
48685 <para>
48686 Authentication failed when trying to send to a host in the
48687 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
48688 </para>
48689 </listitem></varlistentry>
48690 <varlistentry>
48691 <term><option>data_4xx</option></term>
48692 <listitem>
48693 <para>
48694 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
48695 after the command, or after sending the message&#x2019;s data.
48696 </para>
48697 </listitem></varlistentry>
48698 <varlistentry>
48699 <term><option>mail_4xx</option></term>
48700 <listitem>
48701 <para>
48702 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
48703 </para>
48704 </listitem></varlistentry>
48705 <varlistentry>
48706 <term><option>rcpt_4xx</option></term>
48707 <listitem>
48708 <para>
48709 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
48710 </para>
48711 </listitem></varlistentry>
48712 </variablelist>
48713 <para>
48714 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x&#x2019;s can be given
48715 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
48716 recognize 452 errors given to RCPT commands for addresses in a certain domain,
48717 and have retries every ten minutes with a one-hour timeout, you could set up a
48718 retry rule of this form:
48719 </para>
48720 <literallayout class="monospaced">
48721 the.domain.name  rcpt_452   F,1h,10m
48722 </literallayout>
48723 <para>
48724 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
48725 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
48726 </para>
48727 <variablelist>
48728 <varlistentry>
48729 <term><option>lost_connection</option></term>
48730 <listitem>
48731 <para>
48732 A server unexpectedly closed the SMTP connection. There may, of course,
48733 legitimate reasons for this (host died, network died), but if it repeats a lot
48734 for the same host, it indicates something odd.
48735 </para>
48736 </listitem></varlistentry>
48737 <varlistentry>
48738 <term><option>lookup</option></term>
48739 <listitem>
48740 <para>
48741 A DNS lookup for a host failed.
48742 Note that a <option>dnslookup</option> router will need to have matched
48743 its <option>fail_defer_domains</option> option for this retry type to be usable.
48744 Also note that a <option>manualroute</option> router will probably need
48745 its <option>host_find_failed</option> option set to <option>defer</option>.
48746 </para>
48747 </listitem></varlistentry>
48748 <varlistentry>
48749 <term><option>refused_MX</option></term>
48750 <listitem>
48751 <para>
48752 A connection to a host obtained from an MX record was refused.
48753 </para>
48754 </listitem></varlistentry>
48755 <varlistentry>
48756 <term><option>refused_A</option></term>
48757 <listitem>
48758 <para>
48759 A connection to a host not obtained from an MX record was refused.
48760 </para>
48761 </listitem></varlistentry>
48762 <varlistentry>
48763 <term><option>refused</option></term>
48764 <listitem>
48765 <para>
48766 A connection was refused.
48767 </para>
48768 </listitem></varlistentry>
48769 <varlistentry>
48770 <term><option>timeout_connect_MX</option></term>
48771 <listitem>
48772 <para>
48773 A connection attempt to a host obtained from an MX record timed out.
48774 </para>
48775 </listitem></varlistentry>
48776 <varlistentry>
48777 <term><option>timeout_connect_A</option></term>
48778 <listitem>
48779 <para>
48780 A connection attempt to a host not obtained from an MX record timed out.
48781 </para>
48782 </listitem></varlistentry>
48783 <varlistentry>
48784 <term><option>timeout_connect</option></term>
48785 <listitem>
48786 <para>
48787 A connection attempt timed out.
48788 </para>
48789 </listitem></varlistentry>
48790 <varlistentry>
48791 <term><option>timeout_MX</option></term>
48792 <listitem>
48793 <para>
48794 There was a timeout while connecting or during an SMTP session with a host
48795 obtained from an MX record.
48796 </para>
48797 </listitem></varlistentry>
48798 <varlistentry>
48799 <term><option>timeout_A</option></term>
48800 <listitem>
48801 <para>
48802 There was a timeout while connecting or during an SMTP session with a host not
48803 obtained from an MX record.
48804 </para>
48805 </listitem></varlistentry>
48806 <varlistentry>
48807 <term><option>timeout</option></term>
48808 <listitem>
48809 <para>
48810 There was a timeout while connecting or during an SMTP session.
48811 </para>
48812 </listitem></varlistentry>
48813 <varlistentry>
48814 <term><option>tls_required</option></term>
48815 <listitem>
48816 <para>
48817 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
48818 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
48819 to STARTTLS, or there was a problem setting up the TLS connection.
48820 </para>
48821 </listitem></varlistentry>
48822 <varlistentry>
48823 <term><option>quota</option></term>
48824 <listitem>
48825 <para>
48826 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
48827 transport.
48828 </para>
48829 </listitem></varlistentry>
48830 <varlistentry>
48831 <term><option>quota_</option>&lt;<emphasis>time</emphasis>&gt;</term>
48832 <listitem>
48833 <para>
48834 <indexterm role="concept">
48835 <primary>quota</primary>
48836 <secondary>error testing in retry rule</secondary>
48837 </indexterm>
48838 <indexterm role="concept">
48839 <primary>retry</primary>
48840 <secondary>quota error testing</secondary>
48841 </indexterm>
48842 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
48843 transport, and the mailbox has not been accessed for &lt;<emphasis>time</emphasis>&gt;. For example,
48844 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
48845 for four days.
48846 </para>
48847 </listitem></varlistentry>
48848 </variablelist>
48849 <para>
48850 <indexterm role="concept">
48851 <primary>mailbox</primary>
48852 <secondary>time of last read</secondary>
48853 </indexterm>
48854 The idea of <option>quota_</option>&lt;<emphasis>time</emphasis>&gt; is to make it possible to have shorter
48855 timeouts when the mailbox is full and is not being read by its owner. Ideally,
48856 it should be based on the last time that the user accessed the mailbox.
48857 However, it is not always possible to determine this. Exim uses the following
48858 heuristic rules:
48859 </para>
48860 <itemizedlist>
48861 <listitem>
48862 <para>
48863 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
48864 used. As no new messages are being delivered (because the mailbox is over
48865 quota), Exim does not access the file, so this is the time of last user access.
48866 </para>
48867 </listitem>
48868 <listitem>
48869 <para>
48870 <indexterm role="concept">
48871 <primary>maildir format</primary>
48872 <secondary>time of last read</secondary>
48873 </indexterm>
48874 For a maildir delivery, the time of last modification of the <filename>new</filename>
48875 subdirectory is used. As the mailbox is over quota, no new files are created in
48876 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
48877 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
48878 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
48879 time that is used is therefore the last time that the user read a new message.
48880 </para>
48881 </listitem>
48882 <listitem>
48883 <para>
48884 For other kinds of multi-file mailbox, the time of last access cannot be
48885 obtained, so a retry rule that uses this type of error field is never matched.
48886 </para>
48887 </listitem>
48888 </itemizedlist>
48889 <para>
48890 The quota errors apply both to system-enforced quotas and to Exim&#x2019;s own quota
48891 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
48892 when a local delivery is deferred because a partition is full (the ENOSPC
48893 error).
48894 </para>
48895 </section>
48896 <section id="SECID162">
48897 <title>Retry rules for specified senders</title>
48898 <para>
48899 <indexterm role="concept">
48900 <primary>retry</primary>
48901 <secondary>rules; sender-specific</secondary>
48902 </indexterm>
48903 You can specify retry rules that apply only when the failing message has a
48904 specific sender. In particular, this can be used to define retry rules that
48905 apply only to bounce messages. The third item in a retry rule can be of this
48906 form:
48907 </para>
48908 <literallayout>
48909 <literal>senders=</literal>&lt;<emphasis>address list</emphasis>&gt;
48910 </literallayout>
48911 <para>
48912 The retry timings themselves are then the fourth item. For example:
48913 </para>
48914 <literallayout class="monospaced">
48915 *   rcpt_4xx   senders=:   F,1h,30m
48916 </literallayout>
48917 <para>
48918 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
48919 host. If the address list contains white space, it must be enclosed in quotes.
48920 For example:
48921 </para>
48922 <literallayout class="monospaced">
48923 a.domain  rcpt_452  senders="xb.dom : yc.dom"  G,8h,10m,1.5
48924 </literallayout>
48925 <para>
48926 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
48927 (which do not depend on the recipient). The reason is that the sender is used
48928 only to match the retry rule. Once the rule has been found for a host error,
48929 its contents are used to set a retry time for the host, and this will apply to
48930 all messages, not just those with specific senders.
48931 </para>
48932 <para>
48933 When testing retry rules using <option>-brt</option>, you can supply a sender using the
48934 <option>-f</option> command line option, like this:
48935 </para>
48936 <literallayout class="monospaced">
48937 exim -f "" -brt user@dom.ain
48938 </literallayout>
48939 <para>
48940 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
48941 list is never matched.
48942 </para>
48943 </section>
48944 <section id="SECID163">
48945 <title>Retry parameters</title>
48946 <para>
48947 <indexterm role="concept">
48948 <primary>retry</primary>
48949 <secondary>parameters in rules</secondary>
48950 </indexterm>
48951 The third (or fourth, if a senders list is present) field in a retry rule is a
48952 sequence of retry parameter sets, separated by semicolons. Each set consists of
48953 </para>
48954 <literallayout>
48955 &lt;<emphasis>letter</emphasis>&gt;,&lt;<emphasis>cutoff time</emphasis>&gt;,&lt;<emphasis>arguments</emphasis>&gt;
48956 </literallayout>
48957 <para>
48958 The letter identifies the algorithm for computing a new retry time; the cutoff
48959 time is the time beyond which this algorithm no longer applies, and the
48960 arguments vary the algorithm&#x2019;s action. The cutoff time is measured from the
48961 time that the first failure for the domain (combined with the local part if
48962 relevant) was detected, not from the time the message was received.
48963 </para>
48964 <para>
48965 <indexterm role="concept">
48966 <primary>retry</primary>
48967 <secondary>algorithms</secondary>
48968 </indexterm>
48969 <indexterm role="concept">
48970 <primary>retry</primary>
48971 <secondary>fixed intervals</secondary>
48972 </indexterm>
48973 <indexterm role="concept">
48974 <primary>retry</primary>
48975 <secondary>increasing intervals</secondary>
48976 </indexterm>
48977 <indexterm role="concept">
48978 <primary>retry</primary>
48979 <secondary>random intervals</secondary>
48980 </indexterm>
48981 The available algorithms are:
48982 </para>
48983 <itemizedlist>
48984 <listitem>
48985 <para>
48986 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
48987 the interval.
48988 </para>
48989 </listitem>
48990 <listitem>
48991 <para>
48992 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
48993 specifies a starting value for the interval, and the second a multiplier, which
48994 is used to increase the size of the interval at each retry.
48995 </para>
48996 </listitem>
48997 <listitem>
48998 <para>
48999 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
49000 retry, the previous interval is multiplied by the factor in order to get a
49001 maximum for the next interval. The minimum interval is the first argument of
49002 the parameter, and an actual interval is chosen randomly between them. Such a
49003 rule has been found to be helpful in cluster configurations when all the
49004 members of the cluster restart at once, and may therefore synchronize their
49005 queue processing times.
49006 </para>
49007 </listitem>
49008 </itemizedlist>
49009 <para>
49010 When computing the next retry time, the algorithm definitions are scanned in
49011 order until one whose cutoff time has not yet passed is reached. This is then
49012 used to compute a new retry time that is later than the current time. In the
49013 case of fixed interval retries, this simply means adding the interval to the
49014 current time. For geometrically increasing intervals, retry intervals are
49015 computed from the rule&#x2019;s parameters until one that is greater than the previous
49016 interval is found. The main configuration variable
49017 <indexterm role="concept">
49018 <primary>limit</primary>
49019 <secondary>retry interval</secondary>
49020 </indexterm>
49021 <indexterm role="concept">
49022 <primary>retry</primary>
49023 <secondary>interval, maximum</secondary>
49024 </indexterm>
49025 <indexterm role="option">
49026 <primary><option>retry_interval_max</option></primary>
49027 </indexterm>
49028 <option>retry_interval_max</option> limits the maximum interval between retries. It
49029 cannot be set greater than <literal>24h</literal>, which is its default value.
49030 </para>
49031 <para>
49032 A single remote domain may have a number of hosts associated with it, and each
49033 host may have more than one IP address. Retry algorithms are selected on the
49034 basis of the domain name, but are applied to each IP address independently. If,
49035 for example, a host has two IP addresses and one is unusable, Exim will
49036 generate retry times for it and will not try to use it until its next retry
49037 time comes. Thus the good IP address is likely to be tried first most of the
49038 time.
49039 </para>
49040 <para>
49041 <indexterm role="concept">
49042 <primary>hints database</primary>
49043 <secondary>use for retrying</secondary>
49044 </indexterm>
49045 Retry times are hints rather than promises. Exim does not make any attempt to
49046 run deliveries exactly at the computed times. Instead, a queue runner process
49047 starts delivery processes for delayed messages periodically, and these attempt
49048 new deliveries only for those addresses that have passed their next retry time.
49049 If a new message arrives for a deferred address, an immediate delivery attempt
49050 occurs only if the address has passed its retry time. In the absence of new
49051 messages, the minimum time between retries is the interval between queue runner
49052 processes. There is not much point in setting retry times of five minutes if
49053 your queue runners happen only once an hour, unless there are a significant
49054 number of incoming messages (which might be the case on a system that is
49055 sending everything to a smart host, for example).
49056 </para>
49057 <para>
49058 The data in the retry hints database can be inspected by using the
49059 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
49060 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
49061 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
49062 are for the hosts associated with a particular mail domain, and also for local
49063 deliveries that have been deferred.
49064 </para>
49065 </section>
49066 <section id="SECID164">
49067 <title>Retry rule examples</title>
49068 <para>
49069 Here are some example retry rules:
49070 </para>
49071 <literallayout class="monospaced">
49072 alice@wonderland.fict.example quota_5d  F,7d,3h
49073 wonderland.fict.example       quota_5d
49074 wonderland.fict.example       *         F,1h,15m; G,2d,1h,2;
49075 lookingglass.fict.example     *         F,24h,30m;
49076 *                 refused_A   F,2h,20m;
49077 *                 *           F,2h,15m; G,16h,1h,1.5; F,5d,8h
49078 </literallayout>
49079 <para>
49080 The first rule sets up special handling for mail to
49081 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
49082 mailbox has not been read for at least 5 days. Retries continue every three
49083 hours for 7 days. The second rule handles over-quota errors for all other local
49084 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
49085 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
49086 fail are bounced immediately if the mailbox has not been read for at least 5
49087 days.
49088 </para>
49089 <para>
49090 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
49091 happen every 15 minutes for an hour, then with geometrically increasing
49092 intervals until two days have passed since a delivery first failed. After the
49093 first hour there is a delay of one hour, then two hours, then four hours, and
49094 so on (this is a rather extreme example).
49095 </para>
49096 <para>
49097 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
49098 They happen every 30 minutes for 24 hours only. The remaining two rules handle
49099 all other domains, with special action for connection refusal from hosts that
49100 were not obtained from an MX record.
49101 </para>
49102 <para>
49103 The final rule in a retry configuration should always have asterisks in the
49104 first two fields so as to provide a general catch-all for any addresses that do
49105 not have their own special handling. This example tries every 15 minutes for 2
49106 hours, then with intervals starting at one hour and increasing by a factor of
49107 1.5 up to 16 hours, then every 8 hours up to 5 days.
49108 </para>
49109 </section>
49110 <section id="SECID165">
49111 <title>Timeout of retry data</title>
49112 <para>
49113 <indexterm role="concept">
49114 <primary>timeout</primary>
49115 <secondary>of retry data</secondary>
49116 </indexterm>
49117 <indexterm role="option">
49118 <primary><option>retry_data_expire</option></primary>
49119 </indexterm>
49120 <indexterm role="concept">
49121 <primary>hints database</primary>
49122 <secondary>data expiry</secondary>
49123 </indexterm>
49124 <indexterm role="concept">
49125 <primary>retry</primary>
49126 <secondary>timeout of data</secondary>
49127 </indexterm>
49128 Exim timestamps the data that it writes to its retry hints database. When it
49129 consults the data during a delivery it ignores any that is older than the value
49130 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn&#x2019;t
49131 been tried for 7 days, Exim will try to deliver to it immediately a message
49132 arrives, and if that fails, it will calculate a retry time as if it were
49133 failing for the first time.
49134 </para>
49135 <para>
49136 This improves the behaviour for messages routed to rarely-used hosts such as MX
49137 backups. If such a host was down at one time, and happens to be down again when
49138 Exim tries a month later, using the old retry data would imply that it had been
49139 down all the time, which is not a justified assumption.
49140 </para>
49141 <para>
49142 If a host really is permanently dead, this behaviour causes a burst of retries
49143 every now and again, but only if messages routed to it are rare. If there is a
49144 message at least once every 7 days the retry data never expires.
49145 </para>
49146 </section>
49147 <section id="SECID166">
49148 <title>Long-term failures</title>
49149 <para>
49150 <indexterm role="concept">
49151 <primary>delivery failure, long-term</primary>
49152 </indexterm>
49153 <indexterm role="concept">
49154 <primary>retry</primary>
49155 <secondary>after long-term failure</secondary>
49156 </indexterm>
49157 Special processing happens when an email address has been failing for so long
49158 that the cutoff time for the last algorithm is reached. For example, using the
49159 default retry rule:
49160 </para>
49161 <literallayout class="monospaced">
49162 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
49163 </literallayout>
49164 <para>
49165 the cutoff time is four days. Reaching the retry cutoff is independent of how
49166 long any specific message has been failing; it is the length of continuous
49167 failure for the recipient address that counts.
49168 </para>
49169 <para>
49170 When the cutoff time is reached for a local delivery, or for all the IP
49171 addresses associated with a remote delivery, a subsequent delivery failure
49172 causes Exim to give up on the address, and a bounce message is generated.
49173 In order to cater for new messages that use the failing address, a next retry
49174 time is still computed from the final algorithm, and is used as follows:
49175 </para>
49176 <para>
49177 For local deliveries, one delivery attempt is always made for any subsequent
49178 messages. If this delivery fails, the address fails immediately. The
49179 post-cutoff retry time is not used.
49180 </para>
49181 <para>
49182 If the delivery is remote, there are two possibilities, controlled by the
49183 <indexterm role="option">
49184 <primary><option>delay_after_cutoff</option></primary>
49185 </indexterm>
49186 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
49187 default. Until the post-cutoff retry time for one of the IP addresses is
49188 reached, the failing email address is bounced immediately, without a delivery
49189 attempt taking place. After that time, one new delivery attempt is made to
49190 those IP addresses that are past their retry times, and if that still fails,
49191 the address is bounced and new retry times are computed.
49192 </para>
49193 <para>
49194 In other words, when all the hosts for a given email address have been failing
49195 for a long time, Exim bounces rather then defers until one of the hosts&#x2019; retry
49196 times is reached. Then it tries once, and bounces if that attempt fails. This
49197 behaviour ensures that few resources are wasted in repeatedly trying to deliver
49198 to a broken destination, but if the host does recover, Exim will eventually
49199 notice.
49200 </para>
49201 <para>
49202 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
49203 addresses are past their final cutoff time, Exim tries to deliver to those IP
49204 addresses that have not been tried since the message arrived. If there are
49205 no suitable IP addresses, or if they all fail, the address is bounced. In other
49206 words, it does not delay when a new message arrives, but tries the expired
49207 addresses immediately, unless they have been tried since the message arrived.
49208 If there is a continuous stream of messages for the failing domains, setting
49209 <option>delay_after_cutoff</option> false means that there will be many more attempts to
49210 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
49211 true.
49212 </para>
49213 </section>
49214 <section id="SECID167">
49215 <title>Deliveries that work intermittently</title>
49216 <para>
49217 <indexterm role="concept">
49218 <primary>retry</primary>
49219 <secondary>intermittently working deliveries</secondary>
49220 </indexterm>
49221 Some additional logic is needed to cope with cases where a host is
49222 intermittently available, or when a message has some attribute that prevents
49223 its delivery when others to the same address get through. In this situation,
49224 because some messages are successfully delivered, the <quote>retry clock</quote> for the
49225 host or address keeps getting reset by the successful deliveries, and so
49226 failing messages remain on the queue for ever because the cutoff time is never
49227 reached.
49228 </para>
49229 <para>
49230 Two exceptional actions are applied to prevent this happening. The first
49231 applies to errors that are related to a message rather than a remote host.
49232 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
49233 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
49234 commands, and quota failures. For this type of error, if a message&#x2019;s arrival
49235 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
49236 is used when scanning the retry rules to decide when to try next and when to
49237 time out the address.
49238 </para>
49239 <para>
49240 The exceptional second action applies in all cases. If a message has been on
49241 the queue for longer than the cutoff time of any applicable retry rule for a
49242 given address, a delivery is attempted for that address, even if it is not yet
49243 time, and if this delivery fails, the address is timed out. A new retry time is
49244 not computed in this case, so that other messages for the same address are
49245 considered immediately.
49246 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
49247 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
49248 </para>
49249 </section>
49250 </chapter>
49251
49252 <chapter id="CHAPSMTPAUTH">
49253 <title>SMTP authentication</title>
49254 <para>
49255 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
49256 <primary>SMTP</primary>
49257 <secondary>authentication configuration</secondary>
49258 </indexterm>
49259 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
49260 <primary>authentication</primary>
49261 </indexterm>
49262 The <quote>authenticators</quote> section of Exim&#x2019;s run time configuration is concerned
49263 with SMTP authentication. This facility is an extension to the SMTP protocol,
49264 described in RFC 2554, which allows a client SMTP host to authenticate itself
49265 to a server. This is a common way for a server to recognize clients that are
49266 permitted to use it as a relay. SMTP authentication is not of relevance to the
49267 transfer of mail between servers that have no managerial connection with each
49268 other.
49269 </para>
49270 <para>
49271 <indexterm role="concept">
49272 <primary>AUTH</primary>
49273 <secondary>description of</secondary>
49274 </indexterm>
49275 Very briefly, the way SMTP authentication works is as follows:
49276 </para>
49277 <itemizedlist>
49278 <listitem>
49279 <para>
49280 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
49281 the client&#x2019;s EHLO command.
49282 </para>
49283 </listitem>
49284 <listitem>
49285 <para>
49286 The client issues an AUTH command, naming a specific mechanism. The command
49287 may, optionally, contain some authentication data.
49288 </para>
49289 </listitem>
49290 <listitem>
49291 <para>
49292 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
49293 appropriate responses. In simple authentication mechanisms, the challenges are
49294 just prompts for user names and passwords. The server does not have to issue
49295 any challenges &ndash; in some mechanisms the relevant data may all be transmitted
49296 with the AUTH command.
49297 </para>
49298 </listitem>
49299 <listitem>
49300 <para>
49301 The server either accepts or denies authentication.
49302 </para>
49303 </listitem>
49304 <listitem>
49305 <para>
49306 If authentication succeeds, the client may optionally make use of the AUTH
49307 option on the MAIL command to pass an authenticated sender in subsequent
49308 mail transactions. Authentication lasts for the remainder of the SMTP
49309 connection.
49310 </para>
49311 </listitem>
49312 <listitem>
49313 <para>
49314 If authentication fails, the client may give up, or it may try a different
49315 authentication mechanism, or it may try transferring mail over the
49316 unauthenticated connection.
49317 </para>
49318 </listitem>
49319 </itemizedlist>
49320 <para>
49321 If you are setting up a client, and want to know which authentication
49322 mechanisms the server supports, you can use Telnet to connect to port 25 (the
49323 SMTP port) on the server, and issue an EHLO command. The response to this
49324 includes the list of supported mechanisms. For example:
49325 </para>
49326 <literallayout>
49327 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
49328 <literal>Trying 192.168.34.25...</literal>
49329 <literal>Connected to server.example.</literal>
49330 <literal>Escape character is &#x0027;^]&#x0027;.</literal>
49331 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
49332 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
49333 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
49334 <literal>250-SIZE 52428800</literal>
49335 <literal>250-PIPELINING</literal>
49336 <literal>250-AUTH PLAIN</literal>
49337 <literal>250 HELP</literal>
49338 </literallayout>
49339 <para>
49340 The second-last line of this example output shows that the server supports
49341 authentication using the PLAIN mechanism. In Exim, the different authentication
49342 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
49343 routers and transports, which authenticators are included in the binary is
49344 controlled by build-time definitions. The following are currently available,
49345 included by setting
49346 </para>
49347 <literallayout class="monospaced">
49348 AUTH_CRAM_MD5=yes
49349 AUTH_CYRUS_SASL=yes
49350 AUTH_DOVECOT=yes
49351 AUTH_GSASL=yes
49352 AUTH_HEIMDAL_GSSAPI=yes
49353 AUTH_PLAINTEXT=yes
49354 AUTH_SPA=yes
49355 AUTH_TLS=yes
49356 </literallayout>
49357 <para>
49358 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
49359 authentication mechanism (RFC 2195), and the second provides an interface to
49360 the Cyrus SASL authentication library.
49361 The third is an interface to Dovecot&#x2019;s authentication system, delegating the
49362 work via a socket interface.
49363 The fourth provides an interface to the GNU SASL authentication library, which
49364 provides mechanisms but typically not data sources.
49365 The fifth provides direct access to Heimdal GSSAPI, geared for Kerberos, but
49366 supporting setting a server keytab.
49367 The sixth can be configured to support
49368 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
49369 not formally documented, but used by several MUAs. The seventh authenticator
49370 supports Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> mechanism.
49371 The eighth is an Exim authenticator but not an SMTP one;
49372 instead it can use information from a TLS negotiation.
49373 </para>
49374 <para>
49375 The authenticators are configured using the same syntax as other drivers (see
49376 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
49377 authentication section need be present in the configuration file. Each
49378 authenticator can in principle have both server and client functions. When Exim
49379 is receiving SMTP mail, it is acting as a server; when it is sending out
49380 messages over SMTP, it is acting as a client. Authenticator configuration
49381 options are provided for use in both these circumstances.
49382 </para>
49383 <para>
49384 To make it clear which options apply to which situation, the prefixes
49385 <option>server_</option> and <option>client_</option> are used on option names that are specific to
49386 either the server or the client function, respectively. Server and client
49387 functions are disabled if none of their options are set. If an authenticator is
49388 to be used for both server and client functions, a single definition, using
49389 both sets of options, is required. For example:
49390 </para>
49391 <literallayout class="monospaced">
49392 cram:
49393   driver = cram_md5
49394   public_name = CRAM-MD5
49395   server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
49396   client_name = ph10
49397   client_secret = secret2
49398 </literallayout>
49399 <para>
49400 The <option>server_</option> option is used when Exim is acting as a server, and the
49401 <option>client_</option> options when it is acting as a client.
49402 </para>
49403 <para>
49404 Descriptions of the individual authenticators are given in subsequent chapters.
49405 The remainder of this chapter covers the generic options for the
49406 authenticators, followed by general discussion of the way authentication works
49407 in Exim.
49408 </para>
49409 <para>
49410 <emphasis role="bold">Beware:</emphasis> the meaning of <varname>$auth1</varname>, <varname>$auth2</varname>, ... varies on a per-driver and
49411 per-mechanism basis.  Please read carefully to determine which variables hold
49412 account labels such as usercodes and which hold passwords or other
49413 authenticating data.
49414 </para>
49415 <para>
49416 Note that some mechanisms support two different identifiers for accounts: the
49417 <emphasis>authentication id</emphasis> and the <emphasis>authorization id</emphasis>.  The contractions <emphasis>authn</emphasis>
49418 and <emphasis>authz</emphasis> are commonly encountered.  The American spelling is standard here.
49419 Conceptually, authentication data such as passwords are tied to the identifier
49420 used to authenticate; servers may have rules to permit one user to act as a
49421 second user, so that after login the session is treated as though that second
49422 user had logged in.  That second user is the <emphasis>authorization id</emphasis>.  A robust
49423 configuration might confirm that the <emphasis>authz</emphasis> field is empty or matches the
49424 <emphasis>authn</emphasis> field.  Often this is just ignored.  The <emphasis>authn</emphasis> can be considered
49425 as verified data, the <emphasis>authz</emphasis> as an unverified request which the server might
49426 choose to honour.
49427 </para>
49428 <para>
49429 A <emphasis>realm</emphasis> is a text string, typically a domain name, presented by a server
49430 to a client to help it select an account and credentials to use.  In some
49431 mechanisms, the client and server provably agree on the realm, but clients
49432 typically can not treat the realm as secure data to be blindly trusted.
49433 </para>
49434 <section id="SECID168">
49435 <title>Generic options for authenticators</title>
49436 <para>
49437 <indexterm role="concept">
49438 <primary>authentication</primary>
49439 <secondary>generic options</secondary>
49440 </indexterm>
49441 <indexterm role="concept">
49442 <primary>options</primary>
49443 <secondary>generic; for authenticators</secondary>
49444 </indexterm>
49445 </para>
49446 <para>
49447 <indexterm role="option">
49448 <primary><option>client_condition</option></primary>
49449 </indexterm>
49450 </para>
49451 <informaltable frame="all">
49452 <tgroup cols="4" colsep="0" rowsep="0">
49453 <colspec colwidth="8*" align="left"/>
49454 <colspec colwidth="6*" align="center"/>
49455 <colspec colwidth="6*" align="center"/>
49456 <colspec colwidth="6*" align="right"/>
49457 <tbody>
49458 <row>
49459 <entry><option>client_condition</option></entry>
49460 <entry>Use: <emphasis>authenticators</emphasis></entry>
49461 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49462 <entry>Default: <emphasis>unset</emphasis></entry>
49463 </row>
49464 </tbody>
49465 </tgroup>
49466 </informaltable>
49467 <para>
49468 When Exim is authenticating as a client, it skips any authenticator whose
49469 <option>client_condition</option> expansion yields <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>. This can be
49470 used, for example, to skip plain text authenticators when the connection is not
49471 encrypted by a setting such as:
49472 </para>
49473 <literallayout class="monospaced">
49474 client_condition = ${if !eq{$tls_out_cipher}{}}
49475 </literallayout>
49476 <para>
49477 <indexterm role="option">
49478 <primary><option>client_set_id</option></primary>
49479 </indexterm>
49480 </para>
49481 <informaltable frame="all">
49482 <tgroup cols="4" colsep="0" rowsep="0">
49483 <colspec colwidth="8*" align="left"/>
49484 <colspec colwidth="6*" align="center"/>
49485 <colspec colwidth="6*" align="center"/>
49486 <colspec colwidth="6*" align="right"/>
49487 <tbody>
49488 <row>
49489 <entry><option>client_set_id</option></entry>
49490 <entry>Use: <emphasis>authenticators</emphasis></entry>
49491 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49492 <entry>Default: <emphasis>unset</emphasis></entry>
49493 </row>
49494 </tbody>
49495 </tgroup>
49496 </informaltable>
49497 <para>
49498 When client authentication succeeds, this condition is expanded; the
49499 result is used in the log lines for outbound messages.
49500 Typically it will be the user name used for authentication.
49501 </para>
49502 <para>
49503 <indexterm role="option">
49504 <primary><option>driver</option></primary>
49505 </indexterm>
49506 </para>
49507 <informaltable frame="all">
49508 <tgroup cols="4" colsep="0" rowsep="0">
49509 <colspec colwidth="8*" align="left"/>
49510 <colspec colwidth="6*" align="center"/>
49511 <colspec colwidth="6*" align="center"/>
49512 <colspec colwidth="6*" align="right"/>
49513 <tbody>
49514 <row>
49515 <entry><option>driver</option></entry>
49516 <entry>Use: <emphasis>authenticators</emphasis></entry>
49517 <entry>Type: <emphasis>string</emphasis></entry>
49518 <entry>Default: <emphasis>unset</emphasis></entry>
49519 </row>
49520 </tbody>
49521 </tgroup>
49522 </informaltable>
49523 <para>
49524 This option must always be set. It specifies which of the available
49525 authenticators is to be used.
49526 </para>
49527 <para>
49528 <indexterm role="option">
49529 <primary><option>public_name</option></primary>
49530 </indexterm>
49531 </para>
49532 <informaltable frame="all">
49533 <tgroup cols="4" colsep="0" rowsep="0">
49534 <colspec colwidth="8*" align="left"/>
49535 <colspec colwidth="6*" align="center"/>
49536 <colspec colwidth="6*" align="center"/>
49537 <colspec colwidth="6*" align="right"/>
49538 <tbody>
49539 <row>
49540 <entry><option>public_name</option></entry>
49541 <entry>Use: <emphasis>authenticators</emphasis></entry>
49542 <entry>Type: <emphasis>string</emphasis></entry>
49543 <entry>Default: <emphasis>unset</emphasis></entry>
49544 </row>
49545 </tbody>
49546 </tgroup>
49547 </informaltable>
49548 <para>
49549 This option specifies the name of the authentication mechanism that the driver
49550 implements, and by which it is known to the outside world. These names should
49551 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
49552 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
49553 defaults to the driver&#x2019;s instance name.
49554 </para>
49555 <para>
49556 <indexterm role="option">
49557 <primary><option>server_advertise_condition</option></primary>
49558 </indexterm>
49559 </para>
49560 <informaltable frame="all">
49561 <tgroup cols="4" colsep="0" rowsep="0">
49562 <colspec colwidth="8*" align="left"/>
49563 <colspec colwidth="6*" align="center"/>
49564 <colspec colwidth="6*" align="center"/>
49565 <colspec colwidth="6*" align="right"/>
49566 <tbody>
49567 <row>
49568 <entry><option>server_advertise_condition</option></entry>
49569 <entry>Use: <emphasis>authenticators</emphasis></entry>
49570 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49571 <entry>Default: <emphasis>unset</emphasis></entry>
49572 </row>
49573 </tbody>
49574 </tgroup>
49575 </informaltable>
49576 <para>
49577 When a server is about to advertise an authentication mechanism, the condition
49578 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
49579 mechanism is not advertised.
49580 If the expansion fails, the mechanism is not advertised. If the failure was not
49581 forced, and was not caused by a lookup defer, the incident is logged.
49582 See section <xref linkend="SECTauthexiser"/> below for further discussion.
49583 </para>
49584 <para>
49585 <indexterm role="option">
49586 <primary><option>server_condition</option></primary>
49587 </indexterm>
49588 </para>
49589 <informaltable frame="all">
49590 <tgroup cols="4" colsep="0" rowsep="0">
49591 <colspec colwidth="8*" align="left"/>
49592 <colspec colwidth="6*" align="center"/>
49593 <colspec colwidth="6*" align="center"/>
49594 <colspec colwidth="6*" align="right"/>
49595 <tbody>
49596 <row>
49597 <entry><option>server_condition</option></entry>
49598 <entry>Use: <emphasis>authenticators</emphasis></entry>
49599 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49600 <entry>Default: <emphasis>unset</emphasis></entry>
49601 </row>
49602 </tbody>
49603 </tgroup>
49604 </informaltable>
49605 <para>
49606 This option must be set for a <option>plaintext</option> server authenticator, where it
49607 is used directly to control authentication. See section <xref linkend="SECTplainserver"/>
49608 for details.
49609 </para>
49610 <para>
49611 For the <command>gsasl</command> authenticator, this option is required for various
49612 mechanisms; see chapter <xref linkend="CHAPgsasl"/> for details.
49613 </para>
49614 <para>
49615 For the other authenticators, <option>server_condition</option> can be used as an additional
49616 authentication or authorization mechanism that is applied after the other
49617 authenticator conditions succeed. If it is set, it is expanded when the
49618 authenticator would otherwise return a success code. If the expansion is forced
49619 to fail, authentication fails. Any other expansion failure causes a temporary
49620 error code to be returned. If the result of a successful expansion is an empty
49621 string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
49622 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds. For any
49623 other result, a temporary error code is returned, with the expanded string as
49624 the error text.
49625 </para>
49626 <para>
49627 <indexterm role="option">
49628 <primary><option>server_debug_print</option></primary>
49629 </indexterm>
49630 </para>
49631 <informaltable frame="all">
49632 <tgroup cols="4" colsep="0" rowsep="0">
49633 <colspec colwidth="8*" align="left"/>
49634 <colspec colwidth="6*" align="center"/>
49635 <colspec colwidth="6*" align="center"/>
49636 <colspec colwidth="6*" align="right"/>
49637 <tbody>
49638 <row>
49639 <entry><option>server_debug_print</option></entry>
49640 <entry>Use: <emphasis>authenticators</emphasis></entry>
49641 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49642 <entry>Default: <emphasis>unset</emphasis></entry>
49643 </row>
49644 </tbody>
49645 </tgroup>
49646 </informaltable>
49647 <para>
49648 If this option is set and authentication debugging is enabled (see the <option>-d</option>
49649 command line option), the string is expanded and included in the debugging
49650 output when the authenticator is run as a server. This can help with checking
49651 out the values of variables.
49652 If expansion of the string fails, the error message is written to the debugging
49653 output, and Exim carries on processing.
49654 </para>
49655 <para>
49656 <indexterm role="option">
49657 <primary><option>server_set_id</option></primary>
49658 </indexterm>
49659 </para>
49660 <informaltable frame="all">
49661 <tgroup cols="4" colsep="0" rowsep="0">
49662 <colspec colwidth="8*" align="left"/>
49663 <colspec colwidth="6*" align="center"/>
49664 <colspec colwidth="6*" align="center"/>
49665 <colspec colwidth="6*" align="right"/>
49666 <tbody>
49667 <row>
49668 <entry><option>server_set_id</option></entry>
49669 <entry>Use: <emphasis>authenticators</emphasis></entry>
49670 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49671 <entry>Default: <emphasis>unset</emphasis></entry>
49672 </row>
49673 </tbody>
49674 </tgroup>
49675 </informaltable>
49676 <para>
49677 <indexterm role="variable">
49678 <primary><varname>$authenticated_id</varname></primary>
49679 </indexterm>
49680 When an Exim server successfully authenticates a client, this string is
49681 expanded using data from the authentication, and preserved for any incoming
49682 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
49683 lines for incoming messages. For example, a user/password authenticator
49684 configuration might preserve the user name that was used to authenticate, and
49685 refer to it subsequently during delivery of the message.
49686 If expansion fails, the option is ignored.
49687 </para>
49688 <para>
49689 <indexterm role="option">
49690 <primary><option>server_mail_auth_condition</option></primary>
49691 </indexterm>
49692 </para>
49693 <informaltable frame="all">
49694 <tgroup cols="4" colsep="0" rowsep="0">
49695 <colspec colwidth="8*" align="left"/>
49696 <colspec colwidth="6*" align="center"/>
49697 <colspec colwidth="6*" align="center"/>
49698 <colspec colwidth="6*" align="right"/>
49699 <tbody>
49700 <row>
49701 <entry><option>server_mail_auth_condition</option></entry>
49702 <entry>Use: <emphasis>authenticators</emphasis></entry>
49703 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49704 <entry>Default: <emphasis>unset</emphasis></entry>
49705 </row>
49706 </tbody>
49707 </tgroup>
49708 </informaltable>
49709 <para>
49710 This option allows a server to discard authenticated sender addresses supplied
49711 as part of MAIL commands in SMTP connections that are authenticated by the
49712 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
49713 as part of the authentication process; instead its (unexpanded) value is
49714 remembered for later use.
49715 How it is used is described in the following section.
49716 </para>
49717 </section>
49718 <section id="SECTauthparamail">
49719 <title>The AUTH parameter on MAIL commands</title>
49720 <para>
49721 <indexterm role="concept">
49722 <primary>authentication</primary>
49723 <secondary>sender; authenticated</secondary>
49724 </indexterm>
49725 <indexterm role="concept">
49726 <primary>AUTH</primary>
49727 <secondary>on MAIL command</secondary>
49728 </indexterm>
49729 When a client supplied an AUTH= item on a MAIL command, Exim applies
49730 the following checks before accepting it as the authenticated sender of the
49731 message:
49732 </para>
49733 <itemizedlist>
49734 <listitem>
49735 <para>
49736 If the connection is not using extended SMTP (that is, HELO was used rather
49737 than EHLO), the use of AUTH= is a syntax error.
49738 </para>
49739 </listitem>
49740 <listitem>
49741 <para>
49742 If the value of the AUTH= parameter is <quote>&lt;&gt;</quote>, it is ignored.
49743 </para>
49744 </listitem>
49745 <listitem>
49746 <para>
49747 <indexterm role="variable">
49748 <primary><varname>$authenticated_sender</varname></primary>
49749 </indexterm>
49750 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
49751 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
49752 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
49753 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
49754 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
49755 given for the MAIL command.
49756 </para>
49757 </listitem>
49758 <listitem>
49759 <para>
49760 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
49761 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
49762 authenticated.
49763 </para>
49764 </listitem>
49765 <listitem>
49766 <para>
49767 If the AUTH= value was accepted by either of the two previous rules, and
49768 the client has authenticated, and the authenticator has a setting for the
49769 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
49770 valued that was saved from the authenticator is expanded. If the expansion
49771 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
49772 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
49773 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
49774 message.
49775 </para>
49776 </listitem>
49777 </itemizedlist>
49778 <para>
49779 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
49780 hosts to which Exim authenticates as a client. Do not confuse this value with
49781 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
49782 process, and which is not usually a complete email address.
49783 </para>
49784 <para>
49785 <indexterm role="variable">
49786 <primary><varname>$sender_address</varname></primary>
49787 </indexterm>
49788 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
49789 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
49790 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
49791 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
49792 ACL is run.
49793 </para>
49794 </section>
49795 <section id="SECTauthexiser">
49796 <title>Authentication on an Exim server</title>
49797 <para>
49798 <indexterm role="concept">
49799 <primary>authentication</primary>
49800 <secondary>on an Exim server</secondary>
49801 </indexterm>
49802 When Exim receives an EHLO command, it advertises the public names of those
49803 authenticators that are configured as servers, subject to the following
49804 conditions:
49805 </para>
49806 <itemizedlist>
49807 <listitem>
49808 <para>
49809 The client host must match <option>auth_advertise_hosts</option> (default *).
49810 </para>
49811 </listitem>
49812 <listitem>
49813 <para>
49814 It the <option>server_advertise_condition</option> option is set, its expansion must not
49815 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
49816 </para>
49817 </listitem>
49818 </itemizedlist>
49819 <para>
49820 The order in which the authenticators are defined controls the order in which
49821 the mechanisms are advertised.
49822 </para>
49823 <para>
49824 Some mail clients (for example, some versions of Netscape) require the user to
49825 provide a name and password for authentication whenever AUTH is advertised,
49826 even though authentication may not in fact be needed (for example, Exim may be
49827 set up to allow unconditional relaying from the client by an IP address check).
49828 You can make such clients more friendly by not advertising AUTH to them.
49829 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
49830 that runs for RCPT) to relay without authentication, you should set
49831 </para>
49832 <literallayout class="monospaced">
49833 auth_advertise_hosts = ! 10.9.8.0/24
49834 </literallayout>
49835 <para>
49836 so that no authentication mechanisms are advertised to them.
49837 </para>
49838 <para>
49839 The <option>server_advertise_condition</option> controls the advertisement of individual
49840 authentication mechanisms. For example, it can be used to restrict the
49841 advertisement of a particular mechanism to encrypted connections, by a setting
49842 such as:
49843 </para>
49844 <literallayout class="monospaced">
49845 server_advertise_condition = ${if eq{$tls_in_cipher}{}{no}{yes}}
49846 </literallayout>
49847 <para>
49848 <indexterm role="variable">
49849 <primary><varname>$tls_in_cipher</varname></primary>
49850 </indexterm>
49851 If the session is encrypted, <varname>$tls_in_cipher</varname> is not empty, and so the expansion
49852 yields <quote>yes</quote>, which allows the advertisement to happen.
49853 </para>
49854 <para>
49855 When an Exim server receives an AUTH command from a client, it rejects it
49856 immediately if AUTH was not advertised in response to an earlier EHLO
49857 command. This is the case if
49858 </para>
49859 <itemizedlist>
49860 <listitem>
49861 <para>
49862 The client host does not match <option>auth_advertise_hosts</option>; or
49863 </para>
49864 </listitem>
49865 <listitem>
49866 <para>
49867 No authenticators are configured with server options; or
49868 </para>
49869 </listitem>
49870 <listitem>
49871 <para>
49872 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
49873 server authenticators.
49874 </para>
49875 </listitem>
49876 </itemizedlist>
49877 <para>
49878 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
49879 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
49880 AUTH is accepted from any client host.
49881 </para>
49882 <para>
49883 If AUTH is not rejected by the ACL, Exim searches its configuration for a
49884 server authentication mechanism that was advertised in response to EHLO and
49885 that matches the one named in the AUTH command. If it finds one, it runs
49886 the appropriate authentication protocol, and authentication either succeeds or
49887 fails. If there is no matching advertised mechanism, the AUTH command is
49888 rejected with a 504 error.
49889 </para>
49890 <para>
49891 <indexterm role="variable">
49892 <primary><varname>$received_protocol</varname></primary>
49893 </indexterm>
49894 <indexterm role="variable">
49895 <primary><varname>$sender_host_authenticated</varname></primary>
49896 </indexterm>
49897 When a message is received from an authenticated host, the value of
49898 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
49899 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
49900 public name) of the authenticator driver that successfully authenticated the
49901 client from which the message was received. This variable is empty if there was
49902 no successful authentication.
49903 </para>
49904 </section>
49905 <section id="SECID169">
49906 <title>Testing server authentication</title>
49907 <para>
49908 <indexterm role="concept">
49909 <primary>authentication</primary>
49910 <secondary>testing a server</secondary>
49911 </indexterm>
49912 <indexterm role="concept">
49913 <primary>AUTH</primary>
49914 <secondary>testing a server</secondary>
49915 </indexterm>
49916 <indexterm role="concept">
49917 <primary>base64 encoding</primary>
49918 <secondary>creating authentication test data</secondary>
49919 </indexterm>
49920 Exim&#x2019;s <option>-bh</option> option can be useful for testing server authentication
49921 configurations. The data for the AUTH command has to be sent using base64
49922 encoding. A quick way to produce such data for testing is the following Perl
49923 script:
49924 </para>
49925 <literallayout class="monospaced">
49926 use MIME::Base64;
49927 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
49928 </literallayout>
49929 <para>
49930 <indexterm role="concept">
49931 <primary>binary zero</primary>
49932 <secondary>in authentication data</secondary>
49933 </indexterm>
49934 This interprets its argument as a Perl string, and then encodes it. The
49935 interpretation as a Perl string allows binary zeros, which are required for
49936 some kinds of authentication, to be included in the data. For example, a
49937 command line to run this script on such data might be
49938 </para>
49939 <literallayout class="monospaced">
49940 encode '\0user\0password'
49941 </literallayout>
49942 <para>
49943 Note the use of single quotes to prevent the shell interpreting the
49944 backslashes, so that they can be interpreted by Perl to specify characters
49945 whose code value is zero.
49946 </para>
49947 <para>
49948 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
49949 digit, you must use three zeros instead of one after the leading backslash. If
49950 you do not, the octal digit that starts your string will be incorrectly
49951 interpreted as part of the code for the first character.
49952 </para>
49953 <para>
49954 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
49955 specially, you must use a Perl escape to prevent them being misinterpreted. For
49956 example, a command such as
49957 </para>
49958 <literallayout class="monospaced">
49959 encode '\0user@domain.com\0pas$$word'
49960 </literallayout>
49961 <para>
49962 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
49963 </para>
49964 <para>
49965 If you have the <option>mimencode</option> command installed, another way to do produce
49966 base64-encoded strings is to run the command
49967 </para>
49968 <literallayout class="monospaced">
49969 echo -e -n `\0user\0password' | mimencode
49970 </literallayout>
49971 <para>
49972 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
49973 in the argument, and the <option>-n</option> option specifies no newline at the end of its
49974 output. However, not all versions of <option>echo</option> recognize these options, so you
49975 should check your version before relying on this suggestion.
49976 </para>
49977 </section>
49978 <section id="SECID170">
49979 <title>Authentication by an Exim client</title>
49980 <para>
49981 <indexterm role="concept">
49982 <primary>authentication</primary>
49983 <secondary>on an Exim client</secondary>
49984 </indexterm>
49985 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
49986 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
49987 announces support for authentication, and the host matches an entry in either
49988 of these options, Exim (as a client) tries to authenticate as follows:
49989 </para>
49990 <itemizedlist>
49991 <listitem>
49992 <para>
49993 For each authenticator that is configured as a client, in the order in which
49994 they are defined in the configuration, it searches the authentication
49995 mechanisms announced by the server for one whose name matches the public name
49996 of the authenticator.
49997 </para>
49998 </listitem>
49999 <listitem>
50000 <para>
50001 <indexterm role="variable">
50002 <primary><varname>$host</varname></primary>
50003 </indexterm>
50004 <indexterm role="variable">
50005 <primary><varname>$host_address</varname></primary>
50006 </indexterm>
50007 When it finds one that matches, it runs the authenticator&#x2019;s client code. The
50008 variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string expansions
50009 that the client might do. They are set to the server&#x2019;s name and IP address. If
50010 any expansion is forced to fail, the authentication attempt is abandoned, and
50011 Exim moves on to the next authenticator. Otherwise an expansion failure causes
50012 delivery to be deferred.
50013 </para>
50014 </listitem>
50015 <listitem>
50016 <para>
50017 If the result of the authentication attempt is a temporary error or a timeout,
50018 Exim abandons trying to send the message to the host for the moment. It will
50019 try again later. If there are any backup hosts available, they are tried in the
50020 usual way.
50021 </para>
50022 </listitem>
50023 <listitem>
50024 <para>
50025 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
50026 carries on searching the list of authenticators and tries another one if
50027 possible. If all authentication attempts give permanent errors, or if there are
50028 no attempts because no mechanisms match (or option expansions force failure),
50029 what happens depends on whether the host matches <option>hosts_require_auth</option> or
50030 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
50031 delivery is deferred. The error can be detected in the retry rules, and thereby
50032 turned into a permanent error if you wish. In the second case, Exim tries to
50033 deliver the message unauthenticated.
50034 </para>
50035 </listitem>
50036 </itemizedlist>
50037 <para>
50038 <indexterm role="concept">
50039 <primary>AUTH</primary>
50040 <secondary>on MAIL command</secondary>
50041 </indexterm>
50042 When Exim has authenticated itself to a remote server, it adds the AUTH
50043 parameter to the MAIL commands it sends, if it has an authenticated sender for
50044 the message. If the message came from a remote host, the authenticated sender
50045 is the one that was receiving on an incoming MAIL command, provided that the
50046 incoming connection was authenticated and the <option>server_mail_auth</option> condition
50047 allowed the authenticated sender to be retained. If a local process calls Exim
50048 to send a message, the sender address that is built from the login name and
50049 <option>qualify_domain</option> is treated as authenticated. However, if the
50050 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
50051 the authenticated sender that was received with the message.
50052 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
50053 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
50054 </para>
50055 </section>
50056 </chapter>
50057
50058 <chapter id="CHAPplaintext">
50059 <title>The plaintext authenticator</title>
50060 <para>
50061 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
50062 <primary><command>plaintext</command> authenticator</primary>
50063 </indexterm>
50064 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
50065 <primary>authenticators</primary>
50066 <secondary><command>plaintext</command></secondary>
50067 </indexterm>
50068 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
50069 LOGIN authentication mechanisms, both of which transfer authentication data as
50070 plain (unencrypted) text (though base64 encoded). The use of plain text is a
50071 security risk; you are strongly advised to insist on the use of SMTP encryption
50072 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
50073 use unencrypted plain text, you should not use the same passwords for SMTP
50074 connections as you do for login accounts.
50075 </para>
50076 <section id="SECID171">
50077 <title>Plaintext options</title>
50078 <para>
50079 <indexterm role="concept">
50080 <primary>options</primary>
50081 <secondary><command>plaintext</command> authenticator (server)</secondary>
50082 </indexterm>
50083 When configured as a server, <command>plaintext</command> uses the following options:
50084 </para>
50085 <para>
50086 <indexterm role="option">
50087 <primary><option>server_condition</option></primary>
50088 </indexterm>
50089 </para>
50090 <informaltable frame="all">
50091 <tgroup cols="4" colsep="0" rowsep="0">
50092 <colspec colwidth="8*" align="left"/>
50093 <colspec colwidth="6*" align="center"/>
50094 <colspec colwidth="6*" align="center"/>
50095 <colspec colwidth="6*" align="right"/>
50096 <tbody>
50097 <row>
50098 <entry><option>server_condition</option></entry>
50099 <entry>Use: <emphasis>authenticators</emphasis></entry>
50100 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50101 <entry>Default: <emphasis>unset</emphasis></entry>
50102 </row>
50103 </tbody>
50104 </tgroup>
50105 </informaltable>
50106 <para>
50107 This is actually a global authentication option, but it must be set in order to
50108 configure the <command>plaintext</command> driver as a server. Its use is described below.
50109 </para>
50110 <para>
50111 <indexterm role="option">
50112 <primary><option>server_prompts</option></primary>
50113 </indexterm>
50114 </para>
50115 <informaltable frame="all">
50116 <tgroup cols="4" colsep="0" rowsep="0">
50117 <colspec colwidth="8*" align="left"/>
50118 <colspec colwidth="6*" align="center"/>
50119 <colspec colwidth="6*" align="center"/>
50120 <colspec colwidth="6*" align="right"/>
50121 <tbody>
50122 <row>
50123 <entry><option>server_prompts</option></entry>
50124 <entry>Use: <emphasis>plaintext</emphasis></entry>
50125 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50126 <entry>Default: <emphasis>unset</emphasis></entry>
50127 </row>
50128 </tbody>
50129 </tgroup>
50130 </informaltable>
50131 <para>
50132 The contents of this option, after expansion, must be a colon-separated list of
50133 prompt strings. If expansion fails, a temporary authentication rejection is
50134 given.
50135 </para>
50136 </section>
50137 <section id="SECTplainserver">
50138 <title>Using plaintext in a server</title>
50139 <para>
50140 <indexterm role="concept">
50141 <primary>AUTH</primary>
50142 <secondary>in <command>plaintext</command> authenticator</secondary>
50143 </indexterm>
50144 <indexterm role="concept">
50145 <primary>binary zero</primary>
50146 <secondary>in <command>plaintext</command> authenticator</secondary>
50147 </indexterm>
50148 <indexterm role="concept">
50149 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
50150 <secondary>in <command>plaintext</command> authenticator</secondary>
50151 </indexterm>
50152 <indexterm role="variable">
50153 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
50154 </indexterm>
50155 <indexterm role="concept">
50156 <primary>base64 encoding</primary>
50157 <secondary>in <command>plaintext</command> authenticator</secondary>
50158 </indexterm>
50159 </para>
50160 <para>
50161 When running as a server, <command>plaintext</command> performs the authentication test by
50162 expanding a string. The data sent by the client with the AUTH command, or in
50163 response to subsequent prompts, is base64 encoded, and so may contain any byte
50164 values when decoded. If any data is supplied with the command, it is treated as
50165 a list of strings, separated by NULs (binary zeros), the first three of which
50166 are placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname>
50167 (neither LOGIN nor PLAIN uses more than three strings).
50168 </para>
50169 <para>
50170 For compatibility with previous releases of Exim, the values are also placed in
50171 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
50172 variables for this purpose is now deprecated, as it can lead to confusion in
50173 string expansions that also use them for other things.
50174 </para>
50175 <para>
50176 If there are more strings in <option>server_prompts</option> than the number of strings
50177 supplied with the AUTH command, the remaining prompts are used to obtain more
50178 data. Each response from the client may be a list of NUL-separated strings.
50179 </para>
50180 <para>
50181 <indexterm role="variable">
50182 <primary><varname>$authenticated_id</varname></primary>
50183 </indexterm>
50184 Once a sufficient number of data strings have been received,
50185 <option>server_condition</option> is expanded. If the expansion is forced to fail,
50186 authentication fails. Any other expansion failure causes a temporary error code
50187 to be returned. If the result of a successful expansion is an empty string,
50188 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
50189 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
50190 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
50191 For any other result, a temporary error code is returned, with the expanded
50192 string as the error text
50193 </para>
50194 <para>
50195 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user&#x2019;s
50196 password, be sure to make the authentication fail if the user is unknown.
50197 There are good and bad examples at the end of the next section.
50198 </para>
50199 </section>
50200 <section id="SECID172">
50201 <title>The PLAIN authentication mechanism</title>
50202 <para>
50203 <indexterm role="concept">
50204 <primary>PLAIN authentication mechanism</primary>
50205 </indexterm>
50206 <indexterm role="concept">
50207 <primary>authentication</primary>
50208 <secondary>PLAIN mechanism</secondary>
50209 </indexterm>
50210 <indexterm role="concept">
50211 <primary>binary zero</primary>
50212 <secondary>in <command>plaintext</command> authenticator</secondary>
50213 </indexterm>
50214 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
50215 sent as one item of data (that is, one combined string containing two NUL
50216 separators). The data is sent either as part of the AUTH command, or
50217 subsequently in response to an empty prompt from the server.
50218 </para>
50219 <para>
50220 The second and third strings are a user name and a corresponding password.
50221 Using a single fixed user name and password as an example, this could be
50222 configured as follows:
50223 </para>
50224 <literallayout class="monospaced">
50225 fixed_plain:
50226   driver = plaintext
50227   public_name = PLAIN
50228   server_prompts = :
50229   server_condition = \
50230     ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
50231   server_set_id = $auth2
50232 </literallayout>
50233 <para>
50234 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
50235 are exactly what we want here, so they need not be specified. Obviously, if the
50236 password contains expansion-significant characters such as dollar, backslash,
50237 or closing brace, they have to be escaped.
50238 </para>
50239 <para>
50240 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
50241 the end of a string list are ignored). If all the data comes as part of the
50242 AUTH command, as is commonly the case, the prompt is not used. This
50243 authenticator is advertised in the response to EHLO as
50244 </para>
50245 <literallayout class="monospaced">
50246 250-AUTH PLAIN
50247 </literallayout>
50248 <para>
50249 and a client host can authenticate itself by sending the command
50250 </para>
50251 <literallayout class="monospaced">
50252 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
50253 </literallayout>
50254 <para>
50255 As this contains three strings (more than the number of prompts), no further
50256 data is required from the client. Alternatively, the client may just send
50257 </para>
50258 <literallayout class="monospaced">
50259 AUTH PLAIN
50260 </literallayout>
50261 <para>
50262 to initiate authentication, in which case the server replies with an empty
50263 prompt. The client must respond with the combined data string.
50264 </para>
50265 <para>
50266 The data string is base64 encoded, as required by the RFC. This example,
50267 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;
50268 represents a zero byte. This is split up into three strings, the first of which
50269 is empty. The <option>server_condition</option> option in the authenticator checks that the
50270 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
50271 </para>
50272 <para>
50273 Having just one fixed user name and password, as in this example, is not very
50274 realistic, though for a small organization with only a handful of
50275 authenticating clients it could make sense.
50276 </para>
50277 <para>
50278 A more sophisticated instance of this authenticator could use the user name in
50279 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
50280 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
50281 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
50282 This is an incorrect example:
50283 </para>
50284 <literallayout class="monospaced">
50285 server_condition = \
50286   ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
50287 </literallayout>
50288 <para>
50289 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
50290 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
50291 incorrect? It works fine for existing users, but consider what happens if a
50292 non-existent user name is given. The lookup fails, but as no success/failure
50293 strings are given for the lookup, it yields an empty string. Thus, to defeat
50294 the authentication, all a client has to do is to supply a non-existent user
50295 name and an empty password. The correct way of writing this test is:
50296 </para>
50297 <literallayout class="monospaced">
50298 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
50299   {${if eq{$value}{$auth3}}} {false}}
50300 </literallayout>
50301 <para>
50302 In this case, if the lookup succeeds, the result is checked; if the lookup
50303 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
50304 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
50305 always fails if its second argument is empty. However, the second way of
50306 writing the test makes the logic clearer.
50307 </para>
50308 </section>
50309 <section id="SECID173">
50310 <title>The LOGIN authentication mechanism</title>
50311 <para>
50312 <indexterm role="concept">
50313 <primary>LOGIN authentication mechanism</primary>
50314 </indexterm>
50315 <indexterm role="concept">
50316 <primary>authentication</primary>
50317 <secondary>LOGIN mechanism</secondary>
50318 </indexterm>
50319 The LOGIN authentication mechanism is not documented in any RFC, but is in use
50320 in a number of programs. No data is sent with the AUTH command. Instead, a
50321 user name and password are supplied separately, in response to prompts. The
50322 plaintext authenticator can be configured to support this as in this example:
50323 </para>
50324 <literallayout class="monospaced">
50325 fixed_login:
50326   driver = plaintext
50327   public_name = LOGIN
50328   server_prompts = User Name : Password
50329   server_condition = \
50330     ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
50331   server_set_id = $auth1
50332 </literallayout>
50333 <para>
50334 Because of the way plaintext operates, this authenticator accepts data supplied
50335 with the AUTH command (in contravention of the specification of LOGIN), but
50336 if the client does not supply it (as is the case for LOGIN clients), the prompt
50337 strings are used to obtain two data items.
50338 </para>
50339 <para>
50340 Some clients are very particular about the precise text of the prompts. For
50341 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
50342 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
50343 strings. It uses the <option>ldapauth</option> expansion condition to check the user
50344 name and password by binding to an LDAP server:
50345 </para>
50346 <literallayout class="monospaced">
50347 login:
50348   driver = plaintext
50349   public_name = LOGIN
50350   server_prompts = Username:: : Password::
50351   server_condition = ${if and{{ \
50352     !eq{}{$auth1} }{ \
50353     ldapauth{\
50354       user="uid=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
50355       pass=${quote:$auth2} \
50356       ldap://ldap.example.org/} }} }
50357   server_set_id = uid=$auth1,ou=people,o=example.org
50358 </literallayout>
50359 <para>
50360 We have to check that the username is not empty before using it, because LDAP
50361 does not permit empty DN components. We must also use the <option>quote_ldap_dn</option>
50362 operator to correctly quote the DN for authentication. However, the basic
50363 <option>quote</option> operator, rather than any of the LDAP quoting operators, is the
50364 correct one to use for the password, because quoting is needed only to make
50365 the password conform to the Exim syntax. At the LDAP level, the password is an
50366 uninterpreted string.
50367 </para>
50368 </section>
50369 <section id="SECID174">
50370 <title>Support for different kinds of authentication</title>
50371 <para>
50372 A number of string expansion features are provided for the purpose of
50373 interfacing to different ways of user authentication. These include checking
50374 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
50375 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
50376 <xref linkend="SECTexpcond"/>.
50377 </para>
50378 </section>
50379 <section id="SECID175">
50380 <title>Using plaintext in a client</title>
50381 <para>
50382 <indexterm role="concept">
50383 <primary>options</primary>
50384 <secondary><command>plaintext</command> authenticator (client)</secondary>
50385 </indexterm>
50386 The <command>plaintext</command> authenticator has two client options:
50387 </para>
50388 <para>
50389 <indexterm role="option">
50390 <primary><option>client_ignore_invalid_base64</option></primary>
50391 </indexterm>
50392 </para>
50393 <informaltable frame="all">
50394 <tgroup cols="4" colsep="0" rowsep="0">
50395 <colspec colwidth="8*" align="left"/>
50396 <colspec colwidth="6*" align="center"/>
50397 <colspec colwidth="6*" align="center"/>
50398 <colspec colwidth="6*" align="right"/>
50399 <tbody>
50400 <row>
50401 <entry><option>client_ignore_invalid_base64</option></entry>
50402 <entry>Use: <emphasis>plaintext</emphasis></entry>
50403 <entry>Type: <emphasis>boolean</emphasis></entry>
50404 <entry>Default: <emphasis>false</emphasis></entry>
50405 </row>
50406 </tbody>
50407 </tgroup>
50408 </informaltable>
50409 <para>
50410 If the client receives a server prompt that is not a valid base64 string,
50411 authentication is abandoned by default. However, if this option is set true,
50412 the error in the challenge is ignored and the client sends the response as
50413 usual.
50414 </para>
50415 <para>
50416 <indexterm role="option">
50417 <primary><option>client_send</option></primary>
50418 </indexterm>
50419 </para>
50420 <informaltable frame="all">
50421 <tgroup cols="4" colsep="0" rowsep="0">
50422 <colspec colwidth="8*" align="left"/>
50423 <colspec colwidth="6*" align="center"/>
50424 <colspec colwidth="6*" align="center"/>
50425 <colspec colwidth="6*" align="right"/>
50426 <tbody>
50427 <row>
50428 <entry><option>client_send</option></entry>
50429 <entry>Use: <emphasis>plaintext</emphasis></entry>
50430 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50431 <entry>Default: <emphasis>unset</emphasis></entry>
50432 </row>
50433 </tbody>
50434 </tgroup>
50435 </informaltable>
50436 <para>
50437 The string is a colon-separated list of authentication data strings. Each
50438 string is independently expanded before being sent to the server. The first
50439 string is sent with the AUTH command; any more strings are sent in response
50440 to prompts from the server. Before each string is expanded, the value of the
50441 most recent prompt is placed in the next <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable, starting
50442 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
50443 way. Thus, the prompt that is received in response to sending the first string
50444 (with the AUTH command) can be used in the expansion of the second string, and
50445 so on. If an invalid base64 string is received when
50446 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
50447 <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable.
50448 </para>
50449 <para>
50450 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
50451 splitting takes priority and happens first.
50452 </para>
50453 <para>
50454 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
50455 the data, further processing is applied to each string before it is sent. If
50456 there are any single circumflex characters in the string, they are converted to
50457 NULs. Should an actual circumflex be required as data, it must be doubled in
50458 the string.
50459 </para>
50460 <para>
50461 This is an example of a client configuration that implements the PLAIN
50462 authentication mechanism with a fixed user name and password:
50463 </para>
50464 <literallayout class="monospaced">
50465 fixed_plain:
50466   driver = plaintext
50467   public_name = PLAIN
50468   client_send = ^username^mysecret
50469 </literallayout>
50470 <para>
50471 The lack of colons means that the entire text is sent with the AUTH
50472 command, with the circumflex characters converted to NULs. A similar example
50473 that uses the LOGIN mechanism is:
50474 </para>
50475 <literallayout class="monospaced">
50476 fixed_login:
50477   driver = plaintext
50478   public_name = LOGIN
50479   client_send = : username : mysecret
50480 </literallayout>
50481 <para>
50482 The initial colon means that the first string is empty, so no data is sent with
50483 the AUTH command itself. The remaining strings are sent in response to
50484 prompts.
50485 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
50486 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
50487 </para>
50488 </section>
50489 </chapter>
50490
50491 <chapter id="CHID9">
50492 <title>The cram_md5 authenticator</title>
50493 <para>
50494 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
50495 <primary><command>cram_md5</command> authenticator</primary>
50496 </indexterm>
50497 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
50498 <primary>authenticators</primary>
50499 <secondary><command>cram_md5</command></secondary>
50500 </indexterm>
50501 <indexterm role="concept">
50502 <primary>CRAM-MD5 authentication mechanism</primary>
50503 </indexterm>
50504 <indexterm role="concept">
50505 <primary>authentication</primary>
50506 <secondary>CRAM-MD5 mechanism</secondary>
50507 </indexterm>
50508 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
50509 sends a challenge string to the client, and the response consists of a user
50510 name and the CRAM-MD5 digest of the challenge string combined with a secret
50511 string (password) which is known to both server and client. Thus, the secret
50512 is not sent over the network as plain text, which makes this authenticator more
50513 secure than <command>plaintext</command>. However, the downside is that the secret has to be
50514 available in plain text at either end.
50515 </para>
50516 <section id="SECID176">
50517 <title>Using cram_md5 as a server</title>
50518 <para>
50519 <indexterm role="concept">
50520 <primary>options</primary>
50521 <secondary><command>cram_md5</command> authenticator (server)</secondary>
50522 </indexterm>
50523 This authenticator has one server option, which must be set to configure the
50524 authenticator as a server:
50525 </para>
50526 <para>
50527 <indexterm role="option">
50528 <primary><option>server_secret</option></primary>
50529 </indexterm>
50530 </para>
50531 <informaltable frame="all">
50532 <tgroup cols="4" colsep="0" rowsep="0">
50533 <colspec colwidth="8*" align="left"/>
50534 <colspec colwidth="6*" align="center"/>
50535 <colspec colwidth="6*" align="center"/>
50536 <colspec colwidth="6*" align="right"/>
50537 <tbody>
50538 <row>
50539 <entry><option>server_secret</option></entry>
50540 <entry>Use: <emphasis>cram_md5</emphasis></entry>
50541 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50542 <entry>Default: <emphasis>unset</emphasis></entry>
50543 </row>
50544 </tbody>
50545 </tgroup>
50546 </informaltable>
50547 <para>
50548 <indexterm role="concept">
50549 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
50550 <secondary>in <command>cram_md5</command> authenticator</secondary>
50551 </indexterm>
50552 When the server receives the client&#x2019;s response, the user name is placed in
50553 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
50554 obtain the password for that user. The server then computes the CRAM-MD5 digest
50555 that the client should have sent, and checks that it received the correct
50556 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
50557 fails. If the expansion fails for some other reason, a temporary error code is
50558 returned to the client.
50559 </para>
50560 <para>
50561 For compatibility with previous releases of Exim, the user name is also placed
50562 in <varname>$1</varname>. However, the use of this variables for this purpose is now
50563 deprecated, as it can lead to confusion in string expansions that also use
50564 numeric variables for other things.
50565 </para>
50566 <para>
50567 For example, the following authenticator checks that the user name given by the
50568 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
50569 user name, authentication fails.
50570 </para>
50571 <literallayout class="monospaced">
50572 fixed_cram:
50573   driver = cram_md5
50574   public_name = CRAM-MD5
50575   server_secret = ${if eq{$auth1}{ph10}{secret}fail}
50576   server_set_id = $auth1
50577 </literallayout>
50578 <para>
50579 <indexterm role="variable">
50580 <primary><varname>$authenticated_id</varname></primary>
50581 </indexterm>
50582 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
50583 name in <varname>$authenticated_id</varname>. A more typical configuration might look up the
50584 secret string in a file, using the user name as the key. For example:
50585 </para>
50586 <literallayout class="monospaced">
50587 lookup_cram:
50588   driver = cram_md5
50589   public_name = CRAM-MD5
50590   server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}\
50591                   {$value}fail}
50592   server_set_id = $auth1
50593 </literallayout>
50594 <para>
50595 Note that this expansion explicitly forces failure if the lookup fails
50596 because <varname>$auth1</varname> contains an unknown user name.
50597 </para>
50598 <para>
50599 As another example, if you wish to re-use a Cyrus SASL sasldb2 file without
50600 using the relevant libraries, you need to know the realm to specify in the
50601 lookup and then ask for the <quote>userPassword</quote> attribute for that user in that
50602 realm, with:
50603 </para>
50604 <literallayout class="monospaced">
50605 cyrusless_crammd5:
50606   driver = cram_md5
50607   public_name = CRAM-MD5
50608   server_secret = ${lookup{$auth1:mail.example.org:userPassword}\
50609                   dbmjz{/etc/sasldb2}{$value}fail}
50610   server_set_id = $auth1
50611 </literallayout>
50612 </section>
50613 <section id="SECID177">
50614 <title>Using cram_md5 as a client</title>
50615 <para>
50616 <indexterm role="concept">
50617 <primary>options</primary>
50618 <secondary><command>cram_md5</command> authenticator (client)</secondary>
50619 </indexterm>
50620 When used as a client, the <command>cram_md5</command> authenticator has two options:
50621 </para>
50622 <para>
50623 <indexterm role="option">
50624 <primary><option>client_name</option></primary>
50625 </indexterm>
50626 </para>
50627 <informaltable frame="all">
50628 <tgroup cols="4" colsep="0" rowsep="0">
50629 <colspec colwidth="8*" align="left"/>
50630 <colspec colwidth="6*" align="center"/>
50631 <colspec colwidth="6*" align="center"/>
50632 <colspec colwidth="6*" align="right"/>
50633 <tbody>
50634 <row>
50635 <entry><option>client_name</option></entry>
50636 <entry>Use: <emphasis>cram_md5</emphasis></entry>
50637 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50638 <entry>Default: <emphasis>the primary host name</emphasis></entry>
50639 </row>
50640 </tbody>
50641 </tgroup>
50642 </informaltable>
50643 <para>
50644 This string is expanded, and the result used as the user name data when
50645 computing the response to the server&#x2019;s challenge.
50646 </para>
50647 <para>
50648 <indexterm role="option">
50649 <primary><option>client_secret</option></primary>
50650 </indexterm>
50651 </para>
50652 <informaltable frame="all">
50653 <tgroup cols="4" colsep="0" rowsep="0">
50654 <colspec colwidth="8*" align="left"/>
50655 <colspec colwidth="6*" align="center"/>
50656 <colspec colwidth="6*" align="center"/>
50657 <colspec colwidth="6*" align="right"/>
50658 <tbody>
50659 <row>
50660 <entry><option>client_secret</option></entry>
50661 <entry>Use: <emphasis>cram_md5</emphasis></entry>
50662 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50663 <entry>Default: <emphasis>unset</emphasis></entry>
50664 </row>
50665 </tbody>
50666 </tgroup>
50667 </informaltable>
50668 <para>
50669 This option must be set for the authenticator to work as a client. Its value is
50670 expanded and the result used as the secret string when computing the response.
50671 </para>
50672 <para>
50673 <indexterm role="variable">
50674 <primary><varname>$host</varname></primary>
50675 </indexterm>
50676 <indexterm role="variable">
50677 <primary><varname>$host_address</varname></primary>
50678 </indexterm>
50679 Different user names and secrets can be used for different servers by referring
50680 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
50681 expansion string is treated as an indication that this authenticator is not
50682 prepared to handle this case. Exim moves on to the next configured client
50683 authenticator. Any other expansion failure causes Exim to give up trying to
50684 send the message to the current server.
50685 </para>
50686 <para>
50687 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
50688 strings, is:
50689 </para>
50690 <literallayout class="monospaced">
50691 fixed_cram:
50692   driver = cram_md5
50693   public_name = CRAM-MD5
50694   client_name = ph10
50695   client_secret = secret
50696 </literallayout>
50697 <para>
50698 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
50699 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
50700 </para>
50701 </section>
50702 </chapter>
50703
50704 <chapter id="CHID10">
50705 <title>The cyrus_sasl authenticator</title>
50706 <para>
50707 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
50708 <primary><command>cyrus_sasl</command> authenticator</primary>
50709 </indexterm>
50710 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
50711 <primary>authenticators</primary>
50712 <secondary><command>cyrus_sasl</command></secondary>
50713 </indexterm>
50714 <indexterm role="concept">
50715 <primary>Cyrus</primary>
50716 <secondary>SASL library</secondary>
50717 </indexterm>
50718 <indexterm role="concept">
50719 <primary>Kerberos</primary>
50720 </indexterm>
50721 The code for this authenticator was provided by Matthew Byng-Maddick of A L
50722 Digital Ltd (<emphasis role="bold"><ulink url="http://www.aldigital.co.uk">http://www.aldigital.co.uk</ulink></emphasis>).
50723 </para>
50724 <para>
50725 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
50726 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
50727 Layer</quote>). This library supports a number of authentication mechanisms,
50728 including PLAIN and LOGIN, but also several others that Exim does not support
50729 directly. In particular, there is support for Kerberos authentication.
50730 </para>
50731 <para>
50732 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
50733 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
50734 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
50735 name of the driver to determine which mechanism to support.
50736 </para>
50737 <para>
50738 Where access to some kind of secret file is required, for example in GSSAPI
50739 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
50740 user, and that the Cyrus SASL library has no way of escalating privileges
50741 by default. You may also find you need to set environment variables,
50742 depending on the driver you are using.
50743 </para>
50744 <para>
50745 The application name provided by Exim is <quote>exim</quote>, so various SASL options may
50746 be set in <filename>exim.conf</filename> in your SASL directory. If you are using GSSAPI for
50747 Kerberos, note that because of limitations in the GSSAPI interface,
50748 changing the server keytab might need to be communicated down to the Kerberos
50749 layer independently. The mechanism for doing so is dependent upon the Kerberos
50750 implementation.
50751 </para>
50752 <para>
50753 For example, for older releases of Heimdal, the environment variable KRB5_KTNAME
50754 may be set to point to an alternative keytab file. Exim will pass this
50755 variable through from its own inherited environment when started as root or the
50756 Exim user. The keytab file needs to be readable by the Exim user.
50757 With newer releases of Heimdal, a setuid Exim may cause Heimdal to discard the
50758 environment variable.  In practice, for those releases, the Cyrus authenticator
50759 is not a suitable interface for GSSAPI (Kerberos) support.  Instead, consider
50760 the <command>heimdal_gssapi</command> authenticator, described in chapter <xref linkend="CHAPheimdalgss"/>
50761 </para>
50762 <section id="SECID178">
50763 <title>Using cyrus_sasl as a server</title>
50764 <para>
50765 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
50766 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
50767 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
50768 use of this variable for this purpose is now deprecated, as it can lead to
50769 confusion in string expansions that also use numeric variables for other
50770 things.
50771 </para>
50772 <para>
50773 <indexterm role="option">
50774 <primary><option>server_hostname</option></primary>
50775 </indexterm>
50776 </para>
50777 <informaltable frame="all">
50778 <tgroup cols="4" colsep="0" rowsep="0">
50779 <colspec colwidth="8*" align="left"/>
50780 <colspec colwidth="6*" align="center"/>
50781 <colspec colwidth="6*" align="center"/>
50782 <colspec colwidth="6*" align="right"/>
50783 <tbody>
50784 <row>
50785 <entry><option>server_hostname</option></entry>
50786 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
50787 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50788 <entry>Default: <emphasis>see below</emphasis></entry>
50789 </row>
50790 </tbody>
50791 </tgroup>
50792 </informaltable>
50793 <para>
50794 This option selects the hostname that is used when communicating with the
50795 library. The default value is <literal>$primary_hostname</literal>. It is up to the underlying
50796 SASL plug-in what it does with this data.
50797 </para>
50798 <para>
50799 <indexterm role="option">
50800 <primary><option>server_mech</option></primary>
50801 </indexterm>
50802 </para>
50803 <informaltable frame="all">
50804 <tgroup cols="4" colsep="0" rowsep="0">
50805 <colspec colwidth="8*" align="left"/>
50806 <colspec colwidth="6*" align="center"/>
50807 <colspec colwidth="6*" align="center"/>
50808 <colspec colwidth="6*" align="right"/>
50809 <tbody>
50810 <row>
50811 <entry><option>server_mech</option></entry>
50812 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
50813 <entry>Type: <emphasis>string</emphasis></entry>
50814 <entry>Default: <emphasis>see below</emphasis></entry>
50815 </row>
50816 </tbody>
50817 </tgroup>
50818 </informaltable>
50819 <para>
50820 This option selects the authentication mechanism this driver should use. The
50821 default is the value of the generic <option>public_name</option> option. This option allows
50822 you to use a different underlying mechanism from the advertised name. For
50823 example:
50824 </para>
50825 <literallayout class="monospaced">
50826 sasl:
50827   driver = cyrus_sasl
50828   public_name = X-ANYTHING
50829   server_mech = CRAM-MD5
50830   server_set_id = $auth1
50831 </literallayout>
50832 <para>
50833 <indexterm role="option">
50834 <primary><option>server_realm</option></primary>
50835 </indexterm>
50836 </para>
50837 <informaltable frame="all">
50838 <tgroup cols="4" colsep="0" rowsep="0">
50839 <colspec colwidth="8*" align="left"/>
50840 <colspec colwidth="6*" align="center"/>
50841 <colspec colwidth="6*" align="center"/>
50842 <colspec colwidth="6*" align="right"/>
50843 <tbody>
50844 <row>
50845 <entry><option>server_realm</option></entry>
50846 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
50847 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50848 <entry>Default: <emphasis>unset</emphasis></entry>
50849 </row>
50850 </tbody>
50851 </tgroup>
50852 </informaltable>
50853 <para>
50854 This specifies the SASL realm that the server claims to be in.
50855 </para>
50856 <para>
50857 <indexterm role="option">
50858 <primary><option>server_service</option></primary>
50859 </indexterm>
50860 </para>
50861 <informaltable frame="all">
50862 <tgroup cols="4" colsep="0" rowsep="0">
50863 <colspec colwidth="8*" align="left"/>
50864 <colspec colwidth="6*" align="center"/>
50865 <colspec colwidth="6*" align="center"/>
50866 <colspec colwidth="6*" align="right"/>
50867 <tbody>
50868 <row>
50869 <entry><option>server_service</option></entry>
50870 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
50871 <entry>Type: <emphasis>string</emphasis></entry>
50872 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
50873 </row>
50874 </tbody>
50875 </tgroup>
50876 </informaltable>
50877 <para>
50878 This is the SASL service that the server claims to implement.
50879 </para>
50880 <para>
50881 For straightforward cases, you do not need to set any of the authenticator&#x2019;s
50882 private options. All you need to do is to specify an appropriate mechanism as
50883 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
50884 PLAIN, you could have two authenticators as follows:
50885 </para>
50886 <literallayout class="monospaced">
50887 sasl_cram_md5:
50888   driver = cyrus_sasl
50889   public_name = CRAM-MD5
50890   server_set_id = $auth1
50891
50892 sasl_plain:
50893   driver = cyrus_sasl
50894   public_name = PLAIN
50895   server_set_id = $auth2
50896 </literallayout>
50897 <para>
50898 Cyrus SASL does implement the LOGIN authentication method, even though it is
50899 not a standard method. It is disabled by default in the source distribution,
50900 but it is present in many binary distributions.
50901 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
50902 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
50903 </para>
50904 </section>
50905 </chapter>
50906
50907 <chapter id="CHAPdovecot">
50908 <title>The dovecot authenticator</title>
50909 <para>
50910 <indexterm role="concept" id="IIDdcotauth1" class="startofrange">
50911 <primary><command>dovecot</command> authenticator</primary>
50912 </indexterm>
50913 <indexterm role="concept" id="IIDdcotauth2" class="startofrange">
50914 <primary>authenticators</primary>
50915 <secondary><command>dovecot</command></secondary>
50916 </indexterm>
50917 This authenticator is an interface to the authentication facility of the
50918 Dovecot POP/IMAP server, which can support a number of authentication methods.
50919 Note that Dovecot must be configured to use auth-client not auth-userdb.
50920 If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful
50921 to use the same mechanisms for SMTP authentication. This is a server
50922 authenticator only. There is only one option:
50923 </para>
50924 <para>
50925 <indexterm role="option">
50926 <primary><option>server_socket</option></primary>
50927 </indexterm>
50928 </para>
50929 <informaltable frame="all">
50930 <tgroup cols="4" colsep="0" rowsep="0">
50931 <colspec colwidth="8*" align="left"/>
50932 <colspec colwidth="6*" align="center"/>
50933 <colspec colwidth="6*" align="center"/>
50934 <colspec colwidth="6*" align="right"/>
50935 <tbody>
50936 <row>
50937 <entry><option>server_socket</option></entry>
50938 <entry>Use: <emphasis>dovecot</emphasis></entry>
50939 <entry>Type: <emphasis>string</emphasis></entry>
50940 <entry>Default: <emphasis>unset</emphasis></entry>
50941 </row>
50942 </tbody>
50943 </tgroup>
50944 </informaltable>
50945 <para>
50946 This option must specify the socket that is the interface to Dovecot
50947 authentication. The <option>public_name</option> option must specify an authentication
50948 mechanism that Dovecot is configured to support. You can have several
50949 authenticators for different mechanisms. For example:
50950 </para>
50951 <literallayout class="monospaced">
50952 dovecot_plain:
50953   driver = dovecot
50954   public_name = PLAIN
50955   server_socket = /var/run/dovecot/auth-client
50956   server_set_id = $auth1
50957
50958 dovecot_ntlm:
50959   driver = dovecot
50960   public_name = NTLM
50961   server_socket = /var/run/dovecot/auth-client
50962   server_set_id = $auth1
50963 </literallayout>
50964 <para>
50965 If the SMTP connection is encrypted, or if <varname>$sender_host_address</varname> is equal to
50966 <varname>$received_ip_address</varname> (that is, the connection is local), the <quote>secured</quote>
50967 option is passed in the Dovecot authentication command. If, for a TLS
50968 connection, a client certificate has been verified, the <quote>valid-client-cert</quote>
50969 option is passed. When authentication succeeds, the identity of the user
50970 who authenticated is placed in <varname>$auth1</varname>.
50971 <indexterm role="concept" startref="IIDdcotauth1" class="endofrange"/>
50972 <indexterm role="concept" startref="IIDdcotauth2" class="endofrange"/>
50973 </para>
50974 </chapter>
50975
50976 <chapter id="CHAPgsasl">
50977 <title>The gsasl authenticator</title>
50978 <para>
50979 <indexterm role="concept" id="IIDgsaslauth1" class="startofrange">
50980 <primary><command>gsasl</command> authenticator</primary>
50981 </indexterm>
50982 <indexterm role="concept" id="IIDgsaslauth2" class="startofrange">
50983 <primary>authenticators</primary>
50984 <secondary><command>gsasl</command></secondary>
50985 </indexterm>
50986 <indexterm role="concept">
50987 <primary>authentication</primary>
50988 <secondary>GNU SASL</secondary>
50989 </indexterm>
50990 <indexterm role="concept">
50991 <primary>authentication</primary>
50992 <secondary>SASL</secondary>
50993 </indexterm>
50994 <indexterm role="concept">
50995 <primary>authentication</primary>
50996 <secondary>EXTERNAL</secondary>
50997 </indexterm>
50998 <indexterm role="concept">
50999 <primary>authentication</primary>
51000 <secondary>ANONYMOUS</secondary>
51001 </indexterm>
51002 <indexterm role="concept">
51003 <primary>authentication</primary>
51004 <secondary>PLAIN</secondary>
51005 </indexterm>
51006 <indexterm role="concept">
51007 <primary>authentication</primary>
51008 <secondary>LOGIN</secondary>
51009 </indexterm>
51010 <indexterm role="concept">
51011 <primary>authentication</primary>
51012 <secondary>DIGEST-MD5</secondary>
51013 </indexterm>
51014 <indexterm role="concept">
51015 <primary>authentication</primary>
51016 <secondary>CRAM-MD5</secondary>
51017 </indexterm>
51018 <indexterm role="concept">
51019 <primary>authentication</primary>
51020 <secondary>SCRAM-SHA-1</secondary>
51021 </indexterm>
51022 The <command>gsasl</command> authenticator provides server integration for the GNU SASL
51023 library and the mechanisms it provides.  This is new as of the 4.80 release
51024 and there are a few areas where the library does not let Exim smoothly
51025 scale to handle future authentication mechanisms, so no guarantee can be
51026 made that any particular new authentication mechanism will be supported
51027 without code changes in Exim.
51028 </para>
51029 <para>
51030 <indexterm role="option">
51031 <primary><option>server_channelbinding</option></primary>
51032 </indexterm>
51033 </para>
51034 <informaltable frame="all">
51035 <tgroup cols="4" colsep="0" rowsep="0">
51036 <colspec colwidth="8*" align="left"/>
51037 <colspec colwidth="6*" align="center"/>
51038 <colspec colwidth="6*" align="center"/>
51039 <colspec colwidth="6*" align="right"/>
51040 <tbody>
51041 <row>
51042 <entry><option>server_channelbinding</option></entry>
51043 <entry>Use: <emphasis>gsasl</emphasis></entry>
51044 <entry>Type: <emphasis>boolean</emphasis></entry>
51045 <entry>Default: <emphasis>false</emphasis></entry>
51046 </row>
51047 </tbody>
51048 </tgroup>
51049 </informaltable>
51050 <para>
51051 Some authentication mechanisms are able to use external context at both ends
51052 of the session to bind the authentication to that context, and fail the
51053 authentication process if that context differs.  Specifically, some TLS
51054 ciphersuites can provide identifying information about the cryptographic
51055 context.
51056 </para>
51057 <para>
51058 This means that certificate identity and verification becomes a non-issue,
51059 as a man-in-the-middle attack will cause the correct client and server to
51060 see different identifiers and authentication will fail.
51061 </para>
51062 <para>
51063 This is currently only supported when using the GnuTLS library.  This is
51064 only usable by mechanisms which support "channel binding"; at time of
51065 writing, that&#x2019;s the SCRAM family.
51066 </para>
51067 <para>
51068 This defaults off to ensure smooth upgrade across Exim releases, in case
51069 this option causes some clients to start failing.  Some future release
51070 of Exim may switch the default to be true.
51071 </para>
51072 <para>
51073 <indexterm role="option">
51074 <primary><option>server_hostname</option></primary>
51075 </indexterm>
51076 </para>
51077 <informaltable frame="all">
51078 <tgroup cols="4" colsep="0" rowsep="0">
51079 <colspec colwidth="8*" align="left"/>
51080 <colspec colwidth="6*" align="center"/>
51081 <colspec colwidth="6*" align="center"/>
51082 <colspec colwidth="6*" align="right"/>
51083 <tbody>
51084 <row>
51085 <entry><option>server_hostname</option></entry>
51086 <entry>Use: <emphasis>gsasl</emphasis></entry>
51087 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51088 <entry>Default: <emphasis>see below</emphasis></entry>
51089 </row>
51090 </tbody>
51091 </tgroup>
51092 </informaltable>
51093 <para>
51094 This option selects the hostname that is used when communicating with the
51095 library. The default value is <literal>$primary_hostname</literal>.
51096 Some mechanisms will use this data.
51097 </para>
51098 <para>
51099 <indexterm role="option">
51100 <primary><option>server_mech</option></primary>
51101 </indexterm>
51102 </para>
51103 <informaltable frame="all">
51104 <tgroup cols="4" colsep="0" rowsep="0">
51105 <colspec colwidth="8*" align="left"/>
51106 <colspec colwidth="6*" align="center"/>
51107 <colspec colwidth="6*" align="center"/>
51108 <colspec colwidth="6*" align="right"/>
51109 <tbody>
51110 <row>
51111 <entry><option>server_mech</option></entry>
51112 <entry>Use: <emphasis>gsasl</emphasis></entry>
51113 <entry>Type: <emphasis>string</emphasis></entry>
51114 <entry>Default: <emphasis>see below</emphasis></entry>
51115 </row>
51116 </tbody>
51117 </tgroup>
51118 </informaltable>
51119 <para>
51120 This option selects the authentication mechanism this driver should use. The
51121 default is the value of the generic <option>public_name</option> option. This option allows
51122 you to use a different underlying mechanism from the advertised name. For
51123 example:
51124 </para>
51125 <literallayout class="monospaced">
51126 sasl:
51127   driver = gsasl
51128   public_name = X-ANYTHING
51129   server_mech = CRAM-MD5
51130   server_set_id = $auth1
51131 </literallayout>
51132 <para>
51133 <indexterm role="option">
51134 <primary><option>server_password</option></primary>
51135 </indexterm>
51136 </para>
51137 <informaltable frame="all">
51138 <tgroup cols="4" colsep="0" rowsep="0">
51139 <colspec colwidth="8*" align="left"/>
51140 <colspec colwidth="6*" align="center"/>
51141 <colspec colwidth="6*" align="center"/>
51142 <colspec colwidth="6*" align="right"/>
51143 <tbody>
51144 <row>
51145 <entry><option>server_password</option></entry>
51146 <entry>Use: <emphasis>gsasl</emphasis></entry>
51147 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51148 <entry>Default: <emphasis>unset</emphasis></entry>
51149 </row>
51150 </tbody>
51151 </tgroup>
51152 </informaltable>
51153 <para>
51154 Various mechanisms need access to the cleartext password on the server, so
51155 that proof-of-possession can be demonstrated on the wire, without sending
51156 the password itself.
51157 </para>
51158 <para>
51159 The data available for lookup varies per mechanism.
51160 In all cases, <varname>$auth1</varname> is set to the <emphasis>authentication id</emphasis>.
51161 The <varname>$auth2</varname> variable will always be the <emphasis>authorization id</emphasis> (<emphasis>authz</emphasis>)
51162 if available, else the empty string.
51163 The <varname>$auth3</varname> variable will always be the <emphasis>realm</emphasis> if available,
51164 else the empty string.
51165 </para>
51166 <para>
51167 A forced failure will cause authentication to defer.
51168 </para>
51169 <para>
51170 If using this option, it may make sense to set the <option>server_condition</option>
51171 option to be simply "true".
51172 </para>
51173 <para>
51174 <indexterm role="option">
51175 <primary><option>server_realm</option></primary>
51176 </indexterm>
51177 </para>
51178 <informaltable frame="all">
51179 <tgroup cols="4" colsep="0" rowsep="0">
51180 <colspec colwidth="8*" align="left"/>
51181 <colspec colwidth="6*" align="center"/>
51182 <colspec colwidth="6*" align="center"/>
51183 <colspec colwidth="6*" align="right"/>
51184 <tbody>
51185 <row>
51186 <entry><option>server_realm</option></entry>
51187 <entry>Use: <emphasis>gsasl</emphasis></entry>
51188 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51189 <entry>Default: <emphasis>unset</emphasis></entry>
51190 </row>
51191 </tbody>
51192 </tgroup>
51193 </informaltable>
51194 <para>
51195 This specifies the SASL realm that the server claims to be in.
51196 Some mechanisms will use this data.
51197 </para>
51198 <para>
51199 <indexterm role="option">
51200 <primary><option>server_scram_iter</option></primary>
51201 </indexterm>
51202 </para>
51203 <informaltable frame="all">
51204 <tgroup cols="4" colsep="0" rowsep="0">
51205 <colspec colwidth="8*" align="left"/>
51206 <colspec colwidth="6*" align="center"/>
51207 <colspec colwidth="6*" align="center"/>
51208 <colspec colwidth="6*" align="right"/>
51209 <tbody>
51210 <row>
51211 <entry><option>server_scram_iter</option></entry>
51212 <entry>Use: <emphasis>gsasl</emphasis></entry>
51213 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51214 <entry>Default: <emphasis>unset</emphasis></entry>
51215 </row>
51216 </tbody>
51217 </tgroup>
51218 </informaltable>
51219 <para>
51220 This option provides data for the SCRAM family of mechanisms.
51221 <varname>$auth1</varname> is not available at evaluation time.
51222 (This may change, as we receive feedback on use)
51223 </para>
51224 <para>
51225 <indexterm role="option">
51226 <primary><option>server_scram_salt</option></primary>
51227 </indexterm>
51228 </para>
51229 <informaltable frame="all">
51230 <tgroup cols="4" colsep="0" rowsep="0">
51231 <colspec colwidth="8*" align="left"/>
51232 <colspec colwidth="6*" align="center"/>
51233 <colspec colwidth="6*" align="center"/>
51234 <colspec colwidth="6*" align="right"/>
51235 <tbody>
51236 <row>
51237 <entry><option>server_scram_salt</option></entry>
51238 <entry>Use: <emphasis>gsasl</emphasis></entry>
51239 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51240 <entry>Default: <emphasis>unset</emphasis></entry>
51241 </row>
51242 </tbody>
51243 </tgroup>
51244 </informaltable>
51245 <para>
51246 This option provides data for the SCRAM family of mechanisms.
51247 <varname>$auth1</varname> is not available at evaluation time.
51248 (This may change, as we receive feedback on use)
51249 </para>
51250 <para>
51251 <indexterm role="option">
51252 <primary><option>server_service</option></primary>
51253 </indexterm>
51254 </para>
51255 <informaltable frame="all">
51256 <tgroup cols="4" colsep="0" rowsep="0">
51257 <colspec colwidth="8*" align="left"/>
51258 <colspec colwidth="6*" align="center"/>
51259 <colspec colwidth="6*" align="center"/>
51260 <colspec colwidth="6*" align="right"/>
51261 <tbody>
51262 <row>
51263 <entry><option>server_service</option></entry>
51264 <entry>Use: <emphasis>gsasl</emphasis></entry>
51265 <entry>Type: <emphasis>string</emphasis></entry>
51266 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
51267 </row>
51268 </tbody>
51269 </tgroup>
51270 </informaltable>
51271 <para>
51272 This is the SASL service that the server claims to implement.
51273 Some mechanisms will use this data.
51274 </para>
51275 <section id="SECTgsaslauthvar">
51276 <title><command>gsasl</command> auth variables</title>
51277 <para>
51278 <indexterm role="variable">
51279 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
51280 </indexterm>
51281 These may be set when evaluating specific options, as detailed above.
51282 They will also be set when evaluating <option>server_condition</option>.
51283 </para>
51284 <para>
51285 Unless otherwise stated below, the <command>gsasl</command> integration will use the following
51286 meanings for these variables:
51287 </para>
51288 <itemizedlist>
51289 <listitem>
51290 <para>
51291 <indexterm role="variable">
51292 <primary><varname>$auth1</varname></primary>
51293 </indexterm>
51294 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>
51295 </para>
51296 </listitem>
51297 <listitem>
51298 <para>
51299 <indexterm role="variable">
51300 <primary><varname>$auth2</varname></primary>
51301 </indexterm>
51302 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>
51303 </para>
51304 </listitem>
51305 <listitem>
51306 <para>
51307 <indexterm role="variable">
51308 <primary><varname>$auth3</varname></primary>
51309 </indexterm>
51310 <varname>$auth3</varname>: the <emphasis>realm</emphasis>
51311 </para>
51312 </listitem>
51313 </itemizedlist>
51314 <para>
51315 On a per-mechanism basis:
51316 </para>
51317 <itemizedlist>
51318 <listitem>
51319 <para>
51320 <indexterm role="concept">
51321 <primary>authentication</primary>
51322 <secondary>EXTERNAL</secondary>
51323 </indexterm>
51324 EXTERNAL: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>authorization id</emphasis>;
51325 the <option>server_condition</option> option must be present.
51326 </para>
51327 </listitem>
51328 <listitem>
51329 <para>
51330 <indexterm role="concept">
51331 <primary>authentication</primary>
51332 <secondary>ANONYMOUS</secondary>
51333 </indexterm>
51334 ANONYMOUS: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>anonymous token</emphasis>;
51335 the <option>server_condition</option> option must be present.
51336 </para>
51337 </listitem>
51338 <listitem>
51339 <para>
51340 <indexterm role="concept">
51341 <primary>authentication</primary>
51342 <secondary>GSSAPI</secondary>
51343 </indexterm>
51344 GSSAPI: <varname>$auth1</varname> will be set to the <emphasis>GSSAPI Display Name</emphasis>;
51345 <varname>$auth2</varname> will be set to the <emphasis>authorization id</emphasis>,
51346 the <option>server_condition</option> option must be present.
51347 </para>
51348 </listitem>
51349 </itemizedlist>
51350 <para>
51351 An <emphasis>anonymous token</emphasis> is something passed along as an unauthenticated
51352 identifier; this is analogous to FTP anonymous authentication passing an
51353 email address, or software-identifier@, as the "password".
51354 </para>
51355 <para>
51356 An example showing the password having the realm specified in the callback
51357 and demonstrating a Cyrus SASL to GSASL migration approach is:
51358 </para>
51359 <literallayout class="monospaced">
51360 gsasl_cyrusless_crammd5:
51361   driver = gsasl
51362   public_name = CRAM-MD5
51363   server_realm = imap.example.org
51364   server_password = ${lookup{$auth1:$auth3:userPassword}\
51365                     dbmjz{/etc/sasldb2}{$value}fail}
51366   server_set_id = ${quote:$auth1}
51367   server_condition = yes
51368 </literallayout>
51369 </section>
51370 </chapter>
51371
51372 <chapter id="CHAPheimdalgss">
51373 <title>The heimdal_gssapi authenticator</title>
51374 <para>
51375 <indexterm role="concept" id="IIDheimdalgssauth1" class="startofrange">
51376 <primary><command>heimdal_gssapi</command> authenticator</primary>
51377 </indexterm>
51378 <indexterm role="concept" id="IIDheimdalgssauth2" class="startofrange">
51379 <primary>authenticators</primary>
51380 <secondary><command>heimdal_gssapi</command></secondary>
51381 </indexterm>
51382 <indexterm role="concept">
51383 <primary>authentication</primary>
51384 <secondary>GSSAPI</secondary>
51385 </indexterm>
51386 <indexterm role="concept">
51387 <primary>authentication</primary>
51388 <secondary>Kerberos</secondary>
51389 </indexterm>
51390 The <command>heimdal_gssapi</command> authenticator provides server integration for the
51391 Heimdal GSSAPI/Kerberos library, permitting Exim to set a keytab pathname
51392 reliably.
51393 </para>
51394 <para>
51395 <indexterm role="option">
51396 <primary><option>server_hostname</option></primary>
51397 </indexterm>
51398 </para>
51399 <informaltable frame="all">
51400 <tgroup cols="4" colsep="0" rowsep="0">
51401 <colspec colwidth="8*" align="left"/>
51402 <colspec colwidth="6*" align="center"/>
51403 <colspec colwidth="6*" align="center"/>
51404 <colspec colwidth="6*" align="right"/>
51405 <tbody>
51406 <row>
51407 <entry><option>server_hostname</option></entry>
51408 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
51409 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51410 <entry>Default: <emphasis>see below</emphasis></entry>
51411 </row>
51412 </tbody>
51413 </tgroup>
51414 </informaltable>
51415 <para>
51416 This option selects the hostname that is used, with <option>server_service</option>,
51417 for constructing the GSS server name, as a <emphasis>GSS_C_NT_HOSTBASED_SERVICE</emphasis>
51418 identifier.  The default value is <literal>$primary_hostname</literal>.
51419 </para>
51420 <para>
51421 <indexterm role="option">
51422 <primary><option>server_keytab</option></primary>
51423 </indexterm>
51424 </para>
51425 <informaltable frame="all">
51426 <tgroup cols="4" colsep="0" rowsep="0">
51427 <colspec colwidth="8*" align="left"/>
51428 <colspec colwidth="6*" align="center"/>
51429 <colspec colwidth="6*" align="center"/>
51430 <colspec colwidth="6*" align="right"/>
51431 <tbody>
51432 <row>
51433 <entry><option>server_keytab</option></entry>
51434 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
51435 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51436 <entry>Default: <emphasis>unset</emphasis></entry>
51437 </row>
51438 </tbody>
51439 </tgroup>
51440 </informaltable>
51441 <para>
51442 If set, then Heimdal will not use the system default keytab (typically
51443 <filename>/etc/krb5.keytab</filename>) but instead the pathname given in this option.
51444 The value should be a pathname, with no <quote>file:</quote> prefix.
51445 </para>
51446 <para>
51447 <indexterm role="option">
51448 <primary><option>server_service</option></primary>
51449 </indexterm>
51450 </para>
51451 <informaltable frame="all">
51452 <tgroup cols="4" colsep="0" rowsep="0">
51453 <colspec colwidth="8*" align="left"/>
51454 <colspec colwidth="6*" align="center"/>
51455 <colspec colwidth="6*" align="center"/>
51456 <colspec colwidth="6*" align="right"/>
51457 <tbody>
51458 <row>
51459 <entry><option>server_service</option></entry>
51460 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
51461 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51462 <entry>Default: <emphasis>smtp</emphasis></entry>
51463 </row>
51464 </tbody>
51465 </tgroup>
51466 </informaltable>
51467 <para>
51468 This option specifies the service identifier used, in conjunction with
51469 <option>server_hostname</option>, for building the identifier for finding credentials
51470 from the keytab.
51471 </para>
51472 <section id="SECTheimdalgssauthvar">
51473 <title><command>heimdal_gssapi</command> auth variables</title>
51474 <para>
51475 Beware that these variables will typically include a realm, thus will appear
51476 to be roughly like an email address already.  The <emphasis>authzid</emphasis> in <varname>$auth2</varname> is
51477 not verified, so a malicious client can set it to anything.
51478 </para>
51479 <para>
51480 The <varname>$auth1</varname> field should be safely trustable as a value from the Key
51481 Distribution Center.  Note that these are not quite email addresses.
51482 Each identifier is for a role, and so the left-hand-side may include a
51483 role suffix.  For instance, <quote>joe/admin@EXAMPLE.ORG</quote>.
51484 </para>
51485 <para>
51486 <indexterm role="variable">
51487 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
51488 </indexterm>
51489 </para>
51490 <itemizedlist>
51491 <listitem>
51492 <para>
51493 <indexterm role="variable">
51494 <primary><varname>$auth1</varname></primary>
51495 </indexterm>
51496 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>, set to the GSS Display Name.
51497 </para>
51498 </listitem>
51499 <listitem>
51500 <para>
51501 <indexterm role="variable">
51502 <primary><varname>$auth2</varname></primary>
51503 </indexterm>
51504 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>, sent within SASL encapsulation after
51505 authentication.  If that was empty, this will also be set to the
51506 GSS Display Name.
51507 </para>
51508 </listitem>
51509 </itemizedlist>
51510 </section>
51511 </chapter>
51512
51513 <chapter id="CHAPspa">
51514 <title>The spa authenticator</title>
51515 <para>
51516 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
51517 <primary><command>spa</command> authenticator</primary>
51518 </indexterm>
51519 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
51520 <primary>authenticators</primary>
51521 <secondary><command>spa</command></secondary>
51522 </indexterm>
51523 <indexterm role="concept">
51524 <primary>authentication</primary>
51525 <secondary>Microsoft Secure Password</secondary>
51526 </indexterm>
51527 <indexterm role="concept">
51528 <primary>authentication</primary>
51529 <secondary>NTLM</secondary>
51530 </indexterm>
51531 <indexterm role="concept">
51532 <primary>Microsoft Secure Password Authentication</primary>
51533 </indexterm>
51534 <indexterm role="concept">
51535 <primary>NTLM authentication</primary>
51536 </indexterm>
51537 The <command>spa</command> authenticator provides client support for Microsoft&#x2019;s <emphasis>Secure
51538 Password Authentication</emphasis> mechanism,
51539 which is also sometimes known as NTLM (NT LanMan). The code for client side of
51540 this authenticator was contributed by Marc Prud&#x2019;hommeaux, and much of it is
51541 taken from the Samba project (<emphasis role="bold"><ulink url="http://www.samba.org">http://www.samba.org</ulink></emphasis>). The code for the
51542 server side was subsequently contributed by Tom Kistner. The mechanism works as
51543 follows:
51544 </para>
51545 <itemizedlist>
51546 <listitem>
51547 <para>
51548 After the AUTH command has been accepted, the client sends an SPA
51549 authentication request based on the user name and optional domain.
51550 </para>
51551 </listitem>
51552 <listitem>
51553 <para>
51554 The server sends back a challenge.
51555 </para>
51556 </listitem>
51557 <listitem>
51558 <para>
51559 The client builds a challenge response which makes use of the user&#x2019;s password
51560 and sends it to the server, which then accepts or rejects it.
51561 </para>
51562 </listitem>
51563 </itemizedlist>
51564 <para>
51565 Encryption is used to protect the password in transit.
51566 </para>
51567 <section id="SECID179">
51568 <title>Using spa as a server</title>
51569 <para>
51570 <indexterm role="concept">
51571 <primary>options</primary>
51572 <secondary><command>spa</command> authenticator (server)</secondary>
51573 </indexterm>
51574 The <command>spa</command> authenticator has just one server option:
51575 </para>
51576 <para>
51577 <indexterm role="option">
51578 <primary><option>server_password</option></primary>
51579 </indexterm>
51580 </para>
51581 <informaltable frame="all">
51582 <tgroup cols="4" colsep="0" rowsep="0">
51583 <colspec colwidth="8*" align="left"/>
51584 <colspec colwidth="6*" align="center"/>
51585 <colspec colwidth="6*" align="center"/>
51586 <colspec colwidth="6*" align="right"/>
51587 <tbody>
51588 <row>
51589 <entry><option>server_password</option></entry>
51590 <entry>Use: <emphasis>spa</emphasis></entry>
51591 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51592 <entry>Default: <emphasis>unset</emphasis></entry>
51593 </row>
51594 </tbody>
51595 </tgroup>
51596 </informaltable>
51597 <para>
51598 <indexterm role="concept">
51599 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
51600 <secondary>in <command>spa</command> authenticator</secondary>
51601 </indexterm>
51602 This option is expanded, and the result must be the cleartext password for the
51603 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
51604 compatibility with previous releases of Exim, the user name is also placed in
51605 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
51606 it can lead to confusion in string expansions that also use numeric variables
51607 for other things. For example:
51608 </para>
51609 <literallayout class="monospaced">
51610 spa:
51611   driver = spa
51612   public_name = NTLM
51613   server_password = \
51614     ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
51615 </literallayout>
51616 <para>
51617 If the expansion is forced to fail, authentication fails. Any other expansion
51618 failure causes a temporary error code to be returned.
51619 </para>
51620 </section>
51621 <section id="SECID180">
51622 <title>Using spa as a client</title>
51623 <para>
51624 <indexterm role="concept">
51625 <primary>options</primary>
51626 <secondary><command>spa</command> authenticator (client)</secondary>
51627 </indexterm>
51628 The <command>spa</command> authenticator has the following client options:
51629 </para>
51630 <para>
51631 <indexterm role="option">
51632 <primary><option>client_domain</option></primary>
51633 </indexterm>
51634 </para>
51635 <informaltable frame="all">
51636 <tgroup cols="4" colsep="0" rowsep="0">
51637 <colspec colwidth="8*" align="left"/>
51638 <colspec colwidth="6*" align="center"/>
51639 <colspec colwidth="6*" align="center"/>
51640 <colspec colwidth="6*" align="right"/>
51641 <tbody>
51642 <row>
51643 <entry><option>client_domain</option></entry>
51644 <entry>Use: <emphasis>spa</emphasis></entry>
51645 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51646 <entry>Default: <emphasis>unset</emphasis></entry>
51647 </row>
51648 </tbody>
51649 </tgroup>
51650 </informaltable>
51651 <para>
51652 This option specifies an optional domain for the authentication.
51653 </para>
51654 <para>
51655 <indexterm role="option">
51656 <primary><option>client_password</option></primary>
51657 </indexterm>
51658 </para>
51659 <informaltable frame="all">
51660 <tgroup cols="4" colsep="0" rowsep="0">
51661 <colspec colwidth="8*" align="left"/>
51662 <colspec colwidth="6*" align="center"/>
51663 <colspec colwidth="6*" align="center"/>
51664 <colspec colwidth="6*" align="right"/>
51665 <tbody>
51666 <row>
51667 <entry><option>client_password</option></entry>
51668 <entry>Use: <emphasis>spa</emphasis></entry>
51669 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51670 <entry>Default: <emphasis>unset</emphasis></entry>
51671 </row>
51672 </tbody>
51673 </tgroup>
51674 </informaltable>
51675 <para>
51676 This option specifies the user&#x2019;s password, and must be set.
51677 </para>
51678 <para>
51679 <indexterm role="option">
51680 <primary><option>client_username</option></primary>
51681 </indexterm>
51682 </para>
51683 <informaltable frame="all">
51684 <tgroup cols="4" colsep="0" rowsep="0">
51685 <colspec colwidth="8*" align="left"/>
51686 <colspec colwidth="6*" align="center"/>
51687 <colspec colwidth="6*" align="center"/>
51688 <colspec colwidth="6*" align="right"/>
51689 <tbody>
51690 <row>
51691 <entry><option>client_username</option></entry>
51692 <entry>Use: <emphasis>spa</emphasis></entry>
51693 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51694 <entry>Default: <emphasis>unset</emphasis></entry>
51695 </row>
51696 </tbody>
51697 </tgroup>
51698 </informaltable>
51699 <para>
51700 This option specifies the user name, and must be set. Here is an example of a
51701 configuration of this authenticator for use with the mail servers at
51702 <emphasis>msn.com</emphasis>:
51703 </para>
51704 <literallayout class="monospaced">
51705 msn:
51706   driver = spa
51707   public_name = MSN
51708   client_username = msn/msn_username
51709   client_password = msn_plaintext_password
51710   client_domain = DOMAIN_OR_UNSET
51711 </literallayout>
51712 <para>
51713 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
51714 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
51715 </para>
51716 </section>
51717 </chapter>
51718
51719 <chapter id="CHAPtlsauth">
51720 <title>The tls authenticator</title>
51721 <para>
51722 <indexterm role="concept" id="IIDtlsauth1" class="startofrange">
51723 <primary><command>tls</command> authenticator</primary>
51724 </indexterm>
51725 <indexterm role="concept" id="IIDtlsauth2" class="startofrange">
51726 <primary>authenticators</primary>
51727 <secondary><command>tls</command></secondary>
51728 </indexterm>
51729 <indexterm role="concept">
51730 <primary>authentication</primary>
51731 <secondary>Client Certificate</secondary>
51732 </indexterm>
51733 <indexterm role="concept">
51734 <primary>authentication</primary>
51735 <secondary>X509</secondary>
51736 </indexterm>
51737 <indexterm role="concept">
51738 <primary>Certificate-based authentication</primary>
51739 </indexterm>
51740 The <command>tls</command> authenticator provides server support for
51741 authentication based on client certificates.
51742 </para>
51743 <para>
51744 It is not an SMTP authentication mechanism and is not
51745 advertised by the server as part of the SMTP EHLO response.
51746 It is an Exim authenticator in the sense that it affects
51747 the protocol element of the log line, can be tested for
51748 by the <option>authenticated</option> ACL condition, and can set
51749 the <varname>$authenticated_id</varname> variable.
51750 </para>
51751 <para>
51752 The client must present a verifiable certificate,
51753 for which it must have been requested via the
51754 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> main options
51755 (see <xref linkend="CHAPTLS"/>).
51756 </para>
51757 <para>
51758 If an authenticator of this type is configured it is
51759 run before any SMTP-level communication is done,
51760 and can authenticate the connection.
51761 If it does, SMTP authentication is not offered.
51762 </para>
51763 <para>
51764 A maximum of one authenticator of this type may be present.
51765 </para>
51766 <para>
51767 <indexterm role="concept">
51768 <primary>options</primary>
51769 <secondary><command>tls</command> authenticator (server)</secondary>
51770 </indexterm>
51771 The <command>tls</command> authenticator has three server options:
51772 </para>
51773 <para>
51774 <indexterm role="option">
51775 <primary><option>server_param1</option></primary>
51776 </indexterm>
51777 </para>
51778 <informaltable frame="all">
51779 <tgroup cols="4" colsep="0" rowsep="0">
51780 <colspec colwidth="8*" align="left"/>
51781 <colspec colwidth="6*" align="center"/>
51782 <colspec colwidth="6*" align="center"/>
51783 <colspec colwidth="6*" align="right"/>
51784 <tbody>
51785 <row>
51786 <entry><option>server_param1</option></entry>
51787 <entry>Use: <emphasis>tls</emphasis></entry>
51788 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51789 <entry>Default: <emphasis>unset</emphasis></entry>
51790 </row>
51791 </tbody>
51792 </tgroup>
51793 </informaltable>
51794 <para>
51795 <indexterm role="concept">
51796 <primary>variables (<varname>$auth1</varname> <varname>$auth2</varname> etc)</primary>
51797 <secondary>in <command>tls</command> authenticator</secondary>
51798 </indexterm>
51799 This option is expanded after the TLS negotiation and
51800 the result is placed in <varname>$auth1</varname>.
51801 If the expansion is forced to fail, authentication fails. Any other expansion
51802 failure causes a temporary error code to be returned.
51803 </para>
51804 <para>
51805 <indexterm role="option">
51806 <primary><option>server_param2</option></primary>
51807 </indexterm>
51808 </para>
51809 <informaltable frame="all">
51810 <tgroup cols="4" colsep="0" rowsep="0">
51811 <colspec colwidth="8*" align="left"/>
51812 <colspec colwidth="6*" align="center"/>
51813 <colspec colwidth="6*" align="center"/>
51814 <colspec colwidth="6*" align="right"/>
51815 <tbody>
51816 <row>
51817 <entry><option>server_param2</option></entry>
51818 <entry>Use: <emphasis>tls</emphasis></entry>
51819 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51820 <entry>Default: <emphasis>unset</emphasis></entry>
51821 </row>
51822 </tbody>
51823 </tgroup>
51824 </informaltable>
51825 <para>
51826 <indexterm role="option">
51827 <primary><option>server_param3</option></primary>
51828 </indexterm>
51829 </para>
51830 <informaltable frame="all">
51831 <tgroup cols="4" colsep="0" rowsep="0">
51832 <colspec colwidth="8*" align="left"/>
51833 <colspec colwidth="6*" align="center"/>
51834 <colspec colwidth="6*" align="center"/>
51835 <colspec colwidth="6*" align="right"/>
51836 <tbody>
51837 <row>
51838 <entry><option>server_param3</option></entry>
51839 <entry>Use: <emphasis>tls</emphasis></entry>
51840 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51841 <entry>Default: <emphasis>unset</emphasis></entry>
51842 </row>
51843 </tbody>
51844 </tgroup>
51845 </informaltable>
51846 <para>
51847 As above, for <varname>$auth2</varname> and <varname>$auth3</varname>.
51848 </para>
51849 <para>
51850 <option>server_param1</option> may also be spelled <option>server_param</option>.
51851 </para>
51852 <para>
51853 Example:
51854 </para>
51855 <literallayout class="monospaced">
51856 tls:
51857   driver = tls
51858   server_param1 =     ${certextract {subj_altname,mail,&gt;:} \
51859                                     {$tls_in_peercert}}
51860   server_condition =  ${if forany {$auth1} \
51861                             {!= {0} \
51862                                 {${lookup ldap{ldap:///\
51863                          mailname=${quote_ldap_dn:${lc:$item}},\
51864                          ou=users,LDAP_DC?mailid} {$value}{0} \
51865                        }    }   } }
51866   server_set_id =     ${if = {1}{${listcount:$auth1}} {$auth1}{}}
51867 </literallayout>
51868 <para>
51869 This accepts a client certificate that is verifiable against any
51870 of your configured trust-anchors
51871 which usually means the full set of public CAs)
51872 and which has a SAN with a good account name.
51873 Note that the client cert is on the wire in-clear, including the SAN,
51874 whereas a plaintext SMTP AUTH done inside TLS is not.
51875 </para>
51876 <para>
51877 <indexterm role="concept" startref="IIDtlsauth1" class="endofrange"/>
51878 <indexterm role="concept" startref="IIDtlsauth2" class="endofrange"/>
51879 </para>
51880 <para>
51881 Note that because authentication is traditionally an SMTP operation,
51882 the <option>authenticated</option> ACL condition cannot be used in
51883 a connect- or helo-ACL.
51884 </para>
51885 </chapter>
51886
51887 <chapter id="CHAPTLS">
51888 <title>Encrypted SMTP connections using TLS/SSL</title>
51889 <titleabbrev>Encrypted SMTP connections</titleabbrev>
51890 <para>
51891 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
51892 <primary>encryption</primary>
51893 <secondary>on SMTP connection</secondary>
51894 </indexterm>
51895 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
51896 <primary>SMTP</primary>
51897 <secondary>encryption</secondary>
51898 </indexterm>
51899 <indexterm role="concept">
51900 <primary>TLS</primary>
51901 <secondary>on SMTP connection</secondary>
51902 </indexterm>
51903 <indexterm role="concept">
51904 <primary>OpenSSL</primary>
51905 </indexterm>
51906 <indexterm role="concept">
51907 <primary>GnuTLS</primary>
51908 </indexterm>
51909 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
51910 Sockets Layer), is implemented by making use of the OpenSSL library or the
51911 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
51912 cryptographic code in the Exim distribution itself for implementing TLS. In
51913 order to use this feature you must install OpenSSL or GnuTLS, and then build a
51914 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
51915 You also need to understand the basic concepts of encryption at a managerial
51916 level, and in particular, the way that public keys, private keys, and
51917 certificates are used.
51918 </para>
51919 <para>
51920 RFC 3207 defines how SMTP connections can make use of encryption. Once a
51921 connection is established, the client issues a STARTTLS command. If the
51922 server accepts this, the client and the server negotiate an encryption
51923 mechanism. If the negotiation succeeds, the data that subsequently passes
51924 between them is encrypted.
51925 </para>
51926 <para>
51927 Exim&#x2019;s ACLs can detect whether the current SMTP session is encrypted or not,
51928 and if so, what cipher suite is in use, whether the client supplied a
51929 certificate, and whether or not that certificate was verified. This makes it
51930 possible for an Exim server to deny or accept certain commands based on the
51931 encryption state.
51932 </para>
51933 <para>
51934 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
51935 disrupt TLS connections. You need to turn off SMTP scanning for these products
51936 in order to get TLS to work.
51937 </para>
51938 <section id="SECID284">
51939 <title>Support for the legacy <quote>ssmtp</quote> (aka <quote>smtps</quote>) protocol</title>
51940 <para>
51941 <indexterm role="concept">
51942 <primary>ssmtp protocol</primary>
51943 </indexterm>
51944 <indexterm role="concept">
51945 <primary>smtps protocol</primary>
51946 </indexterm>
51947 <indexterm role="concept">
51948 <primary>SMTP</primary>
51949 <secondary>ssmtp protocol</secondary>
51950 </indexterm>
51951 <indexterm role="concept">
51952 <primary>SMTP</primary>
51953 <secondary>smtps protocol</secondary>
51954 </indexterm>
51955 Early implementations of encrypted SMTP used a different TCP port from normal
51956 SMTP, and expected an encryption negotiation to start immediately, instead of
51957 waiting for a STARTTLS command from the client using the standard SMTP
51958 port. The protocol was called <quote>ssmtp</quote> or <quote>smtps</quote>, and port 465 was
51959 allocated for this purpose.
51960 </para>
51961 <para>
51962 This approach was abandoned when encrypted SMTP was standardized, but there are
51963 still some legacy clients that use it. Exim supports these clients by means of
51964 the <option>tls_on_connect_ports</option> global option. Its value must be a list of port
51965 numbers; the most common use is expected to be:
51966 </para>
51967 <literallayout class="monospaced">
51968 tls_on_connect_ports = 465
51969 </literallayout>
51970 <para>
51971 The port numbers specified by this option apply to all SMTP connections, both
51972 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
51973 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
51974 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
51975 an extra port &ndash; rather, it specifies different behaviour on a port that is
51976 defined elsewhere.
51977 </para>
51978 <para>
51979 There is also a <option>-tls-on-connect</option> command line option. This overrides
51980 <option>tls_on_connect_ports</option>; it forces the legacy behaviour for all ports.
51981 </para>
51982 </section>
51983 <section id="SECTopenvsgnu">
51984 <title>OpenSSL vs GnuTLS</title>
51985 <para>
51986 <indexterm role="concept">
51987 <primary>TLS</primary>
51988 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
51989 </indexterm>
51990 The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS
51991 followed later, when the first versions of GnuTLS were released. To build Exim
51992 to use GnuTLS, you need to set
51993 </para>
51994 <literallayout class="monospaced">
51995 USE_GNUTLS=yes
51996 </literallayout>
51997 <para>
51998 in Local/Makefile, in addition to
51999 </para>
52000 <literallayout class="monospaced">
52001 SUPPORT_TLS=yes
52002 </literallayout>
52003 <para>
52004 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
52005 include files and libraries for GnuTLS can be found.
52006 </para>
52007 <para>
52008 There are some differences in usage when using GnuTLS instead of OpenSSL:
52009 </para>
52010 <itemizedlist>
52011 <listitem>
52012 <para>
52013 The <option>tls_verify_certificates</option> option
52014 cannot be the path of a directory
52015 for GnuTLS versions before 3.3.6
52016 (for later versions, or OpenSSL, it can be either).
52017 </para>
52018 </listitem>
52019 <listitem>
52020 <para>
52021 The default value for <option>tls_dhparam</option> differs for historical reasons.
52022 </para>
52023 </listitem>
52024 <listitem>
52025 <para>
52026 <indexterm role="variable">
52027 <primary><varname>$tls_in_peerdn</varname></primary>
52028 </indexterm>
52029 <indexterm role="variable">
52030 <primary><varname>$tls_out_peerdn</varname></primary>
52031 </indexterm>
52032 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
52033 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
52034 affects the value of the <varname>$tls_in_peerdn</varname> and <varname>$tls_out_peerdn</varname> variables.
52035 </para>
52036 </listitem>
52037 <listitem>
52038 <para>
52039 OpenSSL identifies cipher suites using hyphens as separators, for example:
52040 DES-CBC3-SHA. GnuTLS historically used underscores, for example:
52041 RSA_ARCFOUR_SHA. What is more, OpenSSL complains if underscores are present
52042 in a cipher list. To make life simpler, Exim changes underscores to hyphens
52043 for OpenSSL and passes the string unchanged to GnuTLS (expecting the library
52044 to handle its own older variants) when processing lists of cipher suites in the
52045 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
52046 option).
52047 </para>
52048 </listitem>
52049 <listitem>
52050 <para>
52051 The <option>tls_require_ciphers</option> options operate differently, as described in the
52052 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
52053 </para>
52054 </listitem>
52055 <listitem>
52056 <para>
52057 The <option>tls_dh_min_bits</option> SMTP transport option is only honoured by GnuTLS.
52058 When using OpenSSL, this option is ignored.
52059 (If an API is found to let OpenSSL be configured in this way,
52060 let the Exim Maintainers know and we&#x2019;ll likely use it).
52061 </para>
52062 </listitem>
52063 <listitem>
52064 <para>
52065 Some other recently added features may only be available in one or the other.
52066 This should be documented with the feature.  If the documentation does not
52067 explicitly state that the feature is infeasible in the other TLS
52068 implementation, then patches are welcome.
52069 </para>
52070 </listitem>
52071 </itemizedlist>
52072 </section>
52073 <section id="SECTgnutlsparam">
52074 <title>GnuTLS parameter computation</title>
52075 <para>
52076 This section only applies if <option>tls_dhparam</option> is set to <literal>historic</literal> or to
52077 an explicit path; if the latter, then the text about generation still applies,
52078 but not the chosen filename.
52079 By default, as of Exim 4.80 a hard-coded D-H prime is used.
52080 See the documentation of <option>tls_dhparam</option> for more information.
52081 </para>
52082 <para>
52083 GnuTLS uses D-H parameters that may take a substantial amount of time
52084 to compute. It is unreasonable to re-compute them for every TLS session.
52085 Therefore, Exim keeps this data in a file in its spool directory, called
52086 <filename>gnutls-params-NNNN</filename> for some value of NNNN, corresponding to the number
52087 of bits requested.
52088 The file is owned by the Exim user and is readable only by
52089 its owner. Every Exim process that start up GnuTLS reads the D-H
52090 parameters from this file. If the file does not exist, the first Exim process
52091 that needs it computes the data and writes it to a temporary file which is
52092 renamed once it is complete. It does not matter if several Exim processes do
52093 this simultaneously (apart from wasting a few resources). Once a file is in
52094 place, new Exim processes immediately start using it.
52095 </para>
52096 <para>
52097 For maximum security, the parameters that are stored in this file should be
52098 recalculated periodically, the frequency depending on your paranoia level.
52099 If you are avoiding using the fixed D-H primes published in RFCs, then you
52100 are concerned about some advanced attacks and will wish to do this; if you do
52101 not regenerate then you might as well stick to the standard primes.
52102 </para>
52103 <para>
52104 Arranging this is easy in principle; just delete the file when you want new
52105 values to be computed. However, there may be a problem. The calculation of new
52106 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
52107 If the system is not very active, <filename>/dev/random</filename> may delay returning data
52108 until enough randomness (entropy) is available. This may cause Exim to hang for
52109 a substantial amount of time, causing timeouts on incoming connections.
52110 </para>
52111 <para>
52112 The solution is to generate the parameters externally to Exim. They are stored
52113 in <filename>gnutls-params-N</filename> in PEM format, which means that they can be
52114 generated externally using the <command>certtool</command> command that is part of GnuTLS.
52115 </para>
52116 <para>
52117 To replace the parameters with new ones, instead of deleting the file
52118 and letting Exim re-create it, you can generate new parameters using
52119 <command>certtool</command> and, when this has been done, replace Exim&#x2019;s cache file by
52120 renaming. The relevant commands are something like this:
52121 </para>
52122 <literallayout class="monospaced">
52123 # ls
52124 [ look for file; assume gnutls-params-2236 is the most recent ]
52125 # rm -f new-params
52126 # touch new-params
52127 # chown exim:exim new-params
52128 # chmod 0600 new-params
52129 # certtool --generate-dh-params --bits 2236 &gt;&gt;new-params
52130 # openssl dhparam -noout -text -in new-params | head
52131 [ check the first line, make sure it's not more than 2236;
52132   if it is, then go back to the start ("rm") and repeat
52133   until the size generated is at most the size requested ]
52134 # chmod 0400 new-params
52135 # mv new-params gnutls-params-2236
52136 </literallayout>
52137 <para>
52138 If Exim never has to generate the parameters itself, the possibility of
52139 stalling is removed.
52140 </para>
52141 <para>
52142 The filename changed in Exim 4.80, to gain the -bits suffix.  The value which
52143 Exim will choose depends upon the version of GnuTLS in use.  For older GnuTLS,
52144 the value remains hard-coded in Exim as 1024.  As of GnuTLS 2.12.x, there is
52145 a way for Exim to ask for the "normal" number of bits for D-H public-key usage,
52146 and Exim does so.  This attempt to remove Exim from TLS policy decisions
52147 failed, as GnuTLS 2.12 returns a value higher than the current hard-coded limit
52148 of the NSS library.  Thus Exim gains the <option>tls_dh_max_bits</option> global option,
52149 which applies to all D-H usage, client or server.  If the value returned by
52150 GnuTLS is greater than <option>tls_dh_max_bits</option> then the value will be clamped down
52151 to <option>tls_dh_max_bits</option>.  The default value has been set at the current NSS
52152 limit, which is still much higher than Exim historically used.
52153 </para>
52154 <para>
52155 The filename and bits used will change as the GnuTLS maintainers change the
52156 value for their parameter <literal>GNUTLS_SEC_PARAM_NORMAL</literal>, as clamped by
52157 <option>tls_dh_max_bits</option>.  At the time of writing (mid 2012), GnuTLS 2.12 recommends
52158 2432 bits, while NSS is limited to 2236 bits.
52159 </para>
52160 <para>
52161 In fact, the requested value will be *lower* than <option>tls_dh_max_bits</option>, to
52162 increase the chance of the generated prime actually being within acceptable
52163 bounds, as GnuTLS has been observed to overshoot.  Note the check step in the
52164 procedure above.  There is no sane procedure available to Exim to double-check
52165 the size of the generated prime, so it might still be too large.
52166 </para>
52167 </section>
52168 <section id="SECTreqciphssl">
52169 <title>Requiring specific ciphers in OpenSSL</title>
52170 <para>
52171 <indexterm role="concept">
52172 <primary>TLS</primary>
52173 <secondary>requiring specific ciphers (OpenSSL)</secondary>
52174 </indexterm>
52175 <indexterm role="option">
52176 <primary><option>tls_require_ciphers</option></primary>
52177 <secondary>OpenSSL</secondary>
52178 </indexterm>
52179 There is a function in the OpenSSL library that can be passed a list of cipher
52180 suites before the cipher negotiation takes place. This specifies which ciphers
52181 are acceptable. The list is colon separated and may contain names like
52182 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
52183 directly to this function call.
52184 Many systems will install the OpenSSL manual-pages, so you may have
52185 <emphasis>ciphers(1)</emphasis> available to you.
52186 The following quotation from the OpenSSL
52187 documentation specifies what forms of item are allowed in the cipher string:
52188 </para>
52189 <itemizedlist>
52190 <listitem>
52191 <para>
52192 It can consist of a single cipher suite such as RC4-SHA.
52193 </para>
52194 </listitem>
52195 <listitem>
52196 <para>
52197 It can represent a list of cipher suites containing a certain algorithm,
52198 or cipher suites of a certain type. For example SHA1 represents all
52199 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
52200 SSL v3 algorithms.
52201 </para>
52202 </listitem>
52203 <listitem>
52204 <para>
52205 Lists of cipher suites can be combined in a single cipher string using
52206 the + character. This is used as a logical and operation. For example
52207 SHA1+DES represents all cipher suites containing the SHA1 and the DES
52208 algorithms.
52209 </para>
52210 </listitem>
52211 </itemizedlist>
52212 <para>
52213 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
52214 <literal>-</literal> or <literal>+</literal>.
52215 </para>
52216 <itemizedlist>
52217 <listitem>
52218 <para>
52219 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
52220 ciphers deleted can never reappear in the list even if they are explicitly
52221 stated.
52222 </para>
52223 </listitem>
52224 <listitem>
52225 <para>
52226 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
52227 of the ciphers can be added again by later options.
52228 </para>
52229 </listitem>
52230 <listitem>
52231 <para>
52232 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
52233 option does not add any new ciphers; it just moves matching existing ones.
52234 </para>
52235 </listitem>
52236 </itemizedlist>
52237 <para>
52238 If none of these characters is present, the string is interpreted as
52239 a list of ciphers to be appended to the current preference list. If the list
52240 includes any ciphers already present they will be ignored: that is, they will
52241 not be moved to the end of the list.
52242 </para>
52243 <para>
52244 The OpenSSL <emphasis>ciphers(1)</emphasis> command may be used to test the results of a given
52245 string:
52246 </para>
52247 <literallayout class="monospaced">
52248 # note single-quotes to get ! past any shell history expansion
52249 $ openssl ciphers 'HIGH:!MD5:!SHA1'
52250 </literallayout>
52251 <para>
52252 This example will let the library defaults be permitted on the MX port, where
52253 there&#x2019;s probably no identity verification anyway, but ups the ante on the
52254 submission ports where the administrator might have some influence on the
52255 choice of clients used:
52256 </para>
52257 <literallayout class="monospaced">
52258 # OpenSSL variant; see man ciphers(1)
52259 tls_require_ciphers = ${if =={$received_port}{25}\
52260                            {DEFAULT}\
52261                            {HIGH:!MD5:!SHA1}}
52262 </literallayout>
52263 </section>
52264 <section id="SECTreqciphgnu">
52265 <title>Requiring specific ciphers or other parameters in GnuTLS</title>
52266 <para>
52267 <indexterm role="concept">
52268 <primary>GnuTLS</primary>
52269 <secondary>specifying parameters for</secondary>
52270 </indexterm>
52271 <indexterm role="concept">
52272 <primary>TLS</primary>
52273 <secondary>specifying ciphers (GnuTLS)</secondary>
52274 </indexterm>
52275 <indexterm role="concept">
52276 <primary>TLS</primary>
52277 <secondary>specifying key exchange methods (GnuTLS)</secondary>
52278 </indexterm>
52279 <indexterm role="concept">
52280 <primary>TLS</primary>
52281 <secondary>specifying MAC algorithms (GnuTLS)</secondary>
52282 </indexterm>
52283 <indexterm role="concept">
52284 <primary>TLS</primary>
52285 <secondary>specifying protocols (GnuTLS)</secondary>
52286 </indexterm>
52287 <indexterm role="concept">
52288 <primary>TLS</primary>
52289 <secondary>specifying priority string (GnuTLS)</secondary>
52290 </indexterm>
52291 <indexterm role="option">
52292 <primary><option>tls_require_ciphers</option></primary>
52293 <secondary>GnuTLS</secondary>
52294 </indexterm>
52295 The GnuTLS library allows the caller to provide a "priority string", documented
52296 as part of the <function>gnutls_priority_init</function> function.  This is very similar to the
52297 ciphersuite specification in OpenSSL.
52298 </para>
52299 <para>
52300 The <option>tls_require_ciphers</option> option is treated as the GnuTLS priority string
52301 and controls both protocols and ciphers.
52302 </para>
52303 <para>
52304 The <option>tls_require_ciphers</option> option is available both as an global option,
52305 controlling how Exim behaves as a server, and also as an option of the
52306 <command>smtp</command> transport, controlling how Exim behaves as a client.  In both cases
52307 the value is string expanded.  The resulting string is not an Exim list and
52308 the string is given to the GnuTLS library, so that Exim does not need to be
52309 aware of future feature enhancements of GnuTLS.
52310 </para>
52311 <para>
52312 Documentation of the strings accepted may be found in the GnuTLS manual, under
52313 "Priority strings".  This is online as
52314 <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>,
52315 but beware that this relates to GnuTLS 3, which may be newer than the version
52316 installed on your system.  If you are using GnuTLS 3,
52317 <emphasis role="bold"><ulink url="http://www.gnutls.org/manual/gnutls.html#Listing-the-ciphersuites-in-a-priority-string">then the example code</ulink></emphasis>
52318 on that site can be used to test a given string.
52319 </para>
52320 <para>
52321 For example:
52322 </para>
52323 <literallayout class="monospaced">
52324 # Disable older versions of protocols
52325 tls_require_ciphers = NORMAL:%LATEST_RECORD_VERSION:-VERS-SSL3.0
52326 </literallayout>
52327 <para>
52328 Prior to Exim 4.80, an older API of GnuTLS was used, and Exim supported three
52329 additional options, "<option>gnutls_require_kx</option>", "<option>gnutls_require_mac</option>" and
52330 "<option>gnutls_require_protocols</option>".  <option>tls_require_ciphers</option> was an Exim list.
52331 </para>
52332 <para>
52333 This example will let the library defaults be permitted on the MX port, where
52334 there&#x2019;s probably no identity verification anyway, and lowers security further
52335 by increasing compatibility; but this ups the ante on the submission ports
52336 where the administrator might have some influence on the choice of clients
52337 used:
52338 </para>
52339 <literallayout class="monospaced">
52340 # GnuTLS variant
52341 tls_require_ciphers = ${if =={$received_port}{25}\
52342                            {NORMAL:%COMPAT}\
52343                            {SECURE128}}
52344 </literallayout>
52345 </section>
52346 <section id="SECID182">
52347 <title>Configuring an Exim server to use TLS</title>
52348 <para>
52349 <indexterm role="concept">
52350 <primary>TLS</primary>
52351 <secondary>configuring an Exim server</secondary>
52352 </indexterm>
52353 When Exim has been built with TLS support, it advertises the availability of
52354 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
52355 but not to any others. The default value of this option is unset, which means
52356 that STARTTLS is not advertised at all. This default is chosen because you
52357 need to set some other options in order to make TLS available, and also it is
52358 sensible for systems that want to use TLS only as a client.
52359 </para>
52360 <para>
52361 If a client issues a STARTTLS command and there is some configuration
52362 problem in the server, the command is rejected with a 454 error. If the client
52363 persists in trying to issue SMTP commands, all except QUIT are rejected
52364 with the error
52365 </para>
52366 <literallayout class="monospaced">
52367 554 Security failure
52368 </literallayout>
52369 <para>
52370 If a STARTTLS command is issued within an existing TLS session, it is
52371 rejected with a 554 error code.
52372 </para>
52373 <para>
52374 To enable TLS operations on a server, you must set <option>tls_advertise_hosts</option> to
52375 match some hosts. You can, of course, set it to * to match all hosts.
52376 However, this is not all you need to do. TLS sessions to a server won&#x2019;t work
52377 without some further configuration at the server end.
52378 </para>
52379 <para>
52380 It is rumoured that all existing clients that support TLS/SSL use RSA
52381 encryption. To make this work you need to set, in the server,
52382 </para>
52383 <literallayout class="monospaced">
52384 tls_certificate = /some/file/name
52385 tls_privatekey = /some/file/name
52386 </literallayout>
52387 <para>
52388 These options are, in fact, expanded strings, so you can make them depend on
52389 the identity of the client that is connected if you wish. The first file
52390 contains the server&#x2019;s X509 certificate, and the second contains the private key
52391 that goes with it. These files need to be
52392 PEM format and readable by the Exim user, and must
52393 always be given as full path names.
52394 The key must not be password-protected.
52395 They can be the same file if both the
52396 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
52397 set, or if its expansion is forced to fail or results in an empty string, this
52398 is assumed to be the case. The certificate file may also contain intermediate
52399 certificates that need to be sent to the client to enable it to authenticate
52400 the server&#x2019;s certificate.
52401 </para>
52402 <para>
52403 If you do not understand about certificates and keys, please try to find a
52404 source of this background information, which is not Exim-specific. (There are a
52405 few comments below in section <xref linkend="SECTcerandall"/>.)
52406 </para>
52407 <para>
52408 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client &ndash;
52409 they apply only in the case of a server. If you need to use a certificate in an
52410 Exim client, you must set the options of the same names in an <command>smtp</command>
52411 transport.
52412 </para>
52413 <para>
52414 With just these options, an Exim server will be able to use TLS. It does not
52415 require the client to have a certificate (but see below for how to insist on
52416 this). There is one other option that may be needed in other situations. If
52417 </para>
52418 <literallayout class="monospaced">
52419 tls_dhparam = /some/file/name
52420 </literallayout>
52421 <para>
52422 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
52423 with the parameters contained in the file.
52424 Set this to <literal>none</literal> to disable use of DH entirely, by making no prime
52425 available:
52426 </para>
52427 <literallayout class="monospaced">
52428 tls_dhparam = none
52429 </literallayout>
52430 <para>
52431 This may also be set to a string identifying a standard prime to be used for
52432 DH; if it is set to <literal>default</literal> or, for OpenSSL, is unset, then the prime
52433 used is <literal>ike23</literal>.  There are a few standard primes available, see the
52434 documentation for <option>tls_dhparam</option> for the complete list.
52435 </para>
52436 <para>
52437 See the command
52438 </para>
52439 <literallayout class="monospaced">
52440 openssl dhparam
52441 </literallayout>
52442 <para>
52443 for a way of generating file data.
52444 </para>
52445 <para>
52446 The strings supplied for these three options are expanded every time a client
52447 host connects. It is therefore possible to use different certificates and keys
52448 for different hosts, if you so wish, by making use of the client&#x2019;s IP address
52449 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
52450 forced to fail, Exim behaves as if the option is not set.
52451 </para>
52452 <para>
52453 <indexterm role="concept">
52454 <primary>cipher</primary>
52455 <secondary>logging</secondary>
52456 </indexterm>
52457 <indexterm role="concept">
52458 <primary>log</primary>
52459 <secondary>TLS cipher</secondary>
52460 </indexterm>
52461 <indexterm role="variable">
52462 <primary><varname>$tls_in_cipher</varname></primary>
52463 </indexterm>
52464 The variable <varname>$tls_in_cipher</varname> is set to the cipher suite that was negotiated for
52465 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
52466 incoming message (by default &ndash; you can, of course, change this), and it is
52467 also included in the log line that records a message&#x2019;s arrival, keyed by
52468 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
52469 condition can be used to test for specific cipher suites in ACLs.
52470 </para>
52471 <para>
52472 Once TLS has been established, the ACLs that run for subsequent SMTP commands
52473 can check the name of the cipher suite and vary their actions accordingly. The
52474 cipher suite names vary, depending on which TLS library is being used. For
52475 example, OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other
52476 contexts is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL or GnuTLS
52477 documentation for more details.
52478 </para>
52479 <para>
52480 For outgoing SMTP deliveries, <varname>$tls_out_cipher</varname> is used and logged
52481 (again depending on the <option>tls_cipher</option> log selector).
52482 </para>
52483 </section>
52484 <section id="SECID183">
52485 <title>Requesting and verifying client certificates</title>
52486 <para>
52487 <indexterm role="concept">
52488 <primary>certificate</primary>
52489 <secondary>verification of client</secondary>
52490 </indexterm>
52491 <indexterm role="concept">
52492 <primary>TLS</primary>
52493 <secondary>client certificate verification</secondary>
52494 </indexterm>
52495 If you want an Exim server to request a certificate when negotiating a TLS
52496 session with a client, you must set either <option>tls_verify_hosts</option> or
52497 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
52498 apply to all TLS connections. For any host that matches one of these options,
52499 Exim requests a certificate as part of the setup of the TLS session. The
52500 contents of the certificate are verified by comparing it with a list of
52501 expected certificates.
52502 These may be the system default set (depending on library version),
52503 an explicit file or,
52504 depending on library version, a directory, identified by
52505 <option>tls_verify_certificates</option>.
52506 </para>
52507 <para>
52508 A file can contain multiple certificates, concatenated end to end. If a
52509 directory is used
52510 (OpenSSL only),
52511 each certificate must be in a separate file, with a name (or a symbolic link)
52512 of the form &lt;<emphasis>hash</emphasis>&gt;.0, where &lt;<emphasis>hash</emphasis>&gt; is a hash value constructed from the
52513 certificate. You can compute the relevant hash by running the command
52514 </para>
52515 <literallayout class="monospaced">
52516 openssl x509 -hash -noout -in /cert/file
52517 </literallayout>
52518 <para>
52519 where <filename>/cert/file</filename> contains a single certificate.
52520 </para>
52521 <para>
52522 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
52523 what happens if the client does not supply a certificate, or if the certificate
52524 does not match any of the certificates in the collection named by
52525 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
52526 attempt to set up a TLS session is aborted, and the incoming connection is
52527 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
52528 session continues. ACLs that run for subsequent SMTP commands can detect the
52529 fact that no certificate was verified, and vary their actions accordingly. For
52530 example, you can insist on a certificate before accepting a message for
52531 relaying, but not when the message is destined for local delivery.
52532 </para>
52533 <para>
52534 <indexterm role="variable">
52535 <primary><varname>$tls_in_peerdn</varname></primary>
52536 </indexterm>
52537 When a client supplies a certificate (whether it verifies or not), the value of
52538 the Distinguished Name of the certificate is made available in the variable
52539 <varname>$tls_in_peerdn</varname> during subsequent processing of the message.
52540 </para>
52541 <para>
52542 <indexterm role="concept">
52543 <primary>log</primary>
52544 <secondary>distinguished name</secondary>
52545 </indexterm>
52546 Because it is often a long text string, it is not included in the log line or
52547 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
52548 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
52549 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
52550 certificate is supplied, <varname>$tls_in_peerdn</varname> is empty.
52551 </para>
52552 </section>
52553 <section id="SECID184">
52554 <title>Revoked certificates</title>
52555 <para>
52556 <indexterm role="concept">
52557 <primary>TLS</primary>
52558 <secondary>revoked certificates</secondary>
52559 </indexterm>
52560 <indexterm role="concept">
52561 <primary>revocation list</primary>
52562 </indexterm>
52563 <indexterm role="concept">
52564 <primary>certificate</primary>
52565 <secondary>revocation list</secondary>
52566 </indexterm>
52567 <indexterm role="concept">
52568 <primary>OCSP</primary>
52569 <secondary>stapling</secondary>
52570 </indexterm>
52571 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
52572 certificates are revoked. If you have such a list, you can pass it to an Exim
52573 server using the global option called <option>tls_crl</option> and to an Exim client using
52574 an identically named option for the <command>smtp</command> transport. In each case, the value
52575 of the option is expanded and must then be the name of a file that contains a
52576 CRL in PEM format.
52577 The downside is that clients have to periodically re-download a potentially huge
52578 file from every certificate authority they know of.
52579 </para>
52580 <para>
52581 The way with most moving parts at query time is Online Certificate
52582 Status Protocol (OCSP), where the client verifies the certificate
52583 against an OCSP server run by the CA.  This lets the CA track all
52584 usage of the certs.  It requires running software with access to the
52585 private key of the CA, to sign the responses to the OCSP queries.  OCSP
52586 is based on HTTP and can be proxied accordingly.
52587 </para>
52588 <para>
52589 The only widespread OCSP server implementation (known to this writer)
52590 comes as part of OpenSSL and aborts on an invalid request, such as
52591 connecting to the port and then disconnecting.  This requires
52592 re-entering the passphrase each time some random client does this.
52593 </para>
52594 <para>
52595 The third way is OCSP Stapling; in this, the server using a certificate
52596 issued by the CA periodically requests an OCSP proof of validity from
52597 the OCSP server, then serves it up inline as part of the TLS
52598 negotiation.   This approach adds no extra round trips, does not let the
52599 CA track users, scales well with number of certs issued by the CA and is
52600 resilient to temporary OCSP server failures, as long as the server
52601 starts retrying to fetch an OCSP proof some time before its current
52602 proof expires.  The downside is that it requires server support.
52603 </para>
52604 <para>
52605 Unless Exim is built with the support disabled,
52606 </para>
52607 <para revisionflag="changed">
52608 or with GnuTLS earlier than version 3.3.16 / 3.4.8
52609 </para>
52610 <para>
52611 support for OCSP stapling is included.
52612 </para>
52613 <para>
52614 There is a global option called <option>tls_ocsp_file</option>.
52615 The file specified therein is expected to be in DER format, and contain
52616 an OCSP proof.  Exim will serve it as part of the TLS handshake.  This
52617 option will be re-expanded for SNI, if the <option>tls_certificate</option> option
52618 contains <literal>tls_in_sni</literal>, as per other TLS options.
52619 </para>
52620 <para>
52621 Exim does not at this time implement any support for fetching a new OCSP
52622 proof.  The burden is on the administrator to handle this, outside of
52623 Exim.  The file specified should be replaced atomically, so that the
52624 contents are always valid.  Exim will expand the <option>tls_ocsp_file</option> option
52625 on each connection, so a new file will be handled transparently on the
52626 next connection.
52627 </para>
52628 <para>
52629 When built with OpenSSL Exim will check for a valid next update timestamp
52630 in the OCSP proof; if not present, or if the proof has expired, it will be
52631 ignored.
52632 </para>
52633 <para>
52634 For the client to be able to verify the stapled OCSP the server must
52635 also supply, in its stapled information, any intermediate
52636 certificates for the chain leading to the OCSP proof from the signer
52637 of the server certificate.  There may be zero or one such. These
52638 intermediate certificates should be added to the server OCSP stapling
52639 file named by <option>tls_ocsp_file</option>.
52640 </para>
52641 <para>
52642 Note that the proof only covers the terminal server certificate,
52643 not any of the chain from CA to it.
52644 </para>
52645 <para>
52646 There is no current way to staple a proof for a client certificate.
52647 </para>
52648 <literallayout class="monospaced">
52649   A helper script "ocsp_fetch.pl" for fetching a proof from a CA
52650   OCSP server is supplied.  The server URL may be included in the
52651   server certificate, if the CA is helpful.
52652
52653   One failure mode seen was the OCSP Signer cert expiring before the end
52654   of validity of the OCSP proof. The checking done by Exim/OpenSSL
52655   noted this as invalid overall, but the re-fetch script did not.
52656 </literallayout>
52657 </section>
52658 <section id="SECID185">
52659 <title>Configuring an Exim client to use TLS</title>
52660 <para>
52661 <indexterm role="concept">
52662 <primary>cipher</primary>
52663 <secondary>logging</secondary>
52664 </indexterm>
52665 <indexterm role="concept">
52666 <primary>log</primary>
52667 <secondary>TLS cipher</secondary>
52668 </indexterm>
52669 <indexterm role="concept">
52670 <primary>log</primary>
52671 <secondary>distinguished name</secondary>
52672 </indexterm>
52673 <indexterm role="concept">
52674 <primary>TLS</primary>
52675 <secondary>configuring an Exim client</secondary>
52676 </indexterm>
52677 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
52678 deliveries as well as to incoming, the latter one causing logging of the
52679 server certificate&#x2019;s DN. The remaining client configuration for TLS is all
52680 within the <command>smtp</command> transport.
52681 </para>
52682 <para>
52683 It is not necessary to set any options to have TLS work in the <command>smtp</command>
52684 transport. If Exim is built with TLS support, and TLS is advertised by a
52685 server, the <command>smtp</command> transport always tries to start a TLS session. However,
52686 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
52687 transport) to a list of server hosts for which TLS should not be used.
52688 </para>
52689 <para>
52690 If you do not want Exim to attempt to send messages unencrypted when an attempt
52691 to set up an encrypted connection fails in any way, you can set
52692 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
52693 those hosts, delivery is always deferred if an encrypted connection cannot be
52694 set up. If there are any other hosts for the address, they are tried in the
52695 usual way.
52696 </para>
52697 <para>
52698 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
52699 the message unencrypted. It always does this if the response to STARTTLS is
52700 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
52701 session after a success response code, what happens is controlled by the
52702 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
52703 delivery to this host is deferred, and other hosts (if available) are tried. If
52704 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
52705 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
52706 negotiation fails, Exim closes the current connection (because it is in an
52707 unknown state), opens a new one to the same host, and then tries the delivery
52708 unencrypted.
52709 </para>
52710 <para>
52711 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
52712 transport provide the client with a certificate, which is passed to the server
52713 if it requests it. If the server is Exim, it will request a certificate only if
52714 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client.
52715 </para>
52716 <para>
52717 If the <option>tls_verify_certificates</option> option is set on the <command>smtp</command> transport, it
52718 specifies a collection of expected server certificates.
52719 These may be the system default set (depending on library version),
52720 a file or,
52721 depending on library version, a directory,
52722 must name a file or,
52723 for OpenSSL only (not GnuTLS), a directory.
52724 The client verifies the server&#x2019;s certificate
52725 against this collection, taking into account any revoked certificates that are
52726 in the list defined by <option>tls_crl</option>.
52727 Failure to verify fails the TLS connection unless either of the
52728 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> options are set.
52729 </para>
52730 <para>
52731 The <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> options restrict
52732 certificate verification to the listed servers.  Verification either must
52733 or need not succeed respectively.
52734 </para>
52735 <para>
52736 The <command>smtp</command> transport has two OCSP-related options:
52737 <option>hosts_require_ocsp</option>; a host-list for which a Certificate Status
52738 is requested and required for the connection to proceed.  The default
52739 value is empty.
52740 <option>hosts_request_ocsp</option>; a host-list for which (additionally)
52741 a Certificate Status is requested (but not necessarily verified).  The default
52742 value is "*" meaning that requests are made unless configured
52743 otherwise.
52744 </para>
52745 <para>
52746 The host(s) should also be in <option>hosts_require_tls</option>, and
52747 <option>tls_verify_certificates</option> configured for the transport,
52748 for OCSP to be relevant.
52749 </para>
52750 <para>
52751 If
52752 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
52753 list of permitted cipher suites. If either of these checks fails, delivery to
52754 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
52755 alternative hosts, if any.
52756 </para>
52757 <para>
52758  <emphasis role="bold">Note</emphasis>:
52759 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
52760 is operating as a client. Exim does not assume that a server certificate (set
52761 by the global options of the same name) should also be used when operating as a
52762 client.
52763 </para>
52764 <para>
52765 <indexterm role="variable">
52766 <primary><varname>$host</varname></primary>
52767 </indexterm>
52768 <indexterm role="variable">
52769 <primary><varname>$host_address</varname></primary>
52770 </indexterm>
52771 All the TLS options in the <command>smtp</command> transport are expanded before use, with
52772 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
52773 which the client is connected. Forced failure of an expansion causes Exim to
52774 behave as if the relevant option were unset.
52775 </para>
52776 <para>
52777 <indexterm role="variable">
52778 <primary><varname>$tls_out_bits</varname></primary>
52779 </indexterm>
52780 <indexterm role="variable">
52781 <primary><varname>$tls_out_cipher</varname></primary>
52782 </indexterm>
52783 <indexterm role="variable">
52784 <primary><varname>$tls_out_peerdn</varname></primary>
52785 </indexterm>
52786 <indexterm role="variable">
52787 <primary><varname>$tls_out_sni</varname></primary>
52788 </indexterm>
52789 Before an SMTP connection is established, the
52790 <varname>$tls_out_bits</varname>, <varname>$tls_out_cipher</varname>, <varname>$tls_out_peerdn</varname> and <varname>$tls_out_sni</varname>
52791 variables are emptied. (Until the first connection, they contain the values
52792 that were set when the message was received.) If STARTTLS is subsequently
52793 successfully obeyed, these variables are set to the relevant values for the
52794 outgoing connection.
52795 </para>
52796 </section>
52797 <section id="SECTtlssni">
52798 <title>Use of TLS Server Name Indication</title>
52799 <para>
52800 <indexterm role="concept">
52801 <primary>TLS</primary>
52802 <secondary>Server Name Indication</secondary>
52803 </indexterm>
52804 <indexterm role="variable">
52805 <primary><varname>$tls_in_sni</varname></primary>
52806 </indexterm>
52807 <indexterm role="option">
52808 <primary><option>tls_in_sni</option></primary>
52809 </indexterm>
52810 With TLS1.0 or above, there is an extension mechanism by which extra
52811 information can be included at various points in the protocol.  One of these
52812 extensions, documented in RFC 6066 (and before that RFC 4366) is
52813 <quote>Server Name Indication</quote>, commonly <quote>SNI</quote>.  This extension is sent by the
52814 client in the initial handshake, so that the server can examine the servername
52815 within and possibly choose to use different certificates and keys (and more)
52816 for this session.
52817 </para>
52818 <para>
52819 This is analogous to HTTP&#x2019;s <quote>Host:</quote> header, and is the main mechanism by
52820 which HTTPS-enabled web-sites can be virtual-hosted, many sites to one IP
52821 address.
52822 </para>
52823 <para>
52824 With SMTP to MX, there are the same problems here as in choosing the identity
52825 against which to validate a certificate: you can&#x2019;t rely on insecure DNS to
52826 provide the identity which you then cryptographically verify.  So this will
52827 be of limited use in that environment.
52828 </para>
52829 <para>
52830 With SMTP to Submission, there is a well-defined hostname which clients are
52831 connecting to and can validate certificates against.  Thus clients <emphasis role="bold">can</emphasis>
52832 choose to include this information in the TLS negotiation.  If this becomes
52833 wide-spread, then hosters can choose to present different certificates to
52834 different clients.  Or even negotiate different cipher suites.
52835 </para>
52836 <para>
52837 The <option>tls_sni</option> option on an SMTP transport is an expanded string; the result,
52838 if not empty, will be sent on a TLS session as part of the handshake.  There&#x2019;s
52839 nothing more to it.  Choosing a sensible value not derived insecurely is the
52840 only point of caution.  The <varname>$tls_out_sni</varname> variable will be set to this string
52841 for the lifetime of the client connection (including during authentication).
52842 </para>
52843 <para>
52844 Except during SMTP client sessions, if <varname>$tls_in_sni</varname> is set then it is a string
52845 received from a client.
52846 It can be logged with the <option>log_selector</option> item <literal>+tls_sni</literal>.
52847 </para>
52848 <para>
52849 If the string <literal>tls_in_sni</literal> appears in the main section&#x2019;s <option>tls_certificate</option>
52850 option (prior to expansion) then the following options will be re-expanded
52851 during TLS session handshake, to permit alternative values to be chosen:
52852 </para>
52853 <itemizedlist>
52854 <listitem>
52855 <para>
52856 <indexterm role="variable">
52857 <primary><option>tls_certificate</option></primary>
52858 </indexterm>
52859 <option>tls_certificate</option>
52860 </para>
52861 </listitem>
52862 <listitem>
52863 <para>
52864 <indexterm role="variable">
52865 <primary><option>tls_crl</option></primary>
52866 </indexterm>
52867 <option>tls_crl</option>
52868 </para>
52869 </listitem>
52870 <listitem>
52871 <para>
52872 <indexterm role="variable">
52873 <primary><option>tls_privatekey</option></primary>
52874 </indexterm>
52875 <option>tls_privatekey</option>
52876 </para>
52877 </listitem>
52878 <listitem>
52879 <para>
52880 <indexterm role="variable">
52881 <primary><option>tls_verify_certificates</option></primary>
52882 </indexterm>
52883 <option>tls_verify_certificates</option>
52884 </para>
52885 </listitem>
52886 <listitem>
52887 <para>
52888 <indexterm role="variable">
52889 <primary><option>tls_ocsp_file</option></primary>
52890 </indexterm>
52891 <option>tls_ocsp_file</option>
52892 </para>
52893 </listitem>
52894 </itemizedlist>
52895 <para>
52896 Great care should be taken to deal with matters of case, various injection
52897 attacks in the string (<literal>../</literal> or SQL), and ensuring that a valid filename
52898 can always be referenced; it is important to remember that <varname>$tls_sni</varname> is
52899 arbitrary unverified data provided prior to authentication.
52900 </para>
52901 <para>
52902 The Exim developers are proceeding cautiously and so far no other TLS options
52903 are re-expanded.
52904 </para>
52905 <para>
52906 When Exim is built against OpenSSL, OpenSSL must have been built with support
52907 for TLS Extensions.  This holds true for OpenSSL 1.0.0+ and 0.9.8+ with
52908 enable-tlsext in EXTRACONFIGURE.  If you invoke <command>openssl s_client -h</command> and
52909 see <literal>-servername</literal> in the output, then OpenSSL has support.
52910 </para>
52911 <para>
52912 When Exim is built against GnuTLS, SNI support is available as of GnuTLS
52913 0.5.10.  (Its presence predates the current API which Exim uses, so if Exim
52914 built, then you have SNI support).
52915 </para>
52916 </section>
52917 <section id="SECTmulmessam">
52918 <title>Multiple messages on the same encrypted TCP/IP connection</title>
52919 <para>
52920 <indexterm role="concept">
52921 <primary>multiple SMTP deliveries with TLS</primary>
52922 </indexterm>
52923 <indexterm role="concept">
52924 <primary>TLS</primary>
52925 <secondary>multiple message deliveries</secondary>
52926 </indexterm>
52927 Exim sends multiple messages down the same TCP/IP connection by starting up
52928 an entirely new delivery process for each message, passing the socket from
52929 one process to the next. This implementation does not fit well with the use
52930 of TLS, because there is quite a lot of state information associated with a TLS
52931 connection, not just a socket identification. Passing all the state information
52932 to a new process is not feasible. Consequently, Exim shuts down an existing TLS
52933 session before passing the socket to a new process. The new process may then
52934 try to start a new TLS session, and if successful, may try to re-authenticate
52935 if AUTH is in use, before sending the next message.
52936 </para>
52937 <para>
52938 The RFC is not clear as to whether or not an SMTP session continues in clear
52939 after TLS has been shut down, or whether TLS may be restarted again later, as
52940 just described. However, if the server is Exim, this shutdown and
52941 reinitialization works. It is not known which (if any) other servers operate
52942 successfully if the client closes a TLS session and continues with unencrypted
52943 SMTP, but there are certainly some that do not work. For such servers, Exim
52944 should not pass the socket to another process, because the failure of the
52945 subsequent attempt to use it would cause Exim to record a temporary host error,
52946 and delay other deliveries to that host.
52947 </para>
52948 <para>
52949 To test for this case, Exim sends an EHLO command to the server after
52950 closing down the TLS session. If this fails in any way, the connection is
52951 closed instead of being passed to a new delivery process, but no retry
52952 information is recorded.
52953 </para>
52954 <para>
52955 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
52956 <command>smtp</command> transport to match those hosts for which Exim should not pass
52957 connections to new processes if TLS has been used.
52958 </para>
52959 </section>
52960 <section id="SECTcerandall">
52961 <title>Certificates and all that</title>
52962 <para>
52963 <indexterm role="concept">
52964 <primary>certificate</primary>
52965 <secondary>references to discussion</secondary>
52966 </indexterm>
52967 In order to understand fully how TLS works, you need to know about
52968 certificates, certificate signing, and certificate authorities. This is not the
52969 place to give a tutorial, especially as I do not know very much about it
52970 myself. Some helpful introduction can be found in the FAQ for the SSL addition
52971 to Apache, currently at
52972 </para>
52973 <literallayout>
52974 <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>
52975 </literallayout>
52976 <para>
52977 Other parts of the <emphasis>modssl</emphasis> documentation are also helpful, and have
52978 links to further files.
52979 Eric Rescorla&#x2019;s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
52980 0-201-61598-3), contains both introductory and more in-depth descriptions.
52981 Some sample programs taken from the book are available from
52982 </para>
52983 <literallayout>
52984 <emphasis role="bold"><ulink url="http://www.rtfm.com/openssl-examples/">http://www.rtfm.com/openssl-examples/</ulink></emphasis>
52985 </literallayout>
52986 </section>
52987 <section id="SECID186">
52988 <title>Certificate chains</title>
52989 <para>
52990 The file named by <option>tls_certificate</option> may contain more than one
52991 certificate. This is useful in the case where the certificate that is being
52992 sent is validated by an intermediate certificate which the other end does
52993 not have. Multiple certificates must be in the correct order in the file.
52994 First the host&#x2019;s certificate itself, then the first intermediate
52995 certificate to validate the issuer of the host certificate, then the next
52996 intermediate certificate to validate the issuer of the first intermediate
52997 certificate, and so on, until finally (optionally) the root certificate.
52998 The root certificate must already be trusted by the recipient for
52999 validation to succeed, of course, but if it&#x2019;s not preinstalled, sending the
53000 root certificate along with the rest makes it available for the user to
53001 install if the receiving end is a client MUA that can interact with a user.
53002 </para>
53003 <para>
53004 Note that certificates using MD5 are unlikely to work on today&#x2019;s Internet;
53005 even if your libraries allow loading them for use in Exim when acting as a
53006 server, increasingly clients will not accept such certificates.  The error
53007 diagnostics in such a case can be frustratingly vague.
53008 </para>
53009 </section>
53010 <section id="SECID187">
53011 <title>Self-signed certificates</title>
53012 <para>
53013 <indexterm role="concept">
53014 <primary>certificate</primary>
53015 <secondary>self-signed</secondary>
53016 </indexterm>
53017 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
53018 with OpenSSL, like this:
53019 </para>
53020 <literallayout class="monospaced">
53021 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
53022             -days 9999 -nodes
53023 </literallayout>
53024 <para>
53025 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
53026 delimited and so can be identified independently. The <option>-days</option> option
53027 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
53028 important: if you do not set it, the key is encrypted with a passphrase
53029 that you are prompted for, and any use that is made of the key causes more
53030 prompting for the passphrase. This is not helpful if you are going to use
53031 this certificate and key in an MTA, where prompting is not possible.
53032 </para>
53033 <para>
53034 NB: we are now past the point where 9999 days takes us past the 32-bit Unix
53035 epoch.  If your system uses unsigned time_t (most do) and is 32-bit, then
53036 the above command might produce a date in the past.  Think carefully about
53037 the lifetime of the systems you&#x2019;re deploying, and either reduce the duration
53038 of the certificate or reconsider your platform deployment.  (At time of
53039 writing, reducing the duration is the most likely choice, but the inexorable
53040 progression of time takes us steadily towards an era where this will not
53041 be a sensible resolution).
53042 </para>
53043 <para>
53044 A self-signed certificate made in this way is sufficient for testing, and
53045 may be adequate for all your requirements if you are mainly interested in
53046 encrypting transfers, and not in secure identification.
53047 </para>
53048 <para>
53049 However, many clients require that the certificate presented by the server be a
53050 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
53051 certificate. In this situation, the self-signed certificate described above
53052 must be installed on the client host as a trusted root <emphasis>certification
53053 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
53054 signed with that self-signed certificate.
53055 </para>
53056 <para>
53057 For information on creating self-signed CA certificates and using them to sign
53058 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
53059 Open-source PKI book, available online at
53060 <emphasis role="bold"><ulink url="http://ospkibook.sourceforge.net/">http://ospkibook.sourceforge.net/</ulink></emphasis>.
53061 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
53062 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
53063 </para>
53064 </section>
53065 </chapter>
53066
53067 <chapter id="CHAPACL">
53068 <title>Access control lists</title>
53069 <para>
53070 <indexterm role="concept" id="IIDacl" class="startofrange">
53071 <primary>access control lists (ACLs)</primary>
53072 <secondary>description</secondary>
53073 </indexterm>
53074 <indexterm role="concept">
53075 <primary>control of incoming mail</primary>
53076 </indexterm>
53077 <indexterm role="concept">
53078 <primary>message</primary>
53079 <secondary>controlling incoming</secondary>
53080 </indexterm>
53081 <indexterm role="concept">
53082 <primary>policy control</primary>
53083 <secondary>access control lists</secondary>
53084 </indexterm>
53085 Access Control Lists (ACLs) are defined in a separate section of the run time
53086 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
53087 name, terminated by a colon. Here is a complete ACL section that contains just
53088 one very small ACL:
53089 </para>
53090 <literallayout class="monospaced">
53091 begin acl
53092 small_acl:
53093   accept   hosts = one.host.only
53094 </literallayout>
53095 <para>
53096 You can have as many lists as you like in the ACL section, and the order in
53097 which they appear does not matter. The lists are self-terminating.
53098 </para>
53099 <para>
53100 The majority of ACLs are used to control Exim&#x2019;s behaviour when it receives
53101 certain SMTP commands. This applies both to incoming TCP/IP connections, and
53102 when a local process submits a message using SMTP by specifying the <option>-bs</option>
53103 option. The most common use is for controlling which recipients are accepted
53104 in incoming messages. In addition, you can define an ACL that is used to check
53105 local non-SMTP messages. The default configuration file contains an example of
53106 a realistic ACL for checking RCPT commands. This is discussed in chapter
53107 <xref linkend="CHAPdefconfil"/>.
53108 </para>
53109 <section id="SECID188">
53110 <title>Testing ACLs</title>
53111 <para>
53112 The <option>-bh</option> command line option provides a way of testing your ACL
53113 configuration locally by running a fake SMTP session with which you interact.
53114 </para>
53115 </section>
53116 <section id="SECID189">
53117 <title>Specifying when ACLs are used</title>
53118 <para>
53119 <indexterm role="concept">
53120 <primary>access control lists (ACLs)</primary>
53121 <secondary>options for specifying</secondary>
53122 </indexterm>
53123 In order to cause an ACL to be used, you have to name it in one of the relevant
53124 options in the main part of the configuration. These options are:
53125 <indexterm role="concept">
53126 <primary>AUTH</primary>
53127 <secondary>ACL for</secondary>
53128 </indexterm>
53129 <indexterm role="concept">
53130 <primary>DATA</primary>
53131 <secondary>ACLs for</secondary>
53132 </indexterm>
53133 <indexterm role="concept">
53134 <primary>ETRN</primary>
53135 <secondary>ACL for</secondary>
53136 </indexterm>
53137 <indexterm role="concept">
53138 <primary>EXPN</primary>
53139 <secondary>ACL for</secondary>
53140 </indexterm>
53141 <indexterm role="concept">
53142 <primary>HELO</primary>
53143 <secondary>ACL for</secondary>
53144 </indexterm>
53145 <indexterm role="concept">
53146 <primary>EHLO</primary>
53147 <secondary>ACL for</secondary>
53148 </indexterm>
53149 <indexterm role="concept">
53150 <primary>DKIM</primary>
53151 <secondary>ACL for</secondary>
53152 </indexterm>
53153 <indexterm role="concept">
53154 <primary>MAIL</primary>
53155 <secondary>ACL for</secondary>
53156 </indexterm>
53157 <indexterm role="concept">
53158 <primary>QUIT, ACL for</primary>
53159 </indexterm>
53160 <indexterm role="concept">
53161 <primary>RCPT</primary>
53162 <secondary>ACL for</secondary>
53163 </indexterm>
53164 <indexterm role="concept">
53165 <primary>STARTTLS, ACL for</primary>
53166 </indexterm>
53167 <indexterm role="concept">
53168 <primary>VRFY</primary>
53169 <secondary>ACL for</secondary>
53170 </indexterm>
53171 <indexterm role="concept">
53172 <primary>SMTP</primary>
53173 <secondary>connection, ACL for</secondary>
53174 </indexterm>
53175 <indexterm role="concept">
53176 <primary>non-SMTP messages</primary>
53177 <secondary>ACLs for</secondary>
53178 </indexterm>
53179 <indexterm role="concept">
53180 <primary>MIME content scanning</primary>
53181 <secondary>ACL for</secondary>
53182 </indexterm>
53183 <indexterm role="concept">
53184 <primary>PRDR</primary>
53185 <secondary>ACL for</secondary>
53186 </indexterm>
53187 </para>
53188 <informaltable frame="none">
53189 <tgroup cols="2" colsep="0" rowsep="0">
53190 <colspec colwidth="140pt" align="left"/>
53191 <colspec colwidth="254pt" align="left"/>
53192 <tbody>
53193 <row>
53194 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp</option></entry>
53195 <entry>ACL for non-SMTP messages</entry>
53196 </row>
53197 <row>
53198 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_mime</option></entry>
53199 <entry>ACL for non-SMTP MIME parts</entry>
53200 </row>
53201 <row>
53202 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_start</option></entry>
53203 <entry>ACL at start of non-SMTP message</entry>
53204 </row>
53205 <row>
53206 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_auth</option></entry>
53207 <entry>ACL for AUTH</entry>
53208 </row>
53209 <row>
53210 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_connect</option></entry>
53211 <entry>ACL for start of SMTP connection</entry>
53212 </row>
53213 <row>
53214 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data</option></entry>
53215 <entry>ACL after DATA is complete</entry>
53216 </row>
53217 <row>
53218 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data_prdr</option></entry>
53219 <entry>ACL for each recipient, after DATA is complete</entry>
53220 </row>
53221 <row>
53222 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_dkim</option></entry>
53223 <entry>ACL for each DKIM signer</entry>
53224 </row>
53225 <row>
53226 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_etrn</option></entry>
53227 <entry>ACL for ETRN</entry>
53228 </row>
53229 <row>
53230 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_expn</option></entry>
53231 <entry>ACL for EXPN</entry>
53232 </row>
53233 <row>
53234 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_helo</option></entry>
53235 <entry>ACL for HELO or EHLO</entry>
53236 </row>
53237 <row>
53238 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mail</option></entry>
53239 <entry>ACL for MAIL</entry>
53240 </row>
53241 <row>
53242 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mailauth</option></entry>
53243 <entry>ACL for the AUTH parameter of MAIL</entry>
53244 </row>
53245 <row>
53246 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mime</option></entry>
53247 <entry>ACL for content-scanning MIME parts</entry>
53248 </row>
53249 <row>
53250 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_notquit</option></entry>
53251 <entry>ACL for non-QUIT terminations</entry>
53252 </row>
53253 <row>
53254 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_predata</option></entry>
53255 <entry>ACL at start of DATA command</entry>
53256 </row>
53257 <row>
53258 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_quit</option></entry>
53259 <entry>ACL for QUIT</entry>
53260 </row>
53261 <row>
53262 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_rcpt</option></entry>
53263 <entry>ACL for RCPT</entry>
53264 </row>
53265 <row>
53266 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_starttls</option></entry>
53267 <entry>ACL for STARTTLS</entry>
53268 </row>
53269 <row>
53270 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_vrfy</option></entry>
53271 <entry>ACL for VRFY</entry>
53272 </row>
53273 </tbody>
53274 </tgroup>
53275 </informaltable>
53276 <para>
53277 For example, if you set
53278 </para>
53279 <literallayout class="monospaced">
53280 acl_smtp_rcpt = small_acl
53281 </literallayout>
53282 <para>
53283 the little ACL defined above is used whenever Exim receives a RCPT command
53284 in an SMTP dialogue. The majority of policy tests on incoming messages can be
53285 done when RCPT commands arrive. A rejection of RCPT should cause the
53286 sending MTA to give up on the recipient address contained in the RCPT
53287 command, whereas rejection at other times may cause the client MTA to keep on
53288 trying to deliver the message. It is therefore recommended that you do as much
53289 testing as possible at RCPT time.
53290 </para>
53291 </section>
53292 <section id="SECID190">
53293 <title>The non-SMTP ACLs</title>
53294 <para>
53295 <indexterm role="concept">
53296 <primary>non-SMTP messages</primary>
53297 <secondary>ACLs for</secondary>
53298 </indexterm>
53299 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
53300 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
53301 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
53302 the state of the SMTP connection such as encryption and authentication) are not
53303 relevant and are forbidden in these ACLs. However, the sender and recipients
53304 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
53305 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
53306 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
53307 in any of these ACLs.
53308 </para>
53309 <para>
53310 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
53311 non-SMTP message, before any of the message has been read. (This is the
53312 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) In the case of
53313 batched SMTP input, it runs after the DATA command has been reached. The
53314 result of this ACL is ignored; it cannot be used to reject a message. If you
53315 really need to, you could set a value in an ACL variable here and reject based
53316 on that in the <option>acl_not_smtp</option> ACL. However, this ACL can be used to set
53317 controls, and in particular, it can be used to set
53318 </para>
53319 <literallayout class="monospaced">
53320 control = suppress_local_fixups
53321 </literallayout>
53322 <para>
53323 This cannot be used in the other non-SMTP ACLs because by the time they are
53324 run, it is too late.
53325 </para>
53326 <para>
53327 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
53328 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
53329 </para>
53330 <para>
53331 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
53332 kind of rejection is treated as permanent, because there is no way of sending a
53333 temporary error for these kinds of message.
53334 </para>
53335 </section>
53336 <section id="SECID191">
53337 <title>The SMTP connect ACL</title>
53338 <para>
53339 <indexterm role="concept">
53340 <primary>SMTP</primary>
53341 <secondary>connection, ACL for</secondary>
53342 </indexterm>
53343 <indexterm role="option">
53344 <primary><option>smtp_banner</option></primary>
53345 </indexterm>
53346 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
53347 session, after the test specified by <option>host_reject_connection</option> (which is now
53348 an anomaly) and any TCP Wrappers testing (if configured). If the connection is
53349 accepted by an <option>accept</option> verb that has a <option>message</option> modifier, the contents of
53350 the message override the banner message that is otherwise specified by the
53351 <option>smtp_banner</option> option.
53352 </para>
53353 </section>
53354 <section id="SECID192">
53355 <title>The EHLO/HELO ACL</title>
53356 <para>
53357 <indexterm role="concept">
53358 <primary>EHLO</primary>
53359 <secondary>ACL for</secondary>
53360 </indexterm>
53361 <indexterm role="concept">
53362 <primary>HELO</primary>
53363 <secondary>ACL for</secondary>
53364 </indexterm>
53365 The ACL test specified by <option>acl_smtp_helo</option> happens when the client issues an
53366 EHLO or HELO command, after the tests specified by <option>helo_accept_junk_hosts</option>,
53367 <option>helo_allow_chars</option>, <option>helo_verify_hosts</option>, and <option>helo_try_verify_hosts</option>.
53368 Note that a client may issue more than one EHLO or HELO command in an SMTP
53369 session, and indeed is required to issue a new EHLO or HELO after successfully
53370 setting up encryption following a STARTTLS command.
53371 </para>
53372 <para revisionflag="changed">
53373 Note also that a deny neither forces the client to go away nor means that
53374 mail will be refused on the connection.  Consider checking for
53375 <varname>$sender_helo_name</varname> being defined in a MAIL or RCPT ACL to do that.
53376 </para>
53377 <para>
53378 If the command is accepted by an <option>accept</option> verb that has a <option>message</option>
53379 modifier, the message may not contain more than one line (it will be truncated
53380 at the first newline and a panic logged if it does). Such a message cannot
53381 affect the EHLO options that are listed on the second and subsequent lines of
53382 an EHLO response.
53383 </para>
53384 </section>
53385 <section id="SECID193">
53386 <title>The DATA ACLs</title>
53387 <para>
53388 <indexterm role="concept">
53389 <primary>DATA</primary>
53390 <secondary>ACLs for</secondary>
53391 </indexterm>
53392 Two ACLs are associated with the DATA command, because it is two-stage
53393 command, with two responses being sent to the client.
53394 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
53395 is obeyed. This gives you control after all the RCPT commands, but before
53396 the message itself is received. It offers the opportunity to give a negative
53397 response to the DATA command before the data is transmitted. Header lines
53398 added by MAIL or RCPT ACLs are not visible at this time, but any that
53399 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
53400 </para>
53401 <para>
53402 You cannot test the contents of the message, for example, to verify addresses
53403 in the headers, at RCPT time or when the DATA command is received. Such
53404 tests have to appear in the ACL that is run after the message itself has been
53405 received, before the final response to the DATA command is sent. This is
53406 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
53407 associated with the DATA command.
53408 </para>
53409 <para>
53410 For both of these ACLs, it is not possible to reject individual recipients. An
53411 error response rejects the entire message. Unfortunately, it is known that some
53412 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
53413 before or after the data) correctly &ndash; they keep the message on their queues
53414 and try again later, but that is their problem, though it does waste some of
53415 your resources.
53416 </para>
53417 <para>
53418 The <option>acl_smtp_data</option> ACL is run after
53419 the <option>acl_smtp_data_prdr</option>,
53420 the <option>acl_smtp_dkim</option>
53421 and the <option>acl_smtp_mime</option> ACLs.
53422 </para>
53423 </section>
53424 <section id="SECTDKIMACL">
53425 <title>The SMTP DKIM ACL</title>
53426 <para>
53427 The <option>acl_smtp_dkim</option> ACL is available only when Exim is compiled with DKIM support
53428 enabled (which is the default).
53429 </para>
53430 <para>
53431 The ACL test specified by <option>acl_smtp_dkim</option> happens after a message has been
53432 received, and is executed for each DKIM signature found in a message.  If not
53433 otherwise specified, the default action is to accept.
53434 </para>
53435 <para>
53436 This ACL is evaluated before <option>acl_smtp_mime</option> and <option>acl_smtp_data</option>.
53437 </para>
53438 <para>
53439 For details on the operation of DKIM, see chapter <xref linkend="CHAPdkim"/>.
53440 </para>
53441 </section>
53442 <section id="SECID194">
53443 <title>The SMTP MIME ACL</title>
53444 <para>
53445 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
53446 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
53447 </para>
53448 <para>
53449 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
53450 </para>
53451 </section>
53452 <section id="SECTPRDRACL">
53453 <title>The SMTP PRDR ACL</title>
53454 <para>
53455 <indexterm role="concept">
53456 <primary>PRDR</primary>
53457 <secondary>ACL for</secondary>
53458 </indexterm>
53459 <indexterm role="option">
53460 <primary><option>prdr_enable</option></primary>
53461 </indexterm>
53462 The <option>acl_smtp_data_prdr</option> ACL is available only when Exim is compiled
53463 with PRDR support enabled (which is the default).
53464 It becomes active only when the PRDR feature is negotiated between
53465 client and server for a message, and more than one recipient
53466 has been accepted.
53467 </para>
53468 <para>
53469 The ACL test specified by <option>acl_smtp_data_prdr</option> happens after a message
53470 has been received, and is executed once for each recipient of the message
53471 with <varname>$local_part</varname> and <varname>$domain</varname> valid.
53472 The test may accept, defer or deny for individual recipients.
53473 The <option>acl_smtp_data</option> will still be called after this ACL and
53474 can reject the message overall, even if this ACL has accepted it
53475 for some or all recipients.
53476 </para>
53477 <para>
53478 PRDR may be used to support per-user content filtering.  Without it
53479 one must defer any recipient after the first that has a different
53480 content-filter configuration.  With PRDR, the RCPT-time check
53481 </para>
53482 <para revisionflag="changed">
53483 <indexterm role="concept">
53484 <primary>PRDR</primary>
53485 <secondary>variable for</secondary>
53486 </indexterm>
53487 for this can be disabled when the variable <varname>$prdr_requested</varname>
53488 is <quote>yes</quote>.
53489 </para>
53490 <para>
53491 Any required difference in behaviour of the main DATA-time
53492 ACL should however depend on the PRDR-time ACL having run, as Exim
53493 will avoid doing so in some situations (e.g.  single-recipient mails).
53494 </para>
53495 <para>
53496 See also the <option>prdr_enable</option> global option
53497 and the <option>hosts_try_prdr</option> smtp transport option.
53498 </para>
53499 <para>
53500 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
53501 If the ACL is not defined, processing completes as if
53502 the feature was not requested by the client.
53503 </para>
53504 </section>
53505 <section id="SECTQUITACL">
53506 <title>The QUIT ACL</title>
53507 <para>
53508 <indexterm role="concept">
53509 <primary>QUIT, ACL for</primary>
53510 </indexterm>
53511 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
53512 does not affect the response code to QUIT, which is always 221. Thus, the ACL
53513 does not in fact control any access.
53514 For this reason, it may only accept
53515 or warn as its final result.
53516 </para>
53517 <para>
53518 This ACL can be used for tasks such as custom logging at the end of an SMTP
53519 session. For example, you can use ACL variables in other ACLs to count
53520 messages, recipients, etc., and log the totals at QUIT time using one or
53521 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
53522 </para>
53523 <para>
53524 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
53525 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
53526 </para>
53527 <para>
53528 You do not need to have a final <option>accept</option>, but if you do, you can use a
53529 <option>message</option> modifier to specify custom text that is sent as part of the 221
53530 response to QUIT.
53531 </para>
53532 <para>
53533 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
53534 failure (for example, failure to open a log file, or when Exim is bombing out
53535 because it has detected an unrecoverable error), all SMTP commands from the
53536 client are given temporary error responses until QUIT is received or the
53537 connection is closed. In these special cases, the QUIT ACL does not run.
53538 </para>
53539 </section>
53540 <section id="SECTNOTQUITACL">
53541 <title>The not-QUIT ACL</title>
53542 <para>
53543 <indexterm role="variable">
53544 <primary><varname>$acl_smtp_notquit</varname></primary>
53545 </indexterm>
53546 The not-QUIT ACL, specified by <option>acl_smtp_notquit</option>, is run in most cases when
53547 an SMTP session ends without sending QUIT. However, when Exim itself is in bad
53548 trouble, such as being unable to write to its log files, this ACL is not run,
53549 because it might try to do things (such as write to log files) that make the
53550 situation even worse.
53551 </para>
53552 <para>
53553 Like the QUIT ACL, this ACL is provided to make it possible to do customized
53554 logging or to gather statistics, and its outcome is ignored. The <option>delay</option>
53555 modifier is forbidden in this ACL, and the only permitted verbs are <option>accept</option>
53556 and <option>warn</option>.
53557 </para>
53558 <para>
53559 <indexterm role="variable">
53560 <primary><varname>$smtp_notquit_reason</varname></primary>
53561 </indexterm>
53562 When the not-QUIT ACL is running, the variable <varname>$smtp_notquit_reason</varname> is set
53563 to a string that indicates the reason for the termination of the SMTP
53564 connection. The possible values are:
53565 </para>
53566 <informaltable frame="none">
53567 <tgroup cols="2" colsep="0" rowsep="0">
53568 <colspec colwidth="196pt" align="left"/>
53569 <colspec colwidth="254pt" align="left"/>
53570 <tbody>
53571 <row>
53572 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>acl-drop</literal></entry>
53573 <entry>Another ACL issued a <option>drop</option> command</entry>
53574 </row>
53575 <row>
53576 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>bad-commands</literal></entry>
53577 <entry>Too many unknown or non-mail commands</entry>
53578 </row>
53579 <row>
53580 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>command-timeout</literal></entry>
53581 <entry>Timeout while reading SMTP commands</entry>
53582 </row>
53583 <row>
53584 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>connection-lost</literal></entry>
53585 <entry>The SMTP connection has been lost</entry>
53586 </row>
53587 <row>
53588 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>data-timeout</literal></entry>
53589 <entry>Timeout while reading message data</entry>
53590 </row>
53591 <row>
53592 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-error</literal></entry>
53593 <entry>The <function>local_scan()</function> function crashed</entry>
53594 </row>
53595 <row>
53596 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-timeout</literal></entry>
53597 <entry>The <function>local_scan()</function> function timed out</entry>
53598 </row>
53599 <row>
53600 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>signal-exit</literal></entry>
53601 <entry>SIGTERM or SIGINT</entry>
53602 </row>
53603 <row>
53604 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>synchronization-error</literal></entry>
53605 <entry>SMTP synchronization error</entry>
53606 </row>
53607 <row>
53608 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls-failed</literal></entry>
53609 <entry>TLS failed to start</entry>
53610 </row>
53611 </tbody>
53612 </tgroup>
53613 </informaltable>
53614 <para>
53615 In most cases when an SMTP connection is closed without having received QUIT,
53616 Exim sends an SMTP response message before actually closing the connection.
53617 With the exception of the <literal>acl-drop</literal> case, the default message can be
53618 overridden by the <option>message</option> modifier in the not-QUIT ACL. In the case of a
53619 <option>drop</option> verb in another ACL, it is the message from the other ACL that is
53620 used.
53621 </para>
53622 </section>
53623 <section id="SECID195">
53624 <title>Finding an ACL to use</title>
53625 <para>
53626 <indexterm role="concept">
53627 <primary>access control lists (ACLs)</primary>
53628 <secondary>finding which to use</secondary>
53629 </indexterm>
53630 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
53631 you can use different ACLs in different circumstances. For example,
53632 </para>
53633 <literallayout class="monospaced">
53634 acl_smtp_rcpt = ${if ={25}{$interface_port} \
53635                      {acl_check_rcpt} {acl_check_rcpt_submit} }
53636 </literallayout>
53637 <para>
53638 In the default configuration file there are some example settings for
53639 providing an RFC 4409 message submission service on port 587 and a
53640 non-standard <quote>smtps</quote> service on port 465. You can use a string
53641 expansion like this to choose an ACL for MUAs on these ports which is
53642 more appropriate for this purpose than the default ACL on port 25.
53643 </para>
53644 <para>
53645 The expanded string does not have to be the name of an ACL in the
53646 configuration file; there are other possibilities. Having expanded the
53647 string, Exim searches for an ACL as follows:
53648 </para>
53649 <itemizedlist>
53650 <listitem>
53651 <para>
53652 If the string begins with a slash, Exim uses it as a file name, and reads its
53653 contents as an ACL. The lines are processed in the same way as lines in the
53654 Exim configuration file. In particular, continuation lines are supported, blank
53655 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
53656 If the file does not exist or cannot be read, an error occurs (typically
53657 causing a temporary failure of whatever caused the ACL to be run). For example:
53658 </para>
53659 <literallayout class="monospaced">
53660 acl_smtp_data = /etc/acls/\
53661   ${lookup{$sender_host_address}lsearch\
53662   {/etc/acllist}{$value}{default}}
53663 </literallayout>
53664 <para>
53665 This looks up an ACL file to use on the basis of the host&#x2019;s IP address, falling
53666 back to a default if the lookup fails. If an ACL is successfully read from a
53667 file, it is retained in memory for the duration of the Exim process, so that it
53668 can be re-used without having to re-read the file.
53669 </para>
53670 </listitem>
53671 <listitem>
53672 <para>
53673 If the string does not start with a slash, and does not contain any spaces,
53674 Exim searches the ACL section of the configuration for an ACL whose name
53675 matches the string.
53676 </para>
53677 </listitem>
53678 <listitem>
53679 <para>
53680 If no named ACL is found, or if the string contains spaces, Exim parses
53681 the string as an inline ACL. This can save typing in cases where you just
53682 want to have something like
53683 </para>
53684 <literallayout class="monospaced">
53685 acl_smtp_vrfy = accept
53686 </literallayout>
53687 <para>
53688 in order to allow free use of the VRFY command. Such a string may contain
53689 newlines; it is processed in the same way as an ACL that is read from a file.
53690 </para>
53691 </listitem>
53692 </itemizedlist>
53693 </section>
53694 <section id="SECID196">
53695 <title>ACL return codes</title>
53696 <para>
53697 <indexterm role="concept">
53698 <primary>access control lists (ACLs)</primary>
53699 <secondary>return codes</secondary>
53700 </indexterm>
53701 Except for the QUIT ACL, which does not affect the SMTP return code (see
53702 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
53703 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
53704 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
53705 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
53706 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
53707 This also causes a 4<emphasis>xx</emphasis> return code.
53708 </para>
53709 <para>
53710 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
53711 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
53712 submitters of non-SMTP messages.
53713 </para>
53714 <para>
53715 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
53716 has the effect of <quote>accept</quote>, but causes either the entire message or an
53717 individual recipient address to be discarded. In other words, it is a
53718 blackholing facility. Use it with care.
53719 </para>
53720 <para>
53721 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
53722 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
53723 RCPT ACL is to discard just the one recipient address. If there are no
53724 recipients left when the message&#x2019;s data is received, the DATA ACL is not
53725 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
53726 remaining recipients. The <quote>discard</quote> return is not permitted for the
53727 <option>acl_smtp_predata</option> ACL.
53728 </para>
53729 <para>
53730 <indexterm role="concept">
53731 <primary><function>local_scan()</function> function</primary>
53732 <secondary>when all recipients discarded</secondary>
53733 </indexterm>
53734 The <function>local_scan()</function> function is always run, even if there are no remaining
53735 recipients; it may create new recipients.
53736 </para>
53737 </section>
53738 <section id="SECID197">
53739 <title>Unset ACL options</title>
53740 <para>
53741 <indexterm role="concept">
53742 <primary>access control lists (ACLs)</primary>
53743 <secondary>unset options</secondary>
53744 </indexterm>
53745 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
53746 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
53747 not defined at all. For any defined ACL, the default action when control
53748 reaches the end of the ACL statements is <quote>deny</quote>.
53749 </para>
53750 <para>
53751 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
53752 these two are ACLs that are used only for their side effects. They cannot be
53753 used to accept or reject anything.
53754 </para>
53755 <para>
53756 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
53757 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
53758 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
53759 when the ACL is not defined is <quote>accept</quote>.
53760 </para>
53761 <para>
53762 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
53763 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
53764 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
53765 messages over an SMTP connection. For an example, see the ACL in the default
53766 configuration file.
53767 </para>
53768 </section>
53769 <section id="SECID198">
53770 <title>Data for message ACLs</title>
53771 <para>
53772 <indexterm role="concept">
53773 <primary>access control lists (ACLs)</primary>
53774 <secondary>data for message ACL</secondary>
53775 </indexterm>
53776 <indexterm role="variable">
53777 <primary><varname>$domain</varname></primary>
53778 </indexterm>
53779 <indexterm role="variable">
53780 <primary><varname>$local_part</varname></primary>
53781 </indexterm>
53782 <indexterm role="variable">
53783 <primary><varname>$sender_address</varname></primary>
53784 </indexterm>
53785 <indexterm role="variable">
53786 <primary><varname>$sender_host_address</varname></primary>
53787 </indexterm>
53788 <indexterm role="variable">
53789 <primary><varname>$smtp_command</varname></primary>
53790 </indexterm>
53791 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
53792 that contain information about the host and the message&#x2019;s sender (for example,
53793 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
53794 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
53795 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
53796 is available in <varname>$smtp_command</varname>.
53797 </para>
53798 <para>
53799 When an ACL for the AUTH parameter of MAIL is running, the variables that
53800 contain information about the host are set, but <varname>$sender_address</varname> is not yet
53801 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
53802 how it is used.
53803 </para>
53804 <para>
53805 <indexterm role="variable">
53806 <primary><varname>$message_size</varname></primary>
53807 </indexterm>
53808 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
53809 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
53810 that parameter is not given. The value is updated to the true message size by
53811 the time the final DATA ACL is run (after the message data has been
53812 received).
53813 </para>
53814 <para>
53815 <indexterm role="variable">
53816 <primary><varname>$rcpt_count</varname></primary>
53817 </indexterm>
53818 <indexterm role="variable">
53819 <primary><varname>$recipients_count</varname></primary>
53820 </indexterm>
53821 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
53822 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
53823 accepted, so while an ACL for RCPT is being processed, it contains the number
53824 of previously accepted recipients. At DATA time (for both the DATA ACLs),
53825 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
53826 <varname>$recipients_count</varname> contains the total number of accepted recipients.
53827 </para>
53828 </section>
53829 <section id="SECTdatfornon">
53830 <title>Data for non-message ACLs</title>
53831 <para>
53832 <indexterm role="concept">
53833 <primary>access control lists (ACLs)</primary>
53834 <secondary>data for non-message ACL</secondary>
53835 </indexterm>
53836 <indexterm role="variable">
53837 <primary><varname>$smtp_command_argument</varname></primary>
53838 </indexterm>
53839 <indexterm role="variable">
53840 <primary><varname>$smtp_command</varname></primary>
53841 </indexterm>
53842 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
53843 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
53844 and the entire SMTP command is available in <varname>$smtp_command</varname>.
53845 These variables can be tested using a <option>condition</option> condition. For example,
53846 here is an ACL for use with AUTH, which insists that either the session is
53847 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
53848 does not permit authentication methods that use cleartext passwords on
53849 unencrypted connections.
53850 </para>
53851 <literallayout class="monospaced">
53852 acl_check_auth:
53853   accept encrypted = *
53854   accept condition = ${if eq{${uc:$smtp_command_argument}}\
53855                      {CRAM-MD5}}
53856   deny   message   = TLS encryption or CRAM-MD5 required
53857 </literallayout>
53858 <para>
53859 (Another way of applying this restriction is to arrange for the authenticators
53860 that use cleartext passwords not to be advertised when the connection is not
53861 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
53862 option to do this.)
53863 </para>
53864 </section>
53865 <section id="SECID199">
53866 <title>Format of an ACL</title>
53867 <para>
53868 <indexterm role="concept">
53869 <primary>access control lists (ACLs)</primary>
53870 <secondary>format of</secondary>
53871 </indexterm>
53872 <indexterm role="concept">
53873 <primary>access control lists (ACLs)</primary>
53874 <secondary>verbs, definition of</secondary>
53875 </indexterm>
53876 An individual ACL consists of a number of statements. Each statement starts
53877 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
53878 Modifiers can change the way the verb operates, define error and log messages,
53879 set variables, insert delays, and vary the processing of accepted messages.
53880 </para>
53881 <para>
53882 If all the conditions are met, the verb is obeyed. The same condition may be
53883 used (with different arguments) more than once in the same statement. This
53884 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
53885 example:
53886 </para>
53887 <literallayout class="monospaced">
53888 deny  dnslists = list1.example
53889 dnslists = list2.example
53890 </literallayout>
53891 <para>
53892 If there are no conditions, the verb is always obeyed. Exim stops evaluating
53893 the conditions and modifiers when it reaches a condition that fails. What
53894 happens then depends on the verb (and in one case, on a special modifier). Not
53895 all the conditions make sense at every testing point. For example, you cannot
53896 test a sender address in the ACL that is run for a VRFY command.
53897 </para>
53898 </section>
53899 <section id="SECID200">
53900 <title>ACL verbs</title>
53901 <para>
53902 The ACL verbs are as follows:
53903 </para>
53904 <itemizedlist>
53905 <listitem>
53906 <para>
53907 <indexterm role="concept">
53908 <primary><option>accept</option> ACL verb</primary>
53909 </indexterm>
53910 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
53911 of the conditions are not met, what happens depends on whether <option>endpass</option>
53912 appears among the conditions (for syntax see below). If the failing condition
53913 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
53914 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
53915 check a RCPT command:
53916 </para>
53917 <literallayout class="monospaced">
53918 accept domains = +local_domains
53919 endpass
53920 verify = recipient
53921 </literallayout>
53922 <para>
53923 If the recipient domain does not match the <option>domains</option> condition, control
53924 passes to the next statement. If it does match, the recipient is verified, and
53925 the command is accepted if verification succeeds. However, if verification
53926 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
53927 <option>endpass</option>.
53928 </para>
53929 <para>
53930 The <option>endpass</option> feature has turned out to be confusing to many people, so its
53931 use is not recommended nowadays. It is always possible to rewrite an ACL so
53932 that <option>endpass</option> is not needed, and it is no longer used in the default
53933 configuration.
53934 </para>
53935 <para>
53936 <indexterm role="concept">
53937 <primary><option>message</option> ACL modifier</primary>
53938 <secondary>with <option>accept</option></secondary>
53939 </indexterm>
53940 If a <option>message</option> modifier appears on an <option>accept</option> statement, its action
53941 depends on whether or not <option>endpass</option> is present. In the absence of <option>endpass</option>
53942 (when an <option>accept</option> verb either accepts or passes control to the next
53943 statement), <option>message</option> can be used to vary the message that is sent when an
53944 SMTP command is accepted. For example, in a RCPT ACL you could have:
53945 </para>
53946 <literallayout>
53947 <literal>accept  </literal>&lt;<emphasis>some conditions</emphasis>&gt;
53948 <literal>        message = OK, I will allow you through today</literal>
53949 </literallayout>
53950 <para>
53951 You can specify an SMTP response code, optionally followed by an <quote>extended
53952 response code</quote> at the start of the message, but the first digit must be the
53953 same as would be sent by default, which is 2 for an <option>accept</option> verb.
53954 </para>
53955 <para>
53956 If <option>endpass</option> is present in an <option>accept</option> statement, <option>message</option> specifies
53957 an error message that is used when access is denied. This behaviour is retained
53958 for backward compatibility, but current <quote>best practice</quote> is to avoid the use
53959 of <option>endpass</option>.
53960 </para>
53961 </listitem>
53962 <listitem>
53963 <para>
53964 <indexterm role="concept">
53965 <primary><option>defer</option> ACL verb</primary>
53966 </indexterm>
53967 <option>defer</option>: If all the conditions are true, the ACL returns <quote>defer</quote> which, in
53968 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
53969 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
53970 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
53971 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
53972 be used in any ACL, and even for a recipient it might be a simpler approach.
53973 </para>
53974 </listitem>
53975 <listitem>
53976 <para>
53977 <indexterm role="concept">
53978 <primary><option>deny</option> ACL verb</primary>
53979 </indexterm>
53980 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
53981 the conditions are not met, control is passed to the next ACL statement. For
53982 example,
53983 </para>
53984 <literallayout class="monospaced">
53985 deny dnslists = blackholes.mail-abuse.org
53986 </literallayout>
53987 <para>
53988 rejects commands from hosts that are on a DNS black list.
53989 </para>
53990 </listitem>
53991 <listitem>
53992 <para>
53993 <indexterm role="concept">
53994 <primary><option>discard</option> ACL verb</primary>
53995 </indexterm>
53996 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
53997 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
53998 that are concerned with receiving messages. When all the conditions are true,
53999 the sending entity receives a <quote>success</quote> response. However, <option>discard</option> causes
54000 recipients to be discarded. If it is used in an ACL for RCPT, just the one
54001 recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
54002 message&#x2019;s recipients are discarded. Recipients that are discarded before DATA
54003 do not appear in the log line when the <option>received_recipients</option> log selector is set.
54004 </para>
54005 <para>
54006 If the <option>log_message</option> modifier is set when <option>discard</option> operates,
54007 its contents are added to the line that is automatically written to the log.
54008 The <option>message</option> modifier operates exactly as it does for <option>accept</option>.
54009 </para>
54010 </listitem>
54011 <listitem>
54012 <para>
54013 <indexterm role="concept">
54014 <primary><option>drop</option> ACL verb</primary>
54015 </indexterm>
54016 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
54017 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
54018 </para>
54019 <literallayout class="monospaced">
54020 drop   message   = I don't take more than 20 RCPTs
54021        condition = ${if &gt; {$rcpt_count}{20}}
54022 </literallayout>
54023 <para>
54024 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
54025 The connection is always dropped after sending a 550 response.
54026 </para>
54027 </listitem>
54028 <listitem>
54029 <para>
54030 <indexterm role="concept">
54031 <primary><option>require</option> ACL verb</primary>
54032 </indexterm>
54033 <option>require</option>: If all the conditions are met, control is passed to the next ACL
54034 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
54035 example, when checking a RCPT command,
54036 </para>
54037 <literallayout class="monospaced">
54038 require message = Sender did not verify
54039         verify  = sender
54040 </literallayout>
54041 <para>
54042 passes control to subsequent statements only if the message&#x2019;s sender can be
54043 verified. Otherwise, it rejects the command. Note the positioning of the
54044 <option>message</option> modifier, before the <option>verify</option> condition. The reason for this is
54045 discussed in section <xref linkend="SECTcondmodproc"/>.
54046 </para>
54047 </listitem>
54048 <listitem>
54049 <para>
54050 <indexterm role="concept">
54051 <primary><option>warn</option> ACL verb</primary>
54052 </indexterm>
54053 <option>warn</option>: If all the conditions are true, a line specified by the
54054 <option>log_message</option> modifier is written to Exim&#x2019;s main log. Control always passes
54055 to the next ACL statement. If any condition is false, the log line is not
54056 written. If an identical log line is requested several times in the same
54057 message, only one copy is actually written to the log. If you want to force
54058 duplicates to be written, use the <option>logwrite</option> modifier instead.
54059 </para>
54060 <para>
54061 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
54062 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
54063 <option>logwrite</option>, <option>add_header</option>, and <option>remove_header</option>) that appear before the
54064 first failing condition. There is more about adding header lines in section
54065 <xref linkend="SECTaddheadacl"/>.
54066 </para>
54067 <para>
54068 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
54069 some sort of defer), the log line specified by <option>log_message</option> is not written.
54070 This does not include the case of a forced failure from a lookup, which
54071 is considered to be a successful completion. After a defer, no further
54072 conditions or modifiers in the <option>warn</option> statement are processed. The incident
54073 is logged, and the ACL continues to be processed, from the next statement
54074 onwards.
54075 </para>
54076 <para>
54077 <indexterm role="variable">
54078 <primary><varname>$acl_verify_message</varname></primary>
54079 </indexterm>
54080 When one of the <option>warn</option> conditions is an address verification that fails, the
54081 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
54082 want this logged, you must set it up explicitly. For example:
54083 </para>
54084 <literallayout class="monospaced">
54085 warn   !verify = sender
54086        log_message = sender verify failed: $acl_verify_message
54087 </literallayout>
54088 </listitem>
54089 </itemizedlist>
54090 <para>
54091 At the end of each ACL there is an implicit unconditional <option>deny</option>.
54092 </para>
54093 <para>
54094 As you can see from the examples above, the conditions and modifiers are
54095 written one to a line, with the first one on the same line as the verb, and
54096 subsequent ones on following lines. If you have a very long condition, you can
54097 continue it onto several physical lines by the usual backslash continuation
54098 mechanism. It is conventional to align the conditions vertically.
54099 </para>
54100 </section>
54101 <section id="SECTaclvariables">
54102 <title>ACL variables</title>
54103 <para>
54104 <indexterm role="concept">
54105 <primary>access control lists (ACLs)</primary>
54106 <secondary>variables</secondary>
54107 </indexterm>
54108 There are some special variables that can be set during ACL processing. They
54109 can be used to pass information between different ACLs, different invocations
54110 of the same ACL in the same SMTP connection, and between ACLs and the routers,
54111 transports, and filters that are used to deliver a message. The names of these
54112 variables must begin with <varname>$acl_c</varname> or <varname>$acl_m</varname>, followed either by a digit or
54113 an underscore, but the remainder of the name can be any sequence of
54114 alphanumeric characters and underscores that you choose. There is no limit on
54115 the number of ACL variables. The two sets act as follows:
54116 </para>
54117 <itemizedlist>
54118 <listitem>
54119 <para>
54120 The values of those variables whose names begin with <varname>$acl_c</varname> persist
54121 throughout an SMTP connection. They are never reset. Thus, a value that is set
54122 while receiving one message is still available when receiving the next message
54123 on the same SMTP connection.
54124 </para>
54125 </listitem>
54126 <listitem>
54127 <para>
54128 The values of those variables whose names begin with <varname>$acl_m</varname> persist only
54129 while a message is being received. They are reset afterwards. They are also
54130 reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session.
54131 </para>
54132 </listitem>
54133 </itemizedlist>
54134 <para>
54135 When a message is accepted, the current values of all the ACL variables are
54136 preserved with the message and are subsequently made available at delivery
54137 time. The ACL variables are set by a modifier called <option>set</option>. For example:
54138 </para>
54139 <literallayout class="monospaced">
54140 accept hosts = whatever
54141        set acl_m4 = some value
54142 accept authenticated = *
54143        set acl_c_auth = yes
54144 </literallayout>
54145 <para>
54146 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
54147 be set. If you want to set a variable without taking any action, you can use a
54148 <option>warn</option> verb without any other modifiers or conditions.
54149 </para>
54150 <para>
54151 <indexterm role="option">
54152 <primary><option>strict_acl_vars</option></primary>
54153 </indexterm>
54154 What happens if a syntactically valid but undefined ACL variable is
54155 referenced depends on the setting of the <option>strict_acl_vars</option> option. If it is
54156 false (the default), an empty string is substituted; if it is true, an
54157 error is generated.
54158 </para>
54159 <para>
54160 Versions of Exim before 4.64 have a limited set of numbered variables, but
54161 their names are compatible, so there is no problem with upgrading.
54162 </para>
54163 </section>
54164 <section id="SECTcondmodproc">
54165 <title>Condition and modifier processing</title>
54166 <para>
54167 <indexterm role="concept">
54168 <primary>access control lists (ACLs)</primary>
54169 <secondary>conditions; processing</secondary>
54170 </indexterm>
54171 <indexterm role="concept">
54172 <primary>access control lists (ACLs)</primary>
54173 <secondary>modifiers; processing</secondary>
54174 </indexterm>
54175 An exclamation mark preceding a condition negates its result. For example:
54176 </para>
54177 <literallayout class="monospaced">
54178 deny   domains = *.dom.example
54179       !verify  = recipient
54180 </literallayout>
54181 <para>
54182 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
54183 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
54184 negation can be used on the right-hand side of a condition. For example, these
54185 two statements are equivalent:
54186 </para>
54187 <literallayout class="monospaced">
54188 deny  hosts = !192.168.3.4
54189 deny !hosts =  192.168.3.4
54190 </literallayout>
54191 <para>
54192 However, for many conditions (<option>verify</option> being a good example), only left-hand
54193 side negation of the whole condition is possible.
54194 </para>
54195 <para>
54196 The arguments of conditions and modifiers are expanded. A forced failure
54197 of an expansion causes a condition to be ignored, that is, it behaves as if the
54198 condition is true. Consider these two statements:
54199 </para>
54200 <literallayout class="monospaced">
54201 accept  senders = ${lookup{$host_name}lsearch\
54202                   {/some/file}{$value}fail}
54203 accept  senders = ${lookup{$host_name}lsearch\
54204                   {/some/file}{$value}{}}
54205 </literallayout>
54206 <para>
54207 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
54208 the returned list is searched, but if the lookup fails the behaviour is
54209 different in the two cases. The <option>fail</option> in the first statement causes the
54210 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
54211 therefore succeeds. The second statement, however, generates an empty list when
54212 the lookup fails. No sender can match an empty list, so the condition fails,
54213 and therefore the <option>accept</option> also fails.
54214 </para>
54215 <para>
54216 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
54217 specify actions that are taken as the conditions for a statement are checked;
54218 others specify text for messages that are used when access is denied or a
54219 warning is generated. The <option>control</option> modifier affects the way an incoming
54220 message is handled.
54221 </para>
54222 <para>
54223 The positioning of the modifiers in an ACL statement is important, because the
54224 processing of a verb ceases as soon as its outcome is known. Only those
54225 modifiers that have already been encountered will take effect. For example,
54226 consider this use of the <option>message</option> modifier:
54227 </para>
54228 <literallayout class="monospaced">
54229 require message = Can't verify sender
54230         verify  = sender
54231         message = Can't verify recipient
54232         verify  = recipient
54233         message = This message cannot be used
54234 </literallayout>
54235 <para>
54236 If sender verification fails, Exim knows that the result of the statement is
54237 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
54238 so its text is used as the error message. If sender verification succeeds, but
54239 recipient verification fails, the second message is used. If recipient
54240 verification succeeds, the third message becomes <quote>current</quote>, but is never used
54241 because there are no more conditions to cause failure.
54242 </para>
54243 <para>
54244 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
54245 modifier that is used, because all the conditions must be true for rejection to
54246 happen. Specifying more than one <option>message</option> modifier does not make sense, and
54247 the message can even be specified after all the conditions. For example:
54248 </para>
54249 <literallayout class="monospaced">
54250 deny   hosts = ...
54251       !senders = *@my.domain.example
54252        message = Invalid sender from client host
54253 </literallayout>
54254 <para>
54255 The <quote>deny</quote> result does not happen until the end of the statement is reached,
54256 by which time Exim has set up the message.
54257 </para>
54258 </section>
54259 <section id="SECTACLmodi">
54260 <title>ACL modifiers</title>
54261 <para>
54262 <indexterm role="concept">
54263 <primary>access control lists (ACLs)</primary>
54264 <secondary>modifiers; list of</secondary>
54265 </indexterm>
54266 The ACL modifiers are as follows:
54267 </para>
54268 <variablelist>
54269 <varlistentry>
54270 <term><emphasis role="bold">add_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
54271 <listitem>
54272 <para>
54273 This modifier specifies one or more header lines that are to be added to an
54274 incoming message, assuming, of course, that the message is ultimately
54275 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
54276 </para>
54277 </listitem></varlistentry>
54278 <varlistentry>
54279 <term><emphasis role="bold">continue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
54280 <listitem>
54281 <para>
54282 <indexterm role="concept">
54283 <primary><option>continue</option> ACL modifier</primary>
54284 </indexterm>
54285 <indexterm role="concept">
54286 <primary>database</primary>
54287 <secondary>updating in ACL</secondary>
54288 </indexterm>
54289 This modifier does nothing of itself, and processing of the ACL always
54290 continues with the next condition or modifier. The value of <option>continue</option> is in
54291 the side effects of expanding its argument. Typically this could be used to
54292 update a database. It is really just a syntactic tidiness, to avoid having to
54293 write rather ugly lines like this:
54294 </para>
54295 <literallayout>
54296 <literal>condition = ${if eq{0}{</literal>&lt;<emphasis>some expansion</emphasis>&gt;<literal>}{true}{true}}</literal>
54297 </literallayout>
54298 <para>
54299 Instead, all you need is
54300 </para>
54301 <literallayout>
54302 <literal>continue = </literal>&lt;<emphasis>some expansion</emphasis>&gt;
54303 </literallayout>
54304 </listitem></varlistentry>
54305 <varlistentry>
54306 <term><emphasis role="bold">control</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
54307 <listitem>
54308 <para>
54309 <indexterm role="concept">
54310 <primary><option>control</option> ACL modifier</primary>
54311 </indexterm>
54312 This modifier affects the subsequent processing of the SMTP connection or of an
54313 incoming message that is accepted. The effect of the first type of control
54314 lasts for the duration of the connection, whereas the effect of the second type
54315 lasts only until the current message has been received. The message-specific
54316 controls always apply to the whole message, not to individual recipients,
54317 even if the <option>control</option> modifier appears in a RCPT ACL.
54318 </para>
54319 <para>
54320 As there are now quite a few controls that can be applied, they are described
54321 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
54322 in several different ways. For example:
54323 </para>
54324 <itemizedlist>
54325 <listitem>
54326 <para>
54327 It can be at the end of an <option>accept</option> statement:
54328 </para>
54329 <literallayout class="monospaced">
54330     accept  ...some conditions
54331             control = queue_only
54332 </literallayout>
54333 <para>
54334 In this case, the control is applied when this statement yields <quote>accept</quote>, in
54335 other words, when the conditions are all true.
54336 </para>
54337 </listitem>
54338 <listitem>
54339 <para>
54340 It can be in the middle of an <option>accept</option> statement:
54341 </para>
54342 <literallayout class="monospaced">
54343     accept  ...some conditions...
54344             control = queue_only
54345             ...some more conditions...
54346 </literallayout>
54347 <para>
54348 If the first set of conditions are true, the control is applied, even if the
54349 statement does not accept because one of the second set of conditions is false.
54350 In this case, some subsequent statement must yield <quote>accept</quote> for the control
54351 to be relevant.
54352 </para>
54353 </listitem>
54354 <listitem>
54355 <para>
54356 It can be used with <option>warn</option> to apply the control, leaving the
54357 decision about accepting or denying to a subsequent verb. For
54358 example:
54359 </para>
54360 <literallayout class="monospaced">
54361     warn    ...some conditions...
54362             control = freeze
54363     accept  ...
54364 </literallayout>
54365 <para>
54366 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
54367 <option>logwrite</option>, so it does not add anything to the message and does not write a
54368 log entry.
54369 </para>
54370 </listitem>
54371 <listitem>
54372 <para>
54373 If you want to apply a control unconditionally, you can use it with a
54374 <option>require</option> verb. For example:
54375 </para>
54376 <literallayout class="monospaced">
54377     require  control = no_multiline_responses
54378 </literallayout>
54379 </listitem>
54380 </itemizedlist>
54381 </listitem></varlistentry>
54382 <varlistentry>
54383 <term><emphasis role="bold">delay</emphasis>&nbsp;=&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
54384 <listitem>
54385 <para>
54386 <indexterm role="concept">
54387 <primary><option>delay</option> ACL modifier</primary>
54388 </indexterm>
54389 <indexterm role="option">
54390 <primary><option>-bh</option></primary>
54391 </indexterm>
54392 This modifier may appear in any ACL except notquit. It causes Exim to wait for
54393 the time interval before proceeding. However, when testing Exim using the
54394 <option>-bh</option> option, the delay is not actually imposed (an appropriate message is
54395 output instead). The time is given in the usual Exim notation, and the delay
54396 happens as soon as the modifier is processed. In an SMTP session, pending
54397 output is flushed before the delay is imposed.
54398 </para>
54399 <para>
54400 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
54401 example:
54402 </para>
54403 <literallayout class="monospaced">
54404 deny    ...some conditions...
54405         delay = 30s
54406 </literallayout>
54407 <para>
54408 The delay happens if all the conditions are true, before the statement returns
54409 <quote>deny</quote>. Compare this with:
54410 </para>
54411 <literallayout class="monospaced">
54412 deny    delay = 30s
54413         ...some conditions...
54414 </literallayout>
54415 <para>
54416 which waits for 30s before processing the conditions. The <option>delay</option> modifier
54417 can also be used with <option>warn</option> and together with <option>control</option>:
54418 </para>
54419 <literallayout class="monospaced">
54420 warn    ...some conditions...
54421         delay = 2m
54422         control = freeze
54423 accept  ...
54424 </literallayout>
54425 <para>
54426 If <option>delay</option> is encountered when the SMTP PIPELINING extension is in use,
54427 responses to several commands are no longer buffered and sent in one packet (as
54428 they would normally be) because all output is flushed before imposing the
54429 delay. This optimization is disabled so that a number of small delays do not
54430 appear to the client as one large aggregated delay that might provoke an
54431 unwanted timeout. You can, however, disable output flushing for <option>delay</option> by
54432 using a <option>control</option> modifier to set <option>no_delay_flush</option>.
54433 </para>
54434 </listitem></varlistentry>
54435 <varlistentry>
54436 <term><emphasis role="bold">endpass</emphasis></term>
54437 <listitem>
54438 <para>
54439 <indexterm role="concept">
54440 <primary><option>endpass</option> ACL modifier</primary>
54441 </indexterm>
54442 This modifier, which has no argument, is recognized only in <option>accept</option> and
54443 <option>discard</option> statements. It marks the boundary between the conditions whose
54444 failure causes control to pass to the next statement, and the conditions whose
54445 failure causes the ACL to return <quote>deny</quote>. This concept has proved to be
54446 confusing to some people, so the use of <option>endpass</option> is no longer recommended as
54447 <quote>best practice</quote>. See the description of <option>accept</option> above for more details.
54448 </para>
54449 </listitem></varlistentry>
54450 <varlistentry>
54451 <term><emphasis role="bold">log_message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
54452 <listitem>
54453 <para>
54454 <indexterm role="concept">
54455 <primary><option>log_message</option> ACL modifier</primary>
54456 </indexterm>
54457 This modifier sets up a message that is used as part of the log message if the
54458 ACL denies access or a <option>warn</option> statement&#x2019;s conditions are true. For example:
54459 </para>
54460 <literallayout class="monospaced">
54461 require log_message = wrong cipher suite $tls_in_cipher
54462         encrypted   = DES-CBC3-SHA
54463 </literallayout>
54464 <para>
54465 <option>log_message</option> is also used when recipients are discarded by <option>discard</option>. For
54466 example:
54467 </para>
54468 <literallayout>
54469 <literal>discard </literal>&lt;<emphasis>some conditions</emphasis>&gt;
54470 <literal>        log_message = Discarded $local_part@$domain because...</literal>
54471 </literallayout>
54472 <para>
54473 When access is denied, <option>log_message</option> adds to any underlying error message
54474 that may exist because of a condition failure. For example, while verifying a
54475 recipient address, a <emphasis>:fail:</emphasis> redirection might have already set up a
54476 message.
54477 </para>
54478 <para>
54479 The message may be defined before the conditions to which it applies, because
54480 the string expansion does not happen until Exim decides that access is to be
54481 denied. This means that any variables that are set by the condition are
54482 available for inclusion in the message. For example, the <varname>$dnslist_</varname>&lt;<emphasis>xxx</emphasis>&gt;
54483 variables are set after a DNS black list lookup succeeds. If the expansion of
54484 <option>log_message</option> fails, or if the result is an empty string, the modifier is
54485 ignored.
54486 </para>
54487 <para>
54488 <indexterm role="variable">
54489 <primary><varname>$acl_verify_message</varname></primary>
54490 </indexterm>
54491 If you want to use a <option>warn</option> statement to log the result of an address
54492 verification, you can use <varname>$acl_verify_message</varname> to include the verification
54493 error message.
54494 </para>
54495 <para>
54496 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
54497 the start of the logged message. If the same warning log message is requested
54498 more than once while receiving  a single email message, only one copy is
54499 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
54500 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
54501 is logged for a successful <option>warn</option> statement.
54502 </para>
54503 <para>
54504 If <option>log_message</option> is not present and there is no underlying error message (for
54505 example, from the failure of address verification), but <option>message</option> is present,
54506 the <option>message</option> text is used for logging rejections. However, if any text for
54507 logging contains newlines, only the first line is logged. In the absence of
54508 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
54509 logging rejections.
54510 </para>
54511 </listitem></varlistentry>
54512 <varlistentry>
54513 <term><emphasis role="bold">log_reject_target</emphasis>&nbsp;=&nbsp;&lt;<emphasis>log name list</emphasis>&gt;</term>
54514 <listitem>
54515 <para>
54516 <indexterm role="concept">
54517 <primary><option>log_reject_target</option> ACL modifier</primary>
54518 </indexterm>
54519 <indexterm role="concept">
54520 <primary>logging in ACL</primary>
54521 <secondary>specifying which log</secondary>
54522 </indexterm>
54523 This modifier makes it possible to specify which logs are used for messages
54524 about ACL rejections. Its argument is a colon-separated list of words that can
54525 be <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote>. The default is <literal>main:reject</literal>. The list
54526 may be empty, in which case a rejection is not logged at all. For example, this
54527 ACL fragment writes no logging information when access is denied:
54528 </para>
54529 <literallayout>
54530 <literal>deny </literal>&lt;<emphasis>some conditions</emphasis>&gt;
54531 <literal>     log_reject_target =</literal>
54532 </literallayout>
54533 <para>
54534 This modifier can be used in SMTP and non-SMTP ACLs. It applies to both
54535 permanent and temporary rejections. Its effect lasts for the rest of the
54536 current ACL.
54537 </para>
54538 </listitem></varlistentry>
54539 <varlistentry>
54540 <term><emphasis role="bold">logwrite</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
54541 <listitem>
54542 <para>
54543 <indexterm role="concept">
54544 <primary><option>logwrite</option> ACL modifier</primary>
54545 </indexterm>
54546 <indexterm role="concept">
54547 <primary>logging in ACL</primary>
54548 <secondary>immediate</secondary>
54549 </indexterm>
54550 This modifier writes a message to a log file as soon as it is encountered when
54551 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
54552 <option>warn</option> and <option>discard</option>, is used only if the ACL statement denies
54553 access.) The <option>logwrite</option> modifier can be used to log special incidents in
54554 ACLs. For example:
54555 </para>
54556 <literallayout>
54557 <literal>accept </literal>&lt;<emphasis>some special conditions</emphasis>&gt;
54558 <literal>       control  = freeze</literal>
54559 <literal>       logwrite = froze message because ...</literal>
54560 </literallayout>
54561 <para>
54562 By default, the message is written to the main log. However, it may begin
54563 with a colon, followed by a comma-separated list of log names, and then
54564 another colon, to specify exactly which logs are to be written. For
54565 example:
54566 </para>
54567 <literallayout class="monospaced">
54568 logwrite = :main,reject: text for main and reject logs
54569 logwrite = :panic: text for panic log only
54570 </literallayout>
54571 </listitem></varlistentry>
54572 <varlistentry>
54573 <term><emphasis role="bold">message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
54574 <listitem>
54575 <para>
54576 <indexterm role="concept">
54577 <primary><option>message</option> ACL modifier</primary>
54578 </indexterm>
54579 This modifier sets up a text string that is expanded and used as a response
54580 message when an ACL statement terminates the ACL with an <quote>accept</quote>, <quote>deny</quote>,
54581 or <quote>defer</quote> response. (In the case of the <option>accept</option> and <option>discard</option> verbs,
54582 there is some complication if <option>endpass</option> is involved; see the description of
54583 <option>accept</option> for details.)
54584 </para>
54585 <para>
54586 The expansion of the message happens at the time Exim decides that the ACL is
54587 to end, not at the time it processes <option>message</option>. If the expansion fails, or
54588 generates an empty string, the modifier is ignored. Here is an example where
54589 <option>message</option> must be specified first, because the ACL ends with a rejection if
54590 the <option>hosts</option> condition fails:
54591 </para>
54592 <literallayout class="monospaced">
54593 require  message = Host not recognized
54594          hosts = 10.0.0.0/8
54595 </literallayout>
54596 <para>
54597 (Once a condition has failed, no further conditions or modifiers are
54598 processed.)
54599 </para>
54600 <para>
54601 <indexterm role="concept">
54602 <primary>SMTP</primary>
54603 <secondary>error codes</secondary>
54604 </indexterm>
54605 <indexterm role="option">
54606 <primary><option>smtp_banner</option></primary>
54607 </indexterm>
54608 For ACLs that are triggered by SMTP commands, the message is returned as part
54609 of the SMTP response. The use of <option>message</option> with <option>accept</option> (or <option>discard</option>)
54610 is meaningful only for SMTP, as no message is returned when a non-SMTP message
54611 is accepted. In the case of the connect ACL, accepting with a message modifier
54612 overrides the value of <option>smtp_banner</option>. For the EHLO/HELO ACL, a customized
54613 accept message may not contain more than one line (otherwise it will be
54614 truncated at the first newline and a panic logged), and it cannot affect the
54615 EHLO options.
54616 </para>
54617 <para>
54618 When SMTP is involved, the message may begin with an overriding response code,
54619 consisting of three digits optionally followed by an <quote>extended response code</quote>
54620 of the form <emphasis>n.n.n</emphasis>, each code being followed by a space. For example:
54621 </para>
54622 <literallayout class="monospaced">
54623 deny  message = 599 1.2.3 Host not welcome
54624       hosts = 192.168.34.0/24
54625 </literallayout>
54626 <para>
54627 The first digit of the supplied response code must be the same as would be sent
54628 by default. A panic occurs if it is not. Exim uses a 550 code when it denies
54629 access, but for the predata ACL, note that the default success code is 354, not
54630 2<emphasis>xx</emphasis>.
54631 </para>
54632 <para>
54633 Notwithstanding the previous paragraph, for the QUIT ACL, unlike the others,
54634 the message modifier cannot override the 221 response code.
54635 </para>
54636 <para>
54637 The text in a <option>message</option> modifier is literal; any quotes are taken as
54638 literals, but because the string is expanded, backslash escapes are processed
54639 anyway. If the message contains newlines, this gives rise to a multi-line SMTP
54640 response.
54641 </para>
54642 <para>
54643 <indexterm role="variable">
54644 <primary><varname>$acl_verify_message</varname></primary>
54645 </indexterm>
54646 For ACLs that are called by an <option>acl =</option> ACL condition, the message is
54647 stored in <varname>$acl_verify_message</varname>, from which the calling ACL may use it.
54648 </para>
54649 <para>
54650 If <option>message</option> is used on a statement that verifies an address, the message
54651 specified overrides any message that is generated by the verification process.
54652 However, the original message is available in the variable
54653 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
54654 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
54655 routers to be passed back as part of the SMTP response, you should either not
54656 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
54657 </para>
54658 <para>
54659 For compatibility with previous releases of Exim, a <option>message</option> modifier that
54660 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
54661 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
54662 all the conditions are true, wherever it appears in an ACL command, whereas
54663 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
54664 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
54665 effect.
54666 </para>
54667 </listitem></varlistentry>
54668 <varlistentry>
54669 <term><emphasis role="bold">remove_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
54670 <listitem>
54671 <para>
54672 This modifier specifies one or more header names in a colon-separated list
54673  that are to be removed from an incoming message, assuming, of course, that
54674 the message is ultimately accepted. For details, see section <xref linkend="SECTremoveheadacl"/>.
54675 </para>
54676 </listitem></varlistentry>
54677 <varlistentry>
54678 <term><emphasis role="bold">set</emphasis>&nbsp;&lt;<emphasis>acl_name</emphasis>&gt;&nbsp;=&nbsp;&lt;<emphasis>value</emphasis>&gt;</term>
54679 <listitem>
54680 <para>
54681 <indexterm role="concept">
54682 <primary><option>set</option> ACL modifier</primary>
54683 </indexterm>
54684 This modifier puts a value into one of the ACL variables (see section
54685 <xref linkend="SECTaclvariables"/>).
54686 </para>
54687 </listitem></varlistentry>
54688 <varlistentry>
54689 <term><emphasis role="bold">udpsend</emphasis>&nbsp;=&nbsp;&lt;<emphasis>parameters</emphasis>&gt;</term>
54690 <listitem>
54691 <para>
54692 This modifier sends a UDP packet, for purposes such as statistics
54693 collection or behaviour monitoring. The parameters are expanded, and
54694 the result of the expansion must be a colon-separated list consisting
54695 of a destination server, port number, and the packet contents. The
54696 server can be specified as a host name or IPv4 or IPv6 address. The
54697 separator can be changed with the usual angle bracket syntax. For
54698 example, you might want to collect information on which hosts connect
54699 when:
54700 </para>
54701 <literallayout class="monospaced">
54702 udpsend = &lt;; 2001:dB8::dead:beef ; 1234 ;\
54703              $tod_zulu $sender_host_address
54704 </literallayout>
54705 </listitem></varlistentry>
54706 </variablelist>
54707 </section>
54708 <section id="SECTcontrols">
54709 <title>Use of the control modifier</title>
54710 <para>
54711 <indexterm role="concept">
54712 <primary><option>control</option> ACL modifier</primary>
54713 </indexterm>
54714 The <option>control</option> modifier supports the following settings:
54715 </para>
54716 <variablelist>
54717 <varlistentry>
54718 <term><emphasis role="bold">control&nbsp;=&nbsp;allow_auth_unadvertised</emphasis></term>
54719 <listitem>
54720 <para>
54721 This modifier allows a client host to use the SMTP AUTH command even when it
54722 has not been advertised in response to EHLO. Furthermore, because there are
54723 apparently some really broken clients that do this, Exim will accept AUTH after
54724 HELO (rather than EHLO) when this control is set. It should be used only if you
54725 really need it, and you should limit its use to those broken clients that do
54726 not work without it. For example:
54727 </para>
54728 <literallayout class="monospaced">
54729 warn hosts   = 192.168.34.25
54730      control = allow_auth_unadvertised
54731 </literallayout>
54732 <para>
54733 Normally, when an Exim server receives an AUTH command, it checks the name of
54734 the authentication mechanism that is given in the command to ensure that it
54735 matches an advertised mechanism. When this control is set, the check that a
54736 mechanism has been advertised is bypassed. Any configured mechanism can be used
54737 by the client. This control is permitted only in the connection and HELO ACLs.
54738 </para>
54739 </listitem></varlistentry>
54740 <varlistentry>
54741 <term><emphasis role="bold">control&nbsp;=&nbsp;caseful_local_part</emphasis></term>
54742 <term><emphasis role="bold">control&nbsp;=&nbsp;caselower_local_part</emphasis></term>
54743 <listitem>
54744 <para>
54745 <indexterm role="concept">
54746 <primary>access control lists (ACLs)</primary>
54747 <secondary>case of local part in</secondary>
54748 </indexterm>
54749 <indexterm role="concept">
54750 <primary>case of local parts</primary>
54751 </indexterm>
54752 <indexterm role="variable">
54753 <primary><varname>$local_part</varname></primary>
54754 </indexterm>
54755 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
54756 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
54757 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
54758 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
54759 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
54760 is encountered.
54761 </para>
54762 <para>
54763 These controls affect only the current recipient. Moreover, they apply only to
54764 local part handling that takes place directly in the ACL (for example, as a key
54765 in lookups). If a test to verify the recipient is obeyed, the case-related
54766 handling of the local part during the verification is controlled by the router
54767 configuration (see the <option>caseful_local_part</option> generic router option).
54768 </para>
54769 <para>
54770 This facility could be used, for example, to add a spam score to local parts
54771 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
54772 spam score:
54773 </para>
54774 <literallayout class="monospaced">
54775 warn  control = caseful_local_part
54776       set acl_m4 = ${eval:\
54777                      $acl_m4 + \
54778                      ${if match{$local_part}{[A-Z]}{1}{0}}\
54779                     }
54780       control = caselower_local_part
54781 </literallayout>
54782 <para>
54783 Notice that we put back the lower cased version afterwards, assuming that
54784 is what is wanted for subsequent tests.
54785 </para>
54786 </listitem></varlistentry>
54787 <varlistentry>
54788 <term><emphasis role="bold">control&nbsp;=&nbsp;cutthrough_delivery</emphasis></term>
54789 <listitem>
54790 <para>
54791 <indexterm role="concept">
54792 <primary>access control lists (ACLs)</primary>
54793 <secondary>cutthrough routing</secondary>
54794 </indexterm>
54795 <indexterm role="concept">
54796 <primary>cutthrough</primary>
54797 <secondary>requesting</secondary>
54798 </indexterm>
54799 This option requests delivery be attempted while the item is being received.
54800 </para>
54801 <para>
54802 The option is usable in the RCPT ACL.
54803 If enabled for a message received via smtp and routed to an smtp transport,
54804 and only one transport, interface, destination host and port combination
54805 is used for all recipients of the message,
54806 then the delivery connection is made while the receiving connection is open
54807 and data is copied from one to the other.
54808 </para>
54809 <para>
54810 An attempt to set this option for any recipient but the first
54811 for a mail will be quietly ignored.
54812 If a recipient-verify callout
54813 </para>
54814 <para revisionflag="changed">
54815 (with use_sender)
54816 </para>
54817 <para>
54818 connection is subsequently
54819 requested in the same ACL it is held open and used for
54820 any subsequent recipients and the data,
54821 otherwise one is made after the initial RCPT ACL completes.
54822 </para>
54823 <para>
54824 Note that routers are used in verify mode,
54825 and cannot depend on content of received headers.
54826 Note also that headers cannot be
54827 modified by any of the post-data ACLs (DATA, MIME and DKIM).
54828 Headers may be modified by routers (subject to the above) and transports.
54829 </para>
54830 <para revisionflag="changed">
54831 All the usual ACLs are called; if one results in the message being
54832 rejected, all effort spent in delivery (including the costs on
54833 the ultimate destination) will be wasted.
54834 Note that in the case of data-time ACLs this includes the entire
54835 message body.
54836 </para>
54837 <para>
54838 Cutthrough delivery is not supported via transport-filters or when DKIM signing
54839 of outgoing messages is done, because it sends data to the ultimate destination
54840 before the entire message has been received from the source.
54841 It is not supported for messages received with the SMTP PRDR option in use.
54842 </para>
54843 <para>
54844 Should the ultimate destination system positively accept or reject the mail,
54845 a corresponding indication is given to the source system and nothing is queued.
54846 If there is a temporary error the item is queued for later delivery in the
54847 usual fashion. If the item is successfully delivered in cutthrough mode
54848 the delivery log lines are tagged with "&gt;&gt;" rather than "=&gt;" and appear
54849 before the acceptance "&lt;=" line.
54850 </para>
54851 <para>
54852 Delivery in this mode avoids the generation of a bounce mail to a
54853 (possibly faked)
54854 sender when the destination system is doing content-scan based rejection.
54855 </para>
54856 </listitem></varlistentry>
54857 <varlistentry>
54858 <term><emphasis role="bold">control&nbsp;=&nbsp;debug/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
54859 <listitem>
54860 <para>
54861 <indexterm role="concept">
54862 <primary>access control lists (ACLs)</primary>
54863 <secondary>enabling debug logging</secondary>
54864 </indexterm>
54865 <indexterm role="concept">
54866 <primary>debugging</primary>
54867 <secondary>enabling from an ACL</secondary>
54868 </indexterm>
54869 This control turns on debug logging, almost as though Exim had been invoked
54870 with <literal>-d</literal>, with the output going to a new logfile, by default called
54871 <emphasis>debuglog</emphasis>.  The filename can be adjusted with the <emphasis>tag</emphasis> option, which
54872 may access any variables already defined.  The logging may be adjusted with
54873 the <emphasis>opts</emphasis> option, which takes the same values as the <literal>-d</literal> command-line
54874 option.  Some examples (which depend on variables that don&#x2019;t exist in all
54875 contexts):
54876 </para>
54877 <literallayout class="monospaced">
54878       control = debug
54879       control = debug/tag=.$sender_host_address
54880       control = debug/opts=+expand+acl
54881       control = debug/tag=.$message_exim_id/opts=+expand
54882 </literallayout>
54883 </listitem></varlistentry>
54884 <varlistentry>
54885 <term><emphasis role="bold">control&nbsp;=&nbsp;dkim_disable_verify</emphasis></term>
54886 <listitem>
54887 <para>
54888 <indexterm role="concept">
54889 <primary>disable DKIM verify</primary>
54890 </indexterm>
54891 <indexterm role="concept">
54892 <primary>DKIM</primary>
54893 <secondary>disable verify</secondary>
54894 </indexterm>
54895 This control turns off DKIM verification processing entirely.  For details on
54896 the operation and configuration of DKIM, see chapter <xref linkend="CHAPdkim"/>.
54897 </para>
54898 </listitem></varlistentry>
54899 <varlistentry>
54900 <term><emphasis role="bold">control&nbsp;=&nbsp;dscp/</emphasis>&lt;<emphasis>value</emphasis>&gt;</term>
54901 <listitem>
54902 <para>
54903 <indexterm role="concept">
54904 <primary>access control lists (ACLs)</primary>
54905 <secondary>setting DSCP value</secondary>
54906 </indexterm>
54907 <indexterm role="concept">
54908 <primary>DSCP</primary>
54909 <secondary>inbound</secondary>
54910 </indexterm>
54911 This option causes the DSCP value associated with the socket for the inbound
54912 connection to be adjusted to a given value, given as one of a number of fixed
54913 strings or to numeric value.
54914 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
54915 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
54916 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
54917 </para>
54918 <para>
54919 The outbound packets from Exim will be marked with this value in the header
54920 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
54921 that these values will have any effect, not be stripped by networking
54922 equipment, or do much of anything without cooperation with your Network
54923 Engineer and those of all network operators between the source and destination.
54924 </para>
54925 </listitem></varlistentry>
54926 <varlistentry>
54927 <term><emphasis role="bold">control&nbsp;=&nbsp;enforce_sync</emphasis></term>
54928 <term><emphasis role="bold">control&nbsp;=&nbsp;no_enforce_sync</emphasis></term>
54929 <listitem>
54930 <para>
54931 <indexterm role="concept">
54932 <primary>SMTP</primary>
54933 <secondary>synchronization checking</secondary>
54934 </indexterm>
54935 <indexterm role="concept">
54936 <primary>synchronization checking in SMTP</primary>
54937 </indexterm>
54938 These controls make it possible to be selective about when SMTP synchronization
54939 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
54940 state of the switch (it is true by default). See the description of this option
54941 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
54942 </para>
54943 <para>
54944 The effect of these two controls lasts for the remainder of the SMTP
54945 connection. They can appear in any ACL except the one for the non-SMTP
54946 messages. The most straightforward place to put them is in the ACL defined by
54947 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
54948 before the first synchronization check. The expected use is to turn off the
54949 synchronization checks for badly-behaved hosts that you nevertheless need to
54950 work with.
54951 </para>
54952 </listitem></varlistentry>
54953 <varlistentry>
54954 <term><emphasis role="bold">control&nbsp;=&nbsp;fakedefer/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
54955 <listitem>
54956 <para>
54957 <indexterm role="concept">
54958 <primary>fake defer</primary>
54959 </indexterm>
54960 <indexterm role="concept">
54961 <primary>defer, fake</primary>
54962 </indexterm>
54963 This control works in exactly the same way as <option>fakereject</option> (described below)
54964 except that it causes an SMTP 450 response after the message data instead of a
54965 550 response. You must take care when using <option>fakedefer</option> because it causes the
54966 messages to be duplicated when the sender retries. Therefore, you should not
54967 use <option>fakedefer</option> if the message is to be delivered normally.
54968 </para>
54969 </listitem></varlistentry>
54970 <varlistentry>
54971 <term><emphasis role="bold">control&nbsp;=&nbsp;fakereject/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
54972 <listitem>
54973 <para>
54974 <indexterm role="concept">
54975 <primary>fake rejection</primary>
54976 </indexterm>
54977 <indexterm role="concept">
54978 <primary>rejection, fake</primary>
54979 </indexterm>
54980 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
54981 words, only when an SMTP message is being received. If Exim accepts the
54982 message, instead the final 250 response, a 550 rejection message is sent.
54983 However, Exim proceeds to deliver the message as normal. The control applies
54984 only to the current message, not to any subsequent ones that may be received in
54985 the same SMTP connection.
54986 </para>
54987 <para>
54988 The text for the 550 response is taken from the <option>control</option> modifier. If no
54989 message is supplied, the following is used:
54990 </para>
54991 <literallayout class="monospaced">
54992 550-Your message has been rejected but is being
54993 550-kept for evaluation.
54994 550-If it was a legitimate message, it may still be
54995 550 delivered to the target recipient(s).
54996 </literallayout>
54997 <para>
54998 This facility should be used with extreme caution.
54999 </para>
55000 </listitem></varlistentry>
55001 <varlistentry>
55002 <term><emphasis role="bold">control&nbsp;=&nbsp;freeze</emphasis></term>
55003 <listitem>
55004 <para>
55005 <indexterm role="concept">
55006 <primary>frozen messages</primary>
55007 <secondary>forcing in ACL</secondary>
55008 </indexterm>
55009 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
55010 other words, only when a message is being received. If the message is accepted,
55011 it is placed on Exim&#x2019;s queue and frozen. The control applies only to the
55012 current message, not to any subsequent ones that may be received in the same
55013 SMTP connection.
55014 </para>
55015 <para>
55016 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
55017 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
55018 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
55019 are obeyed for the current message have the <literal>/no_tell</literal> option.
55020 </para>
55021 </listitem></varlistentry>
55022 <varlistentry>
55023 <term><emphasis role="bold">control&nbsp;=&nbsp;no_delay_flush</emphasis></term>
55024 <listitem>
55025 <para>
55026 <indexterm role="concept">
55027 <primary>SMTP</primary>
55028 <secondary>output flushing, disabling for delay</secondary>
55029 </indexterm>
55030 Exim normally flushes SMTP output before implementing a delay in an ACL, to
55031 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
55032 use. This control, as long as it is encountered before the <option>delay</option> modifier,
55033 disables such output flushing.
55034 </para>
55035 </listitem></varlistentry>
55036 <varlistentry>
55037 <term><emphasis role="bold">control&nbsp;=&nbsp;no_callout_flush</emphasis></term>
55038 <listitem>
55039 <para>
55040 <indexterm role="concept">
55041 <primary>SMTP</primary>
55042 <secondary>output flushing, disabling for callout</secondary>
55043 </indexterm>
55044 Exim normally flushes SMTP output before performing a callout in an ACL, to
55045 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
55046 use. This control, as long as it is encountered before the <option>verify</option> condition
55047 that causes the callout, disables such output flushing.
55048 </para>
55049 </listitem></varlistentry>
55050 <varlistentry>
55051 <term><emphasis role="bold">control&nbsp;=&nbsp;no_mbox_unspool</emphasis></term>
55052 <listitem>
55053 <para>
55054 This control is available when Exim is compiled with the content scanning
55055 extension. Content scanning may require a copy of the current message, or parts
55056 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
55057 or spam scanner. Normally, such copies are deleted when they are no longer
55058 needed. If this control is set, the copies are not deleted. The control applies
55059 only to the current message, not to any subsequent ones that may be received in
55060 the same SMTP connection. It is provided for debugging purposes and is unlikely
55061 to be useful in production.
55062 </para>
55063 </listitem></varlistentry>
55064 <varlistentry>
55065 <term><emphasis role="bold">control&nbsp;=&nbsp;no_multiline_responses</emphasis></term>
55066 <listitem>
55067 <para>
55068 <indexterm role="concept">
55069 <primary>multiline responses, suppressing</primary>
55070 </indexterm>
55071 This control is permitted for any ACL except the one for non-SMTP messages.
55072 It seems that there are broken clients in use that cannot handle multiline
55073 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
55074 </para>
55075 <para>
55076 If this control is set, multiline SMTP responses from ACL rejections are
55077 suppressed. One way of doing this would have been to put out these responses as
55078 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
55079 (<quote>use multiline responses for more</quote> it says &ndash; ha!), and some of the
55080 responses might get close to that. So this facility, which is after all only a
55081 sop to broken clients, is implemented by doing two very easy things:
55082 </para>
55083 <itemizedlist>
55084 <listitem>
55085 <para>
55086 Extra information that is normally output as part of a rejection caused by
55087 sender verification failure is omitted. Only the final line (typically <quote>sender
55088 verification failed</quote>) is sent.
55089 </para>
55090 </listitem>
55091 <listitem>
55092 <para>
55093 If a <option>message</option> modifier supplies a multiline response, only the first
55094 line is output.
55095 </para>
55096 </listitem>
55097 </itemizedlist>
55098 <para>
55099 The setting of the switch can, of course, be made conditional on the
55100 calling host. Its effect lasts until the end of the SMTP connection.
55101 </para>
55102 </listitem></varlistentry>
55103 <varlistentry>
55104 <term><emphasis role="bold">control&nbsp;=&nbsp;no_pipelining</emphasis></term>
55105 <listitem>
55106 <para>
55107 <indexterm role="concept">
55108 <primary>PIPELINING</primary>
55109 <secondary>suppressing advertising</secondary>
55110 </indexterm>
55111 This control turns off the advertising of the PIPELINING extension to SMTP in
55112 the current session. To be useful, it must be obeyed before Exim sends its
55113 response to an EHLO command. Therefore, it should normally appear in an ACL
55114 controlled by <option>acl_smtp_connect</option> or <option>acl_smtp_helo</option>. See also
55115 <option>pipelining_advertise_hosts</option>.
55116 </para>
55117 </listitem></varlistentry>
55118 <varlistentry>
55119 <term><emphasis role="bold">control&nbsp;=&nbsp;queue_only</emphasis></term>
55120 <listitem>
55121 <para>
55122 <indexterm role="option">
55123 <primary><option>queue_only</option></primary>
55124 </indexterm>
55125 <indexterm role="concept">
55126 <primary>queueing incoming messages</primary>
55127 </indexterm>
55128 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
55129 other words, only when a message is being received. If the message is accepted,
55130 it is placed on Exim&#x2019;s queue and left there for delivery by a subsequent queue
55131 runner. No immediate delivery process is started. In other words, it has the
55132 effect as the <option>queue_only</option> global option. However, the control applies only
55133 to the current message, not to any subsequent ones that may be received in the
55134 same SMTP connection.
55135 </para>
55136 </listitem></varlistentry>
55137 <varlistentry>
55138 <term><emphasis role="bold">control&nbsp;=&nbsp;submission/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
55139 <listitem>
55140 <para>
55141 <indexterm role="concept">
55142 <primary>message</primary>
55143 <secondary>submission</secondary>
55144 </indexterm>
55145 <indexterm role="concept">
55146 <primary>submission mode</primary>
55147 </indexterm>
55148 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
55149 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
55150 the current message is a submission from a local MUA. In this case, Exim
55151 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
55152 necessary. For example, it adds a <emphasis>Date:</emphasis> header line if one is not present.
55153 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
55154 late (the message has already been created).
55155 </para>
55156 <para>
55157 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
55158 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
55159 submission mode; the available options for this control are described there.
55160 The control applies only to the current message, not to any subsequent ones
55161 that may be received in the same SMTP connection.
55162 </para>
55163 </listitem></varlistentry>
55164 <varlistentry>
55165 <term><emphasis role="bold">control&nbsp;=&nbsp;suppress_local_fixups</emphasis></term>
55166 <listitem>
55167 <para>
55168 <indexterm role="concept">
55169 <primary>submission fixups, suppressing</primary>
55170 </indexterm>
55171 This control applies to locally submitted (non TCP/IP) messages, and is the
55172 complement of <literal>control = submission</literal>. It disables the fixups that are
55173 normally applied to locally-submitted messages. Specifically:
55174 </para>
55175 <itemizedlist>
55176 <listitem>
55177 <para>
55178 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
55179 dynamic version of <option>local_sender_retain</option>).
55180 </para>
55181 </listitem>
55182 <listitem>
55183 <para>
55184 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
55185 </para>
55186 </listitem>
55187 <listitem>
55188 <para>
55189 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
55190 </para>
55191 </listitem>
55192 </itemizedlist>
55193 <para>
55194 This control may be useful when a remotely-originated message is accepted,
55195 passed to some scanning program, and then re-submitted for delivery. It can be
55196 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
55197 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message&#x2019;s
55198 data is read.
55199 </para>
55200 <para>
55201 <emphasis role="bold">Note:</emphasis> This control applies only to the current message, not to any others
55202 that are being submitted at the same time using <option>-bs</option> or <option>-bS</option>.
55203 </para>
55204 </listitem></varlistentry>
55205 <varlistentry revisionflag="changed">
55206 <term><emphasis role="bold">control&nbsp;=&nbsp;utf8_downconvert</emphasis></term>
55207 <listitem>
55208 <para revisionflag="changed">
55209 This control enables conversion of UTF-8 in message addresses
55210 to a-label form.
55211 For details see <xref linkend="SECTi18nMTA"/>.
55212 </para>
55213 </listitem></varlistentry>
55214 </variablelist>
55215 </section>
55216 <section id="SECTsummesfix">
55217 <title>Summary of message fixup control</title>
55218 <para>
55219 All four possibilities for message fixups can be specified:
55220 </para>
55221 <itemizedlist>
55222 <listitem>
55223 <para>
55224 Locally submitted, fixups applied: the default.
55225 </para>
55226 </listitem>
55227 <listitem>
55228 <para>
55229 Locally submitted, no fixups applied: use
55230 <literal>control = suppress_local_fixups</literal>.
55231 </para>
55232 </listitem>
55233 <listitem>
55234 <para>
55235 Remotely submitted, no fixups applied: the default.
55236 </para>
55237 </listitem>
55238 <listitem>
55239 <para>
55240 Remotely submitted, fixups applied: use <literal>control = submission</literal>.
55241 </para>
55242 </listitem>
55243 </itemizedlist>
55244 </section>
55245 <section id="SECTaddheadacl">
55246 <title>Adding header lines in ACLs</title>
55247 <para>
55248 <indexterm role="concept">
55249 <primary>header lines</primary>
55250 <secondary>adding in an ACL</secondary>
55251 </indexterm>
55252 <indexterm role="concept">
55253 <primary>header lines</primary>
55254 <secondary>position of added lines</secondary>
55255 </indexterm>
55256 <indexterm role="concept">
55257 <primary><option>add_header</option> ACL modifier</primary>
55258 </indexterm>
55259 The <option>add_header</option> modifier can be used to add one or more extra header lines
55260 to an incoming message, as in this example:
55261 </para>
55262 <literallayout class="monospaced">
55263 warn dnslists = sbl.spamhaus.org : \
55264                 dialup.mail-abuse.org
55265      add_header = X-blacklisted-at: $dnslist_domain
55266 </literallayout>
55267 <para>
55268 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
55269 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
55270 receiving a message). The message must ultimately be accepted for
55271 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
55272 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
55273 RCPT ACL).
55274 </para>
55275 <para>
55276 Headers will not be added to the message if the modifier is used in
55277 DATA, MIME or DKIM ACLs for messages delivered by cutthrough routing.
55278 </para>
55279 <para>
55280 Leading and trailing newlines are removed from
55281 the data for the <option>add_header</option> modifier; if it then
55282 contains one or more newlines that
55283 are not followed by a space or a tab, it is assumed to contain multiple header
55284 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
55285 front of any line that is not a valid header line.
55286 </para>
55287 <para>
55288 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
55289 They are added to the message before processing the DATA and MIME ACLs.
55290 However, if an identical header line is requested more than once, only one copy
55291 is actually added to the message. Further header lines may be accumulated
55292 during the DATA and MIME ACLs, after which they are added to the message, again
55293 with duplicates suppressed. Thus, it is possible to add two identical header
55294 lines to an SMTP message, but only if one is added before DATA and one after.
55295 In the case of non-SMTP messages, new headers are accumulated during the
55296 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
55297 message is rejected after DATA or by the non-SMTP ACL, all added header lines
55298 are included in the entry that is written to the reject log.
55299 </para>
55300 <para>
55301 <indexterm role="concept">
55302 <primary>header lines</primary>
55303 <secondary>added; visibility of</secondary>
55304 </indexterm>
55305 Header lines are not visible in string expansions
55306 of message headers
55307 until they are added to the
55308 message. It follows that header lines defined in the MAIL, RCPT, and predata
55309 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
55310 header lines that are added by the DATA or MIME ACLs are not visible in those
55311 ACLs. Because of this restriction, you cannot use header lines as a way of
55312 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
55313 this, you can use ACL variables, as described in section
55314 <xref linkend="SECTaclvariables"/>.
55315 </para>
55316 <para>
55317 The list of headers yet to be added is given by the <option>$headers_added</option> variable.
55318 </para>
55319 <para>
55320 The <option>add_header</option> modifier acts immediately as it is encountered during the
55321 processing of an ACL. Notice the difference between these two cases:
55322 </para>
55323 <literallayout>
55324 <literal>accept add_header = ADDED: some text</literal>
55325 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
55326
55327 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
55328 <literal>       add_header = ADDED: some text</literal>
55329 </literallayout>
55330 <para>
55331 In the first case, the header line is always added, whether or not the
55332 condition is true. In the second case, the header line is added only if the
55333 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
55334 ACL statement. All those that are encountered before a condition fails are
55335 honoured.
55336 </para>
55337 <para>
55338 <indexterm role="concept">
55339 <primary><option>warn</option> ACL verb</primary>
55340 </indexterm>
55341 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
55342 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
55343 effect only if all the conditions are true, even if it appears before some of
55344 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
55345 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
55346 are present on a <option>warn</option> verb, both are processed according to their
55347 specifications.
55348 </para>
55349 <para>
55350 By default, new header lines are added to a message at the end of the existing
55351 header lines. However, you can specify that any particular header line should
55352 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
55353 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
55354 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
55355 </para>
55356 <para>
55357 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
55358 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
55359 header line, respectively. (Header text cannot start with a colon, as there has
55360 to be a header name first.) For example:
55361 </para>
55362 <literallayout class="monospaced">
55363 warn add_header = \
55364        :after_received:X-My-Header: something or other...
55365 </literallayout>
55366 <para>
55367 If more than one header line is supplied in a single <option>add_header</option> modifier,
55368 each one is treated independently and can therefore be placed differently. If
55369 you add more than one line at the start, or after the Received: block, they end
55370 up in reverse order.
55371 </para>
55372 <para>
55373 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
55374 added in an ACL. It does NOT work for header lines that are added in a
55375 system filter or in a router or transport.
55376 </para>
55377 </section>
55378 <section id="SECTremoveheadacl">
55379 <title>Removing header lines in ACLs</title>
55380 <para>
55381 <indexterm role="concept">
55382 <primary>header lines</primary>
55383 <secondary>removing in an ACL</secondary>
55384 </indexterm>
55385 <indexterm role="concept">
55386 <primary>header lines</primary>
55387 <secondary>position of removed lines</secondary>
55388 </indexterm>
55389 <indexterm role="concept">
55390 <primary><option>remove_header</option> ACL modifier</primary>
55391 </indexterm>
55392 The <option>remove_header</option> modifier can be used to remove one or more header lines
55393 from an incoming message, as in this example:
55394 </para>
55395 <literallayout class="monospaced">
55396 warn   message        = Remove internal headers
55397        remove_header  = x-route-mail1 : x-route-mail2
55398 </literallayout>
55399 <para>
55400 The <option>remove_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
55401 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
55402 receiving a message). The message must ultimately be accepted for
55403 <option>remove_header</option> to have any significant effect. You can use <option>remove_header</option>
55404 with any ACL verb, including <option>deny</option>, though this is really not useful for
55405 any verb that doesn&#x2019;t result in a delivered message.
55406 </para>
55407 <para>
55408 Headers will not be removed to the message if the modifier is used in
55409 DATA, MIME or DKIM ACLs for messages delivered by cutthrough routing.
55410 </para>
55411 <para>
55412 More than one header can be removed at the same time by using a colon separated
55413 list of header names. The header matching is case insensitive. Wildcards are
55414 not permitted, nor is list expansion performed, so you cannot use hostlists to
55415 create a list of headers, however both connection and message variable expansion
55416 are performed (<option>$acl_c_*</option> and <option>$acl_m_*</option>), illustrated in this example:
55417 </para>
55418 <literallayout class="monospaced">
55419 warn   hosts           = +internal_hosts
55420        set acl_c_ihdrs = x-route-mail1 : x-route-mail2
55421 warn   message         = Remove internal headers
55422        remove_header   = $acl_c_ihdrs
55423 </literallayout>
55424 <para>
55425 Removed header lines are accumulated during the MAIL, RCPT, and predata ACLs.
55426 They are removed from the message before processing the DATA and MIME ACLs.
55427 There is no harm in attempting to remove the same header twice nor is removing
55428 a non-existent header. Further header lines to be removed may be accumulated
55429 during the DATA and MIME ACLs, after which they are removed from the message,
55430 if present. In the case of non-SMTP messages, headers to be removed are
55431 accumulated during the non-SMTP ACLs, and are removed from the message after
55432 all the ACLs have run. If a message is rejected after DATA or by the non-SMTP
55433 ACL, there really is no effect because there is no logging of what headers
55434 would have been removed.
55435 </para>
55436 <para>
55437 <indexterm role="concept">
55438 <primary>header lines</primary>
55439 <secondary>removed; visibility of</secondary>
55440 </indexterm>
55441 Header lines are not visible in string expansions until the DATA phase when it
55442 is received. Any header lines removed in the MAIL, RCPT, and predata ACLs are
55443 not visible in the DATA ACL and MIME ACLs. Similarly, header lines that are
55444 removed by the DATA or MIME ACLs are still visible in those ACLs. Because of
55445 this restriction, you cannot use header lines as a way of controlling data
55446 passed between (for example) the MAIL and RCPT ACLs. If you want to do this,
55447 you should instead use ACL variables, as described in section
55448 <xref linkend="SECTaclvariables"/>.
55449 </para>
55450 <para>
55451 The <option>remove_header</option> modifier acts immediately as it is encountered during the
55452 processing of an ACL. Notice the difference between these two cases:
55453 </para>
55454 <literallayout>
55455 <literal>accept remove_header = X-Internal</literal>
55456 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
55457
55458 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
55459 <literal>       remove_header = X-Internal</literal>
55460 </literallayout>
55461 <para>
55462 In the first case, the header line is always removed, whether or not the
55463 condition is true. In the second case, the header line is removed only if the
55464 condition is true. Multiple occurrences of <option>remove_header</option> may occur in the
55465 same ACL statement. All those that are encountered before a condition fails
55466 are honoured.
55467 </para>
55468 <para>
55469 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
55470 present during ACL processing. It does NOT remove header lines that are added
55471 in a system filter or in a router or transport.
55472 </para>
55473 </section>
55474 <section id="SECTaclconditions">
55475 <title>ACL conditions</title>
55476 <para>
55477 <indexterm role="concept">
55478 <primary>access control lists (ACLs)</primary>
55479 <secondary>conditions; list of</secondary>
55480 </indexterm>
55481 Some of the conditions listed in this section are available only when Exim is
55482 compiled with the content-scanning extension. They are included here briefly
55483 for completeness. More detailed descriptions can be found in the discussion on
55484 content scanning in chapter <xref linkend="CHAPexiscan"/>.
55485 </para>
55486 <para>
55487 Not all conditions are relevant in all circumstances. For example, testing
55488 senders and recipients does not make sense in an ACL that is being run as the
55489 result of the arrival of an ETRN command, and checks on message headers can be
55490 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
55491 can use the same condition (with different parameters) more than once in the
55492 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
55493 The conditions are as follows:
55494 </para>
55495 <variablelist>
55496 <varlistentry>
55497 <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>
55498 <listitem>
55499 <para>
55500 <indexterm role="concept">
55501 <primary>access control lists (ACLs)</primary>
55502 <secondary>nested</secondary>
55503 </indexterm>
55504 <indexterm role="concept">
55505 <primary>access control lists (ACLs)</primary>
55506 <secondary>indirect</secondary>
55507 </indexterm>
55508 <indexterm role="concept">
55509 <primary>access control lists (ACLs)</primary>
55510 <secondary>arguments</secondary>
55511 </indexterm>
55512 <indexterm role="concept">
55513 <primary><option>acl</option> ACL condition</primary>
55514 </indexterm>
55515 The possible values of the argument are the same as for the
55516 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
55517 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
55518 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
55519 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
55520 condition false. This means that further processing of the <option>warn</option> verb
55521 ceases, but processing of the ACL continues.
55522 </para>
55523 <para>
55524 If the argument is a named ACL, up to nine space-separated optional values
55525 can be appended; they appear within the called ACL in $acl_arg1 to $acl_arg9,
55526 and $acl_narg is set to the count of values.
55527 Previous values of these variables are restored after the call returns.
55528 The name and values are expanded separately.
55529 Note that spaces in complex expansions which are used as arguments
55530 will act as argument separators.
55531 </para>
55532 <para>
55533 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
55534 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
55535 <option>accept</option> or <option>discard</option>, and the action is taken immediately &ndash; no further
55536 conditions are tested.
55537 </para>
55538 <para>
55539 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
55540 loops. This condition allows you to use different ACLs in different
55541 circumstances. For example, different ACLs can be used to handle RCPT commands
55542 for different local users or different local domains.
55543 </para>
55544 </listitem></varlistentry>
55545 <varlistentry>
55546 <term><emphasis role="bold">authenticated&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
55547 <listitem>
55548 <para>
55549 <indexterm role="concept">
55550 <primary><option>authenticated</option> ACL condition</primary>
55551 </indexterm>
55552 <indexterm role="concept">
55553 <primary>authentication</primary>
55554 <secondary>ACL checking</secondary>
55555 </indexterm>
55556 <indexterm role="concept">
55557 <primary>access control lists (ACLs)</primary>
55558 <secondary>testing for authentication</secondary>
55559 </indexterm>
55560 If the SMTP connection is not authenticated, the condition is false. Otherwise,
55561 the name of the authenticator is tested against the list. To test for
55562 authentication by any authenticator, you can set
55563 </para>
55564 <literallayout class="monospaced">
55565 authenticated = *
55566 </literallayout>
55567 </listitem></varlistentry>
55568 <varlistentry>
55569 <term><emphasis role="bold">condition&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string</emphasis>&gt;</term>
55570 <listitem>
55571 <para>
55572 <indexterm role="concept">
55573 <primary><option>condition</option> ACL condition</primary>
55574 </indexterm>
55575 <indexterm role="concept">
55576 <primary>customizing</primary>
55577 <secondary>ACL condition</secondary>
55578 </indexterm>
55579 <indexterm role="concept">
55580 <primary>access control lists (ACLs)</primary>
55581 <secondary>customized test</secondary>
55582 </indexterm>
55583 <indexterm role="concept">
55584 <primary>access control lists (ACLs)</primary>
55585 <secondary>testing, customized</secondary>
55586 </indexterm>
55587 This feature allows you to make up custom conditions. If the result of
55588 expanding the string is an empty string, the number zero, or one of the strings
55589 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
55590 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
55591 any other value, some error is assumed to have occurred, and the ACL returns
55592 <quote>defer</quote>. However, if the expansion is forced to fail, the condition is
55593 ignored. The effect is to treat it as true, whether it is positive or
55594 negative.
55595 </para>
55596 </listitem></varlistentry>
55597 <varlistentry>
55598 <term><emphasis role="bold">decode&nbsp;=&nbsp;</emphasis>&lt;<emphasis>location</emphasis>&gt;</term>
55599 <listitem>
55600 <para>
55601 <indexterm role="concept">
55602 <primary><option>decode</option> ACL condition</primary>
55603 </indexterm>
55604 This condition is available only when Exim is compiled with the
55605 content-scanning extension, and it is allowed only in the ACL defined by
55606 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
55607 If all goes well, the condition is true. It is false only if there are
55608 problems such as a syntax error or a memory shortage. For more details, see
55609 chapter <xref linkend="CHAPexiscan"/>.
55610 </para>
55611 </listitem></varlistentry>
55612 <varlistentry>
55613 <term><emphasis role="bold">demime&nbsp;=&nbsp;</emphasis>&lt;<emphasis>extension&nbsp;list</emphasis>&gt;</term>
55614 <listitem>
55615 <para>
55616 <indexterm role="concept">
55617 <primary><option>demime</option> ACL condition</primary>
55618 </indexterm>
55619 This condition is available only when Exim is compiled with the
55620 content-scanning extension. Its use is described in section
55621 <xref linkend="SECTdemimecond"/>.
55622 </para>
55623 </listitem></varlistentry>
55624 <varlistentry>
55625 <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>
55626 <listitem>
55627 <para>
55628 <indexterm role="concept">
55629 <primary><option>dnslists</option> ACL condition</primary>
55630 </indexterm>
55631 <indexterm role="concept">
55632 <primary>DNS list</primary>
55633 <secondary>in ACL</secondary>
55634 </indexterm>
55635 <indexterm role="concept">
55636 <primary>black list (DNS)</primary>
55637 </indexterm>
55638 <indexterm role="concept">
55639 <primary>access control lists (ACLs)</primary>
55640 <secondary>testing a DNS list</secondary>
55641 </indexterm>
55642 This condition checks for entries in DNS black lists. These are also known as
55643 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
55644 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
55645 different variants of this condition to describe briefly here. See sections
55646 <xref linkend="SECTmorednslists"/>&ndash;<xref linkend="SECTmorednslistslast"/> for details.
55647 </para>
55648 </listitem></varlistentry>
55649 <varlistentry>
55650 <term><emphasis role="bold">domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
55651 <listitem>
55652 <para>
55653 <indexterm role="concept">
55654 <primary><option>domains</option> ACL condition</primary>
55655 </indexterm>
55656 <indexterm role="concept">
55657 <primary>domain</primary>
55658 <secondary>ACL checking</secondary>
55659 </indexterm>
55660 <indexterm role="concept">
55661 <primary>access control lists (ACLs)</primary>
55662 <secondary>testing a recipient domain</secondary>
55663 </indexterm>
55664 <indexterm role="variable">
55665 <primary><varname>$domain_data</varname></primary>
55666 </indexterm>
55667 This condition is relevant only after a RCPT command. It checks that the domain
55668 of the recipient address is in the domain list. If percent-hack processing is
55669 enabled, it is done before this test is done. If the check succeeds with a
55670 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
55671 <option>domains</option> test.
55672 </para>
55673 <para>
55674 <emphasis role="bold">Note carefully</emphasis> (because many people seem to fall foul of this): you cannot
55675 use <option>domains</option> in a DATA ACL.
55676 </para>
55677 </listitem></varlistentry>
55678 <varlistentry>
55679 <term><emphasis role="bold">encrypted&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
55680 <listitem>
55681 <para>
55682 <indexterm role="concept">
55683 <primary><option>encrypted</option> ACL condition</primary>
55684 </indexterm>
55685 <indexterm role="concept">
55686 <primary>encryption</primary>
55687 <secondary>checking in an ACL</secondary>
55688 </indexterm>
55689 <indexterm role="concept">
55690 <primary>access control lists (ACLs)</primary>
55691 <secondary>testing for encryption</secondary>
55692 </indexterm>
55693 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
55694 name of the cipher suite in use is tested against the list. To test for
55695 encryption without testing for any specific cipher suite(s), set
55696 </para>
55697 <literallayout class="monospaced">
55698 encrypted = *
55699 </literallayout>
55700 </listitem></varlistentry>
55701 <varlistentry>
55702 <term><emphasis role="bold">hosts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>host&nbsp;list</emphasis>&gt;</term>
55703 <listitem>
55704 <para>
55705 <indexterm role="concept">
55706 <primary><option>hosts</option> ACL condition</primary>
55707 </indexterm>
55708 <indexterm role="concept">
55709 <primary>host</primary>
55710 <secondary>ACL checking</secondary>
55711 </indexterm>
55712 <indexterm role="concept">
55713 <primary>access control lists (ACLs)</primary>
55714 <secondary>testing the client host</secondary>
55715 </indexterm>
55716 This condition tests that the calling host matches the host list. If you have
55717 name lookups or wildcarded host names and IP addresses in the same host list,
55718 you should normally put the IP addresses first. For example, you could have:
55719 </para>
55720 <literallayout class="monospaced">
55721 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
55722 </literallayout>
55723 <para>
55724 The lookup in this example uses the host name for its key. This is implied by
55725 the lookup type <quote>dbm</quote>. (For a host address lookup you would use <quote>net-dbm</quote>
55726 and it wouldn&#x2019;t matter which way round you had these two items.)
55727 </para>
55728 <para>
55729 The reason for the problem with host names lies in the left-to-right way that
55730 Exim processes lists. It can test IP addresses without doing any DNS lookups,
55731 but when it reaches an item that requires a host name, it fails if it cannot
55732 find a host name to compare with the pattern. If the above list is given in the
55733 opposite order, the <option>accept</option> statement fails for a host whose name cannot be
55734 found, even if its IP address is 10.9.8.7.
55735 </para>
55736 <para>
55737 If you really do want to do the name check first, and still recognize the IP
55738 address even if the name lookup fails, you can rewrite the ACL like this:
55739 </para>
55740 <literallayout class="monospaced">
55741 accept hosts = dbm;/etc/friendly/hosts
55742 accept hosts = 10.9.8.7
55743 </literallayout>
55744 <para>
55745 The default action on failing to find the host name is to assume that the host
55746 is not in the list, so the first <option>accept</option> statement fails. The second
55747 statement can then check the IP address.
55748 </para>
55749 <para>
55750 <indexterm role="variable">
55751 <primary><varname>$host_data</varname></primary>
55752 </indexterm>
55753 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
55754 of the lookup is made available in the <varname>$host_data</varname> variable. This
55755 allows you, for example, to set up a statement like this:
55756 </para>
55757 <literallayout class="monospaced">
55758 deny  hosts = net-lsearch;/some/file
55759 message = $host_data
55760 </literallayout>
55761 <para>
55762 which gives a custom error message for each denied host.
55763 </para>
55764 </listitem></varlistentry>
55765 <varlistentry>
55766 <term><emphasis role="bold">local_parts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>local&nbsp;part&nbsp;list</emphasis>&gt;</term>
55767 <listitem>
55768 <para>
55769 <indexterm role="concept">
55770 <primary><option>local_parts</option> ACL condition</primary>
55771 </indexterm>
55772 <indexterm role="concept">
55773 <primary>local part</primary>
55774 <secondary>ACL checking</secondary>
55775 </indexterm>
55776 <indexterm role="concept">
55777 <primary>access control lists (ACLs)</primary>
55778 <secondary>testing a local part</secondary>
55779 </indexterm>
55780 <indexterm role="variable">
55781 <primary><varname>$local_part_data</varname></primary>
55782 </indexterm>
55783 This condition is relevant only after a RCPT command. It checks that the local
55784 part of the recipient address is in the list. If percent-hack processing is
55785 enabled, it is done before this test. If the check succeeds with a lookup, the
55786 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
55787 the next <option>local_parts</option> test.
55788 </para>
55789 </listitem></varlistentry>
55790 <varlistentry>
55791 <term><emphasis role="bold">malware&nbsp;=&nbsp;</emphasis>&lt;<emphasis>option</emphasis>&gt;</term>
55792 <listitem>
55793 <para>
55794 <indexterm role="concept">
55795 <primary><option>malware</option> ACL condition</primary>
55796 </indexterm>
55797 <indexterm role="concept">
55798 <primary>access control lists (ACLs)</primary>
55799 <secondary>virus scanning</secondary>
55800 </indexterm>
55801 <indexterm role="concept">
55802 <primary>access control lists (ACLs)</primary>
55803 <secondary>scanning for viruses</secondary>
55804 </indexterm>
55805 This condition is available only when Exim is compiled with the
55806 content-scanning extension. It causes the incoming message to be scanned for
55807 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
55808 </para>
55809 </listitem></varlistentry>
55810 <varlistentry>
55811 <term><emphasis role="bold">mime_regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
55812 <listitem>
55813 <para>
55814 <indexterm role="concept">
55815 <primary><option>mime_regex</option> ACL condition</primary>
55816 </indexterm>
55817 <indexterm role="concept">
55818 <primary>access control lists (ACLs)</primary>
55819 <secondary>testing by regex matching</secondary>
55820 </indexterm>
55821 This condition is available only when Exim is compiled with the
55822 content-scanning extension, and it is allowed only in the ACL defined by
55823 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
55824 with any of the regular expressions. For details, see chapter
55825 <xref linkend="CHAPexiscan"/>.
55826 </para>
55827 </listitem></varlistentry>
55828 <varlistentry>
55829 <term><emphasis role="bold">ratelimit&nbsp;=&nbsp;</emphasis>&lt;<emphasis>parameters</emphasis>&gt;</term>
55830 <listitem>
55831 <para>
55832 <indexterm role="concept">
55833 <primary>rate limiting</primary>
55834 </indexterm>
55835 This condition can be used to limit the rate at which a user or host submits
55836 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
55837 </para>
55838 </listitem></varlistentry>
55839 <varlistentry>
55840 <term><emphasis role="bold">recipients&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
55841 <listitem>
55842 <para>
55843 <indexterm role="concept">
55844 <primary><option>recipients</option> ACL condition</primary>
55845 </indexterm>
55846 <indexterm role="concept">
55847 <primary>recipient</primary>
55848 <secondary>ACL checking</secondary>
55849 </indexterm>
55850 <indexterm role="concept">
55851 <primary>access control lists (ACLs)</primary>
55852 <secondary>testing a recipient</secondary>
55853 </indexterm>
55854 This condition is relevant only after a RCPT command. It checks the entire
55855 recipient address against a list of recipients.
55856 </para>
55857 </listitem></varlistentry>
55858 <varlistentry>
55859 <term><emphasis role="bold">regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
55860 <listitem>
55861 <para>
55862 <indexterm role="concept">
55863 <primary><option>regex</option> ACL condition</primary>
55864 </indexterm>
55865 <indexterm role="concept">
55866 <primary>access control lists (ACLs)</primary>
55867 <secondary>testing by regex matching</secondary>
55868 </indexterm>
55869 This condition is available only when Exim is compiled with the
55870 content-scanning extension, and is available only in the DATA, MIME, and
55871 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
55872 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
55873 </para>
55874 </listitem></varlistentry>
55875 <varlistentry>
55876 <term><emphasis role="bold">sender_domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
55877 <listitem>
55878 <para>
55879 <indexterm role="concept">
55880 <primary><option>sender_domains</option> ACL condition</primary>
55881 </indexterm>
55882 <indexterm role="concept">
55883 <primary>sender</primary>
55884 <secondary>ACL checking</secondary>
55885 </indexterm>
55886 <indexterm role="concept">
55887 <primary>access control lists (ACLs)</primary>
55888 <secondary>testing a sender domain</secondary>
55889 </indexterm>
55890 <indexterm role="variable">
55891 <primary><varname>$domain</varname></primary>
55892 </indexterm>
55893 <indexterm role="variable">
55894 <primary><varname>$sender_address_domain</varname></primary>
55895 </indexterm>
55896 This condition tests the domain of the sender of the message against the given
55897 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
55898 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
55899 of this condition. This is an exception to the general rule for testing domain
55900 lists. It is done this way so that, if this condition is used in an ACL for a
55901 RCPT command, the recipient&#x2019;s domain (which is in <varname>$domain</varname>) can be used to
55902 influence the sender checking.
55903 </para>
55904 <para>
55905 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
55906 relaying, because sender addresses are easily, and commonly, forged.
55907 </para>
55908 </listitem></varlistentry>
55909 <varlistentry>
55910 <term><emphasis role="bold">senders&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
55911 <listitem>
55912 <para>
55913 <indexterm role="concept">
55914 <primary><option>senders</option> ACL condition</primary>
55915 </indexterm>
55916 <indexterm role="concept">
55917 <primary>sender</primary>
55918 <secondary>ACL checking</secondary>
55919 </indexterm>
55920 <indexterm role="concept">
55921 <primary>access control lists (ACLs)</primary>
55922 <secondary>testing a sender</secondary>
55923 </indexterm>
55924 This condition tests the sender of the message against the given list. To test
55925 for a bounce message, which has an empty sender, set
55926 </para>
55927 <literallayout class="monospaced">
55928 senders = :
55929 </literallayout>
55930 <para>
55931 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
55932 relaying, because sender addresses are easily, and commonly, forged.
55933 </para>
55934 </listitem></varlistentry>
55935 <varlistentry>
55936 <term><emphasis role="bold">spam&nbsp;=&nbsp;</emphasis>&lt;<emphasis>username</emphasis>&gt;</term>
55937 <listitem>
55938 <para>
55939 <indexterm role="concept">
55940 <primary><option>spam</option> ACL condition</primary>
55941 </indexterm>
55942 <indexterm role="concept">
55943 <primary>access control lists (ACLs)</primary>
55944 <secondary>scanning for spam</secondary>
55945 </indexterm>
55946 This condition is available only when Exim is compiled with the
55947 content-scanning extension. It causes the incoming message to be scanned by
55948 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
55949 </para>
55950 </listitem></varlistentry>
55951 <varlistentry>
55952 <term><emphasis role="bold">verify&nbsp;=&nbsp;certificate</emphasis></term>
55953 <listitem>
55954 <para>
55955 <indexterm role="concept">
55956 <primary><option>verify</option> ACL condition</primary>
55957 </indexterm>
55958 <indexterm role="concept">
55959 <primary>TLS</primary>
55960 <secondary>client certificate verification</secondary>
55961 </indexterm>
55962 <indexterm role="concept">
55963 <primary>certificate</primary>
55964 <secondary>verification of client</secondary>
55965 </indexterm>
55966 <indexterm role="concept">
55967 <primary>access control lists (ACLs)</primary>
55968 <secondary>certificate verification</secondary>
55969 </indexterm>
55970 <indexterm role="concept">
55971 <primary>access control lists (ACLs)</primary>
55972 <secondary>testing a TLS certificate</secondary>
55973 </indexterm>
55974 This condition is true in an SMTP session if the session is encrypted, and a
55975 certificate was received from the client, and the certificate was verified. The
55976 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
55977 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
55978 </para>
55979 </listitem></varlistentry>
55980 <varlistentry>
55981 <term><emphasis role="bold">verify&nbsp;=&nbsp;csa</emphasis></term>
55982 <listitem>
55983 <para>
55984 <indexterm role="concept">
55985 <primary>CSA verification</primary>
55986 </indexterm>
55987 This condition checks whether the sending host (the client) is authorized to
55988 send email. Details of how this works are given in section
55989 <xref linkend="SECTverifyCSA"/>.
55990 </para>
55991 </listitem></varlistentry>
55992 <varlistentry>
55993 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_names_ascii</emphasis></term>
55994 <listitem>
55995 <para>
55996 <indexterm role="concept">
55997 <primary><option>verify</option> ACL condition</primary>
55998 </indexterm>
55999 <indexterm role="concept">
56000 <primary>access control lists (ACLs)</primary>
56001 <secondary>verifying header names only ASCII</secondary>
56002 </indexterm>
56003 <indexterm role="concept">
56004 <primary>header lines</primary>
56005 <secondary>verifying header names only ASCII</secondary>
56006 </indexterm>
56007 <indexterm role="concept">
56008 <primary>verifying</primary>
56009 <secondary>header names only ASCII</secondary>
56010 </indexterm>
56011 This condition is relevant only in an ACL that is run after a message has been
56012 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
56013 <option>acl_not_smtp</option>.  It checks all header names (not the content) to make sure
56014 there are no non-ASCII characters, also excluding control characters.  The
56015 allowable characters are decimal ASCII values 33 through 126.
56016 </para>
56017 <para>
56018 Exim itself will handle headers with non-ASCII characters, but it can cause
56019 problems for downstream applications, so this option will allow their
56020 detection and rejection in the DATA ACL&#x2019;s.
56021 </para>
56022 </listitem></varlistentry>
56023 <varlistentry>
56024 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
56025 <listitem>
56026 <para>
56027 <indexterm role="concept">
56028 <primary><option>verify</option> ACL condition</primary>
56029 </indexterm>
56030 <indexterm role="concept">
56031 <primary>access control lists (ACLs)</primary>
56032 <secondary>verifying sender in the header</secondary>
56033 </indexterm>
56034 <indexterm role="concept">
56035 <primary>header lines</primary>
56036 <secondary>verifying the sender in</secondary>
56037 </indexterm>
56038 <indexterm role="concept">
56039 <primary>sender</primary>
56040 <secondary>verifying in header</secondary>
56041 </indexterm>
56042 <indexterm role="concept">
56043 <primary>verifying</primary>
56044 <secondary>sender in header</secondary>
56045 </indexterm>
56046 This condition is relevant only in an ACL that is run after a message has been
56047 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
56048 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
56049 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
56050 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
56051 However, an address that appears in one of these headers need not be an address
56052 that accepts bounce messages; only sender addresses in envelopes are required
56053 to accept bounces. Therefore, if you use the callout option on this check, you
56054 might want to arrange for a non-empty address in the MAIL command.
56055 </para>
56056 <para>
56057 Details of address verification and the options are given later, starting at
56058 section <xref linkend="SECTaddressverification"/> (callouts are described in section
56059 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
56060 condition to restrict it to bounce messages only:
56061 </para>
56062 <literallayout class="monospaced">
56063 deny    senders = :
56064         message = A valid sender header is required for bounces
56065        !verify  = header_sender
56066 </literallayout>
56067 </listitem></varlistentry>
56068 <varlistentry>
56069 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_syntax</emphasis></term>
56070 <listitem>
56071 <para>
56072 <indexterm role="concept">
56073 <primary><option>verify</option> ACL condition</primary>
56074 </indexterm>
56075 <indexterm role="concept">
56076 <primary>access control lists (ACLs)</primary>
56077 <secondary>verifying header syntax</secondary>
56078 </indexterm>
56079 <indexterm role="concept">
56080 <primary>header lines</primary>
56081 <secondary>verifying syntax</secondary>
56082 </indexterm>
56083 <indexterm role="concept">
56084 <primary>verifying</primary>
56085 <secondary>header syntax</secondary>
56086 </indexterm>
56087 This condition is relevant only in an ACL that is run after a message has been
56088 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
56089 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
56090 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
56091 and <emphasis>Bcc:</emphasis>), returning true if there are no problems.
56092 Unqualified addresses (local parts without domains) are
56093 permitted only in locally generated messages and from hosts that match
56094 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
56095 appropriate.
56096 </para>
56097 <para>
56098 Note that this condition is a syntax check only. However, a common spamming
56099 ploy used to be to send syntactically invalid headers such as
56100 </para>
56101 <literallayout class="monospaced">
56102 To: @
56103 </literallayout>
56104 <para>
56105 and this condition can be used to reject such messages, though they are not as
56106 common as they used to be.
56107 </para>
56108 </listitem></varlistentry>
56109 <varlistentry>
56110 <term><emphasis role="bold">verify&nbsp;=&nbsp;helo</emphasis></term>
56111 <listitem>
56112 <para>
56113 <indexterm role="concept">
56114 <primary><option>verify</option> ACL condition</primary>
56115 </indexterm>
56116 <indexterm role="concept">
56117 <primary>access control lists (ACLs)</primary>
56118 <secondary>verifying HELO/EHLO</secondary>
56119 </indexterm>
56120 <indexterm role="concept">
56121 <primary>HELO</primary>
56122 <secondary>verifying</secondary>
56123 </indexterm>
56124 <indexterm role="concept">
56125 <primary>EHLO</primary>
56126 <secondary>verifying</secondary>
56127 </indexterm>
56128 <indexterm role="concept">
56129 <primary>verifying</primary>
56130 <secondary>EHLO</secondary>
56131 </indexterm>
56132 <indexterm role="concept">
56133 <primary>verifying</primary>
56134 <secondary>HELO</secondary>
56135 </indexterm>
56136 This condition is true if a HELO or EHLO command has been received from the
56137 client host, and its contents have been verified. If there has been no previous
56138 attempt to verify the HELO/EHLO contents, it is carried out when this
56139 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
56140 <option>helo_try_verify_hosts</option> options for details of how to request verification
56141 independently of this condition.
56142 </para>
56143 <para>
56144 For SMTP input that does not come over TCP/IP (the <option>-bs</option> command line
56145 option), this condition is always true.
56146 </para>
56147 </listitem></varlistentry>
56148 <varlistentry>
56149 <term><emphasis role="bold">verify&nbsp;=&nbsp;not_blind</emphasis></term>
56150 <listitem>
56151 <para>
56152 <indexterm role="concept">
56153 <primary>verifying</primary>
56154 <secondary>not blind</secondary>
56155 </indexterm>
56156 <indexterm role="concept">
56157 <primary>bcc recipients, verifying none</primary>
56158 </indexterm>
56159 This condition checks that there are no blind (bcc) recipients in the message.
56160 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
56161 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
56162 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
56163 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
56164 used only in a DATA or non-SMTP ACL.
56165 </para>
56166 <para>
56167 There are, of course, many legitimate messages that make use of blind (bcc)
56168 recipients. This check should not be used on its own for blocking messages.
56169 </para>
56170 </listitem></varlistentry>
56171 <varlistentry>
56172 <term><emphasis role="bold">verify&nbsp;=&nbsp;recipient/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
56173 <listitem>
56174 <para>
56175 <indexterm role="concept">
56176 <primary><option>verify</option> ACL condition</primary>
56177 </indexterm>
56178 <indexterm role="concept">
56179 <primary>access control lists (ACLs)</primary>
56180 <secondary>verifying recipient</secondary>
56181 </indexterm>
56182 <indexterm role="concept">
56183 <primary>recipient</primary>
56184 <secondary>verifying</secondary>
56185 </indexterm>
56186 <indexterm role="concept">
56187 <primary>verifying</primary>
56188 <secondary>recipient</secondary>
56189 </indexterm>
56190 <indexterm role="variable">
56191 <primary><varname>$address_data</varname></primary>
56192 </indexterm>
56193 This condition is relevant only after a RCPT command. It verifies the current
56194 recipient. Details of address verification are given later, starting at section
56195 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
56196 of <varname>$address_data</varname> is the last value that was set while routing the address.
56197 This applies even if the verification fails. When an address that is being
56198 verified is redirected to a single address, verification continues with the new
56199 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
56200 value for the child address.
56201 </para>
56202 </listitem></varlistentry>
56203 <varlistentry>
56204 <term><emphasis role="bold">verify&nbsp;=&nbsp;reverse_host_lookup/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
56205 <listitem>
56206 <para>
56207 <indexterm role="concept">
56208 <primary><option>verify</option> ACL condition</primary>
56209 </indexterm>
56210 <indexterm role="concept">
56211 <primary>access control lists (ACLs)</primary>
56212 <secondary>verifying host reverse lookup</secondary>
56213 </indexterm>
56214 <indexterm role="concept">
56215 <primary>host</primary>
56216 <secondary>verifying reverse lookup</secondary>
56217 </indexterm>
56218 This condition ensures that a verified host name has been looked up from the IP
56219 address of the client host. (This may have happened already if the host name
56220 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
56221 Verification ensures that the host name obtained from a reverse DNS lookup, or
56222 one of its aliases, does, when it is itself looked up in the DNS, yield the
56223 original IP address.
56224 </para>
56225 <para>
56226 There is one possible option, <literal>defer_ok</literal>.  If this is present and a
56227 DNS operation returns a temporary error, the verify condition succeeds.
56228 </para>
56229 <para>
56230 If this condition is used for a locally generated message (that is, when there
56231 is no client host involved), it always succeeds.
56232 </para>
56233 </listitem></varlistentry>
56234 <varlistentry>
56235 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
56236 <listitem>
56237 <para>
56238 <indexterm role="concept">
56239 <primary><option>verify</option> ACL condition</primary>
56240 </indexterm>
56241 <indexterm role="concept">
56242 <primary>access control lists (ACLs)</primary>
56243 <secondary>verifying sender</secondary>
56244 </indexterm>
56245 <indexterm role="concept">
56246 <primary>sender</primary>
56247 <secondary>verifying</secondary>
56248 </indexterm>
56249 <indexterm role="concept">
56250 <primary>verifying</primary>
56251 <secondary>sender</secondary>
56252 </indexterm>
56253 This condition is relevant only after a MAIL or RCPT command, or after a
56254 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
56255 the message&#x2019;s sender is empty (that is, this is a bounce message), the
56256 condition is true. Otherwise, the sender address is verified.
56257 </para>
56258 <para>
56259 <indexterm role="variable">
56260 <primary><varname>$address_data</varname></primary>
56261 </indexterm>
56262 <indexterm role="variable">
56263 <primary><varname>$sender_address_data</varname></primary>
56264 </indexterm>
56265 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
56266 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
56267 value can be used in subsequent conditions and modifiers in the same ACL
56268 statement. It does not persist after the end of the current statement. If you
56269 want to preserve the value for longer, you can save it in an ACL variable.
56270 </para>
56271 <para>
56272 Details of verification are given later, starting at section
56273 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
56274 to avoid doing it more than once per message.
56275 </para>
56276 </listitem></varlistentry>
56277 <varlistentry>
56278 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender=</emphasis>&lt;<emphasis>address</emphasis>&gt;<emphasis role="bold">/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
56279 <listitem>
56280 <para>
56281 <indexterm role="concept">
56282 <primary><option>verify</option> ACL condition</primary>
56283 </indexterm>
56284 This is a variation of the previous option, in which a modified address is
56285 verified as a sender.
56286 </para>
56287 </listitem></varlistentry>
56288 </variablelist>
56289 </section>
56290 <section id="SECTmorednslists">
56291 <title>Using DNS lists</title>
56292 <para>
56293 <indexterm role="concept">
56294 <primary>DNS list</primary>
56295 <secondary>in ACL</secondary>
56296 </indexterm>
56297 <indexterm role="concept">
56298 <primary>black list (DNS)</primary>
56299 </indexterm>
56300 <indexterm role="concept">
56301 <primary>access control lists (ACLs)</primary>
56302 <secondary>testing a DNS list</secondary>
56303 </indexterm>
56304 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
56305 is on at least one of a number of DNS lists by looking up the inverted IP
56306 address in one or more DNS domains. (Note that DNS list domains are not mail
56307 domains, so the <literal>+</literal> syntax for named lists doesn&#x2019;t work - it is used for
56308 special options instead.) For example, if the calling host&#x2019;s IP
56309 address is 192.168.62.43, and the ACL statement is
56310 </para>
56311 <literallayout class="monospaced">
56312 deny dnslists = blackholes.mail-abuse.org : \
56313                 dialups.mail-abuse.org
56314 </literallayout>
56315 <para>
56316 the following records are looked up:
56317 </para>
56318 <literallayout class="monospaced">
56319 43.62.168.192.blackholes.mail-abuse.org
56320 43.62.168.192.dialups.mail-abuse.org
56321 </literallayout>
56322 <para>
56323 As soon as Exim finds an existing DNS record, processing of the list stops.
56324 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
56325 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
56326 use two separate conditions:
56327 </para>
56328 <literallayout class="monospaced">
56329 deny dnslists = blackholes.mail-abuse.org
56330      dnslists = dialups.mail-abuse.org
56331 </literallayout>
56332 <para>
56333 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
56334 behaves as if the host does not match the list item, that is, as if the DNS
56335 record does not exist. If there are further items in the DNS list, they are
56336 processed.
56337 </para>
56338 <para>
56339 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
56340 (which is the most common usage), because it prevents a DNS failure from
56341 blocking mail. However, you can change this behaviour by putting one of the
56342 following special items in the list:
56343 </para>
56344 <literallayout>
56345 <literal>+include_unknown </literal>   behave as if the item is on the list
56346 <literal>+exclude_unknown </literal>   behave as if the item is not on the list (default)
56347 <literal>+defer_unknown   </literal>   give a temporary error
56348 </literallayout>
56349 <para>
56350 <indexterm role="concept">
56351 <primary><literal>+include_unknown</literal></primary>
56352 </indexterm>
56353 <indexterm role="concept">
56354 <primary><literal>+exclude_unknown</literal></primary>
56355 </indexterm>
56356 <indexterm role="concept">
56357 <primary><literal>+defer_unknown</literal></primary>
56358 </indexterm>
56359 Each of these applies to any subsequent items on the list. For example:
56360 </para>
56361 <literallayout class="monospaced">
56362 deny dnslists = +defer_unknown : foo.bar.example
56363 </literallayout>
56364 <para>
56365 Testing the list of domains stops as soon as a match is found. If you want to
56366 warn for one list and block for another, you can use two different statements:
56367 </para>
56368 <literallayout class="monospaced">
56369 deny  dnslists = blackholes.mail-abuse.org
56370 warn  message  = X-Warn: sending host is on dialups list
56371       dnslists = dialups.mail-abuse.org
56372 </literallayout>
56373 <para>
56374 <indexterm role="concept">
56375 <primary>cacheing</primary>
56376 <secondary>of dns lookup</secondary>
56377 </indexterm>
56378 <indexterm role="concept">
56379 <primary>DNS</primary>
56380 <secondary>TTL</secondary>
56381 </indexterm>
56382 DNS list lookups are cached by Exim for the duration of the SMTP session
56383 </para>
56384 <para revisionflag="changed">
56385 (but limited by the DNS return TTL value),
56386 </para>
56387 <para>
56388 so a lookup based on the IP address is done at most once for any incoming
56389 connection (assuming long-enough TTL).
56390 Exim does not share information between multiple incoming
56391 connections (but your local name server cache should be active).
56392 </para>
56393 </section>
56394 <section id="SECID201">
56395 <title>Specifying the IP address for a DNS list lookup</title>
56396 <para>
56397 <indexterm role="concept">
56398 <primary>DNS list</primary>
56399 <secondary>keyed by explicit IP address</secondary>
56400 </indexterm>
56401 By default, the IP address that is used in a DNS list lookup is the IP address
56402 of the calling host. However, you can specify another IP address by listing it
56403 after the domain name, introduced by a slash. For example:
56404 </para>
56405 <literallayout class="monospaced">
56406 deny dnslists = black.list.tld/192.168.1.2
56407 </literallayout>
56408 <para>
56409 This feature is not very helpful with explicit IP addresses; it is intended for
56410 use with IP addresses that are looked up, for example, the IP addresses of the
56411 MX hosts or nameservers of an email sender address. For an example, see section
56412 <xref linkend="SECTmulkeyfor"/> below.
56413 </para>
56414 </section>
56415 <section id="SECID202">
56416 <title>DNS lists keyed on domain names</title>
56417 <para>
56418 <indexterm role="concept">
56419 <primary>DNS list</primary>
56420 <secondary>keyed by domain name</secondary>
56421 </indexterm>
56422 There are some lists that are keyed on domain names rather than inverted IP
56423 addresses (see for example the <emphasis>domain based zones</emphasis> link at
56424 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
56425 with these lists. You can change the name that is looked up in a DNS list by
56426 listing it after the domain name, introduced by a slash. For example,
56427 </para>
56428 <literallayout class="monospaced">
56429 deny  message  = Sender's domain is listed at $dnslist_domain
56430       dnslists = dsn.rfc-ignorant.org/$sender_address_domain
56431 </literallayout>
56432 <para>
56433 This particular example is useful only in ACLs that are obeyed after the
56434 RCPT or DATA commands, when a sender address is available. If (for
56435 example) the message&#x2019;s sender is <emphasis>user@tld.example</emphasis> the name that is looked
56436 up by this example is
56437 </para>
56438 <literallayout class="monospaced">
56439 tld.example.dsn.rfc-ignorant.org
56440 </literallayout>
56441 <para>
56442 A single <option>dnslists</option> condition can contain entries for both names and IP
56443 addresses. For example:
56444 </para>
56445 <literallayout class="monospaced">
56446 deny dnslists = sbl.spamhaus.org : \
56447                 dsn.rfc-ignorant.org/$sender_address_domain
56448 </literallayout>
56449 <para>
56450 The first item checks the sending host&#x2019;s IP address; the second checks a domain
56451 name. The whole condition is true if either of the DNS lookups succeeds.
56452 </para>
56453 </section>
56454 <section id="SECTmulkeyfor">
56455 <title>Multiple explicit keys for a DNS list</title>
56456 <para>
56457 <indexterm role="concept">
56458 <primary>DNS list</primary>
56459 <secondary>multiple keys for</secondary>
56460 </indexterm>
56461 The syntax described above for looking up explicitly-defined values (either
56462 names or IP addresses) in a DNS blacklist is a simplification. After the domain
56463 name for the DNS list, what follows the slash can in fact be a list of items.
56464 As with all lists in Exim, the default separator is a colon. However, because
56465 this is a sublist within the list of DNS blacklist domains, it is necessary
56466 either to double the separators like this:
56467 </para>
56468 <literallayout class="monospaced">
56469 dnslists = black.list.tld/name.1::name.2
56470 </literallayout>
56471 <para>
56472 or to change the separator character, like this:
56473 </para>
56474 <literallayout class="monospaced">
56475 dnslists = black.list.tld/&lt;;name.1;name.2
56476 </literallayout>
56477 <para>
56478 If an item in the list is an IP address, it is inverted before the DNS
56479 blacklist domain is appended. If it is not an IP address, no inversion
56480 occurs. Consider this condition:
56481 </para>
56482 <literallayout class="monospaced">
56483 dnslists = black.list.tld/&lt;;192.168.1.2;a.domain
56484 </literallayout>
56485 <para>
56486 The DNS lookups that occur are:
56487 </para>
56488 <literallayout class="monospaced">
56489 2.1.168.192.black.list.tld
56490 a.domain.black.list.tld
56491 </literallayout>
56492 <para>
56493 Once a DNS record has been found (that matches a specific IP return
56494 address, if specified &ndash; see section <xref linkend="SECTaddmatcon"/>), no further lookups
56495 are done. If there is a temporary DNS error, the rest of the sublist of domains
56496 or IP addresses is tried. A temporary error for the whole dnslists item occurs
56497 only if no other DNS lookup in this sublist succeeds. In other words, a
56498 successful lookup for any of the items in the sublist overrides a temporary
56499 error for a previous item.
56500 </para>
56501 <para>
56502 The ability to supply a list of items after the slash is in some sense just a
56503 syntactic convenience. These two examples have the same effect:
56504 </para>
56505 <literallayout class="monospaced">
56506 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
56507 dnslists = black.list.tld/a.domain::b.domain
56508 </literallayout>
56509 <para>
56510 However, when the data for the list is obtained from a lookup, the second form
56511 is usually much more convenient. Consider this example:
56512 </para>
56513 <literallayout class="monospaced">
56514 deny message  = The mail servers for the domain \
56515                 $sender_address_domain \
56516                 are listed at $dnslist_domain ($dnslist_value); \
56517                 see $dnslist_text.
56518      dnslists = sbl.spamhaus.org/&lt;|${lookup dnsdb {&gt;|a=&lt;|\
56519                                    ${lookup dnsdb {&gt;|mxh=\
56520                                    $sender_address_domain} }} }
56521 </literallayout>
56522 <para>
56523 Note the use of <literal>&gt;|</literal> in the dnsdb lookup to specify the separator for
56524 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
56525 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
56526 of expanding the condition might be something like this:
56527 </para>
56528 <literallayout class="monospaced">
56529 dnslists = sbl.spahmaus.org/&lt;|192.168.2.3|192.168.5.6|...
56530 </literallayout>
56531 <para>
56532 Thus, this example checks whether or not the IP addresses of the sender
56533 domain&#x2019;s mail servers are on the Spamhaus black list.
56534 </para>
56535 <para>
56536 The key that was used for a successful DNS list lookup is put into the variable
56537 <varname>$dnslist_matched</varname> (see section <xref linkend="SECID204"/>).
56538 </para>
56539 </section>
56540 <section id="SECID203">
56541 <title>Data returned by DNS lists</title>
56542 <para>
56543 <indexterm role="concept">
56544 <primary>DNS list</primary>
56545 <secondary>data returned from</secondary>
56546 </indexterm>
56547 DNS lists are constructed using address records in the DNS. The original RBL
56548 just used the address 127.0.0.1 on the right hand side of each record, but the
56549 RBL+ list and some other lists use a number of values with different meanings.
56550 The values used on the RBL+ list are:
56551 </para>
56552 <literallayout>
56553 127.1.0.1  RBL
56554 127.1.0.2  DUL
56555 127.1.0.3  DUL and RBL
56556 127.1.0.4  RSS
56557 127.1.0.5  RSS and RBL
56558 127.1.0.6  RSS and DUL
56559 127.1.0.7  RSS and DUL and RBL
56560 </literallayout>
56561 <para>
56562 Section <xref linkend="SECTaddmatcon"/> below describes how you can distinguish between
56563 different values. Some DNS lists may return more than one address record;
56564 see section <xref linkend="SECThanmuldnsrec"/> for details of how they are checked.
56565 </para>
56566 </section>
56567 <section id="SECID204">
56568 <title>Variables set from DNS lists</title>
56569 <para>
56570 <indexterm role="concept">
56571 <primary>expansion</primary>
56572 <secondary>variables, set from DNS list</secondary>
56573 </indexterm>
56574 <indexterm role="concept">
56575 <primary>DNS list</primary>
56576 <secondary>variables set from</secondary>
56577 </indexterm>
56578 <indexterm role="variable">
56579 <primary><varname>$dnslist_domain</varname></primary>
56580 </indexterm>
56581 <indexterm role="variable">
56582 <primary><varname>$dnslist_matched</varname></primary>
56583 </indexterm>
56584 <indexterm role="variable">
56585 <primary><varname>$dnslist_text</varname></primary>
56586 </indexterm>
56587 <indexterm role="variable">
56588 <primary><varname>$dnslist_value</varname></primary>
56589 </indexterm>
56590 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname> contains
56591 the name of the overall domain that matched (for example,
56592 <literal>spamhaus.example</literal>), <varname>$dnslist_matched</varname> contains the key within that domain
56593 (for example, <literal>192.168.5.3</literal>), and <varname>$dnslist_value</varname> contains the data from
56594 the DNS record. When the key is an IP address, it is not reversed in
56595 <varname>$dnslist_matched</varname> (though it is, of course, in the actual lookup). In simple
56596 cases, for example:
56597 </para>
56598 <literallayout class="monospaced">
56599 deny dnslists = spamhaus.example
56600 </literallayout>
56601 <para>
56602 the key is also available in another variable (in this case,
56603 <varname>$sender_host_address</varname>). In more complicated cases, however, this is not true.
56604 For example, using a data lookup (as described in section <xref linkend="SECTmulkeyfor"/>)
56605 might generate a dnslists lookup like this:
56606 </para>
56607 <literallayout class="monospaced">
56608 deny dnslists = spamhaus.example/&lt;|192.168.1.2|192.168.6.7|...
56609 </literallayout>
56610 <para>
56611 If this condition succeeds, the value in <varname>$dnslist_matched</varname> might be
56612 <literal>192.168.6.7</literal> (for example).
56613 </para>
56614 <para>
56615 If more than one address record is returned by the DNS lookup, all the IP
56616 addresses are included in <varname>$dnslist_value</varname>, separated by commas and spaces.
56617 The variable <varname>$dnslist_text</varname> contains the contents of any associated TXT
56618 record. For lists such as RBL+ the TXT record for a merged entry is often not
56619 very meaningful. See section <xref linkend="SECTmordetinf"/> for a way of obtaining more
56620 information.
56621 </para>
56622 <para>
56623 You can use the DNS list variables in <option>message</option> or <option>log_message</option> modifiers
56624 &ndash; although these appear before the condition in the ACL, they are not
56625 expanded until after it has failed. For example:
56626 </para>
56627 <literallayout class="monospaced">
56628 deny    hosts = !+local_networks
56629         message = $sender_host_address is listed \
56630                   at $dnslist_domain
56631         dnslists = rbl-plus.mail-abuse.example
56632 </literallayout>
56633 </section>
56634 <section id="SECTaddmatcon">
56635 <title>Additional matching conditions for DNS lists</title>
56636 <para>
56637 <indexterm role="concept">
56638 <primary>DNS list</primary>
56639 <secondary>matching specific returned data</secondary>
56640 </indexterm>
56641 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
56642 in order to restrict its action to DNS records with a matching right hand side.
56643 For example,
56644 </para>
56645 <literallayout class="monospaced">
56646 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
56647 </literallayout>
56648 <para>
56649 rejects only those hosts that yield 127.0.0.2. Without this additional data,
56650 any address record is considered to be a match. For the moment, we assume
56651 that the DNS lookup returns just one record. Section <xref linkend="SECThanmuldnsrec"/>
56652 describes how multiple records are handled.
56653 </para>
56654 <para>
56655 More than one IP address may be given for checking, using a comma as a
56656 separator. These are alternatives &ndash; if any one of them matches, the
56657 <option>dnslists</option> condition is true. For example:
56658 </para>
56659 <literallayout class="monospaced">
56660 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
56661 </literallayout>
56662 <para>
56663 If you want to specify a constraining address list and also specify names or IP
56664 addresses to be looked up, the constraining address list must be specified
56665 first. For example:
56666 </para>
56667 <literallayout class="monospaced">
56668 deny dnslists = dsn.rfc-ignorant.org\
56669                 =127.0.0.2/$sender_address_domain
56670 </literallayout>
56671 <para>
56672 If the character <literal>&amp;</literal> is used instead of <literal>=</literal>, the comparison for each
56673 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
56674 In other words, the listed addresses are used as bit masks. The comparison is
56675 true if all the bits in the mask are present in the address that is being
56676 tested. For example:
56677 </para>
56678 <literallayout class="monospaced">
56679 dnslists = a.b.c&amp;0.0.0.3
56680 </literallayout>
56681 <para>
56682 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
56683 want to test whether one bit or another bit is present (as opposed to both
56684 being present), you must use multiple values. For example:
56685 </para>
56686 <literallayout class="monospaced">
56687 dnslists = a.b.c&amp;0.0.0.1,0.0.0.2
56688 </literallayout>
56689 <para>
56690 matches if the final component of the address is an odd number or two times
56691 an odd number.
56692 </para>
56693 </section>
56694 <section id="SECID205">
56695 <title>Negated DNS matching conditions</title>
56696 <para>
56697 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
56698 condition. Whereas
56699 </para>
56700 <literallayout class="monospaced">
56701 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
56702 </literallayout>
56703 <para>
56704 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
56705 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
56706 </para>
56707 <literallayout class="monospaced">
56708 deny  dnslists = a.b.c!=127.0.0.2,127.0.0.3
56709 </literallayout>
56710 <para>
56711 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
56712 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
56713 words, the result of the test is inverted if an exclamation mark appears before
56714 the <literal>=</literal> (or the <literal>&amp;</literal>) sign.
56715 </para>
56716 <para>
56717 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
56718 host, or address list (which is why the syntax is different).
56719 </para>
56720 <para>
56721 If you are using just one list, the negation syntax does not gain you much. The
56722 previous example is precisely equivalent to
56723 </para>
56724 <literallayout class="monospaced">
56725 deny  dnslists = a.b.c
56726      !dnslists = a.b.c=127.0.0.2,127.0.0.3
56727 </literallayout>
56728 <para>
56729 However, if you are using multiple lists, the negation syntax is clearer.
56730 Consider this example:
56731 </para>
56732 <literallayout class="monospaced">
56733 deny  dnslists = sbl.spamhaus.org : \
56734                  list.dsbl.org : \
56735                  dnsbl.njabl.org!=127.0.0.3 : \
56736                  relays.ordb.org
56737 </literallayout>
56738 <para>
56739 Using only positive lists, this would have to be:
56740 </para>
56741 <literallayout class="monospaced">
56742 deny  dnslists = sbl.spamhaus.org : \
56743                  list.dsbl.org
56744 deny  dnslists = dnsbl.njabl.org
56745      !dnslists = dnsbl.njabl.org=127.0.0.3
56746 deny  dnslists = relays.ordb.org
56747 </literallayout>
56748 <para>
56749 which is less clear, and harder to maintain.
56750 </para>
56751 </section>
56752 <section id="SECThanmuldnsrec">
56753 <title>Handling multiple DNS records from a DNS list</title>
56754 <para>
56755 A DNS lookup for a <option>dnslists</option> condition may return more than one DNS record,
56756 thereby providing more than one IP address. When an item in a <option>dnslists</option> list
56757 is followed by <literal>=</literal> or <literal>&amp;</literal> and a list of IP addresses, in order to restrict
56758 the match to specific results from the DNS lookup, there are two ways in which
56759 the checking can be handled. For example, consider the condition:
56760 </para>
56761 <literallayout class="monospaced">
56762 dnslists = a.b.c=127.0.0.1
56763 </literallayout>
56764 <para>
56765 What happens if the DNS lookup for the incoming IP address yields both
56766 127.0.0.1 and 127.0.0.2 by means of two separate DNS records? Is the
56767 condition true because at least one given value was found, or is it false
56768 because at least one of the found values was not listed? And how does this
56769 affect negated conditions? Both possibilities are provided for with the help of
56770 additional separators <literal>==</literal> and <literal>=&amp;</literal>.
56771 </para>
56772 <itemizedlist>
56773 <listitem>
56774 <para>
56775 If <literal>=</literal> or <literal>&amp;</literal> is used, the condition is true if any one of the looked up
56776 IP addresses matches one of the listed addresses. For the example above, the
56777 condition is true because 127.0.0.1 matches.
56778 </para>
56779 </listitem>
56780 <listitem>
56781 <para>
56782 If <literal>==</literal> or <literal>=&amp;</literal> is used, the condition is true only if every one of the
56783 looked up IP addresses matches one of the listed addresses. If the condition is
56784 changed to:
56785 </para>
56786 <literallayout class="monospaced">
56787 dnslists = a.b.c==127.0.0.1
56788 </literallayout>
56789 <para>
56790 and the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
56791 false because 127.0.0.2 is not listed. You would need to have:
56792 </para>
56793 <literallayout class="monospaced">
56794 dnslists = a.b.c==127.0.0.1,127.0.0.2
56795 </literallayout>
56796 <para>
56797 for the condition to be true.
56798 </para>
56799 </listitem>
56800 </itemizedlist>
56801 <para>
56802 When <literal>!</literal> is used to negate IP address matching, it inverts the result, giving
56803 the precise opposite of the behaviour above. Thus:
56804 </para>
56805 <itemizedlist>
56806 <listitem>
56807 <para>
56808 If <literal>!=</literal> or <literal>!&amp;</literal> is used, the condition is true if none of the looked up IP
56809 addresses matches one of the listed addresses. Consider:
56810 </para>
56811 <literallayout class="monospaced">
56812 dnslists = a.b.c!&amp;0.0.0.1
56813 </literallayout>
56814 <para>
56815 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
56816 false because 127.0.0.1 matches.
56817 </para>
56818 </listitem>
56819 <listitem>
56820 <para>
56821 If <literal>!==</literal> or <literal>!=&amp;</literal> is used, the condition is true if there is at least one
56822 looked up IP address that does not match. Consider:
56823 </para>
56824 <literallayout class="monospaced">
56825 dnslists = a.b.c!=&amp;0.0.0.1
56826 </literallayout>
56827 <para>
56828 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
56829 true, because 127.0.0.2 does not match. You would need to have:
56830 </para>
56831 <literallayout class="monospaced">
56832 dnslists = a.b.c!=&amp;0.0.0.1,0.0.0.2
56833 </literallayout>
56834 <para>
56835 for the condition to be false.
56836 </para>
56837 </listitem>
56838 </itemizedlist>
56839 <para>
56840 When the DNS lookup yields only a single IP address, there is no difference
56841 between <literal>=</literal> and <literal>==</literal> and between <literal>&amp;</literal> and <literal>=&amp;</literal>.
56842 </para>
56843 </section>
56844 <section id="SECTmordetinf">
56845 <title>Detailed information from merged DNS lists</title>
56846 <para>
56847 <indexterm role="concept">
56848 <primary>DNS list</primary>
56849 <secondary>information from merged</secondary>
56850 </indexterm>
56851 When the facility for restricting the matching IP values in a DNS list is used,
56852 the text from the TXT record that is set in <varname>$dnslist_text</varname> may not reflect
56853 the true reason for rejection. This happens when lists are merged and the IP
56854 address in the A record is used to distinguish them; unfortunately there is
56855 only one TXT record. One way round this is not to use merged lists, but that
56856 can be inefficient because it requires multiple DNS lookups where one would do
56857 in the vast majority of cases when the host of interest is not on any of the
56858 lists.
56859 </para>
56860 <para>
56861 A less inefficient way of solving this problem is available. If
56862 two domain names, comma-separated, are given, the second is used first to
56863 do an initial check, making use of any IP value restrictions that are set.
56864 If there is a match, the first domain is used, without any IP value
56865 restrictions, to get the TXT record. As a byproduct of this, there is also
56866 a check that the IP being tested is indeed on the first list. The first
56867 domain is the one that is put in <varname>$dnslist_domain</varname>. For example:
56868 </para>
56869 <literallayout class="monospaced">
56870 reject message  = \
56871          rejected because $sender_host_address is blacklisted \
56872          at $dnslist_domain\n$dnslist_text
56873        dnslists = \
56874          sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \
56875          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
56876 </literallayout>
56877 <para>
56878 For the first blacklist item, this starts by doing a lookup in
56879 <emphasis>sbl-xbl.spamhaus.org</emphasis> and testing for a 127.0.0.2 return. If there is a
56880 match, it then looks in <emphasis>sbl.spamhaus.org</emphasis>, without checking the return
56881 value, and as long as something is found, it looks for the corresponding TXT
56882 record. If there is no match in <emphasis>sbl-xbl.spamhaus.org</emphasis>, nothing more is done.
56883 The second blacklist item is processed similarly.
56884 </para>
56885 <para>
56886 If you are interested in more than one merged list, the same list must be
56887 given several times, but because the results of the DNS lookups are cached,
56888 the DNS calls themselves are not repeated. For example:
56889 </para>
56890 <literallayout class="monospaced">
56891 reject dnslists = \
56892          http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \
56893          socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \
56894          misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \
56895          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
56896 </literallayout>
56897 <para>
56898 In this case there is one lookup in <emphasis>dnsbl.sorbs.net</emphasis>, and if none of the IP
56899 values matches (or if no record is found), this is the only lookup that is
56900 done. Only if there is a match is one of the more specific lists consulted.
56901 </para>
56902 </section>
56903 <section id="SECTmorednslistslast">
56904 <title>DNS lists and IPv6</title>
56905 <para>
56906 <indexterm role="concept">
56907 <primary>IPv6</primary>
56908 <secondary>DNS black lists</secondary>
56909 </indexterm>
56910 <indexterm role="concept">
56911 <primary>DNS list</primary>
56912 <secondary>IPv6 usage</secondary>
56913 </indexterm>
56914 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
56915 nibble by nibble. For example, if the calling host&#x2019;s IP address is
56916 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
56917 </para>
56918 <literallayout class="monospaced">
56919 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
56920   f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
56921 </literallayout>
56922 <para>
56923 (split over two lines here to fit on the page). Unfortunately, some of the DNS
56924 lists contain wildcard records, intended for IPv4, that interact badly with
56925 IPv6. For example, the DNS entry
56926 </para>
56927 <literallayout class="monospaced">
56928 *.3.some.list.example.    A    127.0.0.1
56929 </literallayout>
56930 <para>
56931 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
56932 Unfortunately, it also matches the entire 3::/4 IPv6 network.
56933 </para>
56934 <para>
56935 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
56936 <option>condition</option> condition, as in this example:
56937 </para>
56938 <literallayout class="monospaced">
56939 deny   condition = ${if isip4{$sender_host_address}}
56940        dnslists  = some.list.example
56941 </literallayout>
56942 <para>
56943 If an explicit key is being used for a DNS lookup and it may be an IPv6
56944 address you should specify alternate list separators for both the outer
56945 (DNS list name) list and inner (lookup keys) list:
56946 </para>
56947 <literallayout class="monospaced">
56948        dnslists = &lt;; dnsbl.example.com/&lt;|$acl_m_addrslist
56949 </literallayout>
56950 </section>
56951 <section id="SECTratelimiting">
56952 <title>Rate limiting incoming messages</title>
56953 <para>
56954 <indexterm role="concept">
56955 <primary>rate limiting</primary>
56956 <secondary>client sending</secondary>
56957 </indexterm>
56958 <indexterm role="concept">
56959 <primary>limiting client sending rates</primary>
56960 </indexterm>
56961 <indexterm role="option">
56962 <primary><option>smtp_ratelimit_*</option></primary>
56963 </indexterm>
56964 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
56965 which clients can send email. This is more powerful than the
56966 <option>smtp_ratelimit_*</option> options, because those options control the rate of
56967 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
56968 works across all connections (concurrent and sequential) from the same client
56969 host. The syntax of the <option>ratelimit</option> condition is:
56970 </para>
56971 <literallayout>
56972 <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;
56973 </literallayout>
56974 <para>
56975 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
56976 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
56977 </para>
56978 <para>
56979 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
56980 <varname>$sender_rate</varname> to the client&#x2019;s computed rate, <varname>$sender_rate_limit</varname> to the
56981 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
56982 of <emphasis>p</emphasis>.
56983 </para>
56984 <para>
56985 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
56986 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
56987 means that it takes Exim longer to forget a client&#x2019;s past behaviour. The
56988 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
56989 send in each time interval. It also specifies the number of messages permitted
56990 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
56991 constant, you can allow a client to send more messages in a burst without
56992 changing its long-term sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
56993 both small, messages must be sent at an even rate.
56994 </para>
56995 <para>
56996 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
56997 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
56998 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
56999 instructions when it is run with no arguments.
57000 </para>
57001 <para>
57002 The key is used to look up the data for calculating the client&#x2019;s average
57003 sending rate. This data is stored in Exim&#x2019;s spool directory, alongside the
57004 retry and other hints databases. The default key is <varname>$sender_host_address</varname>,
57005 which means Exim computes the sending rate of each client host IP address.
57006 By changing the key you can change how Exim identifies clients for the purpose
57007 of ratelimiting. For example, to limit the sending rate of each authenticated
57008 user, independent of the computer they are sending from, set the key to
57009 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
57010 example, <varname>$authenticated_id</varname> is only meaningful if the client has
57011 authenticated (which you can check with the <option>authenticated</option> ACL condition).
57012 </para>
57013 <para>
57014 The lookup key does not have to identify clients: If you want to limit the
57015 rate at which a recipient receives messages, you can use the key
57016 <literal>$local_part@$domain</literal> with the <option>per_rcpt</option> option (see below) in a RCPT
57017 ACL.
57018 </para>
57019 <para>
57020 Each <option>ratelimit</option> condition can have up to four options. A <option>per_*</option> option
57021 specifies what Exim measures the rate of, for example messages or recipients
57022 or bytes. You can adjust the measurement using the <option>unique=</option> and/or
57023 <option>count=</option> options. You can also control when Exim updates the recorded rate
57024 using a <option>strict</option>, <option>leaky</option>, or <option>readonly</option> option. The options are
57025 separated by a slash, like the other parameters. They may appear in any order.
57026 </para>
57027 <para>
57028 Internally, Exim appends the smoothing constant <emphasis>p</emphasis> onto the lookup key with
57029 any options that alter the meaning of the stored data. The limit <emphasis>m</emphasis> is not
57030 stored, so you can alter the configured maximum rate and Exim will still
57031 remember clients&#x2019; past behaviour. If you change the <option>per_*</option> mode or add or
57032 remove the <option>unique=</option> option, the lookup key changes so Exim will forget past
57033 behaviour. The lookup key is not affected by changes to the update mode and
57034 the <option>count=</option> option.
57035 </para>
57036 </section>
57037 <section id="ratoptmea">
57038 <title>Ratelimit options for what is being measured</title>
57039 <para>
57040 <indexterm role="concept">
57041 <primary>rate limiting</primary>
57042 <secondary>per_* options</secondary>
57043 </indexterm>
57044 The <option>per_conn</option> option limits the client&#x2019;s connection rate. It is not
57045 normally used in the <option>acl_not_smtp</option>, <option>acl_not_smtp_mime</option>, or
57046 <option>acl_not_smtp_start</option> ACLs.
57047 </para>
57048 <para>
57049 The <option>per_mail</option> option limits the client&#x2019;s rate of sending messages. This is
57050 the default if none of the <option>per_*</option> options is specified. It can be used in
57051 <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>, <option>acl_smtp_mime</option>,
57052 <option>acl_smtp_data</option>, or <option>acl_not_smtp</option>.
57053 </para>
57054 <para>
57055 The <option>per_byte</option> option limits the sender&#x2019;s email bandwidth. It can be used in
57056 the same ACLs as the <option>per_mail</option> option, though it is best to use this option
57057 in the <option>acl_smtp_mime</option>, <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs; if it is
57058 used in an earlier ACL, Exim relies on the SIZE parameter given by the client
57059 in its MAIL command, which may be inaccurate or completely missing. You can
57060 follow the limit <emphasis>m</emphasis> in the configuration with K, M, or G to specify limits
57061 in kilobytes, megabytes, or gigabytes, respectively.
57062 </para>
57063 <para>
57064 The <option>per_rcpt</option> option causes Exim to limit the rate at which recipients are
57065 accepted. It can be used in the <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
57066 <option>acl_smtp_mime</option>, <option>acl_smtp_data</option>, or <option>acl_smtp_rcpt</option> ACLs. In
57067 <option>acl_smtp_rcpt</option> the rate is updated one recipient at a time; in the other
57068 ACLs the rate is updated with the total (accepted) recipient count in one go. Note that
57069 in either case the rate limiting engine will see a message with many
57070 recipients as a large high-speed burst.
57071 </para>
57072 <para>
57073 The <option>per_addr</option> option is like the <option>per_rcpt</option> option, except it counts the
57074 number of different recipients that the client has sent messages to in the
57075 last time period. That is, if the client repeatedly sends messages to the same
57076 recipient, its measured rate is not increased. This option can only be used in
57077 <option>acl_smtp_rcpt</option>.
57078 </para>
57079 <para>
57080 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
57081 condition is processed. This can be used to limit the rate of any SMTP
57082 command. If it is used in multiple ACLs it can limit the aggregate rate of
57083 multiple different commands.
57084 </para>
57085 <para>
57086 The <option>count=</option> option can be used to alter how much Exim adds to the client&#x2019;s
57087 measured rate. For example, the <option>per_byte</option> option is equivalent to
57088 <literal>per_mail/count=$message_size</literal>. If there is no <option>count=</option> option, Exim
57089 increases the measured rate by one (except for the <option>per_rcpt</option> option in ACLs
57090 other than <option>acl_smtp_rcpt</option>). The count does not have to be an integer.
57091 </para>
57092 <para>
57093 The <option>unique=</option> option is described in section <xref linkend="ratoptuniq"/> below.
57094 </para>
57095 </section>
57096 <section id="ratoptupd">
57097 <title>Ratelimit update modes</title>
57098 <para>
57099 <indexterm role="concept">
57100 <primary>rate limiting</primary>
57101 <secondary>reading data without updating</secondary>
57102 </indexterm>
57103 You can specify one of three options with the <option>ratelimit</option> condition to
57104 control when its database is updated. This section describes the <option>readonly</option>
57105 mode, and the next section describes the <option>strict</option> and <option>leaky</option> modes.
57106 </para>
57107 <para>
57108 If the <option>ratelimit</option> condition is used in <option>readonly</option> mode, Exim looks up a
57109 previously-computed rate to check against the limit.
57110 </para>
57111 <para>
57112 For example, you can test the client&#x2019;s sending rate and deny it access (when
57113 it is too fast) in the connect ACL. If the client passes this check then it
57114 can go on to send a message, in which case its recorded rate will be updated
57115 in the MAIL ACL. Subsequent connections from the same client will check this
57116 new rate.
57117 </para>
57118 <literallayout class="monospaced">
57119 acl_check_connect:
57120  deny ratelimit = 100 / 5m / readonly
57121     log_message = RATE CHECK: $sender_rate/$sender_rate_period \
57122                   (max $sender_rate_limit)
57123 # ...
57124 acl_check_mail:
57125  warn ratelimit = 100 / 5m / strict
57126     log_message = RATE UPDATE: $sender_rate/$sender_rate_period \
57127                   (max $sender_rate_limit)
57128 </literallayout>
57129 <para>
57130 If Exim encounters multiple <option>ratelimit</option> conditions with the same key when
57131 processing a message then it may increase the client&#x2019;s measured rate more than
57132 it should. For example, this will happen if you check the <option>per_rcpt</option> option
57133 in both <option>acl_smtp_rcpt</option> and <option>acl_smtp_data</option>. However it&#x2019;s OK to check the
57134 same <option>ratelimit</option> condition multiple times in the same ACL. You can avoid any
57135 multiple update problems by using the <option>readonly</option> option on later ratelimit
57136 checks.
57137 </para>
57138 <para>
57139 The <option>per_*</option> options described above do not make sense in some ACLs. If you
57140 use a <option>per_*</option> option in an ACL where it is not normally permitted then the
57141 update mode defaults to <option>readonly</option> and you cannot specify the <option>strict</option> or
57142 <option>leaky</option> modes. In other ACLs the default update mode is <option>leaky</option> (see the
57143 next section) so you must specify the <option>readonly</option> option explicitly.
57144 </para>
57145 </section>
57146 <section id="ratoptfast">
57147 <title>Ratelimit options for handling fast clients</title>
57148 <para>
57149 <indexterm role="concept">
57150 <primary>rate limiting</primary>
57151 <secondary>strict and leaky modes</secondary>
57152 </indexterm>
57153 If a client&#x2019;s average rate is greater than the maximum, the rate limiting
57154 engine can react in two possible ways, depending on the presence of the
57155 <option>strict</option> or <option>leaky</option> update modes. This is independent of the other
57156 counter-measures (such as rejecting the message) that may be specified by the
57157 rest of the ACL.
57158 </para>
57159 <para>
57160 The <option>leaky</option> (default) option means that the client&#x2019;s recorded rate is not
57161 updated if it is above the limit. The effect of this is that Exim measures the
57162 client&#x2019;s average rate of successfully sent email, which cannot be greater than
57163 the maximum allowed. If the client is over the limit it may suffer some
57164 counter-measures (as specified in the ACL), but it will still be able to send
57165 email at the configured maximum rate, whatever the rate of its attempts. This
57166 is generally the better choice if you have clients that retry automatically.
57167 For example, it does not prevent a sender with an over-aggressive retry rate
57168 from getting any email through.
57169 </para>
57170 <para>
57171 The <option>strict</option> option means that the client&#x2019;s recorded rate is always
57172 updated. The effect of this is that Exim measures the client&#x2019;s average rate
57173 of attempts to send email, which can be much higher than the maximum it is
57174 actually allowed. If the client is over the limit it may be subjected to
57175 counter-measures by the ACL. It must slow down and allow sufficient time to
57176 pass that its computed rate falls below the maximum before it can send email
57177 again. The time (the number of smoothing periods) it must wait and not
57178 attempt to send mail can be calculated with this formula:
57179 </para>
57180 <literallayout class="monospaced">
57181         ln(peakrate/maxrate)
57182 </literallayout>
57183 </section>
57184 <section id="ratoptuniq">
57185 <title>Limiting the rate of different events</title>
57186 <para>
57187 <indexterm role="concept">
57188 <primary>rate limiting</primary>
57189 <secondary>counting unique events</secondary>
57190 </indexterm>
57191 The <option>ratelimit</option> <option>unique=</option> option controls a mechanism for counting the
57192 rate of different events. For example, the <option>per_addr</option> option uses this
57193 mechanism to count the number of different recipients that the client has
57194 sent messages to in the last time period; it is equivalent to
57195 <literal>per_rcpt/unique=$local_part@$domain</literal>. You could use this feature to
57196 measure the rate that a client uses different sender addresses with the
57197 options <literal>per_mail/unique=$sender_address</literal>.
57198 </para>
57199 <para>
57200 For each <option>ratelimit</option> key Exim stores the set of <option>unique=</option> values that it
57201 has seen for that key. The whole set is thrown away when it is older than the
57202 rate smoothing period <emphasis>p</emphasis>, so each different event is counted at most once
57203 per period. In the <option>leaky</option> update mode, an event that causes the client to
57204 go over the limit is not added to the set, in the same way that the client&#x2019;s
57205 recorded rate is not updated in the same situation.
57206 </para>
57207 <para>
57208 When you combine the <option>unique=</option> and <option>readonly</option> options, the specific
57209 <option>unique=</option> value is ignored, and Exim just retrieves the client&#x2019;s stored
57210 rate.
57211 </para>
57212 <para>
57213 The <option>unique=</option> mechanism needs more space in the ratelimit database than the
57214 other <option>ratelimit</option> options in order to store the event set. The number of
57215 unique values is potentially as large as the rate limit, so the extra space
57216 required increases with larger limits.
57217 </para>
57218 <para>
57219 The uniqueification is not perfect: there is a small probability that Exim
57220 will think a new event has happened before. If the sender&#x2019;s rate is less than
57221 the limit, Exim should be more than 99.9% correct. However in <option>strict</option> mode
57222 the measured rate can go above the limit, in which case Exim may under-count
57223 events by a significant margin. Fortunately, if the rate is high enough (2.7
57224 times the limit) that the false positive rate goes above 9%, then Exim will
57225 throw away the over-full event set before the measured rate falls below the
57226 limit. Therefore the only harm should be that exceptionally high sending rates
57227 are logged incorrectly; any countermeasures you configure will be as effective
57228 as intended.
57229 </para>
57230 </section>
57231 <section id="useratlim">
57232 <title>Using rate limiting</title>
57233 <para>
57234 Exim&#x2019;s other ACL facilities are used to define what counter-measures are taken
57235 when the rate limit is exceeded. This might be anything from logging a warning
57236 (for example, while measuring existing sending rates in order to define
57237 policy), through time delays to slow down fast senders, up to rejecting the
57238 message. For example:
57239 </para>
57240 <literallayout class="monospaced">
57241 # Log all senders' rates
57242 warn ratelimit = 0 / 1h / strict
57243      log_message = Sender rate $sender_rate / $sender_rate_period
57244
57245 # Slow down fast senders; note the need to truncate $sender_rate
57246 # at the decimal point.
57247 warn ratelimit = 100 / 1h / per_rcpt / strict
57248      delay     = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
57249                    $sender_rate_limit }s
57250
57251 # Keep authenticated users under control
57252 deny authenticated = *
57253      ratelimit = 100 / 1d / strict / $authenticated_id
57254
57255 # System-wide rate limit
57256 defer message = Sorry, too busy. Try again later.
57257      ratelimit = 10 / 1s / $primary_hostname
57258
57259 # Restrict incoming rate from each host, with a default
57260 # set using a macro and special cases looked up in a table.
57261 defer message = Sender rate exceeds $sender_rate_limit \
57262                messages per $sender_rate_period
57263      ratelimit = ${lookup {$sender_host_address} \
57264                    cdb {DB/ratelimits.cdb} \
57265                    {$value} {RATELIMIT} }
57266 </literallayout>
57267 <para>
57268 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
57269 especially with the <option>per_rcpt</option> option, you may suffer from a performance
57270 bottleneck caused by locking on the ratelimit hints database. Apart from
57271 making your ACLs less complicated, you can reduce the problem by using a
57272 RAM disk for Exim&#x2019;s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
57273 this means that Exim will lose its hints data after a reboot (including retry
57274 hints, the callout cache, and ratelimit data).
57275 </para>
57276 </section>
57277 <section id="SECTaddressverification">
57278 <title>Address verification</title>
57279 <para>
57280 <indexterm role="concept">
57281 <primary>verifying address</primary>
57282 <secondary>options for</secondary>
57283 </indexterm>
57284 <indexterm role="concept">
57285 <primary>policy control</primary>
57286 <secondary>address verification</secondary>
57287 </indexterm>
57288 Several of the <option>verify</option> conditions described in section
57289 <xref linkend="SECTaclconditions"/> cause addresses to be verified. Section
57290 <xref linkend="SECTsenaddver"/> discusses the reporting of sender verification failures.
57291 The verification conditions can be followed by options that modify the
57292 verification process. The options are separated from the keyword and from each
57293 other by slashes, and some of them contain parameters. For example:
57294 </para>
57295 <literallayout class="monospaced">
57296 verify = sender/callout
57297 verify = recipient/defer_ok/callout=10s,defer_ok
57298 </literallayout>
57299 <para>
57300 The first stage of address verification, which always happens, is to run the
57301 address through the routers, in <quote>verify mode</quote>. Routers can detect the
57302 difference between verification and routing for delivery, and their actions can
57303 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
57304 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
57305 The available options are as follows:
57306 </para>
57307 <itemizedlist>
57308 <listitem>
57309 <para>
57310 If the <option>callout</option> option is specified, successful routing to one or more
57311 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
57312 check. Callouts and their sub-options are discussed in the next section.
57313 </para>
57314 </listitem>
57315 <listitem>
57316 <para>
57317 If there is a defer error while doing verification routing, the ACL
57318 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
57319 options, the condition is forced to be true instead. Note that this is a main
57320 verification option as well as a suboption for callouts.
57321 </para>
57322 </listitem>
57323 <listitem>
57324 <para>
57325 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
57326 discusses the reporting of sender address verification failures.
57327 </para>
57328 </listitem>
57329 <listitem>
57330 <para>
57331 The <option>success_on_redirect</option> option causes verification always to succeed
57332 immediately after a successful redirection. By default, if a redirection
57333 generates just one address, that address is also verified. See further
57334 discussion in section <xref linkend="SECTredirwhilveri"/>.
57335 </para>
57336 </listitem>
57337 </itemizedlist>
57338 <para>
57339 <indexterm role="concept">
57340 <primary>verifying address</primary>
57341 <secondary>differentiating failures</secondary>
57342 </indexterm>
57343 <indexterm role="variable">
57344 <primary><varname>$recipient_verify_failure</varname></primary>
57345 </indexterm>
57346 <indexterm role="variable">
57347 <primary><varname>$sender_verify_failure</varname></primary>
57348 </indexterm>
57349 <indexterm role="variable">
57350 <primary><varname>$acl_verify_message</varname></primary>
57351 </indexterm>
57352 After an address verification failure, <varname>$acl_verify_message</varname> contains the
57353 error message that is associated with the failure. It can be preserved by
57354 coding like this:
57355 </para>
57356 <literallayout class="monospaced">
57357 warn  !verify = sender
57358        set acl_m0 = $acl_verify_message
57359 </literallayout>
57360 <para>
57361 If you are writing your own custom rejection message or log message when
57362 denying access, you can use this variable to include information about the
57363 verification failure.
57364 </para>
57365 <para>
57366 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
57367 appropriate) contains one of the following words:
57368 </para>
57369 <itemizedlist>
57370 <listitem>
57371 <para>
57372 <option>qualify</option>: The address was unqualified (no domain), and the message
57373 was neither local nor came from an exempted host.
57374 </para>
57375 </listitem>
57376 <listitem>
57377 <para>
57378 <option>route</option>: Routing failed.
57379 </para>
57380 </listitem>
57381 <listitem>
57382 <para>
57383 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
57384 occurred at or before the MAIL command (that is, on initial
57385 connection, HELO, or MAIL).
57386 </para>
57387 </listitem>
57388 <listitem>
57389 <para>
57390 <option>recipient</option>: The RCPT command in a callout was rejected.
57391 </para>
57392 </listitem>
57393 <listitem>
57394 <para>
57395 <option>postmaster</option>: The postmaster check in a callout was rejected.
57396 </para>
57397 </listitem>
57398 </itemizedlist>
57399 <para>
57400 The main use of these variables is expected to be to distinguish between
57401 rejections of MAIL and rejections of RCPT in callouts.
57402 </para>
57403 </section>
57404 <section id="SECTcallver">
57405 <title>Callout verification</title>
57406 <para>
57407 <indexterm role="concept">
57408 <primary>verifying address</primary>
57409 <secondary>by callout</secondary>
57410 </indexterm>
57411 <indexterm role="concept">
57412 <primary>callout</primary>
57413 <secondary>verification</secondary>
57414 </indexterm>
57415 <indexterm role="concept">
57416 <primary>SMTP</primary>
57417 <secondary>callout verification</secondary>
57418 </indexterm>
57419 For non-local addresses, routing verifies the domain, but is unable to do any
57420 checking of the local part. There are situations where some means of verifying
57421 the local part is desirable. One way this can be done is to make an SMTP
57422 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
57423 a subsequent host for a recipient address, to see if the host accepts the
57424 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
57425 sender address, the callback is not to the client host that is trying to
57426 deliver the message, but to one of the hosts that accepts incoming mail for the
57427 sender&#x2019;s domain.
57428 </para>
57429 <para>
57430 Exim does not do callouts by default. If you want them to happen, you must
57431 request them by setting appropriate options on the <option>verify</option> condition, as
57432 described below. This facility should be used with care, because it can add a
57433 lot of resource usage to the cost of verifying an address. However, Exim does
57434 cache the results of callouts, which helps to reduce the cost. Details of
57435 caching are in section <xref linkend="SECTcallvercache"/>.
57436 </para>
57437 <para>
57438 Recipient callouts are usually used only between hosts that are controlled by
57439 the same administration. For example, a corporate gateway host could use
57440 callouts to check for valid recipients on an internal mailserver. A successful
57441 callout does not guarantee that a real delivery to the address would succeed;
57442 on the other hand, a failing callout does guarantee that a delivery would fail.
57443 </para>
57444 <para>
57445 If the <option>callout</option> option is present on a condition that verifies an address, a
57446 second stage of verification occurs if the address is successfully routed to
57447 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
57448 <command>manualroute</command> router, where the router specifies the hosts. However, if a
57449 router that does not set up hosts routes to an <command>smtp</command> transport with a
57450 <option>hosts</option> setting, the transport&#x2019;s hosts are used. If an <command>smtp</command> transport has
57451 <option>hosts_override</option> set, its hosts are always used, whether or not the router
57452 supplies a host list.
57453 Callouts are only supported on <command>smtp</command> transports.
57454 </para>
57455 <para>
57456 The port that is used is taken from the transport, if it is specified and is a
57457 remote transport. (For routers that do verification only, no transport need be
57458 specified.) Otherwise, the default SMTP port is used. If a remote transport
57459 specifies an outgoing interface, this is used; otherwise the interface is not
57460 specified. Likewise, the text that is used for the HELO command is taken from
57461 the transport&#x2019;s <option>helo_data</option> option; if there is no transport, the value of
57462 <varname>$smtp_active_hostname</varname> is used.
57463 </para>
57464 <para>
57465 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
57466 test whether a bounce message could be delivered to the sender address. The
57467 following SMTP commands are sent:
57468 </para>
57469 <literallayout>
57470 <literal>HELO </literal>&lt;<emphasis>local host name</emphasis>&gt;
57471 <literal>MAIL FROM:&lt;&gt;</literal>
57472 <literal>RCPT TO:</literal>&lt;<emphasis>the address to be tested</emphasis>&gt;
57473 <literal>QUIT</literal>
57474 </literallayout>
57475 <para>
57476 LHLO is used instead of HELO if the transport&#x2019;s <option>protocol</option> option is
57477 set to <quote>lmtp</quote>.
57478 </para>
57479 <para>
57480 The callout may use EHLO, AUTH and/or STARTTLS given appropriate option
57481 settings.
57482 </para>
57483 <para>
57484 A recipient callout check is similar. By default, it also uses an empty address
57485 for the sender. This default is chosen because most hosts do not make use of
57486 the sender address when verifying a recipient. Using the same address means
57487 that a single cache entry can be used for each recipient. Some sites, however,
57488 do make use of the sender address when verifying. These are catered for by the
57489 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
57490 </para>
57491 <para>
57492 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
57493 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
57494 Exim tries the next host, if any. If there is a problem with all the remote
57495 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
57496 <option>callout</option> option is given, in which case the condition is forced to succeed.
57497 </para>
57498 <para>
57499 <indexterm role="concept">
57500 <primary>SMTP</primary>
57501 <secondary>output flushing, disabling for callout</secondary>
57502 </indexterm>
57503 A callout may take a little time. For this reason, Exim normally flushes SMTP
57504 output before performing a callout in an ACL, to avoid unexpected timeouts in
57505 clients when the SMTP PIPELINING extension is in use. The flushing can be
57506 disabled by using a <option>control</option> modifier to set <option>no_callout_flush</option>.
57507 </para>
57508 </section>
57509 <section id="CALLaddparcall">
57510 <title>Additional parameters for callouts</title>
57511 <para>
57512 <indexterm role="concept">
57513 <primary>callout</primary>
57514 <secondary>additional parameters for</secondary>
57515 </indexterm>
57516 The <option>callout</option> option can be followed by an equals sign and a number of
57517 optional parameters, separated by commas. For example:
57518 </para>
57519 <literallayout class="monospaced">
57520 verify = recipient/callout=10s,defer_ok
57521 </literallayout>
57522 <para>
57523 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
57524 separate verify options, is retained for backwards compatibility, but is now
57525 deprecated. The additional parameters for <option>callout</option> are as follows:
57526 </para>
57527 <variablelist>
57528 <varlistentry>
57529 <term>&lt;<emphasis>a&nbsp;time&nbsp;interval</emphasis>&gt;</term>
57530 <listitem>
57531 <para>
57532 <indexterm role="concept">
57533 <primary>callout</primary>
57534 <secondary>timeout, specifying</secondary>
57535 </indexterm>
57536 This specifies the timeout that applies for the callout attempt to each host.
57537 For example:
57538 </para>
57539 <literallayout class="monospaced">
57540 verify = sender/callout=5s
57541 </literallayout>
57542 <para>
57543 The default is 30 seconds. The timeout is used for each response from the
57544 remote host. It is also used for the initial connection, unless overridden by
57545 the <option>connect</option> parameter.
57546 </para>
57547 </listitem></varlistentry>
57548 <varlistentry>
57549 <term><emphasis role="bold">connect&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
57550 <listitem>
57551 <para>
57552 <indexterm role="concept">
57553 <primary>callout</primary>
57554 <secondary>connection timeout, specifying</secondary>
57555 </indexterm>
57556 This parameter makes it possible to set a different (usually smaller) timeout
57557 for making the SMTP connection. For example:
57558 </para>
57559 <literallayout class="monospaced">
57560 verify = sender/callout=5s,connect=1s
57561 </literallayout>
57562 <para>
57563 If not specified, this timeout defaults to the general timeout value.
57564 </para>
57565 </listitem></varlistentry>
57566 <varlistentry>
57567 <term><emphasis role="bold">defer_ok</emphasis></term>
57568 <listitem>
57569 <para>
57570 <indexterm role="concept">
57571 <primary>callout</primary>
57572 <secondary>defer, action on</secondary>
57573 </indexterm>
57574 When this parameter is present, failure to contact any host, or any other kind
57575 of temporary error, is treated as success by the ACL. However, the cache is not
57576 updated in this circumstance.
57577 </para>
57578 </listitem></varlistentry>
57579 <varlistentry>
57580 <term><emphasis role="bold">fullpostmaster</emphasis></term>
57581 <listitem>
57582 <para>
57583 <indexterm role="concept">
57584 <primary>callout</primary>
57585 <secondary>full postmaster check</secondary>
57586 </indexterm>
57587 This operates like the <option>postmaster</option> option (see below), but if the check for
57588 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
57589 accordance with the specification in RFC 2821. The RFC states that the
57590 unqualified address <emphasis>postmaster</emphasis> should be accepted.
57591 </para>
57592 </listitem></varlistentry>
57593 <varlistentry>
57594 <term><emphasis role="bold">mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
57595 <listitem>
57596 <para>
57597 <indexterm role="concept">
57598 <primary>callout</primary>
57599 <secondary>sender when verifying header</secondary>
57600 </indexterm>
57601 When verifying addresses in header lines using the <option>header_sender</option>
57602 verification option, Exim behaves by default as if the addresses are envelope
57603 sender addresses from a message. Callout verification therefore tests to see
57604 whether a bounce message could be delivered, by using an empty address in the
57605 MAIL command. However, it is arguable that these addresses might never be used
57606 as envelope senders, and could therefore justifiably reject bounce messages
57607 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
57608 address to use in the MAIL command. For example:
57609 </para>
57610 <literallayout class="monospaced">
57611 require  verify = header_sender/callout=mailfrom=abcd@x.y.z
57612 </literallayout>
57613 <para>
57614 This parameter is available only for the <option>header_sender</option> verification option.
57615 </para>
57616 </listitem></varlistentry>
57617 <varlistentry>
57618 <term><emphasis role="bold">maxwait&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
57619 <listitem>
57620 <para>
57621 <indexterm role="concept">
57622 <primary>callout</primary>
57623 <secondary>overall timeout, specifying</secondary>
57624 </indexterm>
57625 This parameter sets an overall timeout for performing a callout verification.
57626 For example:
57627 </para>
57628 <literallayout class="monospaced">
57629 verify = sender/callout=5s,maxwait=30s
57630 </literallayout>
57631 <para>
57632 This timeout defaults to four times the callout timeout for individual SMTP
57633 commands. The overall timeout applies when there is more than one host that can
57634 be tried. The timeout is checked before trying the next host. This prevents
57635 very long delays if there are a large number of hosts and all are timing out
57636 (for example, when network connections are timing out).
57637 </para>
57638 </listitem></varlistentry>
57639 <varlistentry>
57640 <term><emphasis role="bold">no_cache</emphasis></term>
57641 <listitem>
57642 <para>
57643 <indexterm role="concept">
57644 <primary>callout</primary>
57645 <secondary>cache, suppressing</secondary>
57646 </indexterm>
57647 <indexterm role="concept">
57648 <primary>caching callout, suppressing</primary>
57649 </indexterm>
57650 When this parameter is given, the callout cache is neither read nor updated.
57651 </para>
57652 </listitem></varlistentry>
57653 <varlistentry>
57654 <term><emphasis role="bold">postmaster</emphasis></term>
57655 <listitem>
57656 <para>
57657 <indexterm role="concept">
57658 <primary>callout</primary>
57659 <secondary>postmaster; checking</secondary>
57660 </indexterm>
57661 When this parameter is set, a successful callout check is followed by a similar
57662 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
57663 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
57664 the postmaster check is recorded in a cache record; if it is a failure, this is
57665 used to fail subsequent callouts for the domain without a connection being
57666 made, until the cache record expires.
57667 </para>
57668 </listitem></varlistentry>
57669 <varlistentry>
57670 <term><emphasis role="bold">postmaster_mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
57671 <listitem>
57672 <para>
57673 The postmaster check uses an empty sender in the MAIL command by default.
57674 You can use this parameter to do a postmaster check using a different address.
57675 For example:
57676 </para>
57677 <literallayout class="monospaced">
57678 require  verify = sender/callout=postmaster_mailfrom=abc@x.y.z
57679 </literallayout>
57680 <para>
57681 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
57682 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
57683 </para>
57684 <literallayout class="monospaced">
57685 require  verify = sender/callout=postmaster_mailfrom=
57686 </literallayout>
57687 <para>
57688 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
57689 account of the sender address. It is assumed that either the empty address or
57690 a fixed non-empty address will be used. All that Exim remembers is that the
57691 postmaster check for the domain succeeded or failed.
57692 </para>
57693 </listitem></varlistentry>
57694 <varlistentry>
57695 <term><emphasis role="bold">random</emphasis></term>
57696 <listitem>
57697 <para>
57698 <indexterm role="concept">
57699 <primary>callout</primary>
57700 <secondary><quote>random</quote> check</secondary>
57701 </indexterm>
57702 When this parameter is set, before doing the normal callout check, Exim does a
57703 check for a <quote>random</quote> local part at the same domain. The local part is not
57704 really random &ndash; it is defined by the expansion of the option
57705 <option>callout_random_local_part</option>, which defaults to
57706 </para>
57707 <literallayout class="monospaced">
57708 $primary_hostname-$tod_epoch-testing
57709 </literallayout>
57710 <para>
57711 The idea here is to try to determine whether the remote host accepts all local
57712 parts without checking. If it does, there is no point in doing callouts for
57713 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
57714 a cache record, and used to force the current and subsequent callout checks to
57715 succeed without a connection being made, until the cache record expires.
57716 </para>
57717 </listitem></varlistentry>
57718 <varlistentry>
57719 <term><emphasis role="bold">use_postmaster</emphasis></term>
57720 <listitem>
57721 <para>
57722 <indexterm role="concept">
57723 <primary>callout</primary>
57724 <secondary>sender for recipient check</secondary>
57725 </indexterm>
57726 This parameter applies to recipient callouts only. For example:
57727 </para>
57728 <literallayout class="monospaced">
57729 deny  !verify = recipient/callout=use_postmaster
57730 </literallayout>
57731 <para>
57732 <indexterm role="variable">
57733 <primary><varname>$qualify_domain</varname></primary>
57734 </indexterm>
57735 It causes a non-empty postmaster address to be used in the MAIL command when
57736 performing the callout for the recipient, and also for a <quote>random</quote> check if
57737 that is configured. The local part of the address is <literal>postmaster</literal> and the
57738 domain is the contents of <varname>$qualify_domain</varname>.
57739 </para>
57740 </listitem></varlistentry>
57741 <varlistentry>
57742 <term><emphasis role="bold">use_sender</emphasis></term>
57743 <listitem>
57744 <para>
57745 This option applies to recipient callouts only. For example:
57746 </para>
57747 <literallayout class="monospaced">
57748 require  verify = recipient/callout=use_sender
57749 </literallayout>
57750 <para>
57751 It causes the message&#x2019;s actual sender address to be used in the MAIL
57752 command when performing the callout, instead of an empty address. There is no
57753 need to use this option unless you know that the called hosts make use of the
57754 sender when checking recipients. If used indiscriminately, it reduces the
57755 usefulness of callout caching.
57756 </para>
57757 </listitem></varlistentry>
57758 </variablelist>
57759 <para>
57760 If you use any of the parameters that set a non-empty sender for the MAIL
57761 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
57762 <option>use_sender</option>), you should think about possible loops. Recipient checking is
57763 usually done between two hosts that are under the same management, and the host
57764 that receives the callouts is not normally configured to do callouts itself.
57765 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
57766 these circumstances.
57767 </para>
57768 <para>
57769 However, if you use a non-empty sender address for a callout to an arbitrary
57770 host, there is the likelihood that the remote host will itself initiate a
57771 callout check back to your host. As it is checking what appears to be a message
57772 sender, it is likely to use an empty address in MAIL, thus avoiding a
57773 callout loop. However, to be on the safe side it would be best to set up your
57774 own ACLs so that they do not do sender verification checks when the recipient
57775 is the address you use for header sender or postmaster callout checking.
57776 </para>
57777 <para>
57778 Another issue to think about when using non-empty senders for callouts is
57779 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
57780 by the sender/recipient combination; thus, for any given recipient, many more
57781 actual callouts are performed than when an empty sender or postmaster is used.
57782 </para>
57783 </section>
57784 <section id="SECTcallvercache">
57785 <title>Callout caching</title>
57786 <para>
57787 <indexterm role="concept">
57788 <primary>hints database</primary>
57789 <secondary>callout cache</secondary>
57790 </indexterm>
57791 <indexterm role="concept">
57792 <primary>callout</primary>
57793 <secondary>cache, description of</secondary>
57794 </indexterm>
57795 <indexterm role="concept">
57796 <primary>caching</primary>
57797 <secondary>callout</secondary>
57798 </indexterm>
57799 Exim caches the results of callouts in order to reduce the amount of resources
57800 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
57801 option. A hints database called <quote>callout</quote> is used for the cache. Two
57802 different record types are used: one records the result of a callout check for
57803 a specific address, and the other records information that applies to the
57804 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
57805 </para>
57806 <para>
57807 When an original callout fails, a detailed SMTP error message is given about
57808 the failure. However, for subsequent failures use the cache data, this message
57809 is not available.
57810 </para>
57811 <para>
57812 The expiry times for negative and positive address cache records are
57813 independent, and can be set by the global options <option>callout_negative_expire</option>
57814 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
57815 </para>
57816 <para>
57817 If a host gives a negative response to an SMTP connection, or rejects any
57818 commands up to and including
57819 </para>
57820 <literallayout class="monospaced">
57821 MAIL FROM:&lt;&gt;
57822 </literallayout>
57823 <para>
57824 (but not including the MAIL command with a non-empty address),
57825 any callout attempt is bound to fail. Exim remembers such failures in a
57826 domain cache record, which it uses to fail callouts for the domain without
57827 making new connections, until the domain record times out. There are two
57828 separate expiry times for domain cache records:
57829 <option>callout_domain_negative_expire</option> (default 3h) and
57830 <option>callout_domain_positive_expire</option> (default 7d).
57831 </para>
57832 <para>
57833 Domain records expire when the negative expiry time is reached if callouts
57834 cannot be made for the domain, or if the postmaster check failed.
57835 Otherwise, they expire when the positive expiry time is reached. This
57836 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
57837 will eventually be noticed.
57838 </para>
57839 <para>
57840 The callout caching mechanism is based on the domain of the address that is
57841 being tested. If the domain routes to several hosts, it is assumed that their
57842 behaviour will be the same.
57843 </para>
57844 </section>
57845 <section id="SECTsenaddver">
57846 <title>Sender address verification reporting</title>
57847 <para>
57848 <indexterm role="concept">
57849 <primary>verifying</primary>
57850 <secondary>suppressing error details</secondary>
57851 </indexterm>
57852 See section <xref linkend="SECTaddressverification"/> for a general discussion of
57853 verification. When sender verification fails in an ACL, the details of the
57854 failure are given as additional output lines before the 550 response to the
57855 relevant SMTP command (RCPT or DATA). For example, if sender callout is in use,
57856 you might see:
57857 </para>
57858 <literallayout class="monospaced">
57859 MAIL FROM:&lt;xyz@abc.example&gt;
57860 250 OK
57861 RCPT TO:&lt;pqr@def.example&gt;
57862 550-Verification failed for &lt;xyz@abc.example&gt;
57863 550-Called:   192.168.34.43
57864 550-Sent:     RCPT TO:&lt;xyz@abc.example&gt;
57865 550-Response: 550 Unknown local part xyz in &lt;xyz@abc.example&gt;
57866 550 Sender verification failed
57867 </literallayout>
57868 <para>
57869 If more than one RCPT command fails in the same way, the details are given
57870 only for the first of them. However, some administrators do not want to send
57871 out this much information. You can suppress the details by adding
57872 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
57873 example:
57874 </para>
57875 <literallayout class="monospaced">
57876 verify = sender/no_details
57877 </literallayout>
57878 </section>
57879 <section id="SECTredirwhilveri">
57880 <title>Redirection while verifying</title>
57881 <para>
57882 <indexterm role="concept">
57883 <primary>verifying</primary>
57884 <secondary>redirection while</secondary>
57885 </indexterm>
57886 <indexterm role="concept">
57887 <primary>address redirection</primary>
57888 <secondary>while verifying</secondary>
57889 </indexterm>
57890 A dilemma arises when a local address is redirected by aliasing or forwarding
57891 during verification: should the generated addresses themselves be verified,
57892 or should the successful expansion of the original address be enough to verify
57893 it? By default, Exim takes the following pragmatic approach:
57894 </para>
57895 <itemizedlist>
57896 <listitem>
57897 <para>
57898 When an incoming address is redirected to just one child address, verification
57899 continues with the child address, and if that fails to verify, the original
57900 verification also fails.
57901 </para>
57902 </listitem>
57903 <listitem>
57904 <para>
57905 When an incoming address is redirected to more than one child address,
57906 verification does not continue. A success result is returned.
57907 </para>
57908 </listitem>
57909 </itemizedlist>
57910 <para>
57911 This seems the most reasonable behaviour for the common use of aliasing as a
57912 way of redirecting different local parts to the same mailbox. It means, for
57913 example, that a pair of alias entries of the form
57914 </para>
57915 <literallayout class="monospaced">
57916 A.Wol:   aw123
57917 aw123:   :fail: Gone away, no forwarding address
57918 </literallayout>
57919 <para>
57920 work as expected, with both local parts causing verification failure. When a
57921 redirection generates more than one address, the behaviour is more like a
57922 mailing list, where the existence of the alias itself is sufficient for
57923 verification to succeed.
57924 </para>
57925 <para>
57926 It is possible, however, to change the default behaviour so that all successful
57927 redirections count as successful verifications, however many new addresses are
57928 generated. This is specified by the <option>success_on_redirect</option> verification
57929 option. For example:
57930 </para>
57931 <literallayout class="monospaced">
57932 require verify = recipient/success_on_redirect/callout=10s
57933 </literallayout>
57934 <para>
57935 In this example, verification succeeds if a router generates a new address, and
57936 the callout does not occur, because no address was routed to a remote host.
57937 </para>
57938 <para>
57939 When verification is being tested via the <option>-bv</option> option, the treatment of
57940 redirections is as just described, unless the <option>-v</option> or any debugging option is
57941 also specified. In that case, full verification is done for every generated
57942 address and a report is output for each of them.
57943 </para>
57944 </section>
57945 <section id="SECTverifyCSA">
57946 <title>Client SMTP authorization (CSA)</title>
57947 <para>
57948 <indexterm role="concept">
57949 <primary>CSA</primary>
57950 <secondary>verifying</secondary>
57951 </indexterm>
57952 Client SMTP Authorization is a system that allows a site to advertise
57953 which machines are and are not permitted to send email. This is done by placing
57954 special SRV records in the DNS; these are looked up using the client&#x2019;s HELO
57955 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
57956 Authorization checks in Exim are performed by the ACL condition:
57957 </para>
57958 <literallayout class="monospaced">
57959 verify = csa
57960 </literallayout>
57961 <para>
57962 This fails if the client is not authorized. If there is a DNS problem, or if no
57963 valid CSA SRV record is found, or if the client is authorized, the condition
57964 succeeds. These three cases can be distinguished using the expansion variable
57965 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
57966 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
57967 be likely to cause problems for legitimate email.
57968 </para>
57969 <para>
57970 The error messages produced by the CSA code include slightly more
57971 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
57972 looking up the CSA SRV record, or problems looking up the CSA target
57973 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
57974 </para>
57975 <itemizedlist>
57976 <listitem>
57977 <para>
57978 The client&#x2019;s host name is explicitly not authorized.
57979 </para>
57980 </listitem>
57981 <listitem>
57982 <para>
57983 The client&#x2019;s IP address does not match any of the CSA target IP addresses.
57984 </para>
57985 </listitem>
57986 <listitem>
57987 <para>
57988 The client&#x2019;s host name is authorized but it has no valid target IP addresses
57989 (for example, the target&#x2019;s addresses are IPv6 and the client is using IPv4).
57990 </para>
57991 </listitem>
57992 <listitem>
57993 <para>
57994 The client&#x2019;s host name has no CSA SRV record but a parent domain has asserted
57995 that all subdomains must be explicitly authorized.
57996 </para>
57997 </listitem>
57998 </itemizedlist>
57999 <para>
58000 The <option>csa</option> verification condition can take an argument which is the domain to
58001 use for the DNS query. The default is:
58002 </para>
58003 <literallayout class="monospaced">
58004 verify = csa/$sender_helo_name
58005 </literallayout>
58006 <para>
58007 This implementation includes an extension to CSA. If the query domain
58008 is an address literal such as [192.0.2.95], or if it is a bare IP
58009 address, Exim searches for CSA SRV records in the reverse DNS as if
58010 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
58011 meaningful to say:
58012 </para>
58013 <literallayout class="monospaced">
58014 verify = csa/$sender_host_address
58015 </literallayout>
58016 <para>
58017 In fact, this is the check that Exim performs if the client does not say HELO.
58018 This extension can be turned off by setting the main configuration option
58019 <option>dns_csa_use_reverse</option> to be false.
58020 </para>
58021 <para>
58022 If a CSA SRV record is not found for the domain itself, a search
58023 is performed through its parent domains for a record which might be
58024 making assertions about subdomains. The maximum depth of this search is limited
58025 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
58026 default. Exim does not look for CSA SRV records in a top level domain, so the
58027 default settings handle HELO domains as long as seven
58028 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
58029 of legitimate HELO domains.
58030 </para>
58031 <para>
58032 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
58033 direct SRV lookups, this is not sufficient because of the extra parent domain
58034 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
58035 addresses into lookups in the reverse DNS space. The result of a successful
58036 lookup such as:
58037 </para>
58038 <literallayout class="monospaced">
58039 ${lookup dnsdb {csa=$sender_helo_name}}
58040 </literallayout>
58041 <para>
58042 has two space-separated fields: an authorization code and a target host name.
58043 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
58044 authorization required but absent, or <quote>?</quote> for unknown.
58045 </para>
58046 </section>
58047 <section id="SECTverifyPRVS">
58048 <title>Bounce address tag validation</title>
58049 <para>
58050 <indexterm role="concept">
58051 <primary>BATV, verifying</primary>
58052 </indexterm>
58053 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
58054 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
58055 Genuine incoming bounce messages should therefore always be addressed to
58056 recipients that have a valid tag. This scheme is a way of detecting unwanted
58057 bounce messages caused by sender address forgeries (often called <quote>collateral
58058 spam</quote>), because the recipients of such messages do not include valid tags.
58059 </para>
58060 <para>
58061 There are two expansion items to help with the implementation of the BATV
58062 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
58063 the original envelope sender address by using a simple key to add a hash of the
58064 address and some time-based randomizing information. The <option>prvs</option> expansion
58065 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
58066 The syntax of these expansion items is described in section
58067 <xref linkend="SECTexpansionitems"/>.
58068 </para>
58069 <para>
58070 As an example, suppose the secret per-address keys are stored in an MySQL
58071 database. A query to look up the key for an address could be defined as a macro
58072 like this:
58073 </para>
58074 <literallayout class="monospaced">
58075 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
58076                 WHERE sender='${quote_mysql:$prvscheck_address}'\
58077                 }{$value}}
58078 </literallayout>
58079 <para>
58080 Suppose also that the senders who make use of BATV are defined by an address
58081 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
58082 use this:
58083 </para>
58084 <literallayout class="monospaced">
58085 # Bounces: drop unsigned addresses for BATV senders
58086 deny message = This address does not send an unsigned reverse path
58087      senders = :
58088      recipients = +batv_senders
58089
58090 # Bounces: In case of prvs-signed address, check signature.
58091 deny message = Invalid reverse path signature.
58092      senders = :
58093      condition  = ${prvscheck {$local_part@$domain}\
58094                   {PRVSCHECK_SQL}{1}}
58095      !condition = $prvscheck_result
58096 </literallayout>
58097 <para>
58098 The first statement rejects recipients for bounce messages that are addressed
58099 to plain BATV sender addresses, because it is known that BATV senders do not
58100 send out messages with plain sender addresses. The second statement rejects
58101 recipients that are prvs-signed, but with invalid signatures (either because
58102 the key is wrong, or the signature has timed out).
58103 </para>
58104 <para>
58105 A non-prvs-signed address is not rejected by the second statement, because the
58106 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
58107 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
58108 the first argument is a syntactically valid prvs-signed address, the yield is
58109 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
58110 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
58111 of the checks (empty for failure, <quote>1</quote> for success).
58112 </para>
58113 <para>
58114 There is one more issue you must consider when implementing prvs-signing:
58115 you have to ensure that the routers accept prvs-signed addresses and
58116 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
58117 router to remove the signature with a configuration along these lines:
58118 </para>
58119 <literallayout class="monospaced">
58120 batv_redirect:
58121   driver = redirect
58122   data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
58123 </literallayout>
58124 <para>
58125 This works because, if the third argument of <option>prvscheck</option> is empty, the result
58126 of the expansion of a prvs-signed address is the decoded value of the original
58127 address. This router should probably be the first of your routers that handles
58128 local addresses.
58129 </para>
58130 <para>
58131 To create BATV-signed addresses in the first place, a transport of this form
58132 can be used:
58133 </para>
58134 <literallayout class="monospaced">
58135 external_smtp_batv:
58136   driver = smtp
58137   return_path = ${prvs {$return_path} \
58138                        {${lookup mysql{SELECT \
58139                        secret FROM batv_prvs WHERE \
58140                        sender='${quote_mysql:$sender_address}'} \
58141                        {$value}fail}}}
58142 </literallayout>
58143 <para>
58144 If no key can be found for the existing return path, no signing takes place.
58145 </para>
58146 </section>
58147 <section id="SECTrelaycontrol">
58148 <title>Using an ACL to control relaying</title>
58149 <para>
58150 <indexterm role="concept">
58151 <primary>access control lists (ACLs)</primary>
58152 <secondary>relay control</secondary>
58153 </indexterm>
58154 <indexterm role="concept">
58155 <primary>relaying</primary>
58156 <secondary>control by ACL</secondary>
58157 </indexterm>
58158 <indexterm role="concept">
58159 <primary>policy control</primary>
58160 <secondary>relay control</secondary>
58161 </indexterm>
58162 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
58163 delivers it directly to another host as a result of a remote address contained
58164 within it. Redirecting a local address via an alias or forward file and then
58165 passing the message on to another host is not relaying,
58166 <indexterm role="concept">
58167 <primary><quote>percent hack</quote></primary>
58168 </indexterm>
58169 but a redirection as a result of the <quote>percent hack</quote> is.
58170 </para>
58171 <para>
58172 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
58173 A host which is acting as a gateway or an MX backup is concerned with incoming
58174 relaying from arbitrary hosts to a specific set of domains. On the other hand,
58175 a host which is acting as a smart host for a number of clients is concerned
58176 with outgoing relaying from those clients to the Internet at large. Often the
58177 same host is fulfilling both functions,
58178 but in principle these two kinds of relaying are entirely independent. What is
58179 not wanted is the transmission of mail from arbitrary remote hosts through your
58180 system to arbitrary domains.
58181 </para>
58182 <para>
58183 You can implement relay control by means of suitable statements in the ACL that
58184 runs for each RCPT command. For convenience, it is often easiest to use
58185 Exim&#x2019;s named list facility to define the domains and hosts involved. For
58186 example, suppose you want to do the following:
58187 </para>
58188 <itemizedlist>
58189 <listitem>
58190 <para>
58191 Deliver a number of domains to mailboxes on the local host (or process them
58192 locally in some other way). Let&#x2019;s say these are <emphasis>my.dom1.example</emphasis> and
58193 <emphasis>my.dom2.example</emphasis>.
58194 </para>
58195 </listitem>
58196 <listitem>
58197 <para>
58198 Relay mail for a number of other domains for which you are the secondary MX.
58199 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
58200 </para>
58201 </listitem>
58202 <listitem>
58203 <para>
58204 Relay mail from the hosts on your local LAN, to whatever domains are involved.
58205 Suppose your LAN is 192.168.45.0/24.
58206 </para>
58207 </listitem>
58208 </itemizedlist>
58209 <para>
58210 In the main part of the configuration, you put the following definitions:
58211 </para>
58212 <literallayout class="monospaced">
58213 domainlist local_domains    = my.dom1.example : my.dom2.example
58214 domainlist relay_to_domains = friend1.example : friend2.example
58215 hostlist   relay_from_hosts = 192.168.45.0/24
58216 </literallayout>
58217 <para>
58218 Now you can use these definitions in the ACL that is run for every RCPT
58219 command:
58220 </para>
58221 <literallayout class="monospaced">
58222 acl_check_rcpt:
58223   accept domains = +local_domains : +relay_to_domains
58224   accept hosts   = +relay_from_hosts
58225 </literallayout>
58226 <para>
58227 The first statement accepts any RCPT command that contains an address in
58228 the local or relay domains. For any other domain, control passes to the second
58229 statement, which accepts the command only if it comes from one of the relay
58230 hosts. In practice, you will probably want to make your ACL more sophisticated
58231 than this, for example, by including sender and recipient verification. The
58232 default configuration includes a more comprehensive example, which is described
58233 in chapter <xref linkend="CHAPdefconfil"/>.
58234 </para>
58235 </section>
58236 <section id="SECTcheralcon">
58237 <title>Checking a relay configuration</title>
58238 <para>
58239 <indexterm role="concept">
58240 <primary>relaying</primary>
58241 <secondary>checking control of</secondary>
58242 </indexterm>
58243 You can check the relay characteristics of your configuration in the same way
58244 that you can test any ACL behaviour for an incoming SMTP connection, by using
58245 the <option>-bh</option> option to run a fake SMTP session with which you interact.
58246 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
58247 </para>
58248 </section>
58249 </chapter>
58250
58251 <chapter id="CHAPexiscan">
58252 <title>Content scanning at ACL time</title>
58253 <para>
58254 <indexterm role="concept" id="IIDcosca" class="startofrange">
58255 <primary>content scanning</primary>
58256 <secondary>at ACL time</secondary>
58257 </indexterm>
58258 The extension of Exim to include content scanning at ACL time, formerly known
58259 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
58260 was integrated into the main source for Exim release 4.50, and Tom continues to
58261 maintain it. Most of the wording of this chapter is taken from Tom&#x2019;s
58262 specification.
58263 </para>
58264 <para>
58265 It is also possible to scan the content of messages at other times. The
58266 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
58267 scanning after all the ACLs have run. A transport filter can be used to scan
58268 messages at delivery time (see the <option>transport_filter</option> option, described in
58269 chapter <xref linkend="CHAPtransportgeneric"/>).
58270 </para>
58271 <para>
58272 If you want to include the ACL-time content-scanning features when you compile
58273 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
58274 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
58275 </para>
58276 <itemizedlist>
58277 <listitem>
58278 <para>
58279 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
58280 for all MIME parts for SMTP and non-SMTP messages, respectively.
58281 </para>
58282 </listitem>
58283 <listitem>
58284 <para>
58285 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
58286 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
58287 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
58288 </para>
58289 </listitem>
58290 <listitem>
58291 <para>
58292 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
58293 of messages, or parts of messages, for debugging purposes.
58294 </para>
58295 </listitem>
58296 <listitem>
58297 <para>
58298 Additional expansion variables that are set in the new ACL and by the new
58299 conditions.
58300 </para>
58301 </listitem>
58302 <listitem>
58303 <para>
58304 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
58305 </para>
58306 </listitem>
58307 </itemizedlist>
58308 <para>
58309 There is another content-scanning configuration option for <filename>Local/Makefile</filename>,
58310 called WITH_OLD_DEMIME. If this is set, the old, deprecated <option>demime</option> ACL
58311 condition is compiled, in addition to all the other content-scanning features.
58312 </para>
58313 <para>
58314 Content-scanning is continually evolving, and new features are still being
58315 added. While such features are still unstable and liable to incompatible
58316 changes, they are made available in Exim by setting options whose names begin
58317 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
58318 this manual. You can find out about them by reading the file called
58319 <filename>doc/experimental.txt</filename>.
58320 </para>
58321 <para>
58322 All the content-scanning facilities work on a MBOX copy of the message that is
58323 temporarily created in a file called:
58324 </para>
58325 <literallayout>
58326 &lt;<emphasis>spool_directory</emphasis>&gt;<literal>/scan/</literal>&lt;<emphasis>message_id</emphasis>&gt;/&lt;<emphasis>message_id</emphasis>&gt;<literal>.eml</literal>
58327 </literallayout>
58328 <para>
58329 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
58330 expect an MBOX-like structure inside that file. The file is created when the
58331 first content scanning facility is called. Subsequent calls to content
58332 scanning conditions open the same file again. The directory is recursively
58333 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
58334 </para>
58335 <literallayout class="monospaced">
58336 control = no_mbox_unspool
58337 </literallayout>
58338 <para>
58339 has been encountered. When the MIME ACL decodes files, they are put into the
58340 same directory by default.
58341 </para>
58342 <section id="SECTscanvirus">
58343 <title>Scanning for viruses</title>
58344 <para>
58345 <indexterm role="concept">
58346 <primary>virus scanning</primary>
58347 </indexterm>
58348 <indexterm role="concept">
58349 <primary>content scanning</primary>
58350 <secondary>for viruses</secondary>
58351 </indexterm>
58352 <indexterm role="concept">
58353 <primary>content scanning</primary>
58354 <secondary>the <option>malware</option> condition</secondary>
58355 </indexterm>
58356 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
58357 It supports a <quote>generic</quote> interface to scanners called via the shell, and
58358 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
58359 in memory and thus are much faster.
58360 </para>
58361 <para>
58362 A timeout of 2 minutes is applied to a scanner call (by default);
58363 if it expires then a defer action is taken.
58364 </para>
58365 <para>
58366 <indexterm role="option">
58367 <primary><option>av_scanner</option></primary>
58368 </indexterm>
58369 You can set the <option>av_scanner</option> option in the main part of the configuration
58370 to specify which scanner to use, together with any additional options that
58371 are needed. The basic syntax is as follows:
58372 </para>
58373 <literallayout>
58374 <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>
58375 </literallayout>
58376 <para>
58377 If you do not set <option>av_scanner</option>, it defaults to
58378 </para>
58379 <literallayout class="monospaced">
58380 av_scanner = sophie:/var/run/sophie
58381 </literallayout>
58382 <para>
58383 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
58384 before use.
58385 The usual list-parsing of the content (see <xref linkend="SECTlistconstruct"/>) applies.
58386 The following scanner types are supported in this release:
58387 </para>
58388 <variablelist>
58389 <varlistentry>
58390 <term><option>avast</option></term>
58391 <listitem>
58392 <para>
58393 <indexterm role="concept">
58394 <primary>virus scanners</primary>
58395 <secondary>avast</secondary>
58396 </indexterm>
58397 This is the scanner daemon of Avast. It has been tested with Avast Core
58398 Security (currently at version 1.1.7).
58399 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
58400 at <emphasis role="bold"><ulink url="http://www.avast.com/linux-server-antivirus">http://www.avast.com/linux-server-antivirus</ulink></emphasis>.
58401 This scanner type takes one option,
58402 which can be either a full path to a UNIX socket,
58403 or host and port specifiers separated by white space.
58404 The host may be a name or an IP address; the port is either a
58405 single number or a pair of numbers with a dash between.
58406 Any further options are given, on separate lines,
58407 to the daemon as options before the main scan command.
58408 For example:
58409 </para>
58410 <literallayout class="monospaced">
58411 av_scanner = avast:/var/run/avast/scan.sock:FLAGS -fullfiles:SENSITIVITY -pup
58412 av_scanner = avast:192.168.2.22 5036
58413 </literallayout>
58414 <para>
58415 If you omit the argument, the default path
58416 <filename>/var/run/avast/scan.sock</filename>
58417 is used.
58418 If you use a remote host,
58419 you need to make Exim&#x2019;s spool directory available to it,
58420 as the scanner is passed a file path, not file contents.
58421 For information about available commands and their options you may use
58422 </para>
58423 <literallayout class="monospaced">
58424 $ socat UNIX:/var/run/avast/scan.sock STDIO:
58425     FLAGS
58426     SENSITIVITY
58427     PACK
58428 </literallayout>
58429 </listitem></varlistentry>
58430 <varlistentry>
58431 <term><option>aveserver</option></term>
58432 <listitem>
58433 <para>
58434 <indexterm role="concept">
58435 <primary>virus scanners</primary>
58436 <secondary>Kaspersky</secondary>
58437 </indexterm>
58438 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
58439 at <emphasis role="bold"><ulink url="http://www.kaspersky.com">http://www.kaspersky.com</ulink></emphasis>. This scanner type takes one option,
58440 which is the path to the daemon&#x2019;s UNIX socket. The default is shown in this
58441 example:
58442 </para>
58443 <literallayout class="monospaced">
58444 av_scanner = aveserver:/var/run/aveserver
58445 </literallayout>
58446 </listitem></varlistentry>
58447 <varlistentry>
58448 <term><option>clamd</option></term>
58449 <listitem>
58450 <para>
58451 <indexterm role="concept">
58452 <primary>virus scanners</primary>
58453 <secondary>clamd</secondary>
58454 </indexterm>
58455 This daemon-type scanner is GPL and free. You can get it at
58456 <emphasis role="bold"><ulink url="http://www.clamav.net/">http://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
58457 unpack MIME containers, so it used to be recommended to unpack MIME attachments
58458 in the MIME ACL. This is no longer believed to be necessary.
58459 </para>
58460 <para>
58461 The options are a list of server specifiers, which may be
58462 a UNIX socket specification,
58463 a TCP socket specification,
58464 or a (global) option.
58465 </para>
58466 <para>
58467 A socket specification consists of a space-separated list.
58468 For a Unix socket the first element is a full path for the socket,
58469 for a TCP socket the first element is the IP address
58470 and the second a port number,
58471 Any further elements are per-server (non-global) options.
58472 These per-server options are supported:
58473 </para>
58474 <literallayout class="monospaced">
58475 retry=&lt;timespec&gt;  Retry on connect fail
58476 </literallayout>
58477 <para>
58478 The <literal>retry</literal> option specifies a time after which a single retry for
58479 a failed connect is made.  The default is to not retry.
58480 </para>
58481 <para>
58482 If a Unix socket file is specified, only one server is supported.
58483 </para>
58484 <para>
58485 Examples:
58486 </para>
58487 <literallayout class="monospaced">
58488 av_scanner = clamd:/opt/clamd/socket
58489 av_scanner = clamd:192.0.2.3 1234
58490 av_scanner = clamd:192.0.2.3 1234:local
58491 av_scanner = clamd:192.0.2.3 1234 retry=10s
58492 av_scanner = clamd:192.0.2.3 1234 : 192.0.2.4 1234
58493 </literallayout>
58494 <para>
58495 If the value of av_scanner points to a UNIX socket file or contains the
58496 <literal>local</literal>
58497 option, then the ClamAV interface will pass a filename containing the data
58498 to be scanned, which will should normally result in less I/O happening and be
58499 more efficient.  Normally in the TCP case, the data is streamed to ClamAV as
58500 Exim does not assume that there is a common filesystem with the remote host.
58501 There is an option WITH_OLD_CLAMAV_STREAM in <filename>src/EDITME</filename> available, should
58502 you be running a version of ClamAV prior to 0.95.
58503 </para>
58504 <para>
58505 The final example shows that multiple TCP targets can be specified.  Exim will
58506 randomly use one for each incoming email (i.e. it load balances them).  Note
58507 that only TCP targets may be used if specifying a list of scanners; a UNIX
58508 socket cannot be mixed in with TCP targets.  If one of the servers becomes
58509 unavailable, Exim will try the remaining one(s) until it finds one that works.
58510 When a clamd server becomes unreachable, Exim will log a message.  Exim does
58511 not keep track of scanner state between multiple messages, and the scanner
58512 selection is random, so the message will get logged in the mainlog for each
58513 email that the down scanner gets chosen first (message wrapped to be readable):
58514 </para>
58515 <literallayout class="monospaced">
58516 2013-10-09 14:30:39 1VTumd-0000Y8-BQ malware acl condition:
58517    clamd: connection to localhost, port 3310 failed
58518    (Connection refused)
58519 </literallayout>
58520 <para>
58521 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
58522 contributing the code for this scanner.
58523 </para>
58524 </listitem></varlistentry>
58525 <varlistentry>
58526 <term><option>cmdline</option></term>
58527 <listitem>
58528 <para>
58529 <indexterm role="concept">
58530 <primary>virus scanners</primary>
58531 <secondary>command line interface</secondary>
58532 </indexterm>
58533 This is the keyword for the generic command line scanner interface. It can be
58534 used to attach virus scanners that are invoked from the shell. This scanner
58535 type takes 3 mandatory options:
58536 </para>
58537 <orderedlist numeration="arabic">
58538 <listitem>
58539 <para>
58540 The full path and name of the scanner binary, with all command line options,
58541 and a placeholder (<literal>%s</literal>) for the directory to scan.
58542 </para>
58543 </listitem>
58544 <listitem>
58545 <para>
58546 A regular expression to match against the STDOUT and STDERR output of the
58547 virus scanner. If the expression matches, a virus was found. You must make
58548 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
58549 the <quote>trigger</quote> expression.
58550 </para>
58551 </listitem>
58552 <listitem>
58553 <para>
58554 Another regular expression, containing exactly one pair of parentheses, to
58555 match the name of the virus found in the scanners output. This is called the
58556 <quote>name</quote> expression.
58557 </para>
58558 </listitem>
58559 </orderedlist>
58560 <para>
58561 For example, Sophos Sweep reports a virus on a line like this:
58562 </para>
58563 <literallayout class="monospaced">
58564 Virus 'W32/Magistr-B' found in file ./those.bat
58565 </literallayout>
58566 <para>
58567 For the trigger expression, we can match the phrase <quote>found in file</quote>. For the
58568 name expression, we want to extract the W32/Magistr-B string, so we can match
58569 for the single quotes left and right of it. Altogether, this makes the
58570 configuration setting:
58571 </para>
58572 <literallayout class="monospaced">
58573 av_scanner = cmdline:\
58574              /path/to/sweep -ss -all -rec -archive %s:\
58575              found in file:'(.+)'
58576 </literallayout>
58577 </listitem></varlistentry>
58578 <varlistentry>
58579 <term><option>drweb</option></term>
58580 <listitem>
58581 <para>
58582 <indexterm role="concept">
58583 <primary>virus scanners</primary>
58584 <secondary>DrWeb</secondary>
58585 </indexterm>
58586 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="http://www.sald.com/">http://www.sald.com/</ulink></emphasis>) interface
58587 takes one option,
58588 either a full path to a UNIX socket,
58589 or host and port specifiers separated by white space.
58590 The host may be a name or an IP address; the port is either a
58591 single number or a pair of numbers with a dash between.
58592 For example:
58593 </para>
58594 <literallayout class="monospaced">
58595 av_scanner = drweb:/var/run/drwebd.sock
58596 av_scanner = drweb:192.168.2.20 31337
58597 </literallayout>
58598 <para>
58599 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
58600 is used. Thanks to Alex Miller for contributing the code for this scanner.
58601 </para>
58602 </listitem></varlistentry>
58603 <varlistentry>
58604 <term><option>f-protd</option></term>
58605 <listitem>
58606 <para>
58607 <indexterm role="concept">
58608 <primary>virus scanners</primary>
58609 <secondary>f-protd</secondary>
58610 </indexterm>
58611 The f-protd scanner is accessed via HTTP over TCP.
58612 One argument is taken, being a space-separated hostname and port number
58613 (or port-range).
58614 For example:
58615 </para>
58616 <literallayout class="monospaced">
58617 av_scanner = f-protd:localhost 10200-10204
58618 </literallayout>
58619 <para>
58620 If you omit the argument, the default values show above are used.
58621 </para>
58622 </listitem></varlistentry>
58623 <varlistentry>
58624 <term><option>fsecure</option></term>
58625 <listitem>
58626 <para>
58627 <indexterm role="concept">
58628 <primary>virus scanners</primary>
58629 <secondary>F-Secure</secondary>
58630 </indexterm>
58631 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="http://www.f-secure.com">http://www.f-secure.com</ulink></emphasis>) takes one
58632 argument which is the path to a UNIX socket. For example:
58633 </para>
58634 <literallayout class="monospaced">
58635 av_scanner = fsecure:/path/to/.fsav
58636 </literallayout>
58637 <para>
58638 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
58639 Thelmen for contributing the code for this scanner.
58640 </para>
58641 </listitem></varlistentry>
58642 <varlistentry>
58643 <term><option>kavdaemon</option></term>
58644 <listitem>
58645 <para>
58646 <indexterm role="concept">
58647 <primary>virus scanners</primary>
58648 <secondary>Kaspersky</secondary>
58649 </indexterm>
58650 This is the scanner daemon of Kaspersky Version 4. This version of the
58651 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
58652 scanner type takes one option, which is the path to the daemon&#x2019;s UNIX socket.
58653 For example:
58654 </para>
58655 <literallayout class="monospaced">
58656 av_scanner = kavdaemon:/opt/AVP/AvpCtl
58657 </literallayout>
58658 <para>
58659 The default path is <filename>/var/run/AvpCtl</filename>.
58660 </para>
58661 </listitem></varlistentry>
58662 <varlistentry>
58663 <term><option>mksd</option></term>
58664 <listitem>
58665 <para>
58666 <indexterm role="concept">
58667 <primary>virus scanners</primary>
58668 <secondary>mksd</secondary>
58669 </indexterm>
58670 This is a daemon type scanner that is aimed mainly at Polish users, though some
58671 parts of documentation are now available in English. You can get it at
58672 <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
58673 the maximum number of processes used simultaneously to scan the attachments,
58674 provided that the demime facility is employed and also provided that mksd has
58675 been run with at least the same number of child processes. For example:
58676 </para>
58677 <literallayout class="monospaced">
58678 av_scanner = mksd:2
58679 </literallayout>
58680 <para>
58681 You can safely omit this option (the default value is 1).
58682 </para>
58683 </listitem></varlistentry>
58684 <varlistentry>
58685 <term><option>sock</option></term>
58686 <listitem>
58687 <para>
58688 <indexterm role="concept">
58689 <primary>virus scanners</primary>
58690 <secondary>simple socket-connected</secondary>
58691 </indexterm>
58692 This is a general-purpose way of talking to simple scanner daemons
58693 running on the local machine.
58694 There are four options:
58695 an address (which may be an IP address and port, or the path of a Unix socket),
58696 a commandline to send (may include a single %s which will be replaced with
58697 the path to the mail file to be scanned),
58698 an RE to trigger on from the returned data,
58699 an RE to extract malware_name from the returned data.
58700 For example:
58701 </para>
58702 <literallayout class="monospaced">
58703 av_scanner = sock:127.0.0.1 6001:%s:(SPAM|VIRUS):(.*)\$
58704 </literallayout>
58705 <para>
58706 Default for the socket specifier is <filename>/tmp/malware.sock</filename>.
58707 Default for the commandline is <filename>%s\n</filename>.
58708 Both regular-expressions are required.
58709 </para>
58710 </listitem></varlistentry>
58711 <varlistentry>
58712 <term><option>sophie</option></term>
58713 <listitem>
58714 <para>
58715 <indexterm role="concept">
58716 <primary>virus scanners</primary>
58717 <secondary>Sophos and Sophie</secondary>
58718 </indexterm>
58719 Sophie is a daemon that uses Sophos&#x2019; <option>libsavi</option> library to scan for viruses.
58720 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
58721 for this scanner type is the path to the UNIX socket that Sophie uses for
58722 client communication. For example:
58723 </para>
58724 <literallayout class="monospaced">
58725 av_scanner = sophie:/tmp/sophie
58726 </literallayout>
58727 <para>
58728 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
58729 the option.
58730 </para>
58731 </listitem></varlistentry>
58732 </variablelist>
58733 <para>
58734 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
58735 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
58736 ACL.
58737 </para>
58738 <para>
58739 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
58740 makes it possible to use different scanners. See further below for an example.
58741 The <option>malware</option> condition caches its results, so when you use it multiple times
58742 for the same message, the actual scanning process is only carried out once.
58743 However, using expandable items in <option>av_scanner</option> disables this caching, in
58744 which case each use of the <option>malware</option> condition causes a new scan of the
58745 message.
58746 </para>
58747 <para>
58748 The <option>malware</option> condition takes a right-hand argument that is expanded before
58749 use and taken as a list, slash-separated by default.
58750 The first element can then be one of
58751 </para>
58752 <itemizedlist>
58753 <listitem>
58754 <para>
58755 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
58756 The condition succeeds if a virus was found, and fail otherwise. This is the
58757 recommended usage.
58758 </para>
58759 </listitem>
58760 <listitem>
58761 <para>
58762 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
58763 the condition fails immediately.
58764 </para>
58765 </listitem>
58766 <listitem>
58767 <para>
58768 A regular expression, in which case the message is scanned for viruses. The
58769 condition succeeds if a virus is found and its name matches the regular
58770 expression. This allows you to take special actions on certain types of virus.
58771 Note that <quote>/</quote> characters in the RE must be doubled due to the list-processing,
58772 unless the separator is changed (in the usual way).
58773 </para>
58774 </listitem>
58775 </itemizedlist>
58776 <para>
58777 You can append a <literal>defer_ok</literal> element to the <option>malware</option> argument list to accept
58778 messages even if there is a problem with the virus scanner.
58779 Otherwise, such a problem causes the ACL to defer.
58780 </para>
58781 <para>
58782 You can append a <literal>tmo=&lt;val&gt;</literal> element to the <option>malware</option> argument list to
58783 specify a non-default timeout.  The default is two minutes.
58784 For example:
58785 </para>
58786 <literallayout class="monospaced">
58787 malware = * / defer_ok / tmo=10s
58788 </literallayout>
58789 <para>
58790 A timeout causes the ACL to defer.
58791 </para>
58792 <para>
58793 <indexterm role="variable">
58794 <primary><varname>$callout_address</varname></primary>
58795 </indexterm>
58796 When a connection is made to the scanner the expansion variable <varname>$callout_address</varname>
58797 is set to record the actual address used.
58798 </para>
58799 <para>
58800 <indexterm role="variable">
58801 <primary><varname>$malware_name</varname></primary>
58802 </indexterm>
58803 When a virus is found, the condition sets up an expansion variable called
58804 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
58805 <option>message</option> modifier that specifies the error returned to the sender, and/or in
58806 logging data.
58807 </para>
58808 <para>
58809 If your virus scanner cannot unpack MIME and TNEF containers itself, you should
58810 use the <option>demime</option> condition (see section <xref linkend="SECTdemimecond"/>) before the
58811 <option>malware</option> condition.
58812 </para>
58813 <para>
58814 Beware the interaction of Exim&#x2019;s <option>message_size_limit</option> with any size limits
58815 imposed by your anti-virus scanner.
58816 </para>
58817 <para>
58818 Here is a very simple scanning example:
58819 </para>
58820 <literallayout class="monospaced">
58821 deny message = This message contains malware ($malware_name)
58822      demime = *
58823      malware = *
58824 </literallayout>
58825 <para>
58826 The next example accepts messages when there is a problem with the scanner:
58827 </para>
58828 <literallayout class="monospaced">
58829 deny message = This message contains malware ($malware_name)
58830      demime = *
58831      malware = */defer_ok
58832 </literallayout>
58833 <para>
58834 The next example shows how to use an ACL variable to scan with both sophie and
58835 aveserver. It assumes you have set:
58836 </para>
58837 <literallayout class="monospaced">
58838 av_scanner = $acl_m0
58839 </literallayout>
58840 <para>
58841 in the main Exim configuration.
58842 </para>
58843 <literallayout class="monospaced">
58844 deny message = This message contains malware ($malware_name)
58845      set acl_m0 = sophie
58846      malware = *
58847
58848 deny message = This message contains malware ($malware_name)
58849      set acl_m0 = aveserver
58850      malware = *
58851 </literallayout>
58852 </section>
58853 <section id="SECTscanspamass">
58854 <title>Scanning with SpamAssassin and Rspamd</title>
58855 <para>
58856 <indexterm role="concept">
58857 <primary>content scanning</primary>
58858 <secondary>for spam</secondary>
58859 </indexterm>
58860 <indexterm role="concept">
58861 <primary>spam scanning</primary>
58862 </indexterm>
58863 <indexterm role="concept">
58864 <primary>SpamAssassin</primary>
58865 </indexterm>
58866 <indexterm role="concept">
58867 <primary>Rspamd</primary>
58868 </indexterm>
58869 The <option>spam</option> ACL condition calls SpamAssassin&#x2019;s <option>spamd</option> daemon to get a spam
58870 score and a report for the message.
58871 Support is also provided for Rspamd.
58872 </para>
58873 <para>
58874 For more information about installation and configuration of SpamAssassin or
58875 Rspamd refer to their respective websites at
58876 <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>
58877 </para>
58878 <para>
58879 SpamAssassin can be installed with CPAN by running:
58880 </para>
58881 <literallayout class="monospaced">
58882 perl -MCPAN -e 'install Mail::SpamAssassin'
58883 </literallayout>
58884 <para>
58885 SpamAssassin has its own set of configuration files. Please review its
58886 documentation to see how you can tweak it. The default installation should work
58887 nicely, however.
58888 </para>
58889 <para>
58890 <indexterm role="option">
58891 <primary><option>spamd_address</option></primary>
58892 </indexterm>
58893 By default, SpamAssassin listens on 127.0.0.1, TCP port 783 and if you
58894 intend to use an instance running on the local host you do not need to set
58895 <option>spamd_address</option>. If you intend to use another host or port for SpamAssassin,
58896 you must set the <option>spamd_address</option> option in the global part of the Exim
58897 configuration as follows (example):
58898 </para>
58899 <literallayout class="monospaced">
58900 spamd_address = 192.168.99.45 387
58901 </literallayout>
58902 <para>
58903 To use Rspamd (which by default listens on all local addresses
58904 on TCP port 11333)
58905 you should add <option>variant=rspamd</option> after the address/port pair, for example:
58906 </para>
58907 <literallayout class="monospaced">
58908 spamd_address = 127.0.0.1 11333 variant=rspamd
58909 </literallayout>
58910 <para>
58911 As of version 2.60, <option>SpamAssassin</option> also supports communication over UNIX
58912 sockets. If you want to us these, supply <option>spamd_address</option> with an absolute
58913 file name instead of an address/port pair:
58914 </para>
58915 <literallayout class="monospaced">
58916 spamd_address = /var/run/spamd_socket
58917 </literallayout>
58918 <para>
58919 You can have multiple <option>spamd</option> servers to improve scalability. These can
58920 reside on other hardware reachable over the network. To specify multiple
58921 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
58922 option, separated with colons (the separator can be changed in the usual way):
58923 </para>
58924 <literallayout class="monospaced">
58925 spamd_address = 192.168.2.10 783 : \
58926                 192.168.2.11 783 : \
58927                 192.168.2.12 783
58928 </literallayout>
58929 <para>
58930 Up to 32 <option>spamd</option> servers are supported.
58931 When a server fails to respond to the connection attempt, all other
58932 servers are tried until one succeeds. If no server responds, the <option>spam</option>
58933 condition defers.
58934 </para>
58935 <para>
58936 Unix and TCP socket specifications may be mixed in any order.
58937 Each element of the list is a list itself, space-separated by default
58938 and changeable in the usual way.
58939 </para>
58940 <para>
58941 For TCP socket specifications a host name or IP (v4 or v6, but
58942 subject to list-separator quoting rules) address can be used,
58943 and the port can be one or a dash-separated pair.
58944 In the latter case, the range is tried in strict order.
58945 </para>
58946 <para>
58947 Elements after the first for Unix sockets, or second for TCP socket,
58948 are options.
58949 The supported options are:
58950 </para>
58951 <literallayout class="monospaced">
58952 pri=&lt;priority&gt;      Selection priority
58953 weight=&lt;value&gt;      Selection bias
58954 time=&lt;start&gt;-&lt;end&gt;  Use only between these times of day
58955 retry=&lt;timespec&gt;    Retry on connect fail
58956 tmo=&lt;timespec&gt;      Connection time limit
58957 variant=rspamd      Use Rspamd rather than SpamAssassin protocol
58958 </literallayout>
58959 <para>
58960 The <literal>pri</literal> option specifies a priority for the server within the list,
58961 higher values being tried first.
58962 The default priority is 1.
58963 </para>
58964 <para>
58965 The <literal>weight</literal> option specifies a selection bias.
58966 Within a priority set
58967 servers are queried in a random fashion, weighted by this value.
58968 The default value for selection bias is 1.
58969 </para>
58970 <para>
58971 Time specifications for the <literal>time</literal> option are &lt;hour&gt;.&lt;minute&gt;.&lt;second&gt;
58972 in the local time zone; each element being one or more digits.
58973 Either the seconds or both minutes and seconds, plus the leading <literal>.</literal>
58974 characters, may be omitted and will be taken as zero.
58975 </para>
58976 <para>
58977 Timeout specifications for the <literal>retry</literal> and <literal>tmo</literal> options
58978 are the usual Exim time interval standard, e.g. <literal>20s</literal> or <literal>1m</literal>.
58979 </para>
58980 <para>
58981 The <literal>tmo</literal> option specifies an overall timeout for communication.
58982 The default value is two minutes.
58983 </para>
58984 <para>
58985 The <literal>retry</literal> option specifies a time after which a single retry for
58986 a failed connect is made.
58987 The default is to not retry.
58988 </para>
58989 <para>
58990 The <option>spamd_address</option> variable is expanded before use if it starts with
58991 a dollar sign. In this case, the expansion may return a string that is
58992 used as the list so that multiple spamd servers can be the result of an
58993 expansion.
58994 </para>
58995 <para>
58996 <indexterm role="variable">
58997 <primary><varname>$callout_address</varname></primary>
58998 </indexterm>
58999 When a connection is made to the server the expansion variable <varname>$callout_address</varname>
59000 is set to record the actual address used.
59001 </para>
59002 </section>
59003 <section id="SECID206">
59004 <title>Calling SpamAssassin from an Exim ACL</title>
59005 <para>
59006 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
59007 </para>
59008 <literallayout class="monospaced">
59009 deny message = This message was classified as SPAM
59010      spam = joe
59011 </literallayout>
59012 <para>
59013 The right-hand side of the <option>spam</option> condition specifies a name. This is
59014 relevant if you have set up multiple SpamAssassin profiles. If you do not want
59015 to scan using a specific profile, but rather use the SpamAssassin system-wide
59016 default profile, you can scan for an unknown name, or simply use <quote>nobody</quote>.
59017 Rspamd does not use this setting. However, you must put something on the
59018 right-hand side.
59019 </para>
59020 <para>
59021 The name allows you to use per-domain or per-user antispam profiles in
59022 principle, but this is not straightforward in practice, because a message may
59023 have multiple recipients, not necessarily all in the same domain. Because the
59024 <option>spam</option> condition has to be called from a DATA-time ACL in order to be able to
59025 read the contents of the message, the variables <varname>$local_part</varname> and <varname>$domain</varname>
59026 are not set.
59027 Careful enforcement of single-recipient messages
59028 (e.g. by responding with defer in the recipient ACL for all recipients
59029 after the first),
59030 or the use of PRDR,
59031 <indexterm role="concept">
59032 <primary>PRDR</primary>
59033 <secondary>use for per-user SpamAssassin profiles</secondary>
59034 </indexterm>
59035 are needed to use this feature.
59036 </para>
59037 <para>
59038 The right-hand side of the <option>spam</option> condition is expanded before being used, so
59039 you can put lookups or conditions there. When the right-hand side evaluates to
59040 <quote>0</quote> or <quote>false</quote>, no scanning is done and the condition fails immediately.
59041 </para>
59042 <para>
59043 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
59044 large ones may cause significant performance degradation. As most spam messages
59045 are quite small, it is recommended that you do not scan the big ones. For
59046 example:
59047 </para>
59048 <literallayout class="monospaced">
59049 deny message = This message was classified as SPAM
59050      condition = ${if &lt; {$message_size}{10K}}
59051      spam = nobody
59052 </literallayout>
59053 <para>
59054 The <option>spam</option> condition returns true if the threshold specified in the user&#x2019;s
59055 SpamAssassin profile has been matched or exceeded. If you want to use the
59056 <option>spam</option> condition for its side effects (see the variables below), you can make
59057 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
59058 </para>
59059 <para>
59060 <indexterm role="concept">
59061 <primary>spam scanning</primary>
59062 <secondary>returned variables</secondary>
59063 </indexterm>
59064 When the <option>spam</option> condition is run, it sets up a number of expansion
59065 variables.
59066 Except for <varname>$spam_report</varname>,
59067 these variables are saved with the received message so are
59068 available for use at delivery time.
59069 </para>
59070 <variablelist>
59071 <varlistentry>
59072 <term><varname>$spam_score</varname></term>
59073 <listitem>
59074 <para>
59075 The spam score of the message, for example <quote>3.4</quote> or <quote>30.5</quote>. This is useful
59076 for inclusion in log or reject messages.
59077 </para>
59078 </listitem></varlistentry>
59079 <varlistentry>
59080 <term><varname>$spam_score_int</varname></term>
59081 <listitem>
59082 <para>
59083 The spam score of the message, multiplied by ten, as an integer value. For
59084 example <quote>34</quote> or <quote>305</quote>. It may appear to disagree with <varname>$spam_score</varname>
59085 because <varname>$spam_score</varname> is rounded and <varname>$spam_score_int</varname> is truncated.
59086 The integer value is useful for numeric comparisons in conditions.
59087 </para>
59088 </listitem></varlistentry>
59089 <varlistentry>
59090 <term><varname>$spam_bar</varname></term>
59091 <listitem>
59092 <para>
59093 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
59094 integer part of the spam score value. A spam score of 4.4 would have a
59095 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
59096 headers, since MUAs can match on such strings. The maximum length of the
59097 spam bar is 50 characters.
59098 </para>
59099 </listitem></varlistentry>
59100 <varlistentry>
59101 <term><varname>$spam_report</varname></term>
59102 <listitem>
59103 <para>
59104 A multiline text table, containing the full SpamAssassin report for the
59105 message. Useful for inclusion in headers or reject messages.
59106 This variable is only usable in a DATA-time ACL.
59107 </para>
59108 </listitem></varlistentry>
59109 <varlistentry>
59110 <term><varname>$spam_action</varname></term>
59111 <listitem>
59112 <para>
59113 For SpamAssassin either &#x2019;reject&#x2019; or &#x2019;no action&#x2019; depending on the
59114 spam score versus threshold.
59115 For Rspamd, the recommended action.
59116 </para>
59117 </listitem></varlistentry>
59118 </variablelist>
59119 <para>
59120 The <option>spam</option> condition caches its results unless expansion in
59121 spamd_address was used. If you call it again with the same user name, it
59122 does not scan again, but rather returns the same values as before.
59123 </para>
59124 <para>
59125 The <option>spam</option> condition returns DEFER if there is any error while running
59126 the message through SpamAssassin or if the expansion of spamd_address
59127 failed. If you want to treat DEFER as FAIL (to pass on to the next ACL
59128 statement block), append <literal>/defer_ok</literal> to the right-hand side of the
59129 spam condition, like this:
59130 </para>
59131 <literallayout class="monospaced">
59132 deny message = This message was classified as SPAM
59133      spam    = joe/defer_ok
59134 </literallayout>
59135 <para>
59136 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
59137 </para>
59138 <para>
59139 Here is a longer, commented example of the use of the <option>spam</option>
59140 condition:
59141 </para>
59142 <literallayout class="monospaced">
59143 # put headers in all messages (no matter if spam or not)
59144 warn  spam = nobody:true
59145       add_header = X-Spam-Score: $spam_score ($spam_bar)
59146       add_header = X-Spam-Report: $spam_report
59147
59148 # add second subject line with *SPAM* marker when message
59149 # is over threshold
59150 warn  spam = nobody
59151       add_header = Subject: *SPAM* $h_Subject:
59152
59153 # reject spam at high scores (&gt; 12)
59154 deny  message = This message scored $spam_score spam points.
59155       spam = nobody:true
59156       condition = ${if &gt;{$spam_score_int}{120}{1}{0}}
59157 </literallayout>
59158 </section>
59159 <section id="SECTscanmimepart">
59160 <title>Scanning MIME parts</title>
59161 <para>
59162 <indexterm role="concept">
59163 <primary>content scanning</primary>
59164 <secondary>MIME parts</secondary>
59165 </indexterm>
59166 <indexterm role="concept">
59167 <primary>MIME content scanning</primary>
59168 </indexterm>
59169 <indexterm role="option">
59170 <primary><option>acl_smtp_mime</option></primary>
59171 </indexterm>
59172 <indexterm role="option">
59173 <primary><option>acl_not_smtp_mime</option></primary>
59174 </indexterm>
59175 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
59176 each MIME part of an SMTP message, including multipart types, in the sequence
59177 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
59178 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
59179 options may both refer to the same ACL if you want the same processing in both
59180 cases.
59181 </para>
59182 <para>
59183 These ACLs are called (possibly many times) just before the <option>acl_smtp_data</option>
59184 ACL in the case of an SMTP message, or just before the <option>acl_not_smtp</option> ACL in
59185 the case of a non-SMTP message. However, a MIME ACL is called only if the
59186 message contains a <emphasis>Content-Type:</emphasis> header line. When a call to a MIME
59187 ACL does not yield <quote>accept</quote>, ACL processing is aborted and the appropriate
59188 result code is sent to the client. In the case of an SMTP message, the
59189 <option>acl_smtp_data</option> ACL is not called when this happens.
59190 </para>
59191 <para>
59192 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
59193 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
59194 condition to match against the raw MIME part. You can also use the
59195 <option>mime_regex</option> condition to match against the decoded MIME part (see section
59196 <xref linkend="SECTscanregex"/>).
59197 </para>
59198 <para>
59199 At the start of a MIME ACL, a number of variables are set from the header
59200 information for the relevant MIME part. These are described below. The contents
59201 of the MIME part are not by default decoded into a disk file except for MIME
59202 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
59203 part into a disk file, you can use the <option>decode</option> condition. The general
59204 syntax is:
59205 </para>
59206 <literallayout>
59207 <literal>decode = [/</literal>&lt;<emphasis>path</emphasis>&gt;<literal>/]</literal>&lt;<emphasis>filename</emphasis>&gt;
59208 </literallayout>
59209 <para>
59210 The right hand side is expanded before use. After expansion,
59211 the value can be:
59212 </para>
59213 <orderedlist numeration="arabic">
59214 <listitem>
59215 <para>
59216 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
59217 </para>
59218 </listitem>
59219 <listitem>
59220 <para>
59221 The string <quote>default</quote>. In that case, the file is put in the temporary
59222 <quote>default</quote> directory &lt;<emphasis>spool_directory</emphasis>&gt;<filename>/scan/</filename>&lt;<emphasis>message_id</emphasis>&gt;<filename>/</filename> with
59223 a sequential file name consisting of the message id and a sequence number. The
59224 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
59225 </para>
59226 </listitem>
59227 <listitem>
59228 <para>
59229 A full path name starting with a slash. If the full name is an existing
59230 directory, it is used as a replacement for the default directory. The filename
59231 is then sequentially assigned. If the path does not exist, it is used as
59232 the full path and file name.
59233 </para>
59234 </listitem>
59235 <listitem>
59236 <para>
59237 If the string does not start with a slash, it is used as the
59238 filename, and the default path is then used.
59239 </para>
59240 </listitem>
59241 </orderedlist>
59242 <para>
59243 The <option>decode</option> condition normally succeeds. It is only false for syntax
59244 errors or unusual circumstances such as memory shortages. You can easily decode
59245 a file with its original, proposed filename using
59246 </para>
59247 <literallayout class="monospaced">
59248 decode = $mime_filename
59249 </literallayout>
59250 <para>
59251 However, you should keep in mind that <varname>$mime_filename</varname> might contain
59252 anything. If you place files outside of the default path, they are not
59253 automatically unlinked.
59254 </para>
59255 <para>
59256 For RFC822 attachments (these are messages attached to messages, with a
59257 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
59258 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
59259 variable is set (see below). Attached messages are always decoded to disk
59260 before being checked, and the files are unlinked once the check is done.
59261 </para>
59262 <para>
59263 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
59264 used to match regular expressions against raw and decoded MIME parts,
59265 respectively. They are described in section <xref linkend="SECTscanregex"/>.
59266 </para>
59267 <para>
59268 <indexterm role="concept">
59269 <primary>MIME content scanning</primary>
59270 <secondary>returned variables</secondary>
59271 </indexterm>
59272 The following list describes all expansion variables that are
59273 available in the MIME ACL:
59274 </para>
59275 <variablelist>
59276 <varlistentry>
59277 <term><varname>$mime_boundary</varname></term>
59278 <listitem>
59279 <para>
59280 If the current part is a multipart (see <varname>$mime_is_multipart</varname>) below, it should
59281 have a boundary string, which is stored in this variable. If the current part
59282 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
59283 contains the empty string.
59284 </para>
59285 </listitem></varlistentry>
59286 <varlistentry>
59287 <term><varname>$mime_charset</varname></term>
59288 <listitem>
59289 <para>
59290 This variable contains the character set identifier, if one was found in the
59291 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
59292 </para>
59293 <literallayout class="monospaced">
59294 us-ascii
59295 gb2312 (Chinese)
59296 iso-8859-1
59297 </literallayout>
59298 <para>
59299 Please note that this value is not normalized, so you should do matches
59300 case-insensitively.
59301 </para>
59302 </listitem></varlistentry>
59303 <varlistentry>
59304 <term><varname>$mime_content_description</varname></term>
59305 <listitem>
59306 <para>
59307 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
59308 header. It can contain a human-readable description of the parts content. Some
59309 implementations repeat the filename for attachments here, but they are usually
59310 only used for display purposes.
59311 </para>
59312 </listitem></varlistentry>
59313 <varlistentry>
59314 <term><varname>$mime_content_disposition</varname></term>
59315 <listitem>
59316 <para>
59317 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
59318 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
59319 </para>
59320 </listitem></varlistentry>
59321 <varlistentry>
59322 <term><varname>$mime_content_id</varname></term>
59323 <listitem>
59324 <para>
59325 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
59326 This is a unique ID that can be used to reference a part from another part.
59327 </para>
59328 </listitem></varlistentry>
59329 <varlistentry>
59330 <term><varname>$mime_content_size</varname></term>
59331 <listitem>
59332 <para>
59333 This variable is set only after the <option>decode</option> modifier (see above) has been
59334 successfully run. It contains the size of the decoded part in kilobytes. The
59335 size is always rounded up to full kilobytes, so only a completely empty part
59336 has a <varname>$mime_content_size</varname> of zero.
59337 </para>
59338 </listitem></varlistentry>
59339 <varlistentry>
59340 <term><varname>$mime_content_transfer_encoding</varname></term>
59341 <listitem>
59342 <para>
59343 This variable contains the normalized content of the
59344 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
59345 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
59346 </para>
59347 </listitem></varlistentry>
59348 <varlistentry>
59349 <term><varname>$mime_content_type</varname></term>
59350 <listitem>
59351 <para>
59352 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
59353 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
59354 are some examples of popular MIME types, as they may appear in this variable:
59355 </para>
59356 <literallayout class="monospaced">
59357 text/plain
59358 text/html
59359 application/octet-stream
59360 image/jpeg
59361 audio/midi
59362 </literallayout>
59363 <para>
59364 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
59365 empty string.
59366 </para>
59367 </listitem></varlistentry>
59368 <varlistentry>
59369 <term><varname>$mime_decoded_filename</varname></term>
59370 <listitem>
59371 <para>
59372 This variable is set only after the <option>decode</option> modifier (see above) has been
59373 successfully run. It contains the full path and file name of the file
59374 containing the decoded data.
59375 </para>
59376 </listitem></varlistentry>
59377 </variablelist>
59378 <para>
59379 <indexterm role="concept">
59380 <primary>RFC 2047</primary>
59381 </indexterm>
59382 </para>
59383 <variablelist>
59384 <varlistentry>
59385 <term><varname>$mime_filename</varname></term>
59386 <listitem>
59387 <para>
59388 This is perhaps the most important of the MIME variables. It contains a
59389 proposed filename for an attachment, if one was found in either the
59390 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
59391 RFC2047
59392 or RFC2231
59393 decoded, but no additional sanity checks are done.
59394  If no filename was
59395 found, this variable contains the empty string.
59396 </para>
59397 </listitem></varlistentry>
59398 <varlistentry>
59399 <term><varname>$mime_is_coverletter</varname></term>
59400 <listitem>
59401 <para>
59402 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
59403 attached data. It can be used to clamp down on flashy or unnecessarily encoded
59404 content in the cover letter, while not restricting attachments at all.
59405 </para>
59406 <para>
59407 The variable contains 1 (true) for a MIME part believed to be part of the
59408 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
59409 follows:
59410 </para>
59411 <orderedlist numeration="arabic">
59412 <listitem>
59413 <para>
59414 The outermost MIME part of a message is always a cover letter.
59415 </para>
59416 </listitem>
59417 <listitem>
59418 <para>
59419 If a multipart/alternative or multipart/related MIME part is a cover letter,
59420 so are all MIME subparts within that multipart.
59421 </para>
59422 </listitem>
59423 <listitem>
59424 <para>
59425 If any other multipart is a cover letter, the first subpart is a cover letter,
59426 and the rest are attachments.
59427 </para>
59428 </listitem>
59429 <listitem>
59430 <para>
59431 All parts contained within an attachment multipart are attachments.
59432 </para>
59433 </listitem>
59434 </orderedlist>
59435 <para>
59436 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
59437 alternative plain text), while allowing HTML files to be attached. HTML
59438 coverletter mail attached to non-HMTL coverletter mail will also be allowed:
59439 </para>
59440 <literallayout class="monospaced">
59441 deny message = HTML mail is not accepted here
59442 !condition = $mime_is_rfc822
59443 condition = $mime_is_coverletter
59444 condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
59445 </literallayout>
59446 </listitem></varlistentry>
59447 <varlistentry>
59448 <term><varname>$mime_is_multipart</varname></term>
59449 <listitem>
59450 <para>
59451 This variable has the value 1 (true) when the current part has the main type
59452 <quote>multipart</quote>, for example <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
59453 Since multipart entities only serve as containers for other parts, you may not
59454 want to carry out specific actions on them.
59455 </para>
59456 </listitem></varlistentry>
59457 <varlistentry>
59458 <term><varname>$mime_is_rfc822</varname></term>
59459 <listitem>
59460 <para>
59461 This variable has the value 1 (true) if the current part is not a part of the
59462 checked message itself, but part of an attached message. Attached message
59463 decoding is fully recursive.
59464 </para>
59465 </listitem></varlistentry>
59466 <varlistentry>
59467 <term><varname>$mime_part_count</varname></term>
59468 <listitem>
59469 <para>
59470 This variable is a counter that is raised for each processed MIME part. It
59471 starts at zero for the very first part (which is usually a multipart). The
59472 counter is per-message, so it is reset when processing RFC822 attachments (see
59473 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
59474 complete, so you can use it in the DATA ACL to determine the number of MIME
59475 parts of a message. For non-MIME messages, this variable contains the value -1.
59476 </para>
59477 </listitem></varlistentry>
59478 </variablelist>
59479 </section>
59480 <section id="SECTscanregex">
59481 <title>Scanning with regular expressions</title>
59482 <para>
59483 <indexterm role="concept">
59484 <primary>content scanning</primary>
59485 <secondary>with regular expressions</secondary>
59486 </indexterm>
59487 <indexterm role="concept">
59488 <primary>regular expressions</primary>
59489 <secondary>content scanning with</secondary>
59490 </indexterm>
59491 You can specify your own custom regular expression matches on the full body of
59492 the message, or on individual MIME parts.
59493 </para>
59494 <para>
59495 The <option>regex</option> condition takes one or more regular expressions as arguments and
59496 matches them against the full message (when called in the DATA ACL) or a raw
59497 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
59498 linewise, with a maximum line length of 32K characters. That means you cannot
59499 have multiline matches with the <option>regex</option> condition.
59500 </para>
59501 <para>
59502 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
59503 to 32K of decoded content (the whole content at once, not linewise). If the
59504 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
59505 is decoded automatically when <option>mime_regex</option> is executed (using default path
59506 and filename values). If the decoded data is larger than  32K, only the first
59507 32K characters are checked.
59508 </para>
59509 <para>
59510 The regular expressions are passed as a colon-separated list. To include a
59511 literal colon, you must double it. Since the whole right-hand side string is
59512 expanded before being used, you must also escape dollar signs and backslashes
59513 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
59514 Here is a simple example that contains two regular expressions:
59515 </para>
59516 <literallayout class="monospaced">
59517 deny message = contains blacklisted regex ($regex_match_string)
59518      regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
59519 </literallayout>
59520 <para>
59521 The conditions returns true if any one of the regular expressions matches. The
59522 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
59523 matching regular expression.
59524 The expansion variables <varname>$regex1</varname> <varname>$regex2</varname> etc
59525 are set to any substrings captured by the regular expression.
59526 </para>
59527 <para>
59528 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
59529 CPU-intensive.
59530 </para>
59531 </section>
59532 <section id="SECTdemimecond">
59533 <title>The demime condition</title>
59534 <para>
59535 <indexterm role="concept">
59536 <primary>content scanning</primary>
59537 <secondary>MIME checking</secondary>
59538 </indexterm>
59539 <indexterm role="concept">
59540 <primary>MIME content scanning</primary>
59541 </indexterm>
59542 The <option>demime</option> ACL condition provides MIME unpacking, sanity checking and file
59543 extension blocking. It is usable only in the DATA and non-SMTP ACLs. The
59544 <option>demime</option> condition uses a simpler interface to MIME decoding than the MIME
59545 ACL functionality, but provides no additional facilities. Please note that this
59546 condition is deprecated and kept only for backward compatibility. You must set
59547 the WITH_OLD_DEMIME option in <filename>Local/Makefile</filename> at build time to be able to
59548 use the <option>demime</option> condition.
59549 </para>
59550 <para>
59551 The <option>demime</option> condition unpacks MIME containers in the message. It detects
59552 errors in MIME containers and can match file extensions found in the message
59553 against a list. Using this facility produces files containing the unpacked MIME
59554 parts of the message in the temporary scan directory. If you do antivirus
59555 scanning, it is recommended that you use the <option>demime</option> condition before the
59556 antivirus (<option>malware</option>) condition.
59557 </para>
59558 <para>
59559 On the right-hand side of the <option>demime</option> condition you can pass a
59560 colon-separated list of file extensions that it should match against. For
59561 example:
59562 </para>
59563 <literallayout class="monospaced">
59564 deny message = Found blacklisted file attachment
59565      demime  = vbs:com:bat:pif:prf:lnk
59566 </literallayout>
59567 <para>
59568 If one of the file extensions is found, the condition is true, otherwise it is
59569 false. If there is a temporary error while demimeing (for example, <quote>disk
59570 full</quote>), the condition defers, and the message is temporarily rejected (unless
59571 the condition is on a <option>warn</option> verb).
59572 </para>
59573 <para>
59574 The right-hand side is expanded before being treated as a list, so you can have
59575 conditions and lookups there. If it expands to an empty string, <quote>false</quote>, or
59576 zero (<quote>0</quote>), no demimeing is done and the condition is false.
59577 </para>
59578 <para>
59579 The <option>demime</option> condition set the following variables:
59580 </para>
59581 <variablelist>
59582 <varlistentry>
59583 <term><varname>$demime_errorlevel</varname></term>
59584 <listitem>
59585 <para>
59586 <indexterm role="variable">
59587 <primary><varname>$demime_errorlevel</varname></primary>
59588 </indexterm>
59589 When an error is detected in a MIME container, this variable contains the
59590 severity of the error, as an integer number. The higher the value, the more
59591 severe the error (the current maximum value is 3). If this variable is unset or
59592 zero, no error occurred.
59593 </para>
59594 </listitem></varlistentry>
59595 <varlistentry>
59596 <term><varname>$demime_reason</varname></term>
59597 <listitem>
59598 <para>
59599 <indexterm role="variable">
59600 <primary><varname>$demime_reason</varname></primary>
59601 </indexterm>
59602 When <varname>$demime_errorlevel</varname> is greater than zero, this variable contains a
59603 human-readable text string describing the MIME error that occurred.
59604 </para>
59605 </listitem></varlistentry>
59606 </variablelist>
59607 <variablelist>
59608 <varlistentry>
59609 <term><varname>$found_extension</varname></term>
59610 <listitem>
59611 <para>
59612 <indexterm role="variable">
59613 <primary><varname>$found_extension</varname></primary>
59614 </indexterm>
59615 When the <option>demime</option> condition is true, this variable contains the file
59616 extension it found.
59617 </para>
59618 </listitem></varlistentry>
59619 </variablelist>
59620 <para>
59621 Both <varname>$demime_errorlevel</varname> and <varname>$demime_reason</varname> are set by the first call of
59622 the <option>demime</option> condition, and are not changed on subsequent calls.
59623 </para>
59624 <para>
59625 If you do not want to check for file extensions, but rather use the <option>demime</option>
59626 condition for unpacking or error checking purposes, pass <quote>*</quote> as the
59627 right-hand side value. Here is a more elaborate example of how to use this
59628 facility:
59629 </para>
59630 <literallayout class="monospaced">
59631 # Reject messages with serious MIME container errors
59632 deny  message = Found MIME error ($demime_reason).
59633       demime = *
59634       condition = ${if &gt;{$demime_errorlevel}{2}{1}{0}}
59635
59636 # Reject known virus spreading file extensions.
59637 # Accepting these is pretty much braindead.
59638 deny  message = contains $found_extension file (blacklisted).
59639       demime  = com:vbs:bat:pif:scr
59640
59641 # Freeze .exe and .doc files. Postmaster can
59642 # examine them and eventually thaw them.
59643 deny  log_message = Another $found_extension file.
59644       demime = exe:doc
59645       control = freeze
59646 </literallayout>
59647 <para>
59648 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
59649 </para>
59650 </section>
59651 </chapter>
59652
59653 <chapter id="CHAPlocalscan">
59654 <title>Adding a local scan function to Exim</title>
59655 <titleabbrev>Local scan function</titleabbrev>
59656 <para>
59657 <indexterm role="concept" id="IIDlosca" class="startofrange">
59658 <primary><function>local_scan()</function> function</primary>
59659 <secondary>description of</secondary>
59660 </indexterm>
59661 <indexterm role="concept">
59662 <primary>customizing</primary>
59663 <secondary>input scan using C function</secondary>
59664 </indexterm>
59665 <indexterm role="concept">
59666 <primary>policy control</primary>
59667 <secondary>by local scan function</secondary>
59668 </indexterm>
59669 In these days of email worms, viruses, and ever-increasing spam, some sites
59670 want to apply a lot of checking to messages before accepting them.
59671 </para>
59672 <para>
59673 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
59674 passing messages to external virus and spam scanning software. You can also do
59675 a certain amount in Exim itself through string expansions and the <option>condition</option>
59676 condition in the ACL that runs after the SMTP DATA command or the ACL for
59677 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
59678 </para>
59679 <para>
59680 To allow for further customization to a site&#x2019;s own requirements, there is the
59681 possibility of linking Exim with a private message scanning function, written
59682 in C. If you want to run code that is written in something other than C, you
59683 can of course use a little C stub to call it.
59684 </para>
59685 <para>
59686 The local scan function is run once for every incoming message, at the point
59687 when Exim is just about to accept the message.
59688 It can therefore be used to control non-SMTP messages from local processes as
59689 well as messages arriving via SMTP.
59690 </para>
59691 <para>
59692 Exim applies a timeout to calls of the local scan function, and there is an
59693 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
59694 Zero means <quote>no timeout</quote>.
59695 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
59696 before calling the local scan function, so that the most common types of crash
59697 are caught. If the timeout is exceeded or one of those signals is caught, the
59698 incoming message is rejected with a temporary error if it is an SMTP message.
59699 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
59700 code. The incident is logged on the main and reject logs.
59701 </para>
59702 <section id="SECID207">
59703 <title>Building Exim to use a local scan function</title>
59704 <para>
59705 <indexterm role="concept">
59706 <primary><function>local_scan()</function> function</primary>
59707 <secondary>building Exim to use</secondary>
59708 </indexterm>
59709 To make use of the local scan function feature, you must tell Exim where your
59710 function is before building Exim, by setting LOCAL_SCAN_SOURCE in your
59711 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
59712 directory, so you might set
59713 </para>
59714 <literallayout class="monospaced">
59715 LOCAL_SCAN_SOURCE=Local/local_scan.c
59716 </literallayout>
59717 <para>
59718 for example. The function must be called <function>local_scan()</function>. It is called by
59719 Exim after it has received a message, when the success return code is about to
59720 be sent. This is after all the ACLs have been run. The return code from your
59721 function controls whether the message is actually accepted or not. There is a
59722 commented template function (that just accepts the message) in the file
59723 _src/local_scan.c_.
59724 </para>
59725 <para>
59726 If you want to make use of Exim&#x2019;s run time configuration file to set options
59727 for your <function>local_scan()</function> function, you must also set
59728 </para>
59729 <literallayout class="monospaced">
59730 LOCAL_SCAN_HAS_OPTIONS=yes
59731 </literallayout>
59732 <para>
59733 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
59734 </para>
59735 </section>
59736 <section id="SECTapiforloc">
59737 <title>API for local_scan()</title>
59738 <para>
59739 <indexterm role="concept">
59740 <primary><function>local_scan()</function> function</primary>
59741 <secondary>API description</secondary>
59742 </indexterm>
59743 You must include this line near the start of your code:
59744 </para>
59745 <literallayout class="monospaced">
59746 #include "local_scan.h"
59747 </literallayout>
59748 <para>
59749 This header file defines a number of variables and other values, and the
59750 prototype for the function itself. Exim is coded to use unsigned char values
59751 almost exclusively, and one of the things this header defines is a shorthand
59752 for <literal>unsigned char</literal> called <literal>uschar</literal>.
59753 It also contains the following macro definitions, to simplify casting character
59754 strings and pointers to character strings:
59755 </para>
59756 <literallayout class="monospaced">
59757 #define CS   (char *)
59758 #define CCS  (const char *)
59759 #define CSS  (char **)
59760 #define US   (unsigned char *)
59761 #define CUS  (const unsigned char *)
59762 #define USS  (unsigned char **)
59763 </literallayout>
59764 <para>
59765 The function prototype for <function>local_scan()</function> is:
59766 </para>
59767 <literallayout class="monospaced">
59768 extern int local_scan(int fd, uschar **return_text);
59769 </literallayout>
59770 <para>
59771 The arguments are as follows:
59772 </para>
59773 <itemizedlist>
59774 <listitem>
59775 <para>
59776 <option>fd</option> is a file descriptor for the file that contains the body of the message
59777 (the -D file). The file is open for reading and writing, but updating it is not
59778 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
59779 </para>
59780 <para>
59781 The descriptor is positioned at character 19 of the file, which is the first
59782 character of the body itself, because the first 19 characters are the message
59783 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
59784 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
59785 case this changes in some future version.
59786 </para>
59787 </listitem>
59788 <listitem>
59789 <para>
59790 <option>return_text</option> is an address which you can use to return a pointer to a text
59791 string at the end of the function. The value it points to on entry is NULL.
59792 </para>
59793 </listitem>
59794 </itemizedlist>
59795 <para>
59796 The function must return an <option>int</option> value which is one of the following macros:
59797 </para>
59798 <variablelist>
59799 <varlistentry>
59800 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
59801 <listitem>
59802 <para>
59803 <indexterm role="variable">
59804 <primary><varname>$local_scan_data</varname></primary>
59805 </indexterm>
59806 The message is accepted. If you pass back a string of text, it is saved with
59807 the message, and made available in the variable <varname>$local_scan_data</varname>. No
59808 newlines are permitted (if there are any, they are turned into spaces) and the
59809 maximum length of text is 1000 characters.
59810 </para>
59811 </listitem></varlistentry>
59812 <varlistentry>
59813 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
59814 <listitem>
59815 <para>
59816 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
59817 queued without immediate delivery, and is frozen.
59818 </para>
59819 </listitem></varlistentry>
59820 <varlistentry>
59821 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
59822 <listitem>
59823 <para>
59824 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
59825 queued without immediate delivery.
59826 </para>
59827 </listitem></varlistentry>
59828 <varlistentry>
59829 <term><literal>LOCAL_SCAN_REJECT</literal></term>
59830 <listitem>
59831 <para>
59832 The message is rejected; the returned text is used as an error message which is
59833 passed back to the sender and which is also logged. Newlines are permitted &ndash;
59834 they cause a multiline response for SMTP rejections, but are converted to
59835 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
59836 used.
59837 </para>
59838 </listitem></varlistentry>
59839 <varlistentry>
59840 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
59841 <listitem>
59842 <para>
59843 The message is temporarily rejected; the returned text is used as an error
59844 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
59845 problem</quote> is used.
59846 </para>
59847 </listitem></varlistentry>
59848 <varlistentry>
59849 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
59850 <listitem>
59851 <para>
59852 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
59853 message is not written to the reject log. It has the effect of unsetting the
59854 <option>rejected_header</option> log selector for just this rejection. If
59855 <option>rejected_header</option> is already unset (see the discussion of the
59856 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
59857 same as LOCAL_SCAN_REJECT.
59858 </para>
59859 </listitem></varlistentry>
59860 <varlistentry>
59861 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
59862 <listitem>
59863 <para>
59864 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
59865 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
59866 </para>
59867 </listitem></varlistentry>
59868 </variablelist>
59869 <para>
59870 If the message is not being received by interactive SMTP, rejections are
59871 reported by writing to <option>stderr</option> or by sending an email, as configured by the
59872 <option>-oe</option> command line options.
59873 </para>
59874 </section>
59875 <section id="SECTconoptloc">
59876 <title>Configuration options for local_scan()</title>
59877 <para>
59878 <indexterm role="concept">
59879 <primary><function>local_scan()</function> function</primary>
59880 <secondary>configuration options</secondary>
59881 </indexterm>
59882 It is possible to have option settings in the main configuration file
59883 that set values in static variables in the <function>local_scan()</function> module. If you
59884 want to do this, you must have the line
59885 </para>
59886 <literallayout class="monospaced">
59887 LOCAL_SCAN_HAS_OPTIONS=yes
59888 </literallayout>
59889 <para>
59890 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
59891 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
59892 file, you must define static variables to hold the option values, and a table
59893 to define them.
59894 </para>
59895 <para>
59896 The table must be a vector called <option>local_scan_options</option>, of type
59897 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
59898 and a pointer to the variable that holds the value. The entries must appear in
59899 alphabetical order. Following <option>local_scan_options</option> you must also define a
59900 variable called <option>local_scan_options_count</option> that contains the number of
59901 entries in the table. Here is a short example, showing two kinds of option:
59902 </para>
59903 <literallayout class="monospaced">
59904 static int my_integer_option = 42;
59905 static uschar *my_string_option = US"a default string";
59906
59907 optionlist local_scan_options[] = {
59908   { "my_integer", opt_int,       &amp;my_integer_option },
59909   { "my_string",  opt_stringptr, &amp;my_string_option }
59910 };
59911
59912 int local_scan_options_count =
59913   sizeof(local_scan_options)/sizeof(optionlist);
59914 </literallayout>
59915 <para>
59916 The values of the variables can now be changed from Exim&#x2019;s runtime
59917 configuration file by including a local scan section as in this example:
59918 </para>
59919 <literallayout class="monospaced">
59920 begin local_scan
59921 my_integer = 99
59922 my_string = some string of text...
59923 </literallayout>
59924 <para>
59925 The available types of option data are as follows:
59926 </para>
59927 <variablelist>
59928 <varlistentry>
59929 <term><emphasis role="bold">opt_bool</emphasis></term>
59930 <listitem>
59931 <para>
59932 This specifies a boolean (true/false) option. The address should point to a
59933 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
59934 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
59935 whether such a variable has been set at all, you can initialize it to
59936 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
59937 values.)
59938 </para>
59939 </listitem></varlistentry>
59940 <varlistentry>
59941 <term><emphasis role="bold">opt_fixed</emphasis></term>
59942 <listitem>
59943 <para>
59944 This specifies a fixed point number, such as is used for load averages.
59945 The address should point to a variable of type <literal>int</literal>. The value is stored
59946 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
59947 </para>
59948 </listitem></varlistentry>
59949 <varlistentry>
59950 <term><emphasis role="bold">opt_int</emphasis></term>
59951 <listitem>
59952 <para>
59953 This specifies an integer; the address should point to a variable of type
59954 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
59955 Exim.
59956 </para>
59957 </listitem></varlistentry>
59958 <varlistentry>
59959 <term><emphasis role="bold">opt_mkint</emphasis></term>
59960 <listitem>
59961 <para>
59962 This is the same as <option>opt_int</option>, except that when such a value is output in a
59963 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
59964 printed with the suffix K or M.
59965 </para>
59966 </listitem></varlistentry>
59967 <varlistentry>
59968 <term><emphasis role="bold">opt_octint</emphasis></term>
59969 <listitem>
59970 <para>
59971 This also specifies an integer, but the value is always interpreted as an
59972 octal integer, whether or not it starts with the digit zero, and it is
59973 always output in octal.
59974 </para>
59975 </listitem></varlistentry>
59976 <varlistentry>
59977 <term><emphasis role="bold">opt_stringptr</emphasis></term>
59978 <listitem>
59979 <para>
59980 This specifies a string value; the address must be a pointer to a
59981 variable that points to a string (for example, of type <literal>uschar *</literal>).
59982 </para>
59983 </listitem></varlistentry>
59984 <varlistentry>
59985 <term><emphasis role="bold">opt_time</emphasis></term>
59986 <listitem>
59987 <para>
59988 This specifies a time interval value. The address must point to a variable of
59989 type <literal>int</literal>. The value that is placed there is a number of seconds.
59990 </para>
59991 </listitem></varlistentry>
59992 </variablelist>
59993 <para>
59994 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
59995 out the values of all the <function>local_scan()</function> options.
59996 </para>
59997 </section>
59998 <section id="SECID208">
59999 <title>Available Exim variables</title>
60000 <para>
60001 <indexterm role="concept">
60002 <primary><function>local_scan()</function> function</primary>
60003 <secondary>available Exim variables</secondary>
60004 </indexterm>
60005 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
60006 are the only ones that are guaranteed to be maintained from release to release.
60007 Note, however, that you can obtain the value of any Exim expansion variable,
60008 including <varname>$recipients</varname>, by calling <emphasis>expand_string()</emphasis>. The exported
60009 C variables are as follows:
60010 </para>
60011 <variablelist>
60012 <varlistentry>
60013 <term><emphasis role="bold">int&nbsp;body_linecount</emphasis></term>
60014 <listitem>
60015 <para>
60016 This variable contains the number of lines in the message&#x2019;s body.
60017 </para>
60018 </listitem></varlistentry>
60019 <varlistentry>
60020 <term><emphasis role="bold">int&nbsp;body_zerocount</emphasis></term>
60021 <listitem>
60022 <para>
60023 This variable contains the number of binary zero bytes in the message&#x2019;s body.
60024 </para>
60025 </listitem></varlistentry>
60026 <varlistentry>
60027 <term><emphasis role="bold">unsigned&nbsp;int&nbsp;debug_selector</emphasis></term>
60028 <listitem>
60029 <para>
60030 This variable is set to zero when no debugging is taking place. Otherwise, it
60031 is a bitmap of debugging selectors. Two bits are identified for use in
60032 <function>local_scan()</function>; they are defined as macros:
60033 </para>
60034 <itemizedlist>
60035 <listitem>
60036 <para>
60037 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
60038 testing option that is not privileged &ndash; any caller may set it. All the
60039 other selector bits can be set only by admin users.
60040 </para>
60041 </listitem>
60042 <listitem>
60043 <para>
60044 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
60045 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
60046 of debugging bits.
60047 </para>
60048 </listitem>
60049 </itemizedlist>
60050 <para>
60051 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
60052 selected, you should use code like this:
60053 </para>
60054 <literallayout class="monospaced">
60055 if ((debug_selector &amp; D_local_scan) != 0)
60056   debug_printf("xxx", ...);
60057 </literallayout>
60058 </listitem></varlistentry>
60059 <varlistentry>
60060 <term><emphasis role="bold">uschar&nbsp;*expand_string_message</emphasis></term>
60061 <listitem>
60062 <para>
60063 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
60064 variable <option>expand_string_message</option> contains the error message, zero-terminated.
60065 </para>
60066 </listitem></varlistentry>
60067 <varlistentry>
60068 <term><emphasis role="bold">header_line&nbsp;*header_list</emphasis></term>
60069 <listitem>
60070 <para>
60071 A pointer to a chain of header lines. The <option>header_line</option> structure is
60072 discussed below.
60073 </para>
60074 </listitem></varlistentry>
60075 <varlistentry>
60076 <term><emphasis role="bold">header_line&nbsp;*header_last</emphasis></term>
60077 <listitem>
60078 <para>
60079 A pointer to the last of the header lines.
60080 </para>
60081 </listitem></varlistentry>
60082 <varlistentry>
60083 <term><emphasis role="bold">uschar&nbsp;*headers_charset</emphasis></term>
60084 <listitem>
60085 <para>
60086 The value of the <option>headers_charset</option> configuration option.
60087 </para>
60088 </listitem></varlistentry>
60089 <varlistentry>
60090 <term><emphasis role="bold">BOOL&nbsp;host_checking</emphasis></term>
60091 <listitem>
60092 <para>
60093 This variable is TRUE during a host checking session that is initiated by the
60094 <option>-bh</option> command line option.
60095 </para>
60096 </listitem></varlistentry>
60097 <varlistentry>
60098 <term><emphasis role="bold">uschar&nbsp;*interface_address</emphasis></term>
60099 <listitem>
60100 <para>
60101 The IP address of the interface that received the message, as a string. This
60102 is NULL for locally submitted messages.
60103 </para>
60104 </listitem></varlistentry>
60105 <varlistentry>
60106 <term><emphasis role="bold">int&nbsp;interface_port</emphasis></term>
60107 <listitem>
60108 <para>
60109 The port on which this message was received. When testing with the <option>-bh</option>
60110 command line option, the value of this variable is -1 unless a port has been
60111 specified via the <option>-oMi</option> option.
60112 </para>
60113 </listitem></varlistentry>
60114 <varlistentry>
60115 <term><emphasis role="bold">uschar&nbsp;*message_id</emphasis></term>
60116 <listitem>
60117 <para>
60118 This variable contains Exim&#x2019;s message id for the incoming message (the value of
60119 <varname>$message_exim_id</varname>) as a zero-terminated string.
60120 </para>
60121 </listitem></varlistentry>
60122 <varlistentry>
60123 <term><emphasis role="bold">uschar&nbsp;*received_protocol</emphasis></term>
60124 <listitem>
60125 <para>
60126 The name of the protocol by which the message was received.
60127 </para>
60128 </listitem></varlistentry>
60129 <varlistentry>
60130 <term><emphasis role="bold">int&nbsp;recipients_count</emphasis></term>
60131 <listitem>
60132 <para>
60133 The number of accepted recipients.
60134 </para>
60135 </listitem></varlistentry>
60136 <varlistentry>
60137 <term><emphasis role="bold">recipient_item&nbsp;*recipients_list</emphasis></term>
60138 <listitem>
60139 <para>
60140 <indexterm role="concept">
60141 <primary>recipient</primary>
60142 <secondary>adding in local scan</secondary>
60143 </indexterm>
60144 <indexterm role="concept">
60145 <primary>recipient</primary>
60146 <secondary>removing in local scan</secondary>
60147 </indexterm>
60148 The list of accepted recipients, held in a vector of length
60149 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
60150 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
60151 below). You can delete recipients by removing them from the vector and
60152 adjusting the value in <option>recipients_count</option>. In particular, by setting
60153 <option>recipients_count</option> to zero you remove all recipients. If you then return the
60154 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
60155 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
60156 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
60157 </para>
60158 </listitem></varlistentry>
60159 <varlistentry>
60160 <term><emphasis role="bold">uschar&nbsp;*sender_address</emphasis></term>
60161 <listitem>
60162 <para>
60163 The envelope sender address. For bounce messages this is the empty string.
60164 </para>
60165 </listitem></varlistentry>
60166 <varlistentry>
60167 <term><emphasis role="bold">uschar&nbsp;*sender_host_address</emphasis></term>
60168 <listitem>
60169 <para>
60170 The IP address of the sending host, as a string. This is NULL for
60171 locally-submitted messages.
60172 </para>
60173 </listitem></varlistentry>
60174 <varlistentry>
60175 <term><emphasis role="bold">uschar&nbsp;*sender_host_authenticated</emphasis></term>
60176 <listitem>
60177 <para>
60178 The name of the authentication mechanism that was used, or NULL if the message
60179 was not received over an authenticated SMTP connection.
60180 </para>
60181 </listitem></varlistentry>
60182 <varlistentry>
60183 <term><emphasis role="bold">uschar&nbsp;*sender_host_name</emphasis></term>
60184 <listitem>
60185 <para>
60186 The name of the sending host, if known.
60187 </para>
60188 </listitem></varlistentry>
60189 <varlistentry>
60190 <term><emphasis role="bold">int&nbsp;sender_host_port</emphasis></term>
60191 <listitem>
60192 <para>
60193 The port on the sending host.
60194 </para>
60195 </listitem></varlistentry>
60196 <varlistentry>
60197 <term><emphasis role="bold">BOOL&nbsp;smtp_input</emphasis></term>
60198 <listitem>
60199 <para>
60200 This variable is TRUE for all SMTP input, including BSMTP.
60201 </para>
60202 </listitem></varlistentry>
60203 <varlistentry>
60204 <term><emphasis role="bold">BOOL&nbsp;smtp_batched_input</emphasis></term>
60205 <listitem>
60206 <para>
60207 This variable is TRUE for BSMTP input.
60208 </para>
60209 </listitem></varlistentry>
60210 <varlistentry>
60211 <term><emphasis role="bold">int&nbsp;store_pool</emphasis></term>
60212 <listitem>
60213 <para>
60214 The contents of this variable control which pool of memory is used for new
60215 requests. See section <xref linkend="SECTmemhanloc"/> for details.
60216 </para>
60217 </listitem></varlistentry>
60218 </variablelist>
60219 </section>
60220 <section id="SECID209">
60221 <title>Structure of header lines</title>
60222 <para>
60223 The <option>header_line</option> structure contains the members listed below.
60224 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
60225 (see below). You can cause header lines to be ignored (deleted) by setting
60226 their type to *.
60227 </para>
60228 <variablelist>
60229 <varlistentry>
60230 <term><emphasis role="bold">struct&nbsp;header_line&nbsp;*next</emphasis></term>
60231 <listitem>
60232 <para>
60233 A pointer to the next header line, or NULL for the last line.
60234 </para>
60235 </listitem></varlistentry>
60236 <varlistentry>
60237 <term><emphasis role="bold">int&nbsp;type</emphasis></term>
60238 <listitem>
60239 <para>
60240 A code identifying certain headers that Exim recognizes. The codes are printing
60241 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
60242 Notice in particular that any header line whose type is * is not transmitted
60243 with the message. This flagging is used for header lines that have been
60244 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
60245 lines.) Effectively, * means <quote>deleted</quote>.
60246 </para>
60247 </listitem></varlistentry>
60248 <varlistentry>
60249 <term><emphasis role="bold">int&nbsp;slen</emphasis></term>
60250 <listitem>
60251 <para>
60252 The number of characters in the header line, including the terminating and any
60253 internal newlines.
60254 </para>
60255 </listitem></varlistentry>
60256 <varlistentry>
60257 <term><emphasis role="bold">uschar&nbsp;*text</emphasis></term>
60258 <listitem>
60259 <para>
60260 A pointer to the text of the header. It always ends with a newline, followed by
60261 a zero byte. Internal newlines are preserved.
60262 </para>
60263 </listitem></varlistentry>
60264 </variablelist>
60265 </section>
60266 <section id="SECID210">
60267 <title>Structure of recipient items</title>
60268 <para>
60269 The <option>recipient_item</option> structure contains these members:
60270 </para>
60271 <variablelist>
60272 <varlistentry>
60273 <term><emphasis role="bold">uschar&nbsp;*address</emphasis></term>
60274 <listitem>
60275 <para>
60276 This is a pointer to the recipient address as it was received.
60277 </para>
60278 </listitem></varlistentry>
60279 <varlistentry>
60280 <term><emphasis role="bold">int&nbsp;pno</emphasis></term>
60281 <listitem>
60282 <para>
60283 This is used in later Exim processing when top level addresses are created by
60284 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
60285 and must always contain -1 at this stage.
60286 </para>
60287 </listitem></varlistentry>
60288 <varlistentry>
60289 <term><emphasis role="bold">uschar&nbsp;*errors_to</emphasis></term>
60290 <listitem>
60291 <para>
60292 If this value is not NULL, bounce messages caused by failing to deliver to the
60293 recipient are sent to the address it contains. In other words, it overrides the
60294 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
60295 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
60296 an unqualified address, Exim qualifies it using the domain from
60297 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
60298 is NULL for all recipients.
60299 </para>
60300 </listitem></varlistentry>
60301 </variablelist>
60302 </section>
60303 <section id="SECID211">
60304 <title>Available Exim functions</title>
60305 <para>
60306 <indexterm role="concept">
60307 <primary><function>local_scan()</function> function</primary>
60308 <secondary>available Exim functions</secondary>
60309 </indexterm>
60310 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
60311 These are the only ones that are guaranteed to be maintained from release to
60312 release:
60313 </para>
60314 <variablelist>
60315 <varlistentry>
60316 <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>
60317 <listitem>
60318 <para>
60319 This function creates a child process that runs the command specified by
60320 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
60321 be NULL if no environment variables are to be passed. A new umask is supplied
60322 for the process in <option>newumask</option>.
60323 </para>
60324 <para>
60325 Pipes to the standard input and output of the new process are set up
60326 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
60327 standard error is cloned to the standard output. If there are any file
60328 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
60329 argument is TRUE, the new process is made into a process group leader.
60330 </para>
60331 <para>
60332 The function returns the pid of the new process, or -1 if things go wrong.
60333 </para>
60334 </listitem></varlistentry>
60335 <varlistentry>
60336 <term><emphasis role="bold">int&nbsp;child_close(pid_t&nbsp;pid,&nbsp;int&nbsp;timeout)</emphasis></term>
60337 <listitem>
60338 <para>
60339 This function waits for a child process to terminate, or for a timeout (in
60340 seconds) to expire. A timeout value of zero means wait as long as it takes. The
60341 return value is as follows:
60342 </para>
60343 <itemizedlist>
60344 <listitem>
60345 <para>
60346 &gt;= 0
60347 </para>
60348 <para>
60349 The process terminated by a normal exit and the value is the process
60350 ending status.
60351 </para>
60352 </listitem>
60353 <listitem>
60354 <para>
60355 &lt; 0 and &gt; &ndash;256
60356 </para>
60357 <para>
60358 The process was terminated by a signal and the value is the negation of the
60359 signal number.
60360 </para>
60361 </listitem>
60362 <listitem>
60363 <para>
60364 &ndash;256
60365 </para>
60366 <para>
60367 The process timed out.
60368 </para>
60369 </listitem>
60370 <listitem>
60371 <para>
60372 &ndash;257
60373 </para>
60374 <para>
60375 The was some other error in wait(); <option>errno</option> is still set.
60376 </para>
60377 </listitem>
60378 </itemizedlist>
60379 </listitem></varlistentry>
60380 <varlistentry>
60381 <term><emphasis role="bold">pid_t&nbsp;child_open_exim(int&nbsp;*fd)</emphasis></term>
60382 <listitem>
60383 <para>
60384 This function provide you with a means of submitting a new message to
60385 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
60386 want, but this packages it all up for you.) The function creates a pipe,
60387 forks a subprocess that is running
60388 </para>
60389 <literallayout class="monospaced">
60390 exim -t -oem -oi -f &lt;&gt;
60391 </literallayout>
60392 <para>
60393 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
60394 that is connected to the standard input. The yield of the function is the PID
60395 of the subprocess. You can then write a message to the file descriptor, with
60396 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
60397 </para>
60398 <para>
60399 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
60400 finish and to collect its ending status. A timeout value of zero is usually
60401 fine in this circumstance. Unless you have made a mistake with the recipient
60402 addresses, you should get a return code of zero.
60403 </para>
60404 </listitem></varlistentry>
60405 <varlistentry>
60406 <term><emphasis role="bold">pid_t&nbsp;child_open_exim2(int&nbsp;*fd,&nbsp;uschar&nbsp;*sender,&nbsp;uschar&nbsp;*sender_authentication)</emphasis></term>
60407 <listitem>
60408 <para>
60409 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
60410 that it runs is:
60411 </para>
60412 <literallayout>
60413 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
60414 </literallayout>
60415 <para>
60416 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
60417 </para>
60418 </listitem></varlistentry>
60419 <varlistentry>
60420 <term><emphasis role="bold">void&nbsp;debug_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
60421 <listitem>
60422 <para>
60423 This is Exim&#x2019;s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
60424 output is written to the standard error stream. If no debugging is selected,
60425 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
60426 conditional on the <literal>local_scan</literal> debug selector by coding like this:
60427 </para>
60428 <literallayout class="monospaced">
60429 if ((debug_selector &amp; D_local_scan) != 0)
60430   debug_printf("xxx", ...);
60431 </literallayout>
60432 </listitem></varlistentry>
60433 <varlistentry>
60434 <term><emphasis role="bold">uschar&nbsp;*expand_string(uschar&nbsp;*string)</emphasis></term>
60435 <listitem>
60436 <para>
60437 This is an interface to Exim&#x2019;s string expansion code. The return value is the
60438 expanded string, or NULL if there was an expansion failure.
60439 The C variable <option>expand_string_message</option> contains an error message after an
60440 expansion failure. If expansion does not change the string, the return value is
60441 the pointer to the input string. Otherwise, the return value points to a new
60442 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
60443 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
60444 </para>
60445 </listitem></varlistentry>
60446 <varlistentry>
60447 <term><emphasis role="bold">void&nbsp;header_add(int&nbsp;type,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
60448 <listitem>
60449 <para>
60450 This function allows you to an add additional header line at the end of the
60451 existing ones. The first argument is the type, and should normally be a space
60452 character. The second argument is a format string and any number of
60453 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
60454 if you want, and you must ensure that the string ends with a newline.
60455 </para>
60456 </listitem></varlistentry>
60457 <varlistentry>
60458 <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>
60459 <listitem>
60460 <para>
60461 This function adds a new header line at a specified point in the header
60462 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
60463 </para>
60464 <para>
60465 If <option>name</option> is NULL, the new header is added at the end of the chain if
60466 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
60467 NULL, the header lines are searched for the first non-deleted header that
60468 matches the name. If one is found, the new header is added before it if
60469 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
60470 found header and any adjacent subsequent ones with the same name (even if
60471 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
60472 option controls where the header is added. If it is true, addition is at the
60473 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
60474 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
60475 </para>
60476 <literallayout class="monospaced">
60477 header_add_at_position(TRUE, US"Received", TRUE,
60478   ' ', "X-xxx: ...");
60479 </literallayout>
60480 <para>
60481 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
60482 there may not be if <option>received_header_text</option> expands to an empty string.
60483 </para>
60484 </listitem></varlistentry>
60485 <varlistentry>
60486 <term><emphasis role="bold">void&nbsp;header_remove(int&nbsp;occurrence,&nbsp;uschar&nbsp;*name)</emphasis></term>
60487 <listitem>
60488 <para>
60489 This function removes header lines. If <option>occurrence</option> is zero or negative, all
60490 occurrences of the header are removed. If occurrence is greater than zero, that
60491 particular instance of the header is removed. If no header(s) can be found that
60492 match the specification, the function does nothing.
60493 </para>
60494 </listitem></varlistentry>
60495 <varlistentry>
60496 <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>
60497 <listitem>
60498 <para>
60499 This function tests whether the given header has the given name. It is not just
60500 a string comparison, because white space is permitted between the name and the
60501 colon. If the <option>notdel</option> argument is true, a false return is forced for all
60502 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
60503 </para>
60504 <literallayout class="monospaced">
60505 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
60506 </literallayout>
60507 </listitem></varlistentry>
60508 <varlistentry>
60509 <term><emphasis role="bold">uschar&nbsp;*lss_b64encode(uschar&nbsp;*cleartext,&nbsp;int&nbsp;length)</emphasis></term>
60510 <listitem>
60511 <para>
60512 <indexterm role="concept">
60513 <primary>base64 encoding</primary>
60514 <secondary>functions for <function>local_scan()</function> use</secondary>
60515 </indexterm>
60516 This function base64-encodes a string, which is passed by address and length.
60517 The text may contain bytes of any value, including zero. The result is passed
60518 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
60519 zero-terminated.
60520 </para>
60521 </listitem></varlistentry>
60522 <varlistentry>
60523 <term><emphasis role="bold">int&nbsp;lss_b64decode(uschar&nbsp;*codetext,&nbsp;uschar&nbsp;**cleartext)</emphasis></term>
60524 <listitem>
60525 <para>
60526 This function decodes a base64-encoded string. Its arguments are a
60527 zero-terminated base64-encoded string and the address of a variable that is set
60528 to point to the result, which is in dynamic memory. The length of the decoded
60529 string is the yield of the function. If the input is invalid base64 data, the
60530 yield is -1. A zero byte is added to the end of the output string to make it
60531 easy to interpret as a C string (assuming it contains no zeros of its own). The
60532 added zero byte is not included in the returned count.
60533 </para>
60534 </listitem></varlistentry>
60535 <varlistentry>
60536 <term><emphasis role="bold">int&nbsp;lss_match_domain(uschar&nbsp;*domain,&nbsp;uschar&nbsp;*list)</emphasis></term>
60537 <listitem>
60538 <para>
60539 This function checks for a match in a domain list. Domains are always
60540 matched caselessly. The return value is one of the following:
60541 </para>
60542 <literallayout>
60543 <literal>OK     </literal> match succeeded
60544 <literal>FAIL   </literal> match failed
60545 <literal>DEFER  </literal> match deferred
60546 </literallayout>
60547 <para>
60548 DEFER is usually caused by some kind of lookup defer, such as the
60549 inability to contact a database.
60550 </para>
60551 </listitem></varlistentry>
60552 <varlistentry>
60553 <term><emphasis role="bold">int&nbsp;lss_match_local_part(uschar&nbsp;*localpart,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
60554 <listitem>
60555 <para>
60556 This function checks for a match in a local part list. The third argument
60557 controls case-sensitivity. The return values are as for
60558 <emphasis>lss_match_domain()</emphasis>.
60559 </para>
60560 </listitem></varlistentry>
60561 <varlistentry>
60562 <term><emphasis role="bold">int&nbsp;lss_match_address(uschar&nbsp;*address,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
60563 <listitem>
60564 <para>
60565 This function checks for a match in an address list. The third argument
60566 controls the case-sensitivity of the local part match. The domain is always
60567 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
60568 </para>
60569 </listitem></varlistentry>
60570 <varlistentry>
60571 <term><emphasis role="bold">int&nbsp;lss_match_host(uschar&nbsp;*host_name,&nbsp;uschar&nbsp;*host_address,&nbsp;uschar&nbsp;*list)</emphasis></term>
60572 <listitem>
60573 <para>
60574 This function checks for a match in a host list. The most common usage is
60575 expected to be
60576 </para>
60577 <literallayout class="monospaced">
60578 lss_match_host(sender_host_name, sender_host_address, ...)
60579 </literallayout>
60580 <para>
60581 <indexterm role="variable">
60582 <primary><varname>$sender_host_address</varname></primary>
60583 </indexterm>
60584 An empty address field matches an empty item in the host list. If the host name
60585 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
60586 looked up if a host name is required to match an item in the list. The return
60587 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
60588 returns ERROR in the case when it had to look up a host name, but the lookup
60589 failed.
60590 </para>
60591 </listitem></varlistentry>
60592 <varlistentry>
60593 <term><emphasis role="bold">void&nbsp;log_write(unsigned&nbsp;int&nbsp;selector,&nbsp;int&nbsp;which,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
60594 <listitem>
60595 <para>
60596 This function writes to Exim&#x2019;s log files. The first argument should be zero (it
60597 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
60598 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
60599 them. It specifies to which log or logs the message is written. The remaining
60600 arguments are a format and relevant insertion arguments. The string should not
60601 contain any newlines, not even at the end.
60602 </para>
60603 </listitem></varlistentry>
60604 <varlistentry>
60605 <term><emphasis role="bold">void&nbsp;receive_add_recipient(uschar&nbsp;*address,&nbsp;int&nbsp;pno)</emphasis></term>
60606 <listitem>
60607 <para>
60608 This function adds an additional recipient to the message. The first argument
60609 is the recipient address. If it is unqualified (has no domain), it is qualified
60610 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
60611 </para>
60612 <para>
60613 This function does not allow you to specify a private <option>errors_to</option> address (as
60614 described with the structure of <option>recipient_item</option> above), because it pre-dates
60615 the addition of that field to the structure. However, it is easy to add such a
60616 value afterwards. For example:
60617 </para>
60618 <literallayout class="monospaced">
60619  receive_add_recipient(US"monitor@mydom.example", -1);
60620  recipients_list[recipients_count-1].errors_to =
60621    US"postmaster@mydom.example";
60622 </literallayout>
60623 </listitem></varlistentry>
60624 <varlistentry>
60625 <term><emphasis role="bold">BOOL&nbsp;receive_remove_recipient(uschar&nbsp;*recipient)</emphasis></term>
60626 <listitem>
60627 <para>
60628 This is a convenience function to remove a named recipient from the list of
60629 recipients. It returns true if a recipient was removed, and false if no
60630 matching recipient could be found. The argument must be a complete email
60631 address.
60632 </para>
60633 </listitem></varlistentry>
60634 </variablelist>
60635 <para>
60636 <indexterm role="concept">
60637 <primary>RFC 2047</primary>
60638 </indexterm>
60639 </para>
60640 <variablelist>
60641 <varlistentry>
60642 <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>
60643 <listitem>
60644 <para>
60645 This function decodes strings that are encoded according to RFC 2047. Typically
60646 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
60647 from the Q or B encoding into a byte-string. Then, if provided with the name of
60648 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
60649 made  to translate the result to the named character set. If this fails, the
60650 binary string is returned with an error message.
60651 </para>
60652 <para>
60653 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
60654 maximum MIME word length is enforced. The third argument is the target
60655 encoding, or NULL if no translation is wanted.
60656 </para>
60657 <para>
60658 <indexterm role="concept">
60659 <primary>binary zero</primary>
60660 <secondary>in RFC 2047 decoding</secondary>
60661 </indexterm>
60662 <indexterm role="concept">
60663 <primary>RFC 2047</primary>
60664 <secondary>binary zero in</secondary>
60665 </indexterm>
60666 If a binary zero is encountered in the decoded string, it is replaced by the
60667 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
60668 not be 0 because header lines are handled as zero-terminated strings.
60669 </para>
60670 <para>
60671 The function returns the result of processing the string, zero-terminated; if
60672 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
60673 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
60674 </para>
60675 <para>
60676 If an error is encountered, the function returns NULL and uses the <option>error</option>
60677 argument to return an error message. The variable pointed to by <option>error</option> is
60678 set to NULL if there is no error; it may be set non-NULL even when the function
60679 returns a non-NULL value if decoding was successful, but there was a problem
60680 with translation.
60681 </para>
60682 </listitem></varlistentry>
60683 <varlistentry>
60684 <term><emphasis role="bold">int&nbsp;smtp_fflush(void)</emphasis></term>
60685 <listitem>
60686 <para>
60687 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
60688 below.
60689 </para>
60690 </listitem></varlistentry>
60691 <varlistentry>
60692 <term><emphasis role="bold">void&nbsp;smtp_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
60693 <listitem>
60694 <para>
60695 The arguments of this function are like <function>printf()</function>; it writes to the SMTP
60696 output stream. You should use this function only when there is an SMTP output
60697 stream, that is, when the incoming message is being received via interactive
60698 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
60699 is FALSE. If you want to test for an incoming message from another host (as
60700 opposed to a local process that used the <option>-bs</option> command line option), you can
60701 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
60702 is involved.
60703 </para>
60704 <para>
60705 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
60706 output function, so it can be used for all forms of SMTP connection.
60707 </para>
60708 <para>
60709 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
60710 must start with an appropriate response code: 550 if you are going to return
60711 LOCAL_SCAN_REJECT, 451 if you are going to return
60712 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
60713 initial lines of a multi-line response, the code must be followed by a hyphen
60714 to indicate that the line is not the final response line. You must also ensure
60715 that the lines you write terminate with CRLF. For example:
60716 </para>
60717 <literallayout class="monospaced">
60718 smtp_printf("550-this is some extra info\r\n");
60719 return LOCAL_SCAN_REJECT;
60720 </literallayout>
60721 <para>
60722 Note that you can also create multi-line responses by including newlines in
60723 the data returned via the <option>return_text</option> argument. The added value of using
60724 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
60725 multiple output lines.
60726 </para>
60727 <para>
60728 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
60729 does not automatically flush pending output, and therefore does not test
60730 the state of the stream. (In the main code of Exim, flushing and error
60731 detection is done when Exim is ready for the next SMTP input command.) If
60732 you want to flush the output and check for an error (for example, the
60733 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
60734 arguments. It flushes the output stream, and returns a non-zero value if there
60735 is an error.
60736 </para>
60737 </listitem></varlistentry>
60738 <varlistentry>
60739 <term><emphasis role="bold">void&nbsp;*store_get(int)</emphasis></term>
60740 <listitem>
60741 <para>
60742 This function accesses Exim&#x2019;s internal store (memory) manager. It gets a new
60743 chunk of memory whose size is given by the argument. Exim bombs out if it ever
60744 runs out of memory. See the next section for a discussion of memory handling.
60745 </para>
60746 </listitem></varlistentry>
60747 <varlistentry>
60748 <term><emphasis role="bold">void&nbsp;*store_get_perm(int)</emphasis></term>
60749 <listitem>
60750 <para>
60751 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
60752 permanent pool. See the next section for a discussion of memory handling.
60753 </para>
60754 </listitem></varlistentry>
60755 <varlistentry>
60756 <term><emphasis role="bold">uschar&nbsp;*string_copy(uschar&nbsp;*string)</emphasis></term>
60757 <listitem>
60758 <para>
60759 See below.
60760 </para>
60761 </listitem></varlistentry>
60762 <varlistentry>
60763 <term><emphasis role="bold">uschar&nbsp;*string_copyn(uschar&nbsp;*string,&nbsp;int&nbsp;length)</emphasis></term>
60764 <listitem>
60765 <para>
60766 See below.
60767 </para>
60768 </listitem></varlistentry>
60769 <varlistentry>
60770 <term><emphasis role="bold">uschar&nbsp;*string_sprintf(char&nbsp;*format,&nbsp;...)</emphasis></term>
60771 <listitem>
60772 <para>
60773 These three functions create strings using Exim&#x2019;s dynamic memory facilities.
60774 The first makes a copy of an entire string. The second copies up to a maximum
60775 number of characters, indicated by the second argument. The third uses a format
60776 and insertion arguments to create a new string. In each case, the result is a
60777 pointer to a new string in the current memory pool. See the next section for
60778 more discussion.
60779 </para>
60780 </listitem></varlistentry>
60781 </variablelist>
60782 </section>
60783 <section id="SECTmemhanloc">
60784 <title>More about Exim&#x2019;s memory handling</title>
60785 <para>
60786 <indexterm role="concept">
60787 <primary><function>local_scan()</function> function</primary>
60788 <secondary>memory handling</secondary>
60789 </indexterm>
60790 No function is provided for freeing memory, because that is never needed.
60791 The dynamic memory that Exim uses when receiving a message is automatically
60792 recycled if another message is received by the same process (this applies only
60793 to incoming SMTP connections &ndash; other input methods can supply only one
60794 message at a time). After receiving the last message, a reception process
60795 terminates.
60796 </para>
60797 <para>
60798 Because it is recycled, the normal dynamic memory cannot be used for holding
60799 data that must be preserved over a number of incoming messages on the same SMTP
60800 connection. However, Exim in fact uses two pools of dynamic memory; the second
60801 one is not recycled, and can be used for this purpose.
60802 </para>
60803 <para>
60804 If you want to allocate memory that remains available for subsequent messages
60805 in the same SMTP connection, you should set
60806 </para>
60807 <literallayout class="monospaced">
60808 store_pool = POOL_PERM
60809 </literallayout>
60810 <para>
60811 before calling the function that does the allocation. There is no need to
60812 restore the value if you do not need to; however, if you do want to revert to
60813 the normal pool, you can either restore the previous value of <option>store_pool</option> or
60814 set it explicitly to POOL_MAIN.
60815 </para>
60816 <para>
60817 The pool setting applies to all functions that get dynamic memory, including
60818 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
60819 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
60820 block of memory from the permanent pool while preserving the value of
60821 <option>store_pool</option>.
60822 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
60823 </para>
60824 </section>
60825 </chapter>
60826
60827 <chapter id="CHAPsystemfilter">
60828 <title>System-wide message filtering</title>
60829 <para>
60830 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
60831 <primary>filter</primary>
60832 <secondary>system filter</secondary>
60833 </indexterm>
60834 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
60835 <primary>filtering all mail</primary>
60836 </indexterm>
60837 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
60838 <primary>system filter</primary>
60839 </indexterm>
60840 The previous chapters (on ACLs and the local scan function) describe checks
60841 that can be applied to messages before they are accepted by a host. There is
60842 also a mechanism for checking messages once they have been received, but before
60843 they are delivered. This is called the <emphasis>system filter</emphasis>.
60844 </para>
60845 <para>
60846 The system filter operates in a similar manner to users&#x2019; filter files, but it
60847 is run just once per message (however many recipients the message has).
60848 It should not normally be used as a substitute for routing, because <option>deliver</option>
60849 commands in a system router provide new envelope recipient addresses.
60850 The system filter must be an Exim filter. It cannot be a Sieve filter.
60851 </para>
60852 <para>
60853 The system filter is run at the start of a delivery attempt, before any routing
60854 is done. If a message fails to be completely delivered at the first attempt,
60855 the system filter is run again at the start of every retry.
60856 If you want your filter to do something only once per message, you can make use
60857 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
60858 prevent it happening on retries.
60859 </para>
60860 <para>
60861 <indexterm role="variable">
60862 <primary><varname>$domain</varname></primary>
60863 </indexterm>
60864 <indexterm role="variable">
60865 <primary><varname>$local_part</varname></primary>
60866 </indexterm>
60867 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
60868 specific to individual recipient addresses, such as <varname>$local_part</varname> and
60869 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
60870 you want to run a centrally-specified filter for each recipient address
60871 independently, you can do so by setting up a suitable <command>redirect</command> router, as
60872 described in section <xref linkend="SECTperaddfil"/> below.
60873 </para>
60874 <section id="SECID212">
60875 <title>Specifying a system filter</title>
60876 <para>
60877 <indexterm role="concept">
60878 <primary>uid (user id)</primary>
60879 <secondary>system filter</secondary>
60880 </indexterm>
60881 <indexterm role="concept">
60882 <primary>gid (group id)</primary>
60883 <secondary>system filter</secondary>
60884 </indexterm>
60885 The name of the file that contains the system filter must be specified by
60886 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
60887 other than root, you must also set <option>system_filter_user</option> and
60888 <option>system_filter_group</option> as appropriate. For example:
60889 </para>
60890 <literallayout class="monospaced">
60891 system_filter = /etc/mail/exim.filter
60892 system_filter_user = exim
60893 </literallayout>
60894 <para>
60895 If a system filter generates any deliveries directly to files or pipes (via the
60896 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
60897 specified by setting <option>system_filter_file_transport</option> and
60898 <option>system_filter_pipe_transport</option>, respectively. Similarly,
60899 <option>system_filter_reply_transport</option> must be set to handle any messages generated
60900 by the <option>reply</option> command.
60901 </para>
60902 </section>
60903 <section id="SECID213">
60904 <title>Testing a system filter</title>
60905 <para>
60906 You can run simple tests of a system filter in the same way as for a user
60907 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
60908 are permitted only in system filters are recognized.
60909 </para>
60910 <para>
60911 If you want to test the combined effect of a system filter and a user filter,
60912 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
60913 </para>
60914 </section>
60915 <section id="SECID214">
60916 <title>Contents of a system filter</title>
60917 <para>
60918 The language used to specify system filters is the same as for users&#x2019; filter
60919 files. It is described in the separate end-user document <emphasis>Exim&#x2019;s interface to
60920 mail filtering</emphasis>. However, there are some additional features that are
60921 available only in system filters; these are described in subsequent sections.
60922 If they are encountered in a user&#x2019;s filter file or when testing with <option>-bf</option>,
60923 they cause errors.
60924 </para>
60925 <para>
60926 <indexterm role="concept">
60927 <primary>frozen messages</primary>
60928 <secondary>manual thaw; testing in filter</secondary>
60929 </indexterm>
60930 There are two special conditions which, though available in users&#x2019; filter
60931 files, are designed for use in system filters. The condition <option>first_delivery</option>
60932 is true only for the first attempt at delivering a message, and
60933 <option>manually_thawed</option> is true only if the message has been frozen, and
60934 subsequently thawed by an admin user. An explicit forced delivery counts as a
60935 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
60936 </para>
60937 <para>
60938 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
60939 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
60940 succeed, it will not be tried again.
60941 If you want Exim to retry an unseen delivery until it succeeds, you should
60942 arrange to set it up every time the filter runs.
60943 </para>
60944 <para>
60945 When a system filter finishes running, the values of the variables <varname>$n0</varname> &ndash;
60946 <varname>$n9</varname> are copied into <varname>$sn0</varname> &ndash; <varname>$sn9</varname> and are thereby made available to
60947 users&#x2019; filter files. Thus a system filter can, for example, set up <quote>scores</quote>
60948 to which users&#x2019; filter files can refer.
60949 </para>
60950 </section>
60951 <section id="SECID215">
60952 <title>Additional variable for system filters</title>
60953 <para>
60954 <indexterm role="variable">
60955 <primary><varname>$recipients</varname></primary>
60956 </indexterm>
60957 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
60958 of the message (separated by commas and white space), is available in system
60959 filters. It is not available in users&#x2019; filters for privacy reasons.
60960 </para>
60961 </section>
60962 <section id="SECID216">
60963 <title>Defer, freeze, and fail commands for system filters</title>
60964 <para>
60965 <indexterm role="concept">
60966 <primary>freezing messages</primary>
60967 </indexterm>
60968 <indexterm role="concept">
60969 <primary>message</primary>
60970 <secondary>freezing</secondary>
60971 </indexterm>
60972 <indexterm role="concept">
60973 <primary>message</primary>
60974 <secondary>forced failure</secondary>
60975 </indexterm>
60976 <indexterm role="concept">
60977 <primary><option>fail</option></primary>
60978 <secondary>in system filter</secondary>
60979 </indexterm>
60980 <indexterm role="concept">
60981 <primary><option>freeze</option> in system filter</primary>
60982 </indexterm>
60983 <indexterm role="concept">
60984 <primary><option>defer</option> in system filter</primary>
60985 </indexterm>
60986 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
60987 always available in system filters, but are not normally enabled in users&#x2019;
60988 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
60989 for the <command>redirect</command> router.) These commands can optionally be followed by the
60990 word <option>text</option> and a string containing an error message, for example:
60991 </para>
60992 <literallayout class="monospaced">
60993 fail text "this message looks like spam to me"
60994 </literallayout>
60995 <para>
60996 The keyword <option>text</option> is optional if the next character is a double quote.
60997 </para>
60998 <para>
60999 The <option>defer</option> command defers delivery of the original recipients of the
61000 message. The <option>fail</option> command causes all the original recipients to be failed,
61001 and a bounce message to be created. The <option>freeze</option> command suspends all
61002 delivery attempts for the original recipients. In all cases, any new deliveries
61003 that are specified by the filter are attempted as normal after the filter has
61004 run.
61005 </para>
61006 <para>
61007 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
61008 not manually frozen since. This means that automatic freezing by a system
61009 filter can be used as a way of checking out suspicious messages. If a message
61010 is found to be all right, manually unfreezing it allows it to be delivered.
61011 </para>
61012 <para>
61013 <indexterm role="concept">
61014 <primary>log</primary>
61015 <secondary><option>fail</option> command log line</secondary>
61016 </indexterm>
61017 <indexterm role="concept">
61018 <primary><option>fail</option></primary>
61019 <secondary>log line; reducing</secondary>
61020 </indexterm>
61021 The text given with a fail command is used as part of the bounce message as
61022 well as being written to the log. If the message is quite long, this can fill
61023 up a lot of log space when such failures are common. To reduce the size of the
61024 log message, Exim interprets the text in a special way if it starts with the
61025 two characters <literal>&lt;&lt;</literal> and contains <literal>&gt;&gt;</literal> later. The text between these two
61026 strings is written to the log, and the rest of the text is used in the bounce
61027 message. For example:
61028 </para>
61029 <literallayout class="monospaced">
61030 fail "&lt;&lt;filter test 1&gt;&gt;Your message is rejected \
61031      because it contains attachments that we are \
61032      not prepared to receive."
61033 </literallayout>
61034 <para>
61035 <indexterm role="concept">
61036 <primary>loop</primary>
61037 <secondary>caused by <option>fail</option></secondary>
61038 </indexterm>
61039 Take great care with the <option>fail</option> command when basing the decision to fail on
61040 the contents of the message, because the bounce message will of course include
61041 the contents of the original message and will therefore trigger the <option>fail</option>
61042 command again (causing a mail loop) unless steps are taken to prevent this.
61043 Testing the <option>error_message</option> condition is one way to prevent this. You could
61044 use, for example
61045 </para>
61046 <literallayout class="monospaced">
61047 if $message_body contains "this is spam" and not error_message
61048 then fail text "spam is not wanted here" endif
61049 </literallayout>
61050 <para>
61051 though of course that might let through unwanted bounce messages. The
61052 alternative is clever checking of the body and/or headers to detect bounces
61053 generated by the filter.
61054 </para>
61055 <para>
61056 The interpretation of a system filter file ceases after a
61057 <option>defer</option>,
61058 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
61059 set up earlier in the filter file are honoured, so you can use a sequence such
61060 as
61061 </para>
61062 <literallayout class="monospaced">
61063 mail ...
61064 freeze
61065 </literallayout>
61066 <para>
61067 to send a specified message when the system filter is freezing (or deferring or
61068 failing) a message. The normal deliveries for the message do not, of course,
61069 take place.
61070 </para>
61071 </section>
61072 <section id="SECTaddremheasys">
61073 <title>Adding and removing headers in a system filter</title>
61074 <para>
61075 <indexterm role="concept">
61076 <primary>header lines</primary>
61077 <secondary>adding; in system filter</secondary>
61078 </indexterm>
61079 <indexterm role="concept">
61080 <primary>header lines</primary>
61081 <secondary>removing; in system filter</secondary>
61082 </indexterm>
61083 <indexterm role="concept">
61084 <primary>filter</primary>
61085 <secondary>header lines; adding/removing</secondary>
61086 </indexterm>
61087 Two filter commands that are available only in system filters are:
61088 </para>
61089 <literallayout class="monospaced">
61090 headers add &lt;string&gt;
61091 headers remove &lt;string&gt;
61092 </literallayout>
61093 <para>
61094 The argument for the <option>headers add</option> is a string that is expanded and then
61095 added to the end of the message&#x2019;s headers. It is the responsibility of the
61096 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
61097 space is ignored, and if the string is otherwise empty, or if the expansion is
61098 forced to fail, the command has no effect.
61099 </para>
61100 <para>
61101 You can use <quote>\n</quote> within the string, followed by white space, to specify
61102 continued header lines. More than one header may be added in one command by
61103 including <quote>\n</quote> within the string without any following white space. For
61104 example:
61105 </para>
61106 <literallayout class="monospaced">
61107 headers add "X-header-1: ....\n  \
61108              continuation of X-header-1 ...\n\
61109              X-header-2: ...."
61110 </literallayout>
61111 <para>
61112 Note that the header line continuation white space after the first newline must
61113 be placed before the backslash that continues the input string, because white
61114 space after input continuations is ignored.
61115 </para>
61116 <para>
61117 The argument for <option>headers remove</option> is a colon-separated list of header names.
61118 This command applies only to those headers that are stored with the message;
61119 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
61120 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
61121 header with the same name, they are all removed.
61122 </para>
61123 <para>
61124 The <option>headers</option> command in a system filter makes an immediate change to the set
61125 of header lines that was received with the message (with possible additions
61126 from ACL processing). Subsequent commands in the system filter operate on the
61127 modified set, which also forms the basis for subsequent message delivery.
61128 Unless further modified during routing or transporting, this set of headers is
61129 used for all recipients of the message.
61130 </para>
61131 <para>
61132 During routing and transporting, the variables that refer to the contents of
61133 header lines refer only to those lines that are in this set. Thus, header lines
61134 that are added by a system filter are visible to users&#x2019; filter files and to all
61135 routers and transports. This contrasts with the manipulation of header lines by
61136 routers and transports, which is not immediate, but which instead is saved up
61137 until the message is actually being written (see section
61138 <xref linkend="SECTheadersaddrem"/>).
61139 </para>
61140 <para>
61141 If the message is not delivered at the first attempt, header lines that were
61142 added by the system filter are stored with the message, and so are still
61143 present at the next delivery attempt. Header lines that were removed are still
61144 present, but marked <quote>deleted</quote> so that they are not transported with the
61145 message. For this reason, it is usual to make the <option>headers</option> command
61146 conditional on <option>first_delivery</option> so that the set of header lines is not
61147 modified more than once.
61148 </para>
61149 <para>
61150 Because header modification in a system filter acts immediately, you have to
61151 use an indirect approach if you want to modify the contents of a header line.
61152 For example:
61153 </para>
61154 <literallayout class="monospaced">
61155 headers add "Old-Subject: $h_subject:"
61156 headers remove "Subject"
61157 headers add "Subject: new subject (was: $h_old-subject:)"
61158 headers remove "Old-Subject"
61159 </literallayout>
61160 </section>
61161 <section id="SECID217">
61162 <title>Setting an errors address in a system filter</title>
61163 <para>
61164 <indexterm role="concept">
61165 <primary>envelope sender</primary>
61166 </indexterm>
61167 In a system filter, if a <option>deliver</option> command is followed by
61168 </para>
61169 <literallayout class="monospaced">
61170 errors_to &lt;some address&gt;
61171 </literallayout>
61172 <para>
61173 in order to change the envelope sender (and hence the error reporting) for that
61174 delivery, any address may be specified. (In a user filter, only the current
61175 user&#x2019;s address can be set.) For example, if some mail is being monitored, you
61176 might use
61177 </para>
61178 <literallayout class="monospaced">
61179 unseen deliver monitor@spying.example errors_to root@local.example
61180 </literallayout>
61181 <para>
61182 to take a copy which would not be sent back to the normal error reporting
61183 address if its delivery failed.
61184 </para>
61185 </section>
61186 <section id="SECTperaddfil">
61187 <title>Per-address filtering</title>
61188 <para>
61189 <indexterm role="variable">
61190 <primary><varname>$domain</varname></primary>
61191 </indexterm>
61192 <indexterm role="variable">
61193 <primary><varname>$local_part</varname></primary>
61194 </indexterm>
61195 In contrast to the system filter, which is run just once per message for each
61196 delivery attempt, it is also possible to set up a system-wide filtering
61197 operation that runs once for each recipient address. In this case, variables
61198 such as <varname>$local_part</varname> and <varname>$domain</varname> can be used, and indeed, the choice of
61199 filter file could be made dependent on them. This is an example of a router
61200 which implements such a filter:
61201 </para>
61202 <literallayout class="monospaced">
61203 central_filter:
61204   check_local_user
61205   driver = redirect
61206   domains = +local_domains
61207   file = /central/filters/$local_part
61208   no_verify
61209   allow_filter
61210   allow_freeze
61211 </literallayout>
61212 <para>
61213 The filter is run in a separate process under its own uid. Therefore, either
61214 <option>check_local_user</option> must be set (as above), in which case the filter is run as
61215 the local user, or the <option>user</option> option must be used to specify which user to
61216 use. If both are set, <option>user</option> overrides.
61217 </para>
61218 <para>
61219 Care should be taken to ensure that none of the commands in the filter file
61220 specify a significant delivery if the message is to go on to be delivered to
61221 its intended recipient. The router will not then claim to have dealt with the
61222 address, so it will be passed on to subsequent routers to be delivered in the
61223 normal way.
61224 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
61225 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
61226 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
61227 </para>
61228 </section>
61229 </chapter>
61230
61231 <chapter id="CHAPmsgproc">
61232 <title>Message processing</title>
61233 <para>
61234 <indexterm role="concept" id="IIDmesproc" class="startofrange">
61235 <primary>message</primary>
61236 <secondary>general processing</secondary>
61237 </indexterm>
61238 Exim performs various transformations on the sender and recipient addresses of
61239 all messages that it handles, and also on the messages&#x2019; header lines. Some of
61240 these are optional and configurable, while others always take place. All of
61241 this processing, except rewriting as a result of routing, and the addition or
61242 removal of header lines while delivering, happens when a message is received,
61243 before it is placed on Exim&#x2019;s queue.
61244 </para>
61245 <para>
61246 Some of the automatic processing takes place by default only for
61247 <quote>locally-originated</quote> messages. This adjective is used to describe messages
61248 that are not received over TCP/IP, but instead are passed to an Exim process on
61249 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
61250 set up by the <option>-bs</option> command line option.
61251 </para>
61252 <para>
61253 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
61254 or ::1) are not considered to be locally-originated. Exim does not treat the
61255 loopback interface specially in any way.
61256 </para>
61257 <para>
61258 If you want the loopback interface to be treated specially, you must ensure
61259 that there are appropriate entries in your ACLs.
61260 </para>
61261 <section id="SECTsubmodnon">
61262 <title>Submission mode for non-local messages</title>
61263 <para>
61264 <indexterm role="concept">
61265 <primary>message</primary>
61266 <secondary>submission</secondary>
61267 </indexterm>
61268 <indexterm role="concept">
61269 <primary>submission mode</primary>
61270 </indexterm>
61271 Processing that happens automatically for locally-originated messages (unless
61272 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
61273 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
61274 state. Submission mode is set by the modifier
61275 </para>
61276 <literallayout class="monospaced">
61277 control = submission
61278 </literallayout>
61279 <para>
61280 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
61281 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
61282 a local submission, and is normally used when the source of the message is
61283 known to be an MUA running on a client host (as opposed to an MTA). For
61284 example, to set submission mode for messages originating on the IPv4 loopback
61285 interface, you could include the following in the MAIL ACL:
61286 </para>
61287 <literallayout class="monospaced">
61288 warn  hosts = 127.0.0.1
61289       control = submission
61290 </literallayout>
61291 <para>
61292 <indexterm role="concept">
61293 <primary><option>sender_retain</option> submission option</primary>
61294 </indexterm>
61295 There are some options that can be used when setting submission mode. A slash
61296 is used to separate options. For example:
61297 </para>
61298 <literallayout class="monospaced">
61299 control = submission/sender_retain
61300 </literallayout>
61301 <para>
61302 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
61303 true and <option>local_from_check</option> false for the current incoming message. The first
61304 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
61305 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
61306 authenticated sender. With this setting, Exim still fixes up messages by adding
61307 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
61308 attempt to check sender authenticity in header lines.
61309 </para>
61310 <para>
61311 When <option>sender_retain</option> is not set, a submission mode setting may specify a
61312 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
61313 example:
61314 </para>
61315 <literallayout class="monospaced">
61316 control = submission/domain=some.domain
61317 </literallayout>
61318 <para>
61319 The domain may be empty. How this value is used is described in sections
61320 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
61321 that allows you to specify the user&#x2019;s full name for inclusion in a created
61322 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
61323 </para>
61324 <literallayout class="monospaced">
61325 accept authenticated = *
61326        control = submission/domain=wonderland.example/\
61327                             name=${lookup {$authenticated_id} \
61328                                    lsearch {/etc/exim/namelist}}
61329 </literallayout>
61330 <para>
61331 Because the name may contain any characters, including slashes, the <option>name</option>
61332 option must be given last. The remainder of the string is used as the name. For
61333 the example above, if <filename>/etc/exim/namelist</filename> contains:
61334 </para>
61335 <literallayout class="monospaced">
61336 bigegg:  Humpty Dumpty
61337 </literallayout>
61338 <para>
61339 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
61340 line would be:
61341 </para>
61342 <literallayout class="monospaced">
61343 Sender: Humpty Dumpty &lt;bigegg@wonderland.example&gt;
61344 </literallayout>
61345 <para>
61346 <indexterm role="concept">
61347 <primary>return path</primary>
61348 <secondary>in submission mode</secondary>
61349 </indexterm>
61350 By default, submission mode forces the return path to the same address as is
61351 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
61352 specified, the return path is also left unchanged.
61353 </para>
61354 <para>
61355 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
61356 ACL. This means that any sender checks performed before the fix-ups use the
61357 untrusted sender address specified by the user, not the trusted sender address
61358 specified by submission mode. Although this might be slightly unexpected, it
61359 does mean that you can configure ACL checks to spot that a user is trying to
61360 spoof another&#x2019;s address.
61361 </para>
61362 </section>
61363 <section id="SECTlineendings">
61364 <title>Line endings</title>
61365 <para>
61366 <indexterm role="concept">
61367 <primary>line endings</primary>
61368 </indexterm>
61369 <indexterm role="concept">
61370 <primary>carriage return</primary>
61371 </indexterm>
61372 <indexterm role="concept">
61373 <primary>linefeed</primary>
61374 </indexterm>
61375 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
61376 linefeed) is the line ending for messages transmitted over the Internet using
61377 SMTP over TCP/IP. However, within individual operating systems, different
61378 conventions are used. For example, Unix-like systems use just LF, but others
61379 use CRLF or just CR.
61380 </para>
61381 <para>
61382 Exim was designed for Unix-like systems, and internally, it stores messages
61383 using the system&#x2019;s convention of a single LF as a line terminator. When
61384 receiving a message, all line endings are translated to this standard format.
61385 Originally, it was thought that programs that passed messages directly to an
61386 MTA within an operating system would use that system&#x2019;s convention. Experience
61387 has shown that this is not the case; for example, there are Unix applications
61388 that use CRLF in this circumstance. For this reason, and for compatibility with
61389 other MTAs, the way Exim handles line endings for all messages is now as
61390 follows:
61391 </para>
61392 <itemizedlist>
61393 <listitem>
61394 <para>
61395 LF not preceded by CR is treated as a line ending.
61396 </para>
61397 </listitem>
61398 <listitem>
61399 <para>
61400 CR is treated as a line ending; if it is immediately followed by LF, the LF
61401 is ignored.
61402 </para>
61403 </listitem>
61404 <listitem>
61405 <para>
61406 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
61407 nor a local message in the state where a line containing only a dot is a
61408 terminator.
61409 </para>
61410 </listitem>
61411 <listitem>
61412 <para>
61413 If a bare CR is encountered within a header line, an extra space is added after
61414 the line terminator so as not to end the header line. The reasoning behind this
61415 is that bare CRs in header lines are most likely either to be mistakes, or
61416 people trying to play silly games.
61417 </para>
61418 </listitem>
61419 <listitem>
61420 <para>
61421 If the first header line received in a message ends with CRLF, a subsequent
61422 bare LF in a header line is treated in the same way as a bare CR in a header
61423 line.
61424 </para>
61425 </listitem>
61426 </itemizedlist>
61427 </section>
61428 <section id="SECID218">
61429 <title>Unqualified addresses</title>
61430 <para>
61431 <indexterm role="concept">
61432 <primary>unqualified addresses</primary>
61433 </indexterm>
61434 <indexterm role="concept">
61435 <primary>address</primary>
61436 <secondary>qualification</secondary>
61437 </indexterm>
61438 By default, Exim expects every envelope address it receives from an external
61439 host to be fully qualified. Unqualified addresses cause negative responses to
61440 SMTP commands. However, because SMTP is used as a means of transporting
61441 messages from MUAs running on personal workstations, there is sometimes a
61442 requirement to accept unqualified addresses from specific hosts or IP networks.
61443 </para>
61444 <para>
61445 Exim has two options that separately control which hosts may send unqualified
61446 sender or recipient addresses in SMTP commands, namely
61447 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
61448 cases, if an unqualified address is accepted, it is qualified by adding the
61449 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
61450 </para>
61451 <para>
61452 <indexterm role="option">
61453 <primary><option>qualify_domain</option></primary>
61454 </indexterm>
61455 <indexterm role="option">
61456 <primary><option>qualify_recipient</option></primary>
61457 </indexterm>
61458 Unqualified addresses in header lines are automatically qualified for messages
61459 that are locally originated, unless the <option>-bnq</option> option is given on the command
61460 line. For messages received over SMTP, unqualified addresses in header lines
61461 are qualified only if unqualified addresses are permitted in SMTP commands. In
61462 other words, such qualification is also controlled by
61463 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
61464 </para>
61465 </section>
61466 <section id="SECID219">
61467 <title>The UUCP From line</title>
61468 <para>
61469 <indexterm role="concept">
61470 <primary><quote>From</quote> line</primary>
61471 </indexterm>
61472 <indexterm role="concept">
61473 <primary>UUCP</primary>
61474 <secondary><quote>From</quote> line</secondary>
61475 </indexterm>
61476 <indexterm role="concept">
61477 <primary>sender</primary>
61478 <secondary>address</secondary>
61479 </indexterm>
61480 <indexterm role="option">
61481 <primary><option>uucp_from_pattern</option></primary>
61482 </indexterm>
61483 <indexterm role="option">
61484 <primary><option>uucp_from_sender</option></primary>
61485 </indexterm>
61486 <indexterm role="concept">
61487 <primary>envelope sender</primary>
61488 </indexterm>
61489 <indexterm role="concept">
61490 <primary>Sendmail compatibility</primary>
61491 <secondary><quote>From</quote> line</secondary>
61492 </indexterm>
61493 Messages that have come from UUCP (and some other applications) often begin
61494 with a line containing the envelope sender and a timestamp, following the word
61495 <quote>From</quote>. Examples of two common formats are:
61496 </para>
61497 <literallayout class="monospaced">
61498 From a.oakley@berlin.mus Fri Jan  5 12:35 GMT 1996
61499 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
61500 </literallayout>
61501 <para>
61502 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
61503 Exim recognizes such lines at the start of messages that are submitted to it
61504 via the command line (that is, on the standard input). It does not recognize
61505 such lines in incoming SMTP messages, unless the sending host matches
61506 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
61507 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
61508 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
61509 default value matches the two common cases shown above and puts the address
61510 that follows <quote>From</quote> into <varname>$1</varname>.
61511 </para>
61512 <para>
61513 <indexterm role="concept">
61514 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
61515 <secondary>in <quote>From </quote> line handling</secondary>
61516 </indexterm>
61517 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
61518 a trusted user, the message&#x2019;s sender address is constructed by expanding the
61519 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
61520 then parsed as an RFC 2822 address. If there is no domain, the local part is
61521 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
61522 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
61523 </para>
61524 <para>
61525 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
61526 sender address is not changed. This is also the case for incoming SMTP messages
61527 that are permitted to contain <quote>From</quote> lines.
61528 </para>
61529 <para>
61530 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
61531 treated as a data line that starts the body of the message, as it is not valid
61532 as a header line. This also happens if a <quote>From</quote> line is present in an
61533 incoming SMTP message from a source that is not permitted to send them.
61534 </para>
61535 </section>
61536 <section id="SECID220">
61537 <title>Resent- header lines</title>
61538 <para>
61539 <indexterm role="concept">
61540 <primary><option>Resent-</option> header lines</primary>
61541 </indexterm>
61542 RFC 2822 makes provision for sets of header lines starting with the string
61543 <literal>Resent-</literal> to be added to a message when it is resent by the original
61544 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
61545 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
61546 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
61547 </para>
61548 <blockquote>
61549 <para>
61550 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
61551 processing of replies or other such automatic actions on messages.</emphasis>
61552 </para>
61553 </blockquote>
61554 <para>
61555 This leaves things a bit vague as far as other processing actions such as
61556 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
61557 follows:
61558 </para>
61559 <itemizedlist>
61560 <listitem>
61561 <para>
61562 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
61563 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
61564 </para>
61565 </listitem>
61566 <listitem>
61567 <para>
61568 If there&#x2019;s a rewriting rule for a particular header line, it is also applied to
61569 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
61570 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
61571 </para>
61572 </listitem>
61573 <listitem>
61574 <para>
61575 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
61576 also removed.
61577 </para>
61578 </listitem>
61579 <listitem>
61580 <para>
61581 For a locally-submitted message,
61582 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
61583 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
61584 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
61585 included in log lines in this case.
61586 </para>
61587 </listitem>
61588 <listitem>
61589 <para>
61590 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
61591 <option>Resent-</option> header lines are present.
61592 </para>
61593 </listitem>
61594 </itemizedlist>
61595 </section>
61596 <section id="SECID221">
61597 <title>The Auto-Submitted: header line</title>
61598 <para>
61599 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
61600 includes the header line:
61601 </para>
61602 <literallayout class="monospaced">
61603 Auto-Submitted: auto-replied
61604 </literallayout>
61605 </section>
61606 <section id="SECID222">
61607 <title>The Bcc: header line</title>
61608 <para>
61609 <indexterm role="concept">
61610 <primary><emphasis>Bcc:</emphasis> header line</primary>
61611 </indexterm>
61612 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
61613 message&#x2019;s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
61614 extracting its addresses). If <option>-t</option> is not present on the command line, any
61615 existing <emphasis>Bcc:</emphasis> is not removed.
61616 </para>
61617 </section>
61618 <section id="SECID223">
61619 <title>The Date: header line</title>
61620 <para>
61621 <indexterm role="concept">
61622 <primary><emphasis>Date:</emphasis> header line</primary>
61623 </indexterm>
61624 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
61625 Exim adds one, using the current date and time, unless the
61626 <option>suppress_local_fixups</option> control has been specified.
61627 </para>
61628 </section>
61629 <section id="SECID224">
61630 <title>The Delivery-date: header line</title>
61631 <para>
61632 <indexterm role="concept">
61633 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
61634 </indexterm>
61635 <indexterm role="option">
61636 <primary><option>delivery_date_remove</option></primary>
61637 </indexterm>
61638 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
61639 set. Exim can be configured to add them to the final delivery of messages. (See
61640 the generic <option>delivery_date_add</option> transport option.) They should not be present
61641 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
61642 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
61643 messages.
61644 </para>
61645 </section>
61646 <section id="SECID225">
61647 <title>The Envelope-to: header line</title>
61648 <para>
61649 <indexterm role="concept">
61650 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
61651 </indexterm>
61652 <indexterm role="option">
61653 <primary><option>envelope_to_remove</option></primary>
61654 </indexterm>
61655 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
61656 Exim can be configured to add them to the final delivery of messages. (See the
61657 generic <option>envelope_to_add</option> transport option.) They should not be present in
61658 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
61659 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
61660 messages.
61661 </para>
61662 </section>
61663 <section id="SECTthefrohea">
61664 <title>The From: header line</title>
61665 <para>
61666 <indexterm role="concept">
61667 <primary><emphasis>From:</emphasis> header line</primary>
61668 </indexterm>
61669 <indexterm role="concept">
61670 <primary>Sendmail compatibility</primary>
61671 <secondary><quote>From</quote> line</secondary>
61672 </indexterm>
61673 <indexterm role="concept">
61674 <primary>message</primary>
61675 <secondary>submission</secondary>
61676 </indexterm>
61677 <indexterm role="concept">
61678 <primary>submission mode</primary>
61679 </indexterm>
61680 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
61681 adds one if either of the following conditions is true:
61682 </para>
61683 <itemizedlist>
61684 <listitem>
61685 <para>
61686 The envelope sender address is not empty (that is, this is not a bounce
61687 message). The added header line copies the envelope sender address.
61688 </para>
61689 </listitem>
61690 <listitem>
61691 <para>
61692 <indexterm role="variable">
61693 <primary><varname>$authenticated_id</varname></primary>
61694 </indexterm>
61695 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
61696 </para>
61697 <orderedlist numeration="arabic">
61698 <listitem>
61699 <para>
61700 <indexterm role="variable">
61701 <primary><varname>$qualify_domain</varname></primary>
61702 </indexterm>
61703 If no domain is specified by the submission control, the local part is
61704 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
61705 </para>
61706 </listitem>
61707 <listitem>
61708 <para>
61709 If a non-empty domain is specified by the submission control, the local
61710 part is <varname>$authenticated_id</varname>, and the domain is the specified domain.
61711 </para>
61712 </listitem>
61713 <listitem>
61714 <para>
61715 If an empty domain is specified by the submission control,
61716 <varname>$authenticated_id</varname> is assumed to be the complete address.
61717 </para>
61718 </listitem>
61719 </orderedlist>
61720 </listitem>
61721 </itemizedlist>
61722 <para>
61723 A non-empty envelope sender takes precedence.
61724 </para>
61725 <para>
61726 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
61727 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
61728 containing the sender&#x2019;s address. The calling user&#x2019;s login name and full name
61729 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
61730 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
61731 <option>unknown_login</option> configuration option). The address is qualified with
61732 <option>qualify_domain</option>.
61733 </para>
61734 <para>
61735 For compatibility with Sendmail, if an incoming, non-SMTP message has a
61736 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
61737 user, this is replaced by an address containing the user&#x2019;s login name and full
61738 name as described in section <xref linkend="SECTconstr"/>.
61739 </para>
61740 </section>
61741 <section id="SECID226">
61742 <title>The Message-ID: header line</title>
61743 <para>
61744 <indexterm role="concept">
61745 <primary><emphasis>Message-ID:</emphasis> header line</primary>
61746 </indexterm>
61747 <indexterm role="concept">
61748 <primary>message</primary>
61749 <secondary>submission</secondary>
61750 </indexterm>
61751 <indexterm role="option">
61752 <primary><option>message_id_header_text</option></primary>
61753 </indexterm>
61754 If a locally-generated or submission-mode incoming message does not contain a
61755 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
61756 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
61757 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
61758 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim&#x2019;s internal
61759 message id, preceded by the letter E to ensure it starts with a letter, and
61760 followed by @ and the primary host name. Additional information can be included
61761 in this header line by setting the <option>message_id_header_text</option> and/or
61762 <option>message_id_header_domain</option> options.
61763 </para>
61764 </section>
61765 <section id="SECID227">
61766 <title>The Received: header line</title>
61767 <para>
61768 <indexterm role="concept">
61769 <primary><emphasis>Received:</emphasis> header line</primary>
61770 </indexterm>
61771 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
61772 contents are defined by the <option>received_header_text</option> configuration option, and
61773 Exim automatically adds a semicolon and a timestamp to the configured string.
61774 </para>
61775 <para>
61776 The <emphasis>Received:</emphasis> header is generated as soon as the message&#x2019;s header lines
61777 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
61778 line is the time that the message started to be received. This is the value
61779 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
61780 </para>
61781 <para>
61782 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
61783 changed to the time of acceptance, which is (apart from a small delay while the
61784 -H spool file is written) the earliest time at which delivery could start.
61785 </para>
61786 </section>
61787 <section id="SECID228">
61788 <title>The References: header line</title>
61789 <para>
61790 <indexterm role="concept">
61791 <primary><emphasis>References:</emphasis> header line</primary>
61792 </indexterm>
61793 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
61794 header line. This is constructed according to the rules that are described in
61795 section 3.64 of RFC 2822 (which states that replies should contain such a
61796 header line), and section 3.14 of RFC 3834 (which states that automatic
61797 responses are not different in this respect). However, because some mail
61798 processing software does not cope well with very long header lines, no more
61799 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
61800 incoming message. If there are more than 12, the first one and then the final
61801 11 are copied, before adding the message ID of the incoming message.
61802 </para>
61803 </section>
61804 <section id="SECID229">
61805 <title>The Return-path: header line</title>
61806 <para>
61807 <indexterm role="concept">
61808 <primary><emphasis>Return-path:</emphasis> header line</primary>
61809 </indexterm>
61810 <indexterm role="option">
61811 <primary><option>return_path_remove</option></primary>
61812 </indexterm>
61813 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
61814 it does the final delivery of messages. (See the generic <option>return_path_add</option>
61815 transport option.) Therefore, they should not be present in messages in
61816 transit. If the <option>return_path_remove</option> configuration option is set (the
61817 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
61818 </para>
61819 </section>
61820 <section id="SECTthesenhea">
61821 <title>The Sender: header line</title>
61822 <para>
61823 <indexterm role="concept">
61824 <primary><emphasis>Sender:</emphasis> header line</primary>
61825 </indexterm>
61826 <indexterm role="concept">
61827 <primary>message</primary>
61828 <secondary>submission</secondary>
61829 </indexterm>
61830 For a locally-originated message from an untrusted user, Exim may remove an
61831 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
61832 these actions by setting the <option>local_sender_retain</option> option true, the
61833 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
61834 control setting.
61835 </para>
61836 <para>
61837 When a local message is received from an untrusted user and
61838 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
61839 control has not been set, a check is made to see if the address given in the
61840 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
61841 that is expected has the login name as the local part and the value of
61842 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
61843 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
61844 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
61845 line is added to the message.
61846 </para>
61847 <para>
61848 If you set <option>local_from_check</option> false, this checking does not occur. However,
61849 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
61850 <option>local_sender_retain</option> to be true. It is not possible to set both of these
61851 options true at the same time.
61852 </para>
61853 <para>
61854 <indexterm role="concept">
61855 <primary>submission mode</primary>
61856 </indexterm>
61857 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
61858 received over TCP/IP or for messages submitted by trusted users. However, when
61859 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
61860 not specified on the submission control, the following processing takes place:
61861 </para>
61862 <para>
61863 <indexterm role="variable">
61864 <primary><varname>$authenticated_id</varname></primary>
61865 </indexterm>
61866 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
61867 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
61868 created as follows:
61869 </para>
61870 <itemizedlist>
61871 <listitem>
61872 <para>
61873 <indexterm role="variable">
61874 <primary><varname>$qualify_domain</varname></primary>
61875 </indexterm>
61876 If no domain is specified by the submission control, the local part is
61877 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
61878 </para>
61879 </listitem>
61880 <listitem>
61881 <para>
61882 If a non-empty domain is specified by the submission control, the local part
61883 is <varname>$authenticated_id</varname>, and the domain is the specified domain.
61884 </para>
61885 </listitem>
61886 <listitem>
61887 <para>
61888 If an empty domain is specified by the submission control,
61889 <varname>$authenticated_id</varname> is assumed to be the complete address.
61890 </para>
61891 </listitem>
61892 </itemizedlist>
61893 <para>
61894 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
61895 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
61896 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
61897 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
61898 </para>
61899 <para>
61900 <indexterm role="concept">
61901 <primary>return path</primary>
61902 <secondary>created from <emphasis>Sender:</emphasis></secondary>
61903 </indexterm>
61904 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
61905 the message (the envelope sender address) is changed to be the same address,
61906 except in the case of submission mode when <option>sender_retain</option> is specified.
61907 </para>
61908 </section>
61909 <section id="SECTheadersaddrem">
61910 <title>Adding and removing header lines in routers and transports</title>
61911 <para>
61912 <indexterm role="concept">
61913 <primary>header lines</primary>
61914 <secondary>adding; in router or transport</secondary>
61915 </indexterm>
61916 <indexterm role="concept">
61917 <primary>header lines</primary>
61918 <secondary>removing; in router or transport</secondary>
61919 </indexterm>
61920 When a message is delivered, the addition and removal of header lines can be
61921 specified in a system filter, or on any of the routers and transports that
61922 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
61923 modifying headers in a system filter. Header lines can also be added in an ACL
61924 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
61925 </para>
61926 <para>
61927 In contrast to what happens in a system filter, header modifications that are
61928 specified on routers and transports apply only to the particular recipient
61929 addresses that are being processed by those routers and transports. These
61930 changes do not actually take place until a copy of the message is being
61931 transported. Therefore, they do not affect the basic set of header lines, and
61932 they do not affect the values of the variables that refer to header lines.
61933 </para>
61934 <para>
61935 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
61936 the transport cannot refer to the modified header lines, because such
61937 expansions all occur before the message is actually transported.
61938 </para>
61939 <para>
61940 For both routers and transports, the argument of a <option>headers_add</option>
61941 option must be in the form of one or more RFC 2822 header lines, separated by
61942 newlines (coded as <quote>\n</quote>). For example:
61943 </para>
61944 <literallayout class="monospaced">
61945 headers_add = X-added-header: added by $primary_hostname\n\
61946               X-added-second: another added header line
61947 </literallayout>
61948 <para>
61949 Exim does not check the syntax of these added header lines.
61950 </para>
61951 <para>
61952 Multiple <option>headers_add</option> options for a single router or transport can be
61953 specified; the values will append to a single list of header lines.
61954 Each header-line is separately expanded.
61955 </para>
61956 <para>
61957 The argument of a <option>headers_remove</option> option must consist of a colon-separated
61958 list of header names. This is confusing, because header names themselves are
61959 often terminated by colons. In this case, the colons are the list separators,
61960 not part of the names. For example:
61961 </para>
61962 <literallayout class="monospaced">
61963 headers_remove = return-receipt-to:acknowledge-to
61964 </literallayout>
61965 <para>
61966 Multiple <option>headers_remove</option> options for a single router or transport can be
61967 specified; the arguments will append to a single header-names list.
61968 Each item is separately expanded.
61969 Note that colons in complex expansions which are used to
61970 form all or part of a <option>headers_remove</option> list
61971 will act as list separators.
61972 </para>
61973 <para>
61974 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router,
61975 items are expanded at routing time,
61976 and then associated with all addresses that are
61977 accepted by that router, and also with any new addresses that it generates. If
61978 an address passes through several routers as a result of aliasing or
61979 forwarding, the changes are cumulative.
61980 </para>
61981 <para>
61982 <indexterm role="option">
61983 <primary><option>unseen</option></primary>
61984 </indexterm>
61985 However, this does not apply to multiple routers that result from the use of
61986 the <option>unseen</option> option. Any header modifications that were specified by the
61987 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
61988 </para>
61989 <para>
61990 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
61991 settings cannot be delivered together in a batch, so a transport is always
61992 dealing with a set of addresses that have the same header-processing
61993 requirements.
61994 </para>
61995 <para>
61996 The transport starts by writing the original set of header lines that arrived
61997 with the message, possibly modified by the system filter. As it writes out
61998 these lines, it consults the list of header names that were attached to the
61999 recipient address(es) by <option>headers_remove</option> options in routers, and it also
62000 consults the transport&#x2019;s own <option>headers_remove</option> option. Header lines whose
62001 names are on either of these lists are not written out. If there are multiple
62002 instances of any listed header, they are all skipped.
62003 </para>
62004 <para>
62005 After the remaining original header lines have been written, new header
62006 lines that were specified by routers&#x2019; <option>headers_add</option> options are written, in
62007 the order in which they were attached to the address. These are followed by any
62008 header lines specified by the transport&#x2019;s <option>headers_add</option> option.
62009 </para>
62010 <para>
62011 This way of handling header line modifications in routers and transports has
62012 the following consequences:
62013 </para>
62014 <itemizedlist>
62015 <listitem>
62016 <para>
62017 The original set of header lines, possibly modified by the system filter,
62018 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
62019 to it, at all times.
62020 </para>
62021 </listitem>
62022 <listitem>
62023 <para>
62024 Header lines that are added by a router&#x2019;s
62025 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
62026 expansion syntax in subsequent routers or the transport.
62027 </para>
62028 </listitem>
62029 <listitem>
62030 <para>
62031 Conversely, header lines that are specified for removal by <option>headers_remove</option>
62032 in a router remain visible to subsequent routers and the transport.
62033 </para>
62034 </listitem>
62035 <listitem>
62036 <para>
62037 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
62038 a later router or by a transport.
62039 </para>
62040 </listitem>
62041 <listitem>
62042 <para>
62043 An added header can refer to the contents of an original header that is to be
62044 removed, even it has the same name as the added header. For example:
62045 </para>
62046 <literallayout class="monospaced">
62047 headers_remove = subject
62048 headers_add = Subject: new subject (was: $h_subject:)
62049 </literallayout>
62050 </listitem>
62051 </itemizedlist>
62052 <para>
62053 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
62054 for a <command>redirect</command> router that has the <option>one_time</option> option set.
62055 </para>
62056 </section>
62057 <section id="SECTconstr">
62058 <title>Constructed addresses</title>
62059 <para>
62060 <indexterm role="concept">
62061 <primary>address</primary>
62062 <secondary>constructed</secondary>
62063 </indexterm>
62064 <indexterm role="concept">
62065 <primary>constructed address</primary>
62066 </indexterm>
62067 When Exim constructs a sender address for a locally-generated message, it uses
62068 the form
62069 </para>
62070 <literallayout>
62071 &lt;<emphasis>user name</emphasis>&gt;&nbsp;&nbsp;&lt;<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>&gt;
62072 </literallayout>
62073 <para>
62074 For example:
62075 </para>
62076 <literallayout class="monospaced">
62077 Zaphod Beeblebrox &lt;zaphod@end.univ.example&gt;
62078 </literallayout>
62079 <para>
62080 The user name is obtained from the <option>-F</option> command line option if set, or
62081 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
62082 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
62083 ampersand character, this is replaced by the login name with the first letter
62084 upper cased, as is conventional in a number of operating systems. See the
62085 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
62086 The <option>unknown_username</option> option can be used to specify user names in cases when
62087 there is no password file entry.
62088 </para>
62089 <para>
62090 <indexterm role="concept">
62091 <primary>RFC 2047</primary>
62092 </indexterm>
62093 In all cases, the user name is made to conform to RFC 2822 by quoting all or
62094 parts of it if necessary. In addition, if it contains any non-printing
62095 characters, it is encoded as described in RFC 2047, which defines a way of
62096 including non-ASCII characters in header lines. The value of the
62097 <option>headers_charset</option> option specifies the name of the encoding that is used (the
62098 characters are assumed to be in this encoding). The setting of
62099 <option>print_topbitchars</option> controls whether characters with the top bit set (that
62100 is, with codes greater than 127) count as printing characters or not.
62101 </para>
62102 </section>
62103 <section id="SECID230">
62104 <title>Case of local parts</title>
62105 <para>
62106 <indexterm role="concept">
62107 <primary>case of local parts</primary>
62108 </indexterm>
62109 <indexterm role="concept">
62110 <primary>local part</primary>
62111 <secondary>case of</secondary>
62112 </indexterm>
62113 RFC 2822 states that the case of letters in the local parts of addresses cannot
62114 be assumed to be non-significant. Exim preserves the case of local parts of
62115 addresses, but by default it uses a lower-cased form when it is routing,
62116 because on most Unix systems, usernames are in lower case and case-insensitive
62117 routing is required. However, any particular router can be made to use the
62118 original case for local parts by setting the <option>caseful_local_part</option> generic
62119 router option.
62120 </para>
62121 <para>
62122 <indexterm role="concept">
62123 <primary>mixed-case login names</primary>
62124 </indexterm>
62125 If you must have mixed-case user names on your system, the best way to proceed,
62126 assuming you want case-independent handling of incoming email, is to set up
62127 your first router to convert incoming local parts in your domains to the
62128 correct case by means of a file lookup. For example:
62129 </para>
62130 <literallayout class="monospaced">
62131 correct_case:
62132   driver = redirect
62133   domains = +local_domains
62134   data = ${lookup{$local_part}cdb\
62135               {/etc/usercased.cdb}{$value}fail}\
62136               @$domain
62137 </literallayout>
62138 <para>
62139 For this router, the local part is forced to lower case by the default action
62140 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
62141 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
62142 on any subsequent routers which process your domains, they will operate on
62143 local parts with the correct case in a case-sensitive manner.
62144 </para>
62145 </section>
62146 <section id="SECID231">
62147 <title>Dots in local parts</title>
62148 <para>
62149 <indexterm role="concept">
62150 <primary>dot</primary>
62151 <secondary>in local part</secondary>
62152 </indexterm>
62153 <indexterm role="concept">
62154 <primary>local part</primary>
62155 <secondary>dots in</secondary>
62156 </indexterm>
62157 RFC 2822 forbids empty components in local parts. That is, an unquoted local
62158 part may not begin or end with a dot, nor have two consecutive dots in the
62159 middle. However, it seems that many MTAs do not enforce this, so Exim permits
62160 empty components for compatibility.
62161 </para>
62162 </section>
62163 <section id="SECID232">
62164 <title>Rewriting addresses</title>
62165 <para>
62166 <indexterm role="concept">
62167 <primary>rewriting</primary>
62168 <secondary>addresses</secondary>
62169 </indexterm>
62170 Rewriting of sender and recipient addresses, and addresses in headers, can
62171 happen automatically, or as the result of configuration options, as described
62172 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
62173 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
62174 </para>
62175 <para>
62176 Automatic rewriting includes qualification, as mentioned above. The other case
62177 in which it can happen is when an incomplete non-local domain is given. The
62178 routing process may cause this to be expanded into the full domain name. For
62179 example, a header such as
62180 </para>
62181 <literallayout class="monospaced">
62182 To: hare@teaparty
62183 </literallayout>
62184 <para>
62185 might get rewritten as
62186 </para>
62187 <literallayout class="monospaced">
62188 To: hare@teaparty.wonderland.fict.example
62189 </literallayout>
62190 <para>
62191 Rewriting as a result of routing is the one kind of message processing that
62192 does not happen at input time, as it cannot be done until the address has
62193 been routed.
62194 </para>
62195 <para>
62196 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
62197 addresses have been routed, in case any of the headers get changed as a
62198 result of routing. However, doing this in practice would hold up many
62199 deliveries for unreasonable amounts of time, just because one address could not
62200 immediately be routed. Exim therefore does not delay other deliveries when
62201 routing of one or more addresses is deferred.
62202 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
62203 </para>
62204 </section>
62205 </chapter>
62206
62207 <chapter id="CHAPSMTP">
62208 <title>SMTP processing</title>
62209 <para>
62210 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
62211 <primary>SMTP</primary>
62212 <secondary>processing details</secondary>
62213 </indexterm>
62214 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
62215 <primary>LMTP</primary>
62216 <secondary>processing details</secondary>
62217 </indexterm>
62218 Exim supports a number of different ways of using the SMTP protocol, and its
62219 LMTP variant, which is an interactive protocol for transferring messages into a
62220 closed mail store application. This chapter contains details of how SMTP is
62221 processed. For incoming mail, the following are available:
62222 </para>
62223 <itemizedlist>
62224 <listitem>
62225 <para>
62226 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
62227 </para>
62228 </listitem>
62229 <listitem>
62230 <para>
62231 SMTP over the standard input and output (the <option>-bs</option> option);
62232 </para>
62233 </listitem>
62234 <listitem>
62235 <para>
62236 Batched SMTP on the standard input (the <option>-bS</option> option).
62237 </para>
62238 </listitem>
62239 </itemizedlist>
62240 <para>
62241 For mail delivery, the following are available:
62242 </para>
62243 <itemizedlist>
62244 <listitem>
62245 <para>
62246 SMTP over TCP/IP (the <command>smtp</command> transport);
62247 </para>
62248 </listitem>
62249 <listitem>
62250 <para>
62251 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
62252 <quote>lmtp</quote>);
62253 </para>
62254 </listitem>
62255 <listitem>
62256 <para>
62257 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
62258 transport);
62259 </para>
62260 </listitem>
62261 <listitem>
62262 <para>
62263 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
62264 the <option>use_bsmtp</option> option set).
62265 </para>
62266 </listitem>
62267 </itemizedlist>
62268 <para>
62269 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
62270 stored in or read from files (or pipes), in a format in which SMTP commands are
62271 used to contain the envelope information.
62272 </para>
62273 <section id="SECToutSMTPTCP">
62274 <title>Outgoing SMTP and LMTP over TCP/IP</title>
62275 <para>
62276 <indexterm role="concept">
62277 <primary>SMTP</primary>
62278 <secondary>outgoing over TCP/IP</secondary>
62279 </indexterm>
62280 <indexterm role="concept">
62281 <primary>outgoing SMTP over TCP/IP</primary>
62282 </indexterm>
62283 <indexterm role="concept">
62284 <primary>LMTP</primary>
62285 <secondary>over TCP/IP</secondary>
62286 </indexterm>
62287 <indexterm role="concept">
62288 <primary>outgoing LMTP over TCP/IP</primary>
62289 </indexterm>
62290 <indexterm role="concept">
62291 <primary>EHLO</primary>
62292 </indexterm>
62293 <indexterm role="concept">
62294 <primary>HELO</primary>
62295 </indexterm>
62296 <indexterm role="concept">
62297 <primary>SIZE option on MAIL command</primary>
62298 </indexterm>
62299 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
62300 The <option>protocol</option> option selects which protocol is to be used, but the actual
62301 processing is the same in both cases.
62302 </para>
62303 <para>
62304 If, in response to its EHLO command, Exim is told that the SIZE
62305 parameter is supported, it adds SIZE=&lt;<emphasis>n</emphasis>&gt; to each subsequent MAIL
62306 command. The value of &lt;<emphasis>n</emphasis>&gt; is the message size plus the value of the
62307 <option>size_addition</option> option (default 1024) to allow for additions to the message
62308 such as per-transport header lines, or changes made in a
62309 <indexterm role="concept">
62310 <primary>transport</primary>
62311 <secondary>filter</secondary>
62312 </indexterm>
62313 <indexterm role="concept">
62314 <primary>filter</primary>
62315 <secondary>transport filter</secondary>
62316 </indexterm>
62317 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
62318 suppressed.
62319 </para>
62320 <para>
62321 If the remote server advertises support for PIPELINING, Exim uses the
62322 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
62323 required for the transaction.
62324 </para>
62325 <para>
62326 If the remote server advertises support for the STARTTLS command, and Exim
62327 was built to support TLS encryption, it tries to start a TLS session unless the
62328 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
62329 Either a match in that or <option>hosts_verify_avoid_tls</option> apply when the transport
62330 is called for verification.
62331 </para>
62332 <para>
62333 If the remote server advertises support for the AUTH command, Exim scans
62334 the authenticators configuration for any suitable client settings, as described
62335 in chapter <xref linkend="CHAPSMTPAUTH"/>.
62336 </para>
62337 <para>
62338 <indexterm role="concept">
62339 <primary>carriage return</primary>
62340 </indexterm>
62341 <indexterm role="concept">
62342 <primary>linefeed</primary>
62343 </indexterm>
62344 Responses from the remote host are supposed to be terminated by CR followed by
62345 LF. However, there are known to be hosts that do not send CR characters, so in
62346 order to be able to interwork with such hosts, Exim treats LF on its own as a
62347 line terminator.
62348 </para>
62349 <para>
62350 If a message contains a number of different addresses, all those with the same
62351 characteristics (for example, the same envelope sender) that resolve to the
62352 same set of hosts, in the same order, are sent in a single SMTP transaction,
62353 even if they are for different domains, unless there are more than the setting
62354 of the <option>max_rcpt</option>s option in the <command>smtp</command> transport allows, in which case
62355 they are split into groups containing no more than <option>max_rcpt</option>s addresses
62356 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
62357 in parallel sessions. The order of hosts with identical MX values is not
62358 significant when checking whether addresses can be batched in this way.
62359 </para>
62360 <para>
62361 When the <command>smtp</command> transport suffers a temporary failure that is not
62362 message-related, Exim updates its transport-specific database, which contains
62363 records indexed by host name that remember which messages are waiting for each
62364 particular host. It also updates the retry database with new retry times.
62365 </para>
62366 <para>
62367 <indexterm role="concept">
62368 <primary>hints database</primary>
62369 <secondary>retry keys</secondary>
62370 </indexterm>
62371 Exim&#x2019;s retry hints are based on host name plus IP address, so if one address of
62372 a multi-homed host is broken, it will soon be skipped most of the time.
62373 See the next section for more detail about error handling.
62374 </para>
62375 <para>
62376 <indexterm role="concept">
62377 <primary>SMTP</primary>
62378 <secondary>passed connection</secondary>
62379 </indexterm>
62380 <indexterm role="concept">
62381 <primary>SMTP</primary>
62382 <secondary>batching over TCP/IP</secondary>
62383 </indexterm>
62384 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
62385 looks in the hints database for the transport to see if there are any queued
62386 messages waiting for the host to which it is connected. If it finds one, it
62387 creates a new Exim process using the <option>-MC</option> option (which can only be used by
62388 a process running as root or the Exim user) and passes the TCP/IP socket to it
62389 so that it can deliver another message using the same socket. The new process
62390 does only those deliveries that are routed to the connected host, and may in
62391 turn pass the socket on to a third process, and so on.
62392 </para>
62393 <para>
62394 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
62395 limit the number of messages sent down a single TCP/IP connection.
62396 </para>
62397 <para>
62398 <indexterm role="concept">
62399 <primary>asterisk</primary>
62400 <secondary>after IP address</secondary>
62401 </indexterm>
62402 The second and subsequent messages delivered down an existing connection are
62403 identified in the main log by the addition of an asterisk after the closing
62404 square bracket of the IP address.
62405 </para>
62406 </section>
62407 <section id="SECToutSMTPerr">
62408 <title>Errors in outgoing SMTP</title>
62409 <para>
62410 <indexterm role="concept">
62411 <primary>error</primary>
62412 <secondary>in outgoing SMTP</secondary>
62413 </indexterm>
62414 <indexterm role="concept">
62415 <primary>SMTP</primary>
62416 <secondary>errors in outgoing</secondary>
62417 </indexterm>
62418 <indexterm role="concept">
62419 <primary>host</primary>
62420 <secondary>error</secondary>
62421 </indexterm>
62422 Three different kinds of error are recognized for outgoing SMTP: host errors,
62423 message errors, and recipient errors.
62424 </para>
62425 <variablelist>
62426 <varlistentry>
62427 <term><emphasis role="bold">Host errors</emphasis></term>
62428 <listitem>
62429 <para>
62430 A host error is not associated with a particular message or with a
62431 particular recipient of a message. The host errors are:
62432 </para>
62433 <itemizedlist>
62434 <listitem>
62435 <para>
62436 Connection refused or timed out,
62437 </para>
62438 </listitem>
62439 <listitem>
62440 <para>
62441 Any error response code on connection,
62442 </para>
62443 </listitem>
62444 <listitem>
62445 <para>
62446 Any error response code to EHLO or HELO,
62447 </para>
62448 </listitem>
62449 <listitem>
62450 <para>
62451 Loss of connection at any time, except after <quote>.</quote>,
62452 </para>
62453 </listitem>
62454 <listitem>
62455 <para>
62456 I/O errors at any time,
62457 </para>
62458 </listitem>
62459 <listitem>
62460 <para>
62461 Timeouts during the session, other than in response to MAIL, RCPT or
62462 the <quote>.</quote> at the end of the data.
62463 </para>
62464 </listitem>
62465 </itemizedlist>
62466 <para>
62467 For a host error, a permanent error response on connection, or in response to
62468 EHLO, causes all addresses routed to the host to be failed. Any other host
62469 error causes all addresses to be deferred, and retry data to be created for the
62470 host. It is not tried again, for any message, until its retry time arrives. If
62471 the current set of addresses are not all delivered in this run (to some
62472 alternative host), the message is added to the list of those waiting for this
62473 host, so if it is still undelivered when a subsequent successful delivery is
62474 made to the host, it will be sent down the same SMTP connection.
62475 </para>
62476 </listitem></varlistentry>
62477 <varlistentry>
62478 <term><emphasis role="bold">Message errors</emphasis></term>
62479 <listitem>
62480 <para>
62481 <indexterm role="concept">
62482 <primary>message</primary>
62483 <secondary>error</secondary>
62484 </indexterm>
62485 A message error is associated with a particular message when sent to a
62486 particular host, but not with a particular recipient of the message. The
62487 message errors are:
62488 </para>
62489 <itemizedlist>
62490 <listitem>
62491 <para>
62492 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
62493 the data,
62494 </para>
62495 </listitem>
62496 <listitem>
62497 <para>
62498 Timeout after MAIL,
62499 </para>
62500 </listitem>
62501 <listitem>
62502 <para>
62503 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
62504 timeout after the DATA command itself is treated as a host error, as is loss of
62505 connection at any other time.
62506 </para>
62507 </listitem>
62508 </itemizedlist>
62509 <para>
62510 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
62511 to be failed, and a delivery error report to be returned to the sender. A
62512 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
62513 addresses to be deferred. Retry data is not created for the host, but instead,
62514 a retry record for the combination of host plus message id is created. The
62515 message is not added to the list of those waiting for this host. This ensures
62516 that the failing message will not be sent to this host again until the retry
62517 time arrives. However, other messages that are routed to the host are not
62518 affected, so if it is some property of the message that is causing the error,
62519 it will not stop the delivery of other mail.
62520 </para>
62521 <para>
62522 If the remote host specified support for the SIZE parameter in its response
62523 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
62524 over-large message will cause a message error because the error arrives as a
62525 response to MAIL.
62526 </para>
62527 </listitem></varlistentry>
62528 <varlistentry>
62529 <term><emphasis role="bold">Recipient errors</emphasis></term>
62530 <listitem>
62531 <para>
62532 <indexterm role="concept">
62533 <primary>recipient</primary>
62534 <secondary>error</secondary>
62535 </indexterm>
62536 A recipient error is associated with a particular recipient of a message. The
62537 recipient errors are:
62538 </para>
62539 <itemizedlist>
62540 <listitem>
62541 <para>
62542 Any error response to RCPT,
62543 </para>
62544 </listitem>
62545 <listitem>
62546 <para>
62547 Timeout after RCPT.
62548 </para>
62549 </listitem>
62550 </itemizedlist>
62551 <para>
62552 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
62553 recipient address to be failed, and a bounce message to be returned to the
62554 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
62555 address to be deferred, and routing retry data to be created for it. This is
62556 used to delay processing of the address in subsequent queue runs, until its
62557 routing retry time arrives. This applies to all messages, but because it
62558 operates only in queue runs, one attempt will be made to deliver a new message
62559 to the failing address before the delay starts to operate. This ensures that,
62560 if the failure is really related to the message rather than the recipient
62561 (<quote>message too big for this recipient</quote> is a possible example), other messages
62562 have a chance of getting delivered. If a delivery to the address does succeed,
62563 the retry information gets cleared, so all stuck messages get tried again, and
62564 the retry clock is reset.
62565 </para>
62566 <para>
62567 The message is not added to the list of those waiting for this host. Use of the
62568 host for other messages is unaffected, and except in the case of a timeout,
62569 other recipients are processed independently, and may be successfully delivered
62570 in the current SMTP session. After a timeout it is of course impossible to
62571 proceed with the session, so all addresses get deferred. However, those other
62572 than the one that failed do not suffer any subsequent retry delays. Therefore,
62573 if one recipient is causing trouble, the others have a chance of getting
62574 through when a subsequent delivery attempt occurs before the failing
62575 recipient&#x2019;s retry time.
62576 </para>
62577 </listitem></varlistentry>
62578 </variablelist>
62579 <para>
62580 In all cases, if there are other hosts (or IP addresses) available for the
62581 current set of addresses (for example, from multiple MX records), they are
62582 tried in this run for any undelivered addresses, subject of course to their
62583 own retry data. In other words, recipient error retry data does not take effect
62584 until the next delivery attempt.
62585 </para>
62586 <para>
62587 Some hosts have been observed to give temporary error responses to every
62588 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
62589 would be nice if such circumstances could be recognized, and defer data for the
62590 host itself created, but this is not possible within the current Exim design.
62591 What actually happens is that retry data for every (host, message) combination
62592 is created.
62593 </para>
62594 <para>
62595 The reason that timeouts after MAIL and RCPT are treated specially is that
62596 these can sometimes arise as a result of the remote host&#x2019;s verification
62597 procedures. Exim makes this assumption, and treats them as if a temporary error
62598 response had been received. A timeout after <quote>.</quote> is treated specially because
62599 it is known that some broken implementations fail to recognize the end of the
62600 message if the last character of the last line is a binary zero. Thus, it is
62601 helpful to treat this case as a message error.
62602 </para>
62603 <para>
62604 Timeouts at other times are treated as host errors, assuming a problem with the
62605 host, or the connection to it. If a timeout after MAIL, RCPT,
62606 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
62607 the timeout is likely to occur at some other point in the dialogue, causing it
62608 then to be treated as a host error.
62609 </para>
62610 <para>
62611 There is experimental evidence that some MTAs drop the connection after the
62612 terminating <quote>.</quote> if they do not like the contents of the message for some
62613 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
62614 should be given. That is why Exim treats this case as a message rather than a
62615 host error, in order not to delay other messages to the same host.
62616 </para>
62617 </section>
62618 <section id="SECID233">
62619 <title>Incoming SMTP messages over TCP/IP</title>
62620 <para>
62621 <indexterm role="concept">
62622 <primary>SMTP</primary>
62623 <secondary>incoming over TCP/IP</secondary>
62624 </indexterm>
62625 <indexterm role="concept">
62626 <primary>incoming SMTP over TCP/IP</primary>
62627 </indexterm>
62628 <indexterm role="concept">
62629 <primary>inetd</primary>
62630 </indexterm>
62631 <indexterm role="concept">
62632 <primary>daemon</primary>
62633 </indexterm>
62634 Incoming SMTP messages can be accepted in one of two ways: by running a
62635 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
62636 <filename>/etc/inetd.conf</filename> should be like this:
62637 </para>
62638 <literallayout class="monospaced">
62639 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
62640 </literallayout>
62641 <para>
62642 Exim distinguishes between this case and the case of a locally running user
62643 agent using the <option>-bs</option> option by checking whether or not the standard input is
62644 a socket. When it is, either the port must be privileged (less than 1024), or
62645 the caller must be root or the Exim user. If any other user passes a socket
62646 with an unprivileged port number, Exim prints a message on the standard error
62647 stream and exits with an error code.
62648 </para>
62649 <para>
62650 By default, Exim does not make a log entry when a remote host connects or
62651 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
62652 unexpected. It can be made to write such log entries by setting the
62653 <option>smtp_connection</option> log selector.
62654 </para>
62655 <para>
62656 <indexterm role="concept">
62657 <primary>carriage return</primary>
62658 </indexterm>
62659 <indexterm role="concept">
62660 <primary>linefeed</primary>
62661 </indexterm>
62662 Commands from the remote host are supposed to be terminated by CR followed by
62663 LF. However, there are known to be hosts that do not send CR characters. In
62664 order to be able to interwork with such hosts, Exim treats LF on its own as a
62665 line terminator.
62666 Furthermore, because common code is used for receiving messages from all
62667 sources, a CR on its own is also interpreted as a line terminator. However, the
62668 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
62669 </para>
62670 <para>
62671 <indexterm role="concept">
62672 <primary>EHLO</primary>
62673 <secondary>invalid data</secondary>
62674 </indexterm>
62675 <indexterm role="concept">
62676 <primary>HELO</primary>
62677 <secondary>invalid data</secondary>
62678 </indexterm>
62679 One area that sometimes gives rise to problems concerns the EHLO or
62680 HELO commands. Some clients send syntactically invalid versions of these
62681 commands, which Exim rejects by default. (This is nothing to do with verifying
62682 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
62683 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
62684 match the broken hosts that send invalid commands.
62685 </para>
62686 <para>
62687 <indexterm role="concept">
62688 <primary>SIZE option on MAIL command</primary>
62689 </indexterm>
62690 <indexterm role="concept">
62691 <primary>MAIL</primary>
62692 <secondary>SIZE option</secondary>
62693 </indexterm>
62694 The amount of disk space available is checked whenever SIZE is received on
62695 a MAIL command, independently of whether <option>message_size_limit</option> or
62696 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
62697 false. A temporary error is given if there is not enough space. If
62698 <option>check_spool_space</option> is set, the check is for that amount of space plus the
62699 value given with SIZE, that is, it checks that the addition of the incoming
62700 message will not reduce the space below the threshold.
62701 </para>
62702 <para>
62703 When a message is successfully received, Exim includes the local message id in
62704 its response to the final <quote>.</quote> that terminates the data. If the remote host
62705 logs this text it can help with tracing what has happened to a message.
62706 </para>
62707 <para>
62708 The Exim daemon can limit the number of simultaneous incoming connections it is
62709 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
62710 number of simultaneous incoming connections from a single remote host (see the
62711 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
62712 rejected using the SMTP temporary error code 421.
62713 </para>
62714 <para>
62715 The Exim daemon does not rely on the SIGCHLD signal to detect when a
62716 subprocess has finished, as this can get lost at busy times. Instead, it looks
62717 for completed subprocesses every time it wakes up. Provided there are other
62718 things happening (new incoming calls, starts of queue runs), completed
62719 processes will be noticed and tidied away. On very quiet systems you may
62720 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
62721 it will be noticed when the daemon next wakes up.
62722 </para>
62723 <para>
62724 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
62725 and can also be set up to reject SMTP calls from non-reserved hosts at times of
62726 high system load &ndash; for details see the <option>smtp_accept_reserve</option>,
62727 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
62728 applies in both the daemon and <emphasis>inetd</emphasis> cases.
62729 </para>
62730 <para>
62731 Exim normally starts a delivery process for each message received, though this
62732 can be varied by means of the <option>-odq</option> command line option and the
62733 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
62734 number of simultaneously running delivery processes started in this way from
62735 SMTP input can be limited by the <option>smtp_accept_queue</option> and
62736 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
62737 subsequently received messages are just put on the input queue without starting
62738 a delivery process.
62739 </para>
62740 <para>
62741 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
62742 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
62743 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
62744 handled by an entirely independent Exim process. Control by load average is,
62745 however, available with <emphasis>inetd</emphasis>.
62746 </para>
62747 <para>
62748 Exim can be configured to verify addresses in incoming SMTP commands as they
62749 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
62750 to rewrite addresses at this time &ndash; before any syntax checking is done. See
62751 section <xref linkend="SECTrewriteS"/>.
62752 </para>
62753 <para>
62754 Exim can also be configured to limit the rate at which a client host submits
62755 MAIL and RCPT commands in a single SMTP session. See the
62756 <option>smtp_ratelimit_hosts</option> option.
62757 </para>
62758 </section>
62759 <section id="SECID234">
62760 <title>Unrecognized SMTP commands</title>
62761 <para>
62762 <indexterm role="concept">
62763 <primary>SMTP</primary>
62764 <secondary>unrecognized commands</secondary>
62765 </indexterm>
62766 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
62767 commands during a single SMTP connection, it drops the connection after sending
62768 the error response to the last command. The default value for
62769 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
62770 abuse that subvert web servers into making connections to SMTP ports; in these
62771 circumstances, a number of non-SMTP lines are sent first.
62772 </para>
62773 </section>
62774 <section id="SECID235">
62775 <title>Syntax and protocol errors in SMTP commands</title>
62776 <para>
62777 <indexterm role="concept">
62778 <primary>SMTP</primary>
62779 <secondary>syntax errors</secondary>
62780 </indexterm>
62781 <indexterm role="concept">
62782 <primary>SMTP</primary>
62783 <secondary>protocol errors</secondary>
62784 </indexterm>
62785 A syntax error is detected if an SMTP command is recognized, but there is
62786 something syntactically wrong with its data, for example, a malformed email
62787 address in a RCPT command. Protocol errors include invalid command
62788 sequencing such as RCPT before MAIL. If Exim receives more than
62789 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
62790 drops the connection after sending the error response to the last command. The
62791 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
62792 broken clients that loop sending bad commands (yes, it has been seen).
62793 </para>
62794 </section>
62795 <section id="SECID236">
62796 <title>Use of non-mail SMTP commands</title>
62797 <para>
62798 <indexterm role="concept">
62799 <primary>SMTP</primary>
62800 <secondary>non-mail commands</secondary>
62801 </indexterm>
62802 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
62803 DATA. Exim counts such commands, and drops the connection if there are too
62804 many of them in a single SMTP session. This action catches some
62805 denial-of-service attempts and things like repeated failing AUTHs, or a mad
62806 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
62807 defines what <quote>too many</quote> means. Its default value is 10.
62808 </para>
62809 <para>
62810 When a new message is expected, one occurrence of RSET is not counted. This
62811 allows a client to send one RSET between messages (this is not necessary,
62812 but some clients do it). Exim also allows one uncounted occurrence of HELO
62813 or EHLO, and one occurrence of STARTTLS between messages. After
62814 starting up a TLS session, another EHLO is expected, and so it too is not
62815 counted.
62816 </para>
62817 <para>
62818 The first occurrence of AUTH in a connection, or immediately following
62819 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
62820 RCPT, DATA, and QUIT are counted.
62821 </para>
62822 <para>
62823 You can control which hosts are subject to the limit set by
62824 <option>smtp_accept_max_nonmail</option> by setting
62825 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
62826 the limit apply to all hosts. This option means that you can exclude any
62827 specific badly-behaved hosts that you have to live with.
62828 </para>
62829 </section>
62830 <section id="SECID237">
62831 <title>The VRFY and EXPN commands</title>
62832 <para>
62833 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
62834 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
62835 appropriate) in order to decide whether the command should be accepted or not.
62836 </para>
62837 <para revisionflag="changed">
62838 <indexterm role="concept">
62839 <primary>VRFY</primary>
62840 <secondary>processing</secondary>
62841 </indexterm>
62842 When no ACL is defined for VRFY, or if it rejects without
62843 setting an explicit response code, the command is accepted
62844 (with a 252 SMTP response code)
62845 in order to support awkward clients that do a VRFY before every RCPT.
62846 </para>
62847 <para>
62848 When VRFY is accepted, it runs exactly the same code as when Exim is
62849 called with the <option>-bv</option> option, and returns 250/451/550
62850 SMTP response codes.
62851 </para>
62852 <para>
62853 <indexterm role="concept">
62854 <primary>EXPN</primary>
62855 <secondary>processing</secondary>
62856 </indexterm>
62857 If no ACL for EXPN is defined, the command is rejected.
62858 When EXPN is accepted, a single-level expansion of the address is done.
62859 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
62860 than a verification (the <option>-bv</option> option). If an unqualified local part is given
62861 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
62862 of VRFY and EXPN commands are logged on the main and reject logs, and
62863 VRFY verification failures are logged on the main log for consistency with
62864 RCPT failures.
62865 </para>
62866 </section>
62867 <section id="SECTETRN">
62868 <title>The ETRN command</title>
62869 <para>
62870 <indexterm role="concept">
62871 <primary>ETRN</primary>
62872 <secondary>processing</secondary>
62873 </indexterm>
62874 RFC 1985 describes an SMTP command called ETRN that is designed to
62875 overcome the security problems of the TURN command (which has fallen into
62876 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
62877 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
62878 should be accepted or not. If no ACL is defined, the command is rejected.
62879 </para>
62880 <para>
62881 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
62882 delivery to certain hosts. As Exim does not organize its message queue by host,
62883 the only form of ETRN that is supported by default is the one where the
62884 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
62885 specific to the SMTP server. A valid ETRN command causes a run of Exim with
62886 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
62887 argument. For example,
62888 </para>
62889 <literallayout class="monospaced">
62890 ETRN #brigadoon
62891 </literallayout>
62892 <para>
62893 runs the command
62894 </para>
62895 <literallayout class="monospaced">
62896 exim -R brigadoon
62897 </literallayout>
62898 <para>
62899 which causes a delivery attempt on all messages with undelivered addresses
62900 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
62901 default), Exim prevents the simultaneous execution of more than one queue run
62902 for the same argument string as a result of an ETRN command. This stops
62903 a misbehaving client from starting more than one queue runner at once.
62904 </para>
62905 <para>
62906 <indexterm role="concept">
62907 <primary>hints database</primary>
62908 <secondary>ETRN serialization</secondary>
62909 </indexterm>
62910 Exim implements the serialization by means of a hints database in which a
62911 record is written whenever a process is started by ETRN, and deleted when
62912 the process completes. However, Exim does not keep the SMTP session waiting for
62913 the ETRN process to complete. Once ETRN is accepted, the client is sent
62914 a <quote>success</quote> return code. Obviously there is scope for hints records to get
62915 left lying around if there is a system or program crash. To guard against this,
62916 Exim ignores any records that are more than six hours old.
62917 </para>
62918 <para>
62919 <indexterm role="option">
62920 <primary><option>smtp_etrn_command</option></primary>
62921 </indexterm>
62922 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
62923 used. This specifies a command that is run whenever ETRN is received,
62924 whatever the form of its argument. For
62925 example:
62926 </para>
62927 <literallayout class="monospaced">
62928 smtp_etrn_command = /etc/etrn_command $domain \
62929                     $sender_host_address
62930 </literallayout>
62931 <para>
62932 <indexterm role="variable">
62933 <primary><varname>$domain</varname></primary>
62934 </indexterm>
62935 The string is split up into arguments which are independently expanded. The
62936 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
62937 and no syntax checking is done on the contents of this argument. Exim does not
62938 wait for the command to complete, so its status code is not checked. Exim runs
62939 under its own uid and gid when receiving incoming SMTP, so it is not possible
62940 for it to change them before running the command.
62941 </para>
62942 </section>
62943 <section id="SECID238">
62944 <title>Incoming local SMTP</title>
62945 <para>
62946 <indexterm role="concept">
62947 <primary>SMTP</primary>
62948 <secondary>local incoming</secondary>
62949 </indexterm>
62950 Some user agents use SMTP to pass messages to their local MTA using the
62951 standard input and output, as opposed to passing the envelope on the command
62952 line and writing the message to the standard input. This is supported by the
62953 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
62954 messages over TCP/IP (including the use of ACLs), except that the envelope
62955 sender given in a MAIL command is ignored unless the caller is trusted. In
62956 an ACL you can detect this form of SMTP input by testing for an empty host
62957 identification. It is common to have this as the first line in the ACL that
62958 runs for RCPT commands:
62959 </para>
62960 <literallayout class="monospaced">
62961 accept hosts = :
62962 </literallayout>
62963 <para>
62964 This accepts SMTP messages from local processes without doing any other tests.
62965 </para>
62966 </section>
62967 <section id="SECTbatchSMTP">
62968 <title>Outgoing batched SMTP</title>
62969 <para>
62970 <indexterm role="concept">
62971 <primary>SMTP</primary>
62972 <secondary>batched outgoing</secondary>
62973 </indexterm>
62974 <indexterm role="concept">
62975 <primary>batched SMTP output</primary>
62976 </indexterm>
62977 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
62978 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
62979 be output in BSMTP format. No SMTP responses are possible for this form of
62980 delivery. All it is doing is using SMTP commands as a way of transmitting the
62981 envelope along with the message.
62982 </para>
62983 <para>
62984 The message is written to the file or pipe preceded by the SMTP commands
62985 MAIL and RCPT, and followed by a line containing a single dot. Lines in
62986 the message that start with a dot have an extra dot added. The SMTP command
62987 HELO is not normally used. If it is required, the <option>message_prefix</option> option
62988 can be used to specify it.
62989 </para>
62990 <para>
62991 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
62992 one recipient address at a time by default. However, you can arrange for them
62993 to handle several addresses at once by setting the <option>batch_max</option> option. When
62994 this is done for BSMTP, messages may contain multiple RCPT commands. See
62995 chapter <xref linkend="CHAPbatching"/> for more details.
62996 </para>
62997 <para>
62998 <indexterm role="variable">
62999 <primary><varname>$host</varname></primary>
63000 </indexterm>
63001 When one or more addresses are routed to a BSMTP transport by a router that
63002 sets up a host list, the name of the first host on the list is available to the
63003 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
63004 router:
63005 </para>
63006 <literallayout class="monospaced">
63007 begin routers
63008 route_append:
63009   driver = manualroute
63010   transport = smtp_appendfile
63011   route_list = domain.example  batch.host.example
63012
63013 begin transports
63014 smtp_appendfile:
63015   driver = appendfile
63016   directory = /var/bsmtp/$host
63017   batch_max = 1000
63018   use_bsmtp
63019   user = exim
63020 </literallayout>
63021 <para>
63022 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
63023 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
63024 message (unless there are more than 1000 recipients).
63025 </para>
63026 </section>
63027 <section id="SECTincomingbatchedSMTP">
63028 <title>Incoming batched SMTP</title>
63029 <para>
63030 <indexterm role="concept">
63031 <primary>SMTP</primary>
63032 <secondary>batched incoming</secondary>
63033 </indexterm>
63034 <indexterm role="concept">
63035 <primary>batched SMTP input</primary>
63036 </indexterm>
63037 The <option>-bS</option> command line option causes Exim to accept one or more messages by
63038 reading SMTP on the standard input, but to generate no responses. If the caller
63039 is trusted, the senders in the MAIL commands are believed; otherwise the
63040 sender is always the caller of Exim. Unqualified senders and receivers are not
63041 rejected (there seems little point) but instead just get qualified. HELO
63042 and EHLO act as RSET; VRFY, EXPN, ETRN and  HELP, act
63043 as NOOP; QUIT quits.
63044 </para>
63045 <para>
63046 Minimal policy checking is done for BSMTP input. Only the non-SMTP
63047 ACL is run in the same way as for non-SMTP local input.
63048 </para>
63049 <para>
63050 If an error is detected while reading a message, including a missing <quote>.</quote> at
63051 the end, Exim gives up immediately. It writes details of the error to the
63052 standard output in a stylized way that the calling program should be able to
63053 make some use of automatically, for example:
63054 </para>
63055 <literallayout class="monospaced">
63056 554 Unexpected end of file
63057 Transaction started in line 10
63058 Error detected in line 14
63059 </literallayout>
63060 <para>
63061 It writes a more verbose version, for human consumption, to the standard error
63062 file, for example:
63063 </para>
63064 <literallayout class="monospaced">
63065 An error was detected while processing a file of BSMTP input.
63066 The error message was:
63067
63068 501 '&gt;' missing at end of address
63069
63070 The SMTP transaction started in line 10.
63071 The error was detected in line 12.
63072 The SMTP command at fault was:
63073
63074 rcpt to:&lt;malformed@in.com.plete
63075
63076 1 previous message was successfully processed.
63077 The rest of the batch was abandoned.
63078 </literallayout>
63079 <para>
63080 The return code from Exim is zero only if there were no errors. It is 1 if some
63081 messages were accepted before an error was detected, and 2 if no messages were
63082 accepted.
63083 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
63084 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
63085 </para>
63086 </section>
63087 </chapter>
63088
63089 <chapter id="CHAPemsgcust">
63090 <title>Customizing bounce and warning messages</title>
63091 <titleabbrev>Customizing messages</titleabbrev>
63092 <para>
63093 When a message fails to be delivered, or remains on the queue for more than a
63094 configured amount of time, Exim sends a message to the original sender, or
63095 to an alternative configured address. The text of these messages is built into
63096 the code of Exim, but it is possible to change it, either by adding a single
63097 string, or by replacing each of the paragraphs by text supplied in a file.
63098 </para>
63099 <para>
63100 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
63101 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
63102 option. Exim also adds the line
63103 </para>
63104 <literallayout class="monospaced">
63105 Auto-Submitted: auto-generated
63106 </literallayout>
63107 <para>
63108 to all warning and bounce messages,
63109 </para>
63110 <section id="SECID239">
63111 <title>Customizing bounce messages</title>
63112 <para>
63113 <indexterm role="concept">
63114 <primary>customizing</primary>
63115 <secondary>bounce message</secondary>
63116 </indexterm>
63117 <indexterm role="concept">
63118 <primary>bounce message</primary>
63119 <secondary>customizing</secondary>
63120 </indexterm>
63121 If <option>bounce_message_text</option> is set, its contents are included in the default
63122 message immediately after <quote>This message was created automatically by mail
63123 delivery software.</quote> The string is not expanded. It is not used if
63124 <option>bounce_message_file</option> is set.
63125 </para>
63126 <para>
63127 When <option>bounce_message_file</option> is set, it must point to a template file for
63128 constructing error messages. The file consists of a series of text items,
63129 separated by lines consisting of exactly four asterisks. If the file cannot be
63130 opened, default text is used and a message is written to the main and panic
63131 logs. If any text item in the file is empty, default text is used for that
63132 item.
63133 </para>
63134 <para>
63135 <indexterm role="variable">
63136 <primary><varname>$bounce_recipient</varname></primary>
63137 </indexterm>
63138 <indexterm role="variable">
63139 <primary><varname>$bounce_return_size_limit</varname></primary>
63140 </indexterm>
63141 Each item of text that is read from the file is expanded, and there are two
63142 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
63143 the recipient of an error message while it is being created, and
63144 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
63145 option, rounded to a whole number.
63146 </para>
63147 <para>
63148 The items must appear in the file in the following order:
63149 </para>
63150 <itemizedlist>
63151 <listitem>
63152 <para>
63153 The first item is included in the headers, and should include at least a
63154 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
63155 </para>
63156 </listitem>
63157 <listitem>
63158 <para>
63159 The second item forms the start of the error message. After it, Exim lists the
63160 failing addresses with their error messages.
63161 </para>
63162 </listitem>
63163 <listitem>
63164 <para>
63165 The third item is used to introduce any text from pipe transports that is to be
63166 returned to the sender. It is omitted if there is no such text.
63167 </para>
63168 </listitem>
63169 <listitem>
63170 <para>
63171 The fourth, fifth and sixth items will be ignored and may be empty.
63172 The fields exist for back-compatibility
63173 </para>
63174 </listitem>
63175 </itemizedlist>
63176 <para>
63177 The default state (<option>bounce_message_file</option> unset) is equivalent to the
63178 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
63179 other lines have been split in order to fit them on the page:
63180 </para>
63181 <literallayout class="monospaced">
63182 Subject: Mail delivery failed
63183   ${if eq{$sender_address}{$bounce_recipient}
63184   {: returning message to sender}}
63185 ****
63186 This message was created automatically by mail delivery software.
63187
63188 A message ${if eq{$sender_address}{$bounce_recipient}
63189   {that you sent }{sent by
63190
63191 &lt;$sender_address&gt;
63192
63193 }}could not be delivered to all of its recipients.
63194 This is a permanent error. The following address(es) failed:
63195 ****
63196 The following text was generated during the delivery attempt(s):
63197 ****
63198 ------ This is a copy of the message, including all the headers.
63199   ------
63200 ****
63201 ------ The body of the message is $message_size characters long;
63202   only the first
63203 ------ $bounce_return_size_limit or so are included here.
63204 ****
63205 </literallayout>
63206 </section>
63207 <section id="SECTcustwarn">
63208 <title>Customizing warning messages</title>
63209 <para>
63210 <indexterm role="concept">
63211 <primary>customizing</primary>
63212 <secondary>warning message</secondary>
63213 </indexterm>
63214 <indexterm role="concept">
63215 <primary>warning of delay</primary>
63216 <secondary>customizing the message</secondary>
63217 </indexterm>
63218 The option <option>warn_message_file</option> can be pointed at a template file for use when
63219 warnings about message delays are created. In this case there are only three
63220 text sections:
63221 </para>
63222 <itemizedlist>
63223 <listitem>
63224 <para>
63225 The first item is included in the headers, and should include at least a
63226 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
63227 </para>
63228 </listitem>
63229 <listitem>
63230 <para>
63231 The second item forms the start of the warning message. After it, Exim lists
63232 the delayed addresses.
63233 </para>
63234 </listitem>
63235 <listitem>
63236 <para>
63237 The third item then ends the message.
63238 </para>
63239 </listitem>
63240 </itemizedlist>
63241 <para>
63242 The default state is equivalent to the following file, except that some lines
63243 have been split here, in order to fit them on the page:
63244 </para>
63245 <literallayout class="monospaced">
63246 Subject: Warning: message $message_exim_id delayed
63247   $warn_message_delay
63248 ****
63249 This message was created automatically by mail delivery software.
63250
63251 A message ${if eq{$sender_address}{$warn_message_recipients}
63252 {that you sent }{sent by
63253
63254 &lt;$sender_address&gt;
63255
63256 }}has not been delivered to all of its recipients after
63257 more than $warn_message_delay on the queue on $primary_hostname.
63258
63259 The message identifier is:     $message_exim_id
63260 The subject of the message is: $h_subject
63261 The date of the message is:    $h_date
63262
63263 The following address(es) have not yet been delivered:
63264 ****
63265 No action is required on your part. Delivery attempts will
63266 continue for some time, and this warning may be repeated at
63267 intervals if the message remains undelivered. Eventually the
63268 mail delivery software will give up, and when that happens,
63269 the message will be returned to you.
63270 </literallayout>
63271 <para>
63272 <indexterm role="variable">
63273 <primary><varname>$warn_message_delay</varname></primary>
63274 </indexterm>
63275 <indexterm role="variable">
63276 <primary><varname>$warn_message_recipients</varname></primary>
63277 </indexterm>
63278 However, in the default state the subject and date lines are omitted if no
63279 appropriate headers exist. During the expansion of this file,
63280 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote>&lt;<emphasis>n</emphasis>&gt;
63281 minutes</quote> or <quote>&lt;<emphasis>n</emphasis>&gt; hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
63282 of recipients for the warning message. There may be more than one if there are
63283 multiple addresses with different <option>errors_to</option> settings on the routers that
63284 handled them.
63285 </para>
63286 </section>
63287 </chapter>
63288
63289 <chapter id="CHAPcomconreq">
63290 <title>Some common configuration settings</title>
63291 <para>
63292 This chapter discusses some configuration settings that seem to be fairly
63293 common. More examples and discussion can be found in the Exim book.
63294 </para>
63295 <section id="SECID240">
63296 <title>Sending mail to a smart host</title>
63297 <para>
63298 <indexterm role="concept">
63299 <primary>smart host</primary>
63300 <secondary>example router</secondary>
63301 </indexterm>
63302 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
63303 should replace the default <command>dnslookup</command> router with a router which does the
63304 routing explicitly:
63305 </para>
63306 <literallayout class="monospaced">
63307 send_to_smart_host:
63308   driver = manualroute
63309   route_list = !+local_domains smart.host.name
63310   transport = remote_smtp
63311 </literallayout>
63312 <para>
63313 You can use the smart host&#x2019;s IP address instead of the name if you wish.
63314 If you are using Exim only to submit messages to a smart host, and not for
63315 receiving incoming messages, you can arrange for it to do the submission
63316 synchronously by setting the <option>mua_wrapper</option> option (see chapter
63317 <xref linkend="CHAPnonqueueing"/>).
63318 </para>
63319 </section>
63320 <section id="SECTmailinglists">
63321 <title>Using Exim to handle mailing lists</title>
63322 <para>
63323 <indexterm role="concept">
63324 <primary>mailing lists</primary>
63325 </indexterm>
63326 Exim can be used to run simple mailing lists, but for large and/or complicated
63327 requirements, the use of additional specialized mailing list software such as
63328 Majordomo or Mailman is recommended.
63329 </para>
63330 <para>
63331 The <command>redirect</command> router can be used to handle mailing lists where each list
63332 is maintained in a separate file, which can therefore be managed by an
63333 independent manager. The <option>domains</option> router option can be used to run these
63334 lists in a separate domain from normal mail. For example:
63335 </para>
63336 <literallayout class="monospaced">
63337 lists:
63338   driver = redirect
63339   domains = lists.example
63340   file = /usr/lists/$local_part
63341   forbid_pipe
63342   forbid_file
63343   errors_to = $local_part-request@lists.example
63344   no_more
63345 </literallayout>
63346 <para>
63347 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
63348 in that domain, it looks for a file that matches the local part. If there is no
63349 such file, the router declines, but because <option>no_more</option> is set, no subsequent
63350 routers are tried, and so the whole delivery fails.
63351 </para>
63352 <para>
63353 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
63354 expanded into a file name or a pipe delivery, which is usually inappropriate in
63355 a mailing list.
63356 </para>
63357 <para>
63358 <indexterm role="option">
63359 <primary><option>errors_to</option></primary>
63360 </indexterm>
63361 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
63362 taken from a mailing list are to be sent to the given address rather than the
63363 original sender of the message. However, before acting on this, Exim verifies
63364 the error address, and ignores it if verification fails.
63365 </para>
63366 <para>
63367 For example, using the configuration above, mail sent to
63368 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
63369 <filename>/usr/lists/dicts</filename>, with error reports directed to
63370 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
63371 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
63372 the address(es) of this particular list&#x2019;s manager(s), but other approaches,
63373 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
63374 or <option>local_part_suffix</option> options) to handle addresses of the form
63375 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
63376 </para>
63377 </section>
63378 <section id="SECID241">
63379 <title>Syntax errors in mailing lists</title>
63380 <para>
63381 <indexterm role="concept">
63382 <primary>mailing lists</primary>
63383 <secondary>syntax errors in</secondary>
63384 </indexterm>
63385 If an entry in redirection data contains a syntax error, Exim normally defers
63386 delivery of the original address. That means that a syntax error in a mailing
63387 list holds up all deliveries to the list. This may not be appropriate when a
63388 list is being maintained automatically from data supplied by users, and the
63389 addresses are not rigorously checked.
63390 </para>
63391 <para>
63392 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
63393 entries that fail to parse, noting the incident in the log. If in addition
63394 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
63395 whenever a broken address is skipped. It is usually appropriate to set
63396 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
63397 </para>
63398 </section>
63399 <section id="SECID242">
63400 <title>Re-expansion of mailing lists</title>
63401 <para>
63402 <indexterm role="concept">
63403 <primary>mailing lists</primary>
63404 <secondary>re-expansion of</secondary>
63405 </indexterm>
63406 Exim remembers every individual address to which a message has been delivered,
63407 in order to avoid duplication, but it normally stores only the original
63408 recipient addresses with a message. If all the deliveries to a mailing list
63409 cannot be done at the first attempt, the mailing list is re-expanded when the
63410 delivery is next tried. This means that alterations to the list are taken into
63411 account at each delivery attempt, so addresses that have been added to
63412 the list since the message arrived will therefore receive a copy of the
63413 message, even though it pre-dates their subscription.
63414 </para>
63415 <para>
63416 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
63417 on the <command>redirect</command> router. If this is done, any addresses generated by the
63418 router that fail to deliver at the first attempt are added to the message as
63419 <quote>top level</quote> addresses, and the parent address that generated them is marked
63420 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
63421 subsequent delivery attempts. The disadvantage of this is that if any of the
63422 failing addresses are incorrect, correcting them in the file has no effect on
63423 pre-existing messages.
63424 </para>
63425 <para>
63426 The original top-level address is remembered with each of the generated
63427 addresses, and is output in any log messages. However, any intermediate parent
63428 addresses are not recorded. This makes a difference to the log only if the
63429 <option>all_parents</option> selector is set, but for mailing lists there is normally only
63430 one level of expansion anyway.
63431 </para>
63432 </section>
63433 <section id="SECID243">
63434 <title>Closed mailing lists</title>
63435 <para>
63436 <indexterm role="concept">
63437 <primary>mailing lists</primary>
63438 <secondary>closed</secondary>
63439 </indexterm>
63440 The examples so far have assumed open mailing lists, to which anybody may
63441 send mail. It is also possible to set up closed lists, where mail is accepted
63442 from specified senders only. This is done by making use of the generic
63443 <option>senders</option> option to restrict the router that handles the list.
63444 </para>
63445 <para>
63446 The following example uses the same file as a list of recipients and as a list
63447 of permitted senders. It requires three routers:
63448 </para>
63449 <literallayout class="monospaced">
63450 lists_request:
63451   driver = redirect
63452   domains = lists.example
63453   local_part_suffix = -request
63454   file = /usr/lists/$local_part$local_part_suffix
63455   no_more
63456
63457 lists_post:
63458   driver = redirect
63459   domains = lists.example
63460   senders = ${if exists {/usr/lists/$local_part}\
63461              {lsearch;/usr/lists/$local_part}{*}}
63462   file = /usr/lists/$local_part
63463   forbid_pipe
63464   forbid_file
63465   errors_to = $local_part-request@lists.example
63466   no_more
63467
63468 lists_closed:
63469   driver = redirect
63470   domains = lists.example
63471   allow_fail
63472   data = :fail: $local_part@lists.example is a closed mailing list
63473 </literallayout>
63474 <para>
63475 All three routers have the same <option>domains</option> setting, so for any other domains,
63476 they are all skipped. The first router runs only if the local part ends in
63477 <option>-request</option>. It handles messages to the list manager(s) by means of an open
63478 mailing list.
63479 </para>
63480 <para>
63481 The second router runs only if the <option>senders</option> precondition is satisfied. It
63482 checks for the existence of a list that corresponds to the local part, and then
63483 checks that the sender is on the list by means of a linear search. It is
63484 necessary to check for the existence of the file before trying to search it,
63485 because otherwise Exim thinks there is a configuration error. If the file does
63486 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
63487 means that the router runs, but because there is no list, declines, and
63488 <option>no_more</option> ensures that no further routers are run. The address fails with an
63489 <quote>unrouteable address</quote> error.
63490 </para>
63491 <para>
63492 The third router runs only if the second router is skipped, which happens when
63493 a mailing list exists, but the sender is not on it. This router forcibly fails
63494 the address, giving a suitable error message.
63495 </para>
63496 </section>
63497 <section id="SECTverp">
63498 <title>Variable Envelope Return Paths (VERP)</title>
63499 <para>
63500 <indexterm role="concept">
63501 <primary>VERP</primary>
63502 </indexterm>
63503 <indexterm role="concept">
63504 <primary>Variable Envelope Return Paths</primary>
63505 </indexterm>
63506 <indexterm role="concept">
63507 <primary>envelope sender</primary>
63508 </indexterm>
63509 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;
63510 are a way of helping mailing list administrators discover which subscription
63511 address is the cause of a particular delivery failure. The idea is to encode
63512 the original recipient address in the outgoing envelope sender address, so that
63513 if the message is forwarded by another host and then subsequently bounces, the
63514 original recipient can be extracted from the recipient address of the bounce.
63515 </para>
63516 <para>
63517 <indexterm role="option">
63518 <primary><option>errors_to</option></primary>
63519 </indexterm>
63520 <indexterm role="option">
63521 <primary><option>return_path</option></primary>
63522 </indexterm>
63523 Envelope sender addresses can be modified by Exim using two different
63524 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
63525 list examples), or the <option>return_path</option> option on a transport. The second of
63526 these is effective only if the message is successfully delivered to another
63527 host; it is not used for errors detected on the local host (see the description
63528 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
63529 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
63530 </para>
63531 <literallayout class="monospaced">
63532 verp_smtp:
63533   driver = smtp
63534   max_rcpt = 1
63535   return_path = \
63536     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
63537       {$1-request+$local_part=$domain@your.dom.example}fail}
63538 </literallayout>
63539 <para>
63540 This has the effect of rewriting the return path (envelope sender) on outgoing
63541 SMTP messages, if the local part of the original return path ends in
63542 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
63543 local part and domain of the recipient into the return path. Suppose, for
63544 example, that a message whose return path has been set to
63545 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
63546 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
63547 rewritten as
63548 </para>
63549 <literallayout class="monospaced">
63550 somelist-request+subscriber=other.dom.example@your.dom.example
63551 </literallayout>
63552 <para>
63553 <indexterm role="variable">
63554 <primary><varname>$local_part</varname></primary>
63555 </indexterm>
63556 For this to work, you must tell Exim to send multiple copies of messages that
63557 have more than one recipient, so that each copy has just one recipient. This is
63558 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
63559 might be sent to several different recipients in the same domain, in which case
63560 <varname>$local_part</varname> is not available in the transport, because it is not unique.
63561 </para>
63562 <para>
63563 Unless your host is doing nothing but mailing list deliveries, you should
63564 probably use a separate transport for the VERP deliveries, so as not to use
63565 extra resources in making one-per-recipient copies for other deliveries. This
63566 can easily be done by expanding the <option>transport</option> option in the router:
63567 </para>
63568 <literallayout class="monospaced">
63569 dnslookup:
63570   driver = dnslookup
63571   domains = ! +local_domains
63572   transport = \
63573     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
63574       {verp_smtp}{remote_smtp}}
63575   no_more
63576 </literallayout>
63577 <para>
63578 If you want to change the return path using <option>errors_to</option> in a router instead
63579 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
63580 routers that handle mailing list addresses. This will ensure that all delivery
63581 errors, including those detected on the local host, are sent to the VERP
63582 address.
63583 </para>
63584 <para>
63585 On a host that does no local deliveries and has no manual routing, only the
63586 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
63587 SMTP deliveries. Every mailing list recipient has its own return path value,
63588 and so Exim must hand them to the transport one at a time. Here is an example
63589 of a <command>dnslookup</command> router that implements VERP:
63590 </para>
63591 <literallayout class="monospaced">
63592 verp_dnslookup:
63593   driver = dnslookup
63594   domains = ! +local_domains
63595   transport = remote_smtp
63596   errors_to = \
63597     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
63598      {$1-request+$local_part=$domain@your.dom.example}fail}
63599   no_more
63600 </literallayout>
63601 <para>
63602 Before you start sending out messages with VERPed return paths, you must also
63603 configure Exim to accept the bounce messages that come back to those paths.
63604 Typically this is done by setting a <option>local_part_suffix</option> option for a
63605 router, and using this to route the messages to wherever you want to handle
63606 them.
63607 </para>
63608 <para>
63609 The overhead incurred in using VERP depends very much on the size of the
63610 message, the number of recipient addresses that resolve to the same remote
63611 host, and the speed of the connection over which the message is being sent. If
63612 a lot of addresses resolve to the same host and the connection is slow, sending
63613 a separate copy of the message for each address may take substantially longer
63614 than sending a single copy with many recipients (for which VERP cannot be
63615 used).
63616 </para>
63617 </section>
63618 <section id="SECTvirtualdomains">
63619 <title>Virtual domains</title>
63620 <para>
63621 <indexterm role="concept">
63622 <primary>virtual domains</primary>
63623 </indexterm>
63624 <indexterm role="concept">
63625 <primary>domain</primary>
63626 <secondary>virtual</secondary>
63627 </indexterm>
63628 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
63629 meanings:
63630 </para>
63631 <itemizedlist>
63632 <listitem>
63633 <para>
63634 A domain for which there are no real mailboxes; all valid local parts are
63635 aliases for other email addresses. Common examples are organizational
63636 top-level domains and <quote>vanity</quote> domains.
63637 </para>
63638 </listitem>
63639 <listitem>
63640 <para>
63641 One of a number of independent domains that are all handled by the same host,
63642 with mailboxes on that host, but where the mailbox owners do not necessarily
63643 have login accounts on that host.
63644 </para>
63645 </listitem>
63646 </itemizedlist>
63647 <para>
63648 The first usage is probably more common, and does seem more <quote>virtual</quote> than
63649 the second. This kind of domain can be handled in Exim with a straightforward
63650 aliasing router. One approach is to create a separate alias file for each
63651 virtual domain. Exim can test for the existence of the alias file to determine
63652 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
63653 to a router of this form:
63654 </para>
63655 <literallayout class="monospaced">
63656 virtual:
63657   driver = redirect
63658   domains = dsearch;/etc/mail/virtual
63659   data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain}}
63660   no_more
63661 </literallayout>
63662 <para>
63663 The <option>domains</option> option specifies that the router is to be skipped, unless there
63664 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
63665 domain that is being processed. When the router runs, it looks up the local
63666 part in the file to find a new address (or list of addresses). The <option>no_more</option>
63667 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
63668 string), Exim gives up on the address without trying any subsequent routers.
63669 </para>
63670 <para>
63671 This one router can handle all the virtual domains because the alias file names
63672 follow a fixed pattern. Permissions can be arranged so that appropriate people
63673 can edit the different alias files. A successful aliasing operation results in
63674 a new envelope recipient address, which is then routed from scratch.
63675 </para>
63676 <para>
63677 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
63678 way. One approach is to create a file for each domain containing a list of
63679 valid local parts, and use it in a router like this:
63680 </para>
63681 <literallayout class="monospaced">
63682 my_domains:
63683   driver = accept
63684   domains = dsearch;/etc/mail/domains
63685   local_parts = lsearch;/etc/mail/domains/$domain
63686   transport = my_mailboxes
63687 </literallayout>
63688 <para>
63689 The address is accepted if there is a file for the domain, and the local part
63690 can be found in the file. The <option>domains</option> option is used to check for the
63691 file&#x2019;s existence because <option>domains</option> is tested before the <option>local_parts</option>
63692 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
63693 because that option is tested after <option>local_parts</option>. The transport is as
63694 follows:
63695 </para>
63696 <literallayout class="monospaced">
63697 my_mailboxes:
63698   driver = appendfile
63699   file = /var/mail/$domain/$local_part
63700   user = mail
63701 </literallayout>
63702 <para>
63703 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
63704 required, to specify which uid is to be used for writing to the mailboxes.
63705 </para>
63706 <para>
63707 The configuration shown here is just one example of how you might support this
63708 requirement. There are many other ways this kind of configuration can be set
63709 up, for example, by using a database instead of separate files to hold all the
63710 information about the domains.
63711 </para>
63712 </section>
63713 <section id="SECTmulbox">
63714 <title>Multiple user mailboxes</title>
63715 <para>
63716 <indexterm role="concept">
63717 <primary>multiple mailboxes</primary>
63718 </indexterm>
63719 <indexterm role="concept">
63720 <primary>mailbox</primary>
63721 <secondary>multiple</secondary>
63722 </indexterm>
63723 <indexterm role="concept">
63724 <primary>local part</primary>
63725 <secondary>prefix</secondary>
63726 </indexterm>
63727 <indexterm role="concept">
63728 <primary>local part</primary>
63729 <secondary>suffix</secondary>
63730 </indexterm>
63731 Heavy email users often want to operate with multiple mailboxes, into which
63732 incoming mail is automatically sorted. A popular way of handling this is to
63733 allow users to use multiple sender addresses, so that replies can easily be
63734 identified. Users are permitted to add prefixes or suffixes to their local
63735 parts for this purpose. The wildcard facility of the generic router options
63736 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
63737 example, consider this router:
63738 </para>
63739 <literallayout class="monospaced">
63740 userforward:
63741   driver = redirect
63742   check_local_user
63743   file = $home/.forward
63744   local_part_suffix = -*
63745   local_part_suffix_optional
63746   allow_filter
63747 </literallayout>
63748 <para>
63749 <indexterm role="variable">
63750 <primary><varname>$local_part_suffix</varname></primary>
63751 </indexterm>
63752 It runs a user&#x2019;s <filename>.forward</filename> file for all local parts of the form
63753 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
63754 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
63755 </para>
63756 <literallayout class="monospaced">
63757 if $local_part_suffix contains -special then
63758 save /home/$local_part/Mail/special
63759 endif
63760 </literallayout>
63761 <para>
63762 If the filter file does not exist, or does not deal with such addresses, they
63763 fall through to subsequent routers, and, assuming no subsequent use of the
63764 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
63765 control over which suffixes are valid.
63766 </para>
63767 <para>
63768 Alternatively, a suffix can be used to trigger the use of a different
63769 <filename>.forward</filename> file &ndash; which is the way a similar facility is implemented in
63770 another MTA:
63771 </para>
63772 <literallayout class="monospaced">
63773 userforward:
63774   driver = redirect
63775   check_local_user
63776   file = $home/.forward$local_part_suffix
63777   local_part_suffix = -*
63778   local_part_suffix_optional
63779   allow_filter
63780 </literallayout>
63781 <para>
63782 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
63783 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
63784 does not exist, or does not deal with the address, it is passed on to
63785 subsequent routers, which could, if required, look for an unqualified
63786 <filename>.forward</filename> file to use as a default.
63787 </para>
63788 </section>
63789 <section id="SECID244">
63790 <title>Simplified vacation processing</title>
63791 <para>
63792 <indexterm role="concept">
63793 <primary>vacation processing</primary>
63794 </indexterm>
63795 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
63796 a pipe command in a <filename>.forward</filename> file
63797 (see section <xref linkend="SECTspecitredli"/> for syntax details).
63798 This is prone to error by inexperienced users. There are two features of Exim
63799 that can be used to make this process simpler for users:
63800 </para>
63801 <itemizedlist>
63802 <listitem>
63803 <para>
63804 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
63805 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
63806 alternatively can use Exim&#x2019;s <command>autoreply</command> transport. The contents of a user&#x2019;s
63807 <filename>.forward</filename> file are then much simpler. For example:
63808 </para>
63809 <literallayout class="monospaced">
63810 spqr, vacation-spqr
63811 </literallayout>
63812 </listitem>
63813 <listitem>
63814 <para>
63815 The <option>require_files</option> generic router option can be used to trigger a
63816 vacation delivery by checking for the existence of a certain file in the
63817 user&#x2019;s home directory. The <option>unseen</option> generic option should also be used, to
63818 ensure that the original delivery also proceeds. In this case, all the user has
63819 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
63820 message.
63821 </para>
63822 </listitem>
63823 </itemizedlist>
63824 <para>
63825 Another advantage of both these methods is that they both work even when the
63826 use of arbitrary pipes by users is locked out.
63827 </para>
63828 </section>
63829 <section id="SECID245">
63830 <title>Taking copies of mail</title>
63831 <para>
63832 <indexterm role="concept">
63833 <primary>message</primary>
63834 <secondary>copying every</secondary>
63835 </indexterm>
63836 Some installations have policies that require archive copies of all messages to
63837 be made. A single copy of each message can easily be taken by an appropriate
63838 command in a system filter, which could, for example, use a different file for
63839 each day&#x2019;s messages.
63840 </para>
63841 <para>
63842 There is also a shadow transport mechanism that can be used to take copies of
63843 messages that are successfully delivered by local transports, one copy per
63844 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
63845 notification of delivery by sites that insist on doing such things.
63846 </para>
63847 </section>
63848 <section id="SECID246">
63849 <title>Intermittently connected hosts</title>
63850 <para>
63851 <indexterm role="concept">
63852 <primary>intermittently connected hosts</primary>
63853 </indexterm>
63854 It has become quite common (because it is cheaper) for hosts to connect to the
63855 Internet periodically rather than remain connected all the time. The normal
63856 arrangement is that mail for such hosts accumulates on a system that is
63857 permanently connected.
63858 </para>
63859 <para>
63860 Exim was designed for use on permanently connected hosts, and so it is not
63861 particularly well-suited to use in an intermittently connected environment.
63862 Nevertheless there are some features that can be used.
63863 </para>
63864 </section>
63865 <section id="SECID247">
63866 <title>Exim on the upstream server host</title>
63867 <para>
63868 It is tempting to arrange for incoming mail for the intermittently connected
63869 host to remain on Exim&#x2019;s queue until the client connects. However, this
63870 approach does not scale very well. Two different kinds of waiting message are
63871 being mixed up in the same queue &ndash; those that cannot be delivered because of
63872 some temporary problem, and those that are waiting for their destination host
63873 to connect. This makes it hard to manage the queue, as well as wasting
63874 resources, because each queue runner scans the entire queue.
63875 </para>
63876 <para>
63877 A better approach is to separate off those messages that are waiting for an
63878 intermittently connected host. This can be done by delivering these messages
63879 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
63880 format, from where they are transmitted by other software when their
63881 destination connects. This makes it easy to collect all the mail for one host
63882 in a single directory, and to apply local timeout rules on a per-message basis
63883 if required.
63884 </para>
63885 <para>
63886 On a very small scale, leaving the mail on Exim&#x2019;s queue can be made to work. If
63887 you are doing this, you should configure Exim with a long retry period for the
63888 intermittent host. For example:
63889 </para>
63890 <literallayout class="monospaced">
63891 cheshire.wonderland.fict.example    *   F,5d,24h
63892 </literallayout>
63893 <para>
63894 This stops a lot of failed delivery attempts from occurring, but Exim remembers
63895 which messages it has queued up for that host. Once the intermittent host comes
63896 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
63897 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
63898 causes all the queued up messages to be delivered, often down a single SMTP
63899 connection. While the host remains connected, any new messages get delivered
63900 immediately.
63901 </para>
63902 <para>
63903 If the connecting hosts do not have fixed IP addresses, that is, if a host is
63904 issued with a different IP address each time it connects, Exim&#x2019;s retry
63905 mechanisms on the holding host get confused, because the IP address is normally
63906 used as part of the key string for holding retry information. This can be
63907 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
63908 Since this has disadvantages for permanently connected hosts, it is best to
63909 arrange a separate transport for the intermittently connected ones.
63910 </para>
63911 </section>
63912 <section id="SECID248">
63913 <title>Exim on the intermittently connected client host</title>
63914 <para>
63915 The value of <option>smtp_accept_queue_per_connection</option> should probably be
63916 increased, or even set to zero (that is, disabled) on the intermittently
63917 connected host, so that all incoming messages down a single connection get
63918 delivered immediately.
63919 </para>
63920 <para>
63921 <indexterm role="concept">
63922 <primary>SMTP</primary>
63923 <secondary>passed connection</secondary>
63924 </indexterm>
63925 <indexterm role="concept">
63926 <primary>SMTP</primary>
63927 <secondary>multiple deliveries</secondary>
63928 </indexterm>
63929 <indexterm role="concept">
63930 <primary>multiple SMTP deliveries</primary>
63931 </indexterm>
63932 Mail waiting to be sent from an intermittently connected host will probably
63933 not have been routed, because without a connection DNS lookups are not
63934 possible. This means that if a normal queue run is done at connection time,
63935 each message is likely to be sent in a separate SMTP session. This can be
63936 avoided by starting the queue run with a command line option beginning with
63937 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
63938 first pass, routing is done but no deliveries take place. The second pass is a
63939 normal queue run; since all the messages have been previously routed, those
63940 destined for the same host are likely to get sent as multiple deliveries in a
63941 single SMTP connection.
63942 </para>
63943 </section>
63944 </chapter>
63945
63946 <chapter id="CHAPnonqueueing">
63947 <title>Using Exim as a non-queueing client</title>
63948 <titleabbrev>Exim as a non-queueing client</titleabbrev>
63949 <para>
63950 <indexterm role="concept">
63951 <primary>client, non-queueing</primary>
63952 </indexterm>
63953 <indexterm role="concept">
63954 <primary>smart host</primary>
63955 <secondary>suppressing queueing</secondary>
63956 </indexterm>
63957 On a personal computer, it is a common requirement for all
63958 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
63959 configured to operate that way, for all the popular operating systems.
63960 However, there are some MUAs for Unix-like systems that cannot be so
63961 configured: they submit messages using the command line interface of
63962 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
63963 messages this way.
63964 </para>
63965 <para>
63966 If the personal computer runs continuously, there is no problem, because it can
63967 run a conventional MTA that handles delivery to the smart host, and deal with
63968 any delays via its queueing mechanism. However, if the computer does not run
63969 continuously or runs different operating systems at different times, queueing
63970 email is not desirable.
63971 </para>
63972 <para>
63973 There is therefore a requirement for something that can provide the
63974 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
63975 any queueing or retrying facilities. Furthermore, the delivery to the smart
63976 host should be synchronous, so that if it fails, the sending MUA is immediately
63977 informed. In other words, we want something that extends an MUA that submits
63978 to a local MTA via the command line so that it behaves like one that submits
63979 to a remote smart host using TCP/SMTP.
63980 </para>
63981 <para>
63982 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
63983 that do this job. However, people have found them to be lacking in various
63984 ways. For instance, you might want to allow aliasing and forwarding to be done
63985 before sending a message to the smart host.
63986 </para>
63987 <para>
63988 Exim already had the necessary infrastructure for doing this job. Just a few
63989 tweaks were needed to make it behave as required, though it is somewhat of an
63990 overkill to use a fully-featured MTA for this purpose.
63991 </para>
63992 <para>
63993 <indexterm role="option">
63994 <primary><option>mua_wrapper</option></primary>
63995 </indexterm>
63996 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
63997 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
63998 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
63999 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
64000 compatible router and transport configuration. Typically there will be just one
64001 router and one transport, sending everything to a smart host.
64002 </para>
64003 <para>
64004 When run in MUA wrapping mode, the behaviour of Exim changes in the
64005 following ways:
64006 </para>
64007 <itemizedlist>
64008 <listitem>
64009 <para>
64010 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
64011 In other words, the only way to submit messages is via the command line.
64012 </para>
64013 </listitem>
64014 <listitem>
64015 <para>
64016 Each message is synchronously delivered as soon as it is received (<option>-odi</option> is
64017 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
64018 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
64019 does not finish until the delivery attempt is complete. If the delivery is
64020 successful, a zero return code is given.
64021 </para>
64022 </listitem>
64023 <listitem>
64024 <para>
64025 Address redirection is permitted, but the final routing for all addresses must
64026 be to the same remote transport, and to the same list of hosts. Furthermore,
64027 the return address (envelope sender) must be the same for all recipients, as
64028 must any added or deleted header lines. In other words, it must be possible to
64029 deliver the message in a single SMTP transaction, however many recipients there
64030 are.
64031 </para>
64032 </listitem>
64033 <listitem>
64034 <para>
64035 If these conditions are not met, or if routing any address results in a
64036 failure or defer status, or if Exim is unable to deliver all the recipients
64037 successfully to one of the smart hosts, delivery of the entire message fails.
64038 </para>
64039 </listitem>
64040 <listitem>
64041 <para>
64042 Because no queueing is allowed, all failures are treated as permanent; there
64043 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
64044 smart host. Furthermore, because only a single yes/no response can be given to
64045 the caller, it is not possible to deliver to some recipients and not others. If
64046 there is an error (temporary or permanent) for any recipient, all are failed.
64047 </para>
64048 </listitem>
64049 <listitem>
64050 <para>
64051 If more than one smart host is listed, Exim will try another host after a
64052 connection failure or a timeout, in the normal way. However, if this kind of
64053 failure happens for all the hosts, the delivery fails.
64054 </para>
64055 </listitem>
64056 <listitem>
64057 <para>
64058 When delivery fails, an error message is written to the standard error stream
64059 (as well as to Exim&#x2019;s log), and Exim exits to the caller with a return code
64060 value 1. The message is expunged from Exim&#x2019;s spool files. No bounce messages
64061 are ever generated.
64062 </para>
64063 </listitem>
64064 <listitem>
64065 <para>
64066 No retry data is maintained, and any retry rules are ignored.
64067 </para>
64068 </listitem>
64069 <listitem>
64070 <para>
64071 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
64072 true, <option>max_rcpt</option> in the <command>smtp</command> transport is forced to <quote>unlimited</quote>,
64073 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
64074 </para>
64075 </listitem>
64076 </itemizedlist>
64077 <para>
64078 The overall effect is that Exim makes a single synchronous attempt to deliver
64079 the message, failing if there is any kind of problem. Because no local
64080 deliveries are done and no daemon can be run, Exim does not need root
64081 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
64082 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
64083 the advantages and disadvantages of running without root privilege.
64084 </para>
64085 </chapter>
64086
64087 <chapter id="CHAPlog">
64088 <title>Log files</title>
64089 <para>
64090 <indexterm role="concept" id="IIDloggen" class="startofrange">
64091 <primary>log</primary>
64092 <secondary>general description</secondary>
64093 </indexterm>
64094 <indexterm role="concept">
64095 <primary>log</primary>
64096 <secondary>types of</secondary>
64097 </indexterm>
64098 Exim writes three different logs, referred to as the main log, the reject log,
64099 and the panic log:
64100 </para>
64101 <itemizedlist>
64102 <listitem>
64103 <para>
64104 <indexterm role="concept">
64105 <primary>main log</primary>
64106 </indexterm>
64107 The main log records the arrival of each message and each delivery in a single
64108 line in each case. The format is as compact as possible, in an attempt to keep
64109 down the size of log files. Two-character flag sequences make it easy to pick
64110 out these lines. A number of other events are recorded in the main log. Some of
64111 them are optional, in which case the <option>log_selector</option> option controls whether
64112 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
64113 analysis of main log files, is provided in the Exim distribution (see section
64114 <xref linkend="SECTmailstat"/>).
64115 </para>
64116 </listitem>
64117 <listitem>
64118 <para>
64119 <indexterm role="concept">
64120 <primary>reject log</primary>
64121 </indexterm>
64122 The reject log records information from messages that are rejected as a result
64123 of a configuration option (that is, for policy reasons).
64124 The first line of each rejection is a copy of the line that is also written to
64125 the main log. Then, if the message&#x2019;s header has been read at the time the log
64126 is written, its contents are written to this log. Only the original header
64127 lines are available; header lines added by ACLs are not logged. You can use the
64128 reject log to check that your policy controls are working correctly; on a busy
64129 host this may be easier than scanning the main log for rejection messages. You
64130 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
64131 false.
64132 </para>
64133 </listitem>
64134 <listitem>
64135 <para>
64136 <indexterm role="concept">
64137 <primary>panic log</primary>
64138 </indexterm>
64139 <indexterm role="concept">
64140 <primary>system log</primary>
64141 </indexterm>
64142 When certain serious errors occur, Exim writes entries to its panic log. If the
64143 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
64144 are usually written to the main log as well, but can get lost amid the mass of
64145 other entries. The panic log should be empty under normal circumstances. It is
64146 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
64147 regularly, in order to become aware of any problems. When Exim cannot open its
64148 panic log, it tries as a last resort to write to the system log (syslog). This
64149 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
64150 message itself is written at priority LOG_CRIT.
64151 </para>
64152 </listitem>
64153 </itemizedlist>
64154 <para>
64155 Every log line starts with a timestamp, in the format shown in the following
64156 example. Note that many of the examples shown in this chapter are line-wrapped.
64157 In the log file, this would be all on one line:
64158 </para>
64159 <literallayout class="monospaced">
64160 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
64161   by QUIT
64162 </literallayout>
64163 <para>
64164 By default, the timestamps are in the local timezone. There are two
64165 ways of changing this:
64166 </para>
64167 <itemizedlist>
64168 <listitem>
64169 <para>
64170 You can set the <option>timezone</option> option to a different time zone; in particular, if
64171 you set
64172 </para>
64173 <literallayout class="monospaced">
64174 timezone = UTC
64175 </literallayout>
64176 <para>
64177 the timestamps will be in UTC (aka GMT).
64178 </para>
64179 </listitem>
64180 <listitem>
64181 <para>
64182 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
64183 example:
64184 </para>
64185 <literallayout class="monospaced">
64186 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
64187 </literallayout>
64188 </listitem>
64189 </itemizedlist>
64190 <para>
64191 <indexterm role="concept">
64192 <primary>log</primary>
64193 <secondary>process ids in</secondary>
64194 </indexterm>
64195 <indexterm role="concept">
64196 <primary>pid (process id)</primary>
64197 <secondary>in log lines</secondary>
64198 </indexterm>
64199 Exim does not include its process id in log lines by default, but you can
64200 request that it does so by specifying the <literal>pid</literal> log selector (see section
64201 <xref linkend="SECTlogselector"/>). When this is set, the process id is output, in square
64202 brackets, immediately after the time and date.
64203 </para>
64204 <section id="SECTwhelogwri">
64205 <title>Where the logs are written</title>
64206 <para>
64207 <indexterm role="concept">
64208 <primary>log</primary>
64209 <secondary>destination</secondary>
64210 </indexterm>
64211 <indexterm role="concept">
64212 <primary>log</primary>
64213 <secondary>to file</secondary>
64214 </indexterm>
64215 <indexterm role="concept">
64216 <primary>log</primary>
64217 <secondary>to syslog</secondary>
64218 </indexterm>
64219 <indexterm role="concept">
64220 <primary>syslog</primary>
64221 </indexterm>
64222 The logs may be written to local files, or to syslog, or both. However, it
64223 should be noted that many syslog implementations use UDP as a transport, and
64224 are therefore unreliable in the sense that messages are not guaranteed to
64225 arrive at the loghost, nor is the ordering of messages necessarily maintained.
64226 It has also been reported that on large log files (tens of megabytes) you may
64227 need to tweak syslog to prevent it syncing the file with each write &ndash; on
64228 Linux this has been seen to make syslog take 90% plus of CPU time.
64229 </para>
64230 <para>
64231 The destination for Exim&#x2019;s logs is configured by setting LOG_FILE_PATH in
64232 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the run time
64233 configuration. This latter string is expanded, so it can contain, for example,
64234 references to the host name:
64235 </para>
64236 <literallayout class="monospaced">
64237 log_file_path = /var/log/$primary_hostname/exim_%slog
64238 </literallayout>
64239 <para>
64240 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
64241 rather than at run time, because then the setting is available right from the
64242 start of Exim&#x2019;s execution. Otherwise, if there&#x2019;s something it wants to log
64243 before it has read the configuration file (for example, an error in the
64244 configuration file) it will not use the path you want, and may not be able to
64245 log at all.
64246 </para>
64247 <para>
64248 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
64249 list, currently limited to at most two items. This is one option where the
64250 facility for changing a list separator may not be used. The list must always be
64251 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
64252 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
64253 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
64254 implying the use of a default path.
64255 </para>
64256 <para>
64257 When Exim encounters an empty item in the list, it searches the list defined by
64258 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
64259 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
64260 mean <quote>use the path specified at build time</quote>. It no such item exists, log
64261 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
64262 equivalent to the setting:
64263 </para>
64264 <literallayout class="monospaced">
64265 log_file_path = $spool_directory/log/%slog
64266 </literallayout>
64267 <para>
64268 If you do not specify anything at build time or run time,
64269 or if you unset the option at run time (i.e. <literal>log_file_path = </literal>),
64270 that is where the logs are written.
64271 </para>
64272 <para>
64273 A log file path may also contain <literal>%D</literal> or <literal>%M</literal> if datestamped log file names
64274 are in use &ndash; see section <xref linkend="SECTdatlogfil"/> below.
64275 </para>
64276 <para>
64277 Here are some examples of possible settings:
64278 </para>
64279 <literallayout>
64280 <literal>LOG_FILE_PATH=syslog                    </literal> syslog only
64281 <literal>LOG_FILE_PATH=:syslog                   </literal> syslog and default path
64282 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
64283 <literal>LOG_FILE_PATH=/usr/log/exim_%s          </literal> specified path only
64284 </literallayout>
64285 <para>
64286 If there are more than two paths in the list, the first is used and a panic
64287 error is logged.
64288 </para>
64289 </section>
64290 <section id="SECID285">
64291 <title>Logging to local files that are periodically <quote>cycled</quote></title>
64292 <para>
64293 <indexterm role="concept">
64294 <primary>log</primary>
64295 <secondary>cycling local files</secondary>
64296 </indexterm>
64297 <indexterm role="concept">
64298 <primary>cycling logs</primary>
64299 </indexterm>
64300 <indexterm role="concept">
64301 <primary><emphasis>exicyclog</emphasis></primary>
64302 </indexterm>
64303 <indexterm role="concept">
64304 <primary>log</primary>
64305 <secondary>local files; writing to</secondary>
64306 </indexterm>
64307 Some operating systems provide centralized and standardized methods for cycling
64308 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
64309 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
64310 main and reject logs each time it is called. The maximum number of old logs to
64311 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
64312 </para>
64313 <para>
64314 An Exim delivery process opens the main log when it first needs to write to it,
64315 and it keeps the file open in case subsequent entries are required &ndash; for
64316 example, if a number of different deliveries are being done for the same
64317 message. However, remote SMTP deliveries can take a long time, and this means
64318 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
64319 something similar is being used to rename log files on a regular basis. To
64320 ensure that a switch of log files is noticed as soon as possible, Exim calls
64321 <function>stat()</function> on the main log&#x2019;s name before reusing an open file, and if the file
64322 does not exist, or its inode has changed, the old file is closed and Exim
64323 tries to open the main log from scratch. Thus, an old log file may remain open
64324 for quite some time, but no Exim processes should write to it once it has been
64325 renamed.
64326 </para>
64327 </section>
64328 <section id="SECTdatlogfil">
64329 <title>Datestamped log files</title>
64330 <para>
64331 <indexterm role="concept">
64332 <primary>log</primary>
64333 <secondary>datestamped files</secondary>
64334 </indexterm>
64335 Instead of cycling the main and reject log files by renaming them
64336 periodically, some sites like to use files whose names contain a datestamp,
64337 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename> or
64338 <filename>yyyymm</filename>. Exim has support for this way of working. It is enabled by setting
64339 the <option>log_file_path</option> option to a path that includes <literal>%D</literal> or <literal>%M</literal> at the
64340 point where the datestamp is required. For example:
64341 </para>
64342 <literallayout class="monospaced">
64343 log_file_path = /var/spool/exim/log/%slog-%D
64344 log_file_path = /var/log/exim-%s-%D.log
64345 log_file_path = /var/spool/exim/log/%D-%slog
64346 log_file_path = /var/log/exim/%s.%M
64347 </literallayout>
64348 <para>
64349 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
64350 examples of names generated by the above examples:
64351 </para>
64352 <literallayout class="monospaced">
64353 /var/spool/exim/log/mainlog-20021225
64354 /var/log/exim-reject-20021225.log
64355 /var/spool/exim/log/20021225-mainlog
64356 /var/log/exim/main.200212
64357 </literallayout>
64358 <para>
64359 When this form of log file is specified, Exim automatically switches to new
64360 files at midnight. It does not make any attempt to compress old logs; you
64361 will need to write your own script if you require this. You should not
64362 run <emphasis>exicyclog</emphasis> with this form of logging.
64363 </para>
64364 <para>
64365 The location of the panic log is also determined by <option>log_file_path</option>, but it
64366 is not datestamped, because rotation of the panic log does not make sense.
64367 When generating the name of the panic log, <literal>%D</literal> or <literal>%M</literal> are removed from
64368 the string. In addition, if it immediately follows a slash, a following
64369 non-alphanumeric character is removed; otherwise a preceding non-alphanumeric
64370 character is removed. Thus, the four examples above would give these panic
64371 log names:
64372 </para>
64373 <literallayout class="monospaced">
64374 /var/spool/exim/log/paniclog
64375 /var/log/exim-panic.log
64376 /var/spool/exim/log/paniclog
64377 /var/log/exim/panic
64378 </literallayout>
64379 </section>
64380 <section id="SECID249">
64381 <title>Logging to syslog</title>
64382 <para>
64383 <indexterm role="concept">
64384 <primary>log</primary>
64385 <secondary>syslog; writing to</secondary>
64386 </indexterm>
64387 The use of syslog does not change what Exim logs or the format of its messages,
64388 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
64389 Exim&#x2019;s log lines are omitted when these lines are sent to syslog. Apart from
64390 that, the same strings are written to syslog as to log files. The syslog
64391 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
64392 by default, but you can change these by setting the <option>syslog_facility</option> and
64393 <option>syslog_processname</option> options, respectively. If Exim was compiled with
64394 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
64395 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
64396 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
64397 the time and host name to each line.
64398 The three log streams are mapped onto syslog priorities as follows:
64399 </para>
64400 <itemizedlist>
64401 <listitem>
64402 <para>
64403 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
64404 </para>
64405 </listitem>
64406 <listitem>
64407 <para>
64408 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
64409 </para>
64410 </listitem>
64411 <listitem>
64412 <para>
64413 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
64414 </para>
64415 </listitem>
64416 </itemizedlist>
64417 <para>
64418 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
64419 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
64420 these are routed by syslog to the same place. You can suppress this duplication
64421 by setting <option>syslog_duplication</option> false.
64422 </para>
64423 <para>
64424 Exim&#x2019;s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
64425 entries contain multiple lines when headers are included. To cope with both
64426 these cases, entries written to syslog are split into separate <function>syslog()</function>
64427 calls at each internal newline, and also after a maximum of
64428 870 data characters. (This allows for a total syslog line length of 1024, when
64429 additions such as timestamps are added.) If you are running a syslog
64430 replacement that can handle lines longer than the 1024 characters allowed by
64431 RFC 3164, you should set
64432 </para>
64433 <literallayout class="monospaced">
64434 SYSLOG_LONG_LINES=yes
64435 </literallayout>
64436 <para>
64437 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
64438 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
64439 </para>
64440 <para>
64441 To make it easy to re-assemble split lines later, each component of a split
64442 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;]
64443 where &lt;<emphasis>n</emphasis>&gt; is the component number and &lt;<emphasis>m</emphasis>&gt; is the total number of
64444 components in the entry. The / delimiter is used when the line was split
64445 because it was too long; if it was split because of an internal newline, the \
64446 delimiter is used. For example, supposing the length limit to be 50 instead of
64447 870, the following would be the result of a typical rejection message to
64448 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
64449 name, and pid as added by syslog:
64450 </para>
64451 <literallayout class="monospaced">
64452 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
64453 [2/5]  [127.0.0.1] (ph10): syntax error in 'From' header
64454 [3/5]  when scanning for sender: missing or malformed lo
64455 [4/5] cal part in "&lt;&gt;" (envelope sender is &lt;ph10@cam.exa
64456 [5/5] mple&gt;)
64457 </literallayout>
64458 <para>
64459 The same error might cause the following lines to be written to <quote>rejectlog</quote>
64460 (LOG_NOTICE):
64461 </para>
64462 <literallayout class="monospaced">
64463 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
64464 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
64465 [3/18] er when scanning for sender: missing or malformed
64466 [4/18]  local part in "&lt;&gt;" (envelope sender is &lt;ph10@cam
64467 [5\18] .example&gt;)
64468 [6\18] Recipients: ph10@some.domain.cam.example
64469 [7\18] P Received: from [127.0.0.1] (ident=ph10)
64470 [8\18]        by xxxxx.cam.example with smtp (Exim 4.00)
64471 [9\18]        id 16RdAL-0006pc-00
64472 [10/18]        for ph10@cam.example; Mon, 16 Sep 2002 16:
64473 [11\18] 09:43 +0100
64474 [12\18] F From: &lt;&gt;
64475 [13\18]   Subject: this is a test header
64476 [18\18]   X-something: this is another header
64477 [15/18] I Message-Id: &lt;E16RdAL-0006pc-00@xxxxx.cam.examp
64478 [16\18] le&gt;
64479 [17\18] B Bcc:
64480 [18/18]   Date: Mon, 16 Sep 2002 16:09:43 +0100
64481 </literallayout>
64482 <para>
64483 Log lines that are neither too long nor contain newlines are written to syslog
64484 without modification.
64485 </para>
64486 <para>
64487 If only syslog is being used, the Exim monitor is unable to provide a log tail
64488 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
64489 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
64490 where it is.
64491 </para>
64492 </section>
64493 <section id="SECID250">
64494 <title>Log line flags</title>
64495 <para>
64496 One line is written to the main log for each message received, and for each
64497 successful, unsuccessful, and delayed delivery. These lines can readily be
64498 picked out by the distinctive two-character flags that immediately follow the
64499 timestamp. The flags are:
64500 </para>
64501 <literallayout>
64502 <literal>&lt;=</literal>     message arrival
64503 <literal>=&gt;</literal>     normal message delivery
64504 <literal>-&gt;</literal>     additional address in same delivery
64505 <literal>&gt;&gt;</literal>     cutthrough message delivery
64506 <literal>*&gt;</literal>     delivery suppressed by <option>-N</option>
64507 <literal>**</literal>     delivery failed; address bounced
64508 <literal>==</literal>     delivery deferred; temporary problem
64509 </literallayout>
64510 </section>
64511 <section id="SECID251">
64512 <title>Logging message reception</title>
64513 <para>
64514 <indexterm role="concept">
64515 <primary>log</primary>
64516 <secondary>reception line</secondary>
64517 </indexterm>
64518 The format of the single-line entry in the main log that is written for every
64519 message received is shown in the basic example below, which is split over
64520 several lines in order to fit it on the page:
64521 </para>
64522 <literallayout class="monospaced">
64523 2002-10-31 08:57:53 16ZCW1-0005MB-00 &lt;= kryten@dwarf.fict.example
64524   H=mailer.fict.example [192.168.123.123] U=exim
64525   P=smtp S=5678 id=&lt;incoming message id&gt;
64526 </literallayout>
64527 <para>
64528 The address immediately following <quote>&lt;=</quote> is the envelope sender address. A
64529 bounce message is shown with the sender address <quote>&lt;&gt;</quote>, and if it is locally
64530 generated, this is followed by an item of the form
64531 </para>
64532 <literallayout class="monospaced">
64533 R=&lt;message id&gt;
64534 </literallayout>
64535 <para>
64536 which is a reference to the message that caused the bounce to be sent.
64537 </para>
64538 <para>
64539 <indexterm role="concept">
64540 <primary>HELO</primary>
64541 </indexterm>
64542 <indexterm role="concept">
64543 <primary>EHLO</primary>
64544 </indexterm>
64545 For messages from other hosts, the H and U fields identify the remote host and
64546 record the RFC 1413 identity of the user that sent the message, if one was
64547 received. The number given in square brackets is the IP address of the sending
64548 host. If there is a single, unparenthesized  host name in the H field, as
64549 above, it has been verified to correspond to the IP address (see the
64550 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
64551 by the remote host in the SMTP HELO or EHLO command, and has not been
64552 verified. If verification yields a different name to that given for HELO or
64553 EHLO, the verified name appears first, followed by the HELO or EHLO
64554 name in parentheses.
64555 </para>
64556 <para>
64557 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
64558 without brackets, in the HELO or EHLO command, leading to entries in
64559 the log containing text like these examples:
64560 </para>
64561 <literallayout class="monospaced">
64562 H=(10.21.32.43) [192.168.8.34]
64563 H=([10.21.32.43]) [192.168.8.34]
64564 </literallayout>
64565 <para>
64566 This can be confusing. Only the final address in square brackets can be relied
64567 on.
64568 </para>
64569 <para>
64570 For locally generated messages (that is, messages not received over TCP/IP),
64571 the H field is omitted, and the U field contains the login name of the caller
64572 of Exim.
64573 </para>
64574 <para>
64575 <indexterm role="concept">
64576 <primary>authentication</primary>
64577 <secondary>logging</secondary>
64578 </indexterm>
64579 <indexterm role="concept">
64580 <primary>AUTH</primary>
64581 <secondary>logging</secondary>
64582 </indexterm>
64583 For all messages, the P field specifies the protocol used to receive the
64584 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
64585 of incoming SMTP messages, the value indicates whether or not any SMTP
64586 extensions (ESMTP), encryption, or authentication were used. If the SMTP
64587 session was encrypted, there is an additional X field that records the cipher
64588 suite that was used.
64589 </para>
64590 <para>
64591 <indexterm role="concept">
64592 <primary>log</primary>
64593 <secondary>protocol</secondary>
64594 </indexterm>
64595 The protocol is set to <quote>esmtpsa</quote> or <quote>esmtpa</quote> for messages received from
64596 hosts that have authenticated themselves using the SMTP AUTH command. The first
64597 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
64598 there is an additional item A= followed by the name of the authenticator that
64599 was used. If an authenticated identification was set up by the authenticator&#x2019;s
64600 <option>server_set_id</option> option, this is logged too, separated by a colon from the
64601 authenticator name.
64602 </para>
64603 <para>
64604 <indexterm role="concept">
64605 <primary>size</primary>
64606 <secondary>of message</secondary>
64607 </indexterm>
64608 The id field records the existing message id, if present. The size of the
64609 received message is given by the S field. When the message is delivered,
64610 headers may be removed or added, so that the size of delivered copies of the
64611 message may not correspond with this value (and indeed may be different to each
64612 other).
64613 </para>
64614 <para>
64615 The <option>log_selector</option> option can be used to request the logging of additional
64616 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
64617 </para>
64618 </section>
64619 <section id="SECID252">
64620 <title>Logging deliveries</title>
64621 <para>
64622 <indexterm role="concept">
64623 <primary>log</primary>
64624 <secondary>delivery line</secondary>
64625 </indexterm>
64626 The format of the single-line entry in the main log that is written for every
64627 delivery is shown in one of the examples below, for local and remote
64628 deliveries, respectively. Each example has been split into multiple lines in order
64629 to fit it on the page:
64630 </para>
64631 <literallayout class="monospaced">
64632 2002-10-31 08:59:13 16ZCW1-0005MB-00 =&gt; marv
64633   &lt;marv@hitch.fict.example&gt; R=localuser T=local_delivery
64634 2002-10-31 09:00:10 16ZCW1-0005MB-00 =&gt;
64635   monk@holistic.fict.example R=dnslookup T=remote_smtp
64636   H=holistic.fict.example [192.168.234.234]
64637 </literallayout>
64638 <para>
64639 For ordinary local deliveries, the original address is given in angle brackets
64640 after the final delivery address, which might be a pipe or a file. If
64641 intermediate address(es) exist between the original and the final address, the
64642 last of these is given in parentheses after the final address. The R and T
64643 fields record the router and transport that were used to process the address.
64644 </para>
64645 <para>
64646 If SMTP AUTH was used for the delivery there is an additional item A=
64647 followed by the name of the authenticator that was used.
64648 If an authenticated identification was set up by the authenticator&#x2019;s <option>client_set_id</option>
64649 option, this is logged too, separated by a colon from the authenticator name.
64650 </para>
64651 <para>
64652 If a shadow transport was run after a successful local delivery, the log line
64653 for the successful delivery has an item added on the end, of the form
64654 </para>
64655 <literallayout>
64656 <literal>ST=&lt;</literal><emphasis>shadow transport name</emphasis><literal>&gt;</literal>
64657 </literallayout>
64658 <para>
64659 If the shadow transport did not succeed, the error message is put in
64660 parentheses afterwards.
64661 </para>
64662 <para>
64663 <indexterm role="concept">
64664 <primary>asterisk</primary>
64665 <secondary>after IP address</secondary>
64666 </indexterm>
64667 When more than one address is included in a single delivery (for example, two
64668 SMTP RCPT commands in one transaction) the second and subsequent addresses are
64669 flagged with <literal>-&gt;</literal> instead of <literal>=&gt;</literal>. When two or more messages are delivered
64670 down a single SMTP connection, an asterisk follows the IP address in the log
64671 lines for the second and subsequent messages.
64672 </para>
64673 <para>
64674 <indexterm role="concept">
64675 <primary>delivery</primary>
64676 <secondary>cutthrough; logging</secondary>
64677 </indexterm>
64678 <indexterm role="concept">
64679 <primary>cutthrough</primary>
64680 <secondary>logging</secondary>
64681 </indexterm>
64682 When delivery is done in cutthrough mode it is flagged with <literal>&gt;&gt;</literal> and the log
64683 line precedes the reception line, since cutthrough waits for a possible
64684 rejection from the destination in case it can reject the sourced item.
64685 </para>
64686 <para>
64687 The generation of a reply message by a filter file gets logged as a
64688 <quote>delivery</quote> to the addressee, preceded by <quote>&gt;</quote>.
64689 </para>
64690 <para>
64691 The <option>log_selector</option> option can be used to request the logging of additional
64692 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
64693 </para>
64694 </section>
64695 <section id="SECID253">
64696 <title>Discarded deliveries</title>
64697 <para>
64698 <indexterm role="concept">
64699 <primary>discarded messages</primary>
64700 </indexterm>
64701 <indexterm role="concept">
64702 <primary>message</primary>
64703 <secondary>discarded</secondary>
64704 </indexterm>
64705 <indexterm role="concept">
64706 <primary>delivery</primary>
64707 <secondary>discarded; logging</secondary>
64708 </indexterm>
64709 When a message is discarded as a result of the command <quote>seen finish</quote> being
64710 obeyed in a filter file which generates no deliveries, a log entry of the form
64711 </para>
64712 <literallayout class="monospaced">
64713 2002-12-10 00:50:49 16auJc-0001UB-00 =&gt; discarded
64714   &lt;low.club@bridge.example&gt; R=userforward
64715 </literallayout>
64716 <para>
64717 is written, to record why no deliveries are logged. When a message is discarded
64718 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
64719 </para>
64720 <literallayout class="monospaced">
64721 1999-03-02 09:44:33 10HmaX-0005vi-00 =&gt; :blackhole:
64722   &lt;hole@nowhere.example&gt; R=blackhole_router
64723 </literallayout>
64724 </section>
64725 <section id="SECID254">
64726 <title>Deferred deliveries</title>
64727 <para>
64728 When a delivery is deferred, a line of the following form is logged:
64729 </para>
64730 <literallayout class="monospaced">
64731 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
64732   R=dnslookup T=smtp defer (146): Connection refused
64733 </literallayout>
64734 <para>
64735 In the case of remote deliveries, the error is the one that was given for the
64736 last IP address that was tried. Details of individual SMTP failures are also
64737 written to the log, so the above line would be preceded by something like
64738 </para>
64739 <literallayout class="monospaced">
64740 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
64741   mail1.endrest.example [192.168.239.239]: Connection refused
64742 </literallayout>
64743 <para>
64744 When a deferred address is skipped because its retry time has not been reached,
64745 a message is written to the log, but this can be suppressed by setting an
64746 appropriate value in <option>log_selector</option>.
64747 </para>
64748 </section>
64749 <section id="SECID255">
64750 <title>Delivery failures</title>
64751 <para>
64752 <indexterm role="concept">
64753 <primary>delivery</primary>
64754 <secondary>failure; logging</secondary>
64755 </indexterm>
64756 If a delivery fails because an address cannot be routed, a line of the
64757 following form is logged:
64758 </para>
64759 <literallayout class="monospaced">
64760 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
64761   &lt;jim@trek99.example&gt;: unknown mail domain
64762 </literallayout>
64763 <para>
64764 If a delivery fails at transport time, the router and transport are shown, and
64765 the response from the remote host is included, as in this example:
64766 </para>
64767 <literallayout class="monospaced">
64768 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
64769   R=dnslookup T=remote_smtp: SMTP error from remote mailer
64770   after pipelined RCPT TO:&lt;ace400@pb.example&gt;: host
64771   pbmail3.py.example [192.168.63.111]: 553 5.3.0
64772   &lt;ace400@pb.example&gt;...Addressee unknown
64773 </literallayout>
64774 <para>
64775 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
64776 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
64777 disabling PIPELINING. The log lines for all forms of delivery failure are
64778 flagged with <literal>**</literal>.
64779 </para>
64780 </section>
64781 <section id="SECID256">
64782 <title>Fake deliveries</title>
64783 <para>
64784 <indexterm role="concept">
64785 <primary>delivery</primary>
64786 <secondary>fake; logging</secondary>
64787 </indexterm>
64788 If a delivery does not actually take place because the <option>-N</option> option has been
64789 used to suppress it, a normal delivery line is written to the log, except that
64790 <quote>=&gt;</quote> is replaced by <quote>*&gt;</quote>.
64791 </para>
64792 </section>
64793 <section id="SECID257">
64794 <title>Completion</title>
64795 <para>
64796 A line of the form
64797 </para>
64798 <literallayout class="monospaced">
64799 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
64800 </literallayout>
64801 <para>
64802 is written to the main log when a message is about to be removed from the spool
64803 at the end of its processing.
64804 </para>
64805 </section>
64806 <section id="SECID258">
64807 <title>Summary of Fields in Log Lines</title>
64808 <para>
64809 <indexterm role="concept">
64810 <primary>log</primary>
64811 <secondary>summary of fields</secondary>
64812 </indexterm>
64813 A summary of the field identifiers that are used in log lines is shown in
64814 the following table:
64815 </para>
64816 <literallayout>
64817 <literal>A   </literal>        authenticator name (and optional id and sender)
64818 <literal>C   </literal>        SMTP confirmation on delivery
64819 <literal>    </literal>        command list for <quote>no mail in SMTP session</quote>
64820 <literal>CV  </literal>        certificate verification status
64821 <literal>D   </literal>        duration of <quote>no mail in SMTP session</quote>
64822 <literal>DN  </literal>        distinguished name from peer certificate
64823 <literal>DT  </literal>        on <literal>=&gt;</literal> lines: time taken for a delivery
64824 <literal>F   </literal>        sender address (on delivery lines)
64825 <literal>H   </literal>        host name and IP address
64826 <literal>I   </literal>        local interface used
64827 <literal>id  </literal>        message id for incoming message
64828 <literal>P   </literal>        on <literal>&lt;=</literal> lines: protocol used
64829 <literal>    </literal>        on <literal>=&gt;</literal> and <literal>**</literal> lines: return path
64830 <literal>PRX </literal>        on <emphasis>&lt;=</emphasis> and<literal>=&gt;</literal> lines: proxy address
64831 <literal>QT  </literal>        on <literal>=&gt;</literal> lines: time spent on queue so far
64832 <literal>    </literal>        on <quote>Completed</quote> lines: time spent on queue
64833 <literal>R   </literal>        on <literal>&lt;=</literal> lines: reference for local bounce
64834 <literal>    </literal>        on <literal>=&gt;</literal>  <literal>&gt;&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: router name
64835 <literal>S   </literal>        size of message in bytes
64836 <literal>SNI </literal>        server name indication from TLS client hello
64837 <literal>ST  </literal>        shadow transport name
64838 <literal>T   </literal>        on <literal>&lt;=</literal> lines: message subject (topic)
64839 <literal>    </literal>        on <literal>=&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: transport name
64840 <literal>U   </literal>        local user or RFC 1413 identity
64841 <literal>X   </literal>        TLS cipher suite
64842 </literallayout>
64843 </section>
64844 <section id="SECID259">
64845 <title>Other log entries</title>
64846 <para>
64847 Various other types of log entry are written from time to time. Most should be
64848 self-explanatory. Among the more common are:
64849 </para>
64850 <itemizedlist>
64851 <listitem>
64852 <para>
64853 <indexterm role="concept">
64854 <primary>retry</primary>
64855 <secondary>time not reached</secondary>
64856 </indexterm>
64857 <emphasis>retry time not reached</emphasis>&nbsp;&nbsp;An address previously suffered a temporary error
64858 during routing or local delivery, and the time to retry has not yet arrived.
64859 This message is not written to an individual message log file unless it happens
64860 during the first delivery attempt.
64861 </para>
64862 </listitem>
64863 <listitem>
64864 <para>
64865 <emphasis>retry time not reached for any host</emphasis>&nbsp;&nbsp;An address previously suffered
64866 temporary errors during remote delivery, and the retry time has not yet arrived
64867 for any of the hosts to which it is routed.
64868 </para>
64869 </listitem>
64870 <listitem>
64871 <para>
64872 <indexterm role="concept">
64873 <primary>spool directory</primary>
64874 <secondary>file locked</secondary>
64875 </indexterm>
64876 <emphasis>spool file locked</emphasis>&nbsp;&nbsp;An attempt to deliver a message cannot proceed because
64877 some other Exim process is already working on the message. This can be quite
64878 common if queue running processes are started at frequent intervals. The
64879 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
64880 doing.
64881 </para>
64882 </listitem>
64883 <listitem>
64884 <para>
64885 <indexterm role="concept">
64886 <primary>error</primary>
64887 <secondary>ignored</secondary>
64888 </indexterm>
64889 <emphasis>error ignored</emphasis>&nbsp;&nbsp;There are several circumstances that give rise to this
64890 message:
64891 </para>
64892 <orderedlist numeration="arabic">
64893 <listitem>
64894 <para>
64895 Exim failed to deliver a bounce message whose age was greater than
64896 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
64897 </para>
64898 </listitem>
64899 <listitem>
64900 <para>
64901 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
64902 failed. The delivery was discarded.
64903 </para>
64904 </listitem>
64905 <listitem>
64906 <para>
64907 A delivery set up by a router configured with
64908 </para>
64909 <literallayout class="monospaced">
64910     errors_to = &lt;&gt;
64911 </literallayout>
64912 <para>
64913 failed. The delivery was discarded.
64914 </para>
64915 </listitem>
64916 </orderedlist>
64917 </listitem>
64918 </itemizedlist>
64919 </section>
64920 <section id="SECTlogselector">
64921 <title>Reducing or increasing what is logged</title>
64922 <para>
64923 <indexterm role="concept">
64924 <primary>log</primary>
64925 <secondary>selectors</secondary>
64926 </indexterm>
64927 By setting the <option>log_selector</option> global option, you can disable some of Exim&#x2019;s
64928 default logging, or you can request additional logging. The value of
64929 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
64930 example:
64931 </para>
64932 <literallayout class="monospaced">
64933 log_selector = +arguments -retry_defer
64934 </literallayout>
64935 <para>
64936 The list of optional log items is in the following table, with the default
64937 selection marked by asterisks:
64938 </para>
64939 <literallayout>
64940 <literal> 8bitmime                   </literal>  received 8BITMIME status
64941 <literal>*acl_warn_skipped           </literal>  skipped <option>warn</option> statement in ACL
64942 <literal> address_rewrite            </literal>  address rewriting
64943 <literal> all_parents                </literal>  all parents in =&gt; lines
64944 <literal> arguments                  </literal>  command line arguments
64945 <literal>*connection_reject          </literal>  connection rejections
64946 <literal>*delay_delivery             </literal>  immediate delivery delayed
64947 <literal> deliver_time               </literal>  time taken to perform delivery
64948 <literal> delivery_size              </literal>  add <literal>S=</literal><emphasis>nnn</emphasis> to =&gt; lines
64949 <literal>*dnslist_defer              </literal>  defers of DNS list (aka RBL) lookups
64950 <literal>*etrn                       </literal>  ETRN commands
64951 <literal>*host_lookup_failed         </literal>  as it says
64952 <literal> ident_timeout              </literal>  timeout for ident connection
64953 <literal> incoming_interface         </literal>  local interface on &lt;= and =&gt; lines
64954 <literal> incoming_port              </literal>  remote port on &lt;= lines
64955 <literal>*lost_incoming_connection   </literal>  as it says (includes timeouts)
64956 <phrase revisionflag="changed"><literal> outgoing_interface         </literal>  local interface on =&gt; lines
64957 </phrase><literal> outgoing_port              </literal>  add remote port to =&gt; lines
64958 <literal>*queue_run                  </literal>  start and end queue runs
64959 <literal> queue_time                 </literal>  time on queue for one recipient
64960 <literal> queue_time_overall         </literal>  time on queue for whole message
64961 <literal> pid                        </literal>  Exim process id
64962 <phrase revisionflag="changed"><literal> proxy                      </literal>  proxy address on &lt;= and =&gt; lines
64963 </phrase><literal> received_recipients        </literal>  recipients on &lt;= lines
64964 <literal> received_sender            </literal>  sender on &lt;= lines
64965 <literal>*rejected_header            </literal>  header contents on reject log
64966 <literal>*retry_defer                </literal>  <quote>retry time not reached</quote>
64967 <literal> return_path_on_delivery    </literal>  put return path on =&gt; and ** lines
64968 <literal> sender_on_delivery         </literal>  add sender to =&gt; lines
64969 <literal>*sender_verify_fail         </literal>  sender verification failures
64970 <literal>*size_reject                </literal>  rejection because too big
64971 <literal>*skip_delivery              </literal>  delivery skipped in a queue run
64972 <literal>*smtp_confirmation          </literal>  SMTP confirmation on =&gt; lines
64973 <literal> smtp_connection            </literal>  incoming SMTP connections
64974 <literal> smtp_incomplete_transaction</literal>  incomplete SMTP transactions
64975 <literal> smtp_mailauth              </literal>  AUTH argument to MAIL commands
64976 <literal> smtp_no_mail               </literal>  session with no MAIL commands
64977 <literal> smtp_protocol_error        </literal>  SMTP protocol errors
64978 <literal> smtp_syntax_error          </literal>  SMTP syntax errors
64979 <literal> subject                    </literal>  contents of <emphasis>Subject:</emphasis> on &lt;= lines
64980 <literal>*tls_certificate_verified   </literal>  certificate verification status
64981 <literal>*tls_cipher                 </literal>  TLS cipher suite on &lt;= and =&gt; lines
64982 <literal> tls_peerdn                 </literal>  TLS peer DN on &lt;= and =&gt; lines
64983 <literal> tls_sni                    </literal>  TLS SNI on &lt;= lines
64984 <literal> unknown_in_list            </literal>  DNS lookup failed in list match
64985
64986 <literal> all                        </literal>  all of the above
64987 </literallayout>
64988 <para>
64989 See also the <option>slow_lookup_log</option> main configuration option,
64990 section <xref linkend="SECID99"/>
64991 </para>
64992 <para>
64993 More details on each of these items follows:
64994 </para>
64995 <itemizedlist>
64996 <listitem>
64997 <para>
64998 <indexterm role="concept">
64999 <primary>8BITMIME</primary>
65000 </indexterm>
65001 <indexterm role="concept">
65002 <primary>log</primary>
65003 <secondary>8BITMIME</secondary>
65004 </indexterm>
65005 <option>8bitmime</option>: This causes Exim to log any 8BITMIME status of received messages,
65006 which may help in tracking down interoperability issues with ancient MTAs
65007 that are not 8bit clean.  This is added to the <quote>&lt;=</quote> line, tagged with
65008 <literal>M8S=</literal> and a value of <literal>0</literal>, <literal>7</literal> or <literal>8</literal>, corresponding to "not given",
65009 <literal>7BIT</literal> and <literal>8BITMIME</literal> respectively.
65010 </para>
65011 </listitem>
65012 <listitem>
65013 <para>
65014 <indexterm role="concept">
65015 <primary><option>warn</option> ACL verb</primary>
65016 <secondary>log when skipping</secondary>
65017 </indexterm>
65018 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
65019 its conditions cannot be evaluated, a log line to this effect is written if
65020 this log selector is set.
65021 </para>
65022 </listitem>
65023 <listitem>
65024 <para>
65025 <indexterm role="concept">
65026 <primary>log</primary>
65027 <secondary>rewriting</secondary>
65028 </indexterm>
65029 <indexterm role="concept">
65030 <primary>rewriting</primary>
65031 <secondary>logging</secondary>
65032 </indexterm>
65033 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
65034 rewrites, but not to rewrites in filters run as an unprivileged user (because
65035 such users cannot access the log).
65036 </para>
65037 </listitem>
65038 <listitem>
65039 <para>
65040 <indexterm role="concept">
65041 <primary>log</primary>
65042 <secondary>full parentage</secondary>
65043 </indexterm>
65044 <option>all_parents</option>: Normally only the original and final addresses are logged on
65045 delivery lines; with this selector, intermediate parents are given in
65046 parentheses between them.
65047 </para>
65048 </listitem>
65049 <listitem>
65050 <para>
65051 <indexterm role="concept">
65052 <primary>log</primary>
65053 <secondary>Exim arguments</secondary>
65054 </indexterm>
65055 <indexterm role="concept">
65056 <primary>Exim arguments, logging</primary>
65057 </indexterm>
65058 <option>arguments</option>: This causes Exim to write the arguments with which it was called
65059 to the main log, preceded by the current working directory. This is a debugging
65060 feature, added to make it easier to find out how certain MUAs call
65061 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
65062 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
65063 that are empty or that contain white space are quoted. Non-printing characters
65064 are shown as escape sequences. This facility cannot log unrecognized arguments,
65065 because the arguments are checked before the configuration file is read. The
65066 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
65067 between the caller and Exim.
65068 </para>
65069 </listitem>
65070 <listitem>
65071 <para>
65072 <indexterm role="concept">
65073 <primary>log</primary>
65074 <secondary>connection rejections</secondary>
65075 </indexterm>
65076 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
65077 connection is rejected, for whatever reason.
65078 </para>
65079 </listitem>
65080 <listitem>
65081 <para>
65082 <indexterm role="concept">
65083 <primary>log</primary>
65084 <secondary>delayed delivery</secondary>
65085 </indexterm>
65086 <indexterm role="concept">
65087 <primary>delayed delivery, logging</primary>
65088 </indexterm>
65089 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
65090 started for an incoming message because the load is too high or too many
65091 messages were received on one connection. Logging does not occur if no delivery
65092 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
65093 </para>
65094 </listitem>
65095 <listitem>
65096 <para>
65097 <indexterm role="concept">
65098 <primary>log</primary>
65099 <secondary>delivery duration</secondary>
65100 </indexterm>
65101 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
65102 perform the actual delivery is logged as DT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>DT=1s</literal>.
65103 </para>
65104 </listitem>
65105 <listitem>
65106 <para>
65107 <indexterm role="concept">
65108 <primary>log</primary>
65109 <secondary>message size on delivery</secondary>
65110 </indexterm>
65111 <indexterm role="concept">
65112 <primary>size</primary>
65113 <secondary>of message</secondary>
65114 </indexterm>
65115 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
65116 the <quote>=&gt;</quote> line, tagged with S=.
65117 </para>
65118 </listitem>
65119 <listitem>
65120 <para>
65121 <indexterm role="concept">
65122 <primary>log</primary>
65123 <secondary>dnslist defer</secondary>
65124 </indexterm>
65125 <indexterm role="concept">
65126 <primary>DNS list</primary>
65127 <secondary>logging defer</secondary>
65128 </indexterm>
65129 <indexterm role="concept">
65130 <primary>black list (DNS)</primary>
65131 </indexterm>
65132 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
65133 DNS black list suffers a temporary error.
65134 </para>
65135 </listitem>
65136 <listitem>
65137 <para>
65138 <indexterm role="concept">
65139 <primary>log</primary>
65140 <secondary>ETRN commands</secondary>
65141 </indexterm>
65142 <indexterm role="concept">
65143 <primary>ETRN</primary>
65144 <secondary>logging</secondary>
65145 </indexterm>
65146 <option>etrn</option>: Every valid ETRN command that is received is logged, before the ACL
65147 is run to determine whether or not it is actually accepted. An invalid ETRN
65148 command, or one received within a message transaction is not logged by this
65149 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
65150 </para>
65151 </listitem>
65152 <listitem>
65153 <para>
65154 <indexterm role="concept">
65155 <primary>log</primary>
65156 <secondary>host lookup failure</secondary>
65157 </indexterm>
65158 <option>host_lookup_failed</option>: When a lookup of a host&#x2019;s IP addresses fails to find
65159 any addresses, or when a lookup of an IP address fails to find a host name, a
65160 log line is written. This logging does not apply to direct DNS lookups when
65161 routing email addresses, but it does apply to <quote>byname</quote> lookups.
65162 </para>
65163 </listitem>
65164 <listitem>
65165 <para>
65166 <indexterm role="concept">
65167 <primary>log</primary>
65168 <secondary>ident timeout</secondary>
65169 </indexterm>
65170 <indexterm role="concept">
65171 <primary>RFC 1413</primary>
65172 <secondary>logging timeout</secondary>
65173 </indexterm>
65174 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
65175 client&#x2019;s ident port times out.
65176 </para>
65177 </listitem>
65178 <listitem>
65179 <para>
65180 <indexterm role="concept">
65181 <primary>log</primary>
65182 <secondary>incoming interface</secondary>
65183 </indexterm>
65184 <indexterm role="concept">
65185 <primary>log</primary>
65186 <secondary>local interface</secondary>
65187 </indexterm>
65188 <indexterm role="concept">
65189 <primary>log</primary>
65190 <secondary>local address and port</secondary>
65191 </indexterm>
65192 <indexterm role="concept">
65193 <primary>TCP/IP</primary>
65194 <secondary>logging local address and port</secondary>
65195 </indexterm>
65196 <indexterm role="concept">
65197 <primary>interface</primary>
65198 <secondary>logging</secondary>
65199 </indexterm>
65200 <option>incoming_interface</option>: The interface on which a message was received is added
65201 to the <quote>&lt;=</quote> line as an IP address in square brackets, tagged by I= and
65202 followed by a colon and the port number. The local interface and port are also
65203 added to other SMTP log lines, for example <quote>SMTP connection from</quote>, to
65204 rejection lines, and (despite the name) to outgoing <quote>=&gt;</quote> and <quote>-&gt;</quote> lines.
65205 </para>
65206 <para revisionflag="changed">
65207 The latter can be disabled by turning off the <option>outgoing_interface</option> option.
65208 </para>
65209 </listitem>
65210 <listitem>
65211 <para revisionflag="changed">
65212 <indexterm role="concept">
65213 <primary>log</primary>
65214 <secondary>incoming proxy address</secondary>
65215 </indexterm>
65216 <indexterm role="concept">
65217 <primary>proxy</primary>
65218 <secondary>logging proxy address</secondary>
65219 </indexterm>
65220 <indexterm role="concept">
65221 <primary>TCP/IP</primary>
65222 <secondary>logging proxy address</secondary>
65223 </indexterm>
65224 <option>proxy</option>: The internal (closest to the system running Exim) IP address
65225 of the proxy, tagged by PRX=, on the <quote>&lt;=</quote> line for a message accepted
65226 on a proxied connection
65227 or the <quote>=&gt;</quote> line for a message delivered on a proxied connection..
65228 See <xref linkend="SECTproxyInbound"/> for more information.
65229 </para>
65230 </listitem>
65231 <listitem>
65232 <para>
65233 <indexterm role="concept">
65234 <primary>log</primary>
65235 <secondary>incoming remote port</secondary>
65236 </indexterm>
65237 <indexterm role="concept">
65238 <primary>port</primary>
65239 <secondary>logging remote</secondary>
65240 </indexterm>
65241 <indexterm role="concept">
65242 <primary>TCP/IP</primary>
65243 <secondary>logging incoming remote port</secondary>
65244 </indexterm>
65245 <indexterm role="variable">
65246 <primary><varname>$sender_fullhost</varname></primary>
65247 </indexterm>
65248 <indexterm role="variable">
65249 <primary><varname>$sender_rcvhost</varname></primary>
65250 </indexterm>
65251 <option>incoming_port</option>: The remote port number from which a message was received is
65252 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
65253 in square brackets, and separated from it by a colon. This is implemented by
65254 changing the value that is put in the <varname>$sender_fullhost</varname> and
65255 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
65256 important with the widening use of NAT (see RFC 2505).
65257 </para>
65258 </listitem>
65259 <listitem>
65260 <para>
65261 <indexterm role="concept">
65262 <primary>log</primary>
65263 <secondary>dropped connection</secondary>
65264 </indexterm>
65265 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
65266 connection is unexpectedly dropped.
65267 </para>
65268 </listitem>
65269 <listitem>
65270 <para>
65271 <indexterm role="concept">
65272 <primary>log</primary>
65273 <secondary>outgoing interface</secondary>
65274 </indexterm>
65275 <indexterm role="concept">
65276 <primary>log</primary>
65277 <secondary>local interface</secondary>
65278 </indexterm>
65279 <indexterm role="concept">
65280 <primary>log</primary>
65281 <secondary>local address and port</secondary>
65282 </indexterm>
65283 <indexterm role="concept">
65284 <primary>TCP/IP</primary>
65285 <secondary>logging local address and port</secondary>
65286 </indexterm>
65287 <indexterm role="concept">
65288 <primary>interface</primary>
65289 <secondary>logging</secondary>
65290 </indexterm>
65291 </para>
65292 <para revisionflag="changed">
65293 <option>outgoing_interface</option>: If <option>incoming_interface</option> is turned on, then the
65294 interface on which a message was sent is added to delivery lines as an I= tag
65295 followed by IP address in square brackets. You can disable this by turning
65296 off the <option>outgoing_interface</option> option.
65297 </para>
65298 </listitem>
65299 <listitem>
65300 <para>
65301 <indexterm role="concept">
65302 <primary>log</primary>
65303 <secondary>outgoing remote port</secondary>
65304 </indexterm>
65305 <indexterm role="concept">
65306 <primary>port</primary>
65307 <secondary>logging outgoint remote</secondary>
65308 </indexterm>
65309 <indexterm role="concept">
65310 <primary>TCP/IP</primary>
65311 <secondary>logging ougtoing remote port</secondary>
65312 </indexterm>
65313 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
65314 containing =&gt; tags) following the IP address.
65315 </para>
65316 <para revisionflag="changed">
65317 The local port is also added if <option>incoming_interface</option> and
65318 <option>outgoing_interface</option> are both enabled.
65319 </para>
65320 <para>
65321 This option is not included in the default setting, because for most ordinary
65322 configurations, the remote port number is always 25 (the SMTP port), and the
65323 local port is a random ephemeral port.
65324 </para>
65325 </listitem>
65326 <listitem>
65327 <para>
65328 <indexterm role="concept">
65329 <primary>log</primary>
65330 <secondary>process ids in</secondary>
65331 </indexterm>
65332 <indexterm role="concept">
65333 <primary>pid (process id)</primary>
65334 <secondary>in log lines</secondary>
65335 </indexterm>
65336 <option>pid</option>: The current process id is added to every log line, in square brackets,
65337 immediately after the time and date.
65338 </para>
65339 </listitem>
65340 <listitem>
65341 <para>
65342 <indexterm role="concept">
65343 <primary>log</primary>
65344 <secondary>queue run</secondary>
65345 </indexterm>
65346 <indexterm role="concept">
65347 <primary>queue runner</primary>
65348 <secondary>logging</secondary>
65349 </indexterm>
65350 <option>queue_run</option>: The start and end of every queue run are logged.
65351 </para>
65352 </listitem>
65353 <listitem>
65354 <para>
65355 <indexterm role="concept">
65356 <primary>log</primary>
65357 <secondary>queue time</secondary>
65358 </indexterm>
65359 <option>queue_time</option>: The amount of time the message has been in the queue on the
65360 local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on delivery (<literal>=&gt;</literal>) lines, for example,
65361 <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the message, so it
65362 includes reception time as well as the delivery time for the current address.
65363 This means that it may be longer than the difference between the arrival and
65364 delivery log line times, because the arrival log line is not written until the
65365 message has been successfully received.
65366 </para>
65367 </listitem>
65368 <listitem>
65369 <para>
65370 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
65371 the local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on <quote>Completed</quote> lines, for
65372 example, <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the
65373 message, so it includes reception time as well as the total delivery time.
65374 </para>
65375 </listitem>
65376 <listitem>
65377 <para>
65378 <indexterm role="concept">
65379 <primary>log</primary>
65380 <secondary>recipients</secondary>
65381 </indexterm>
65382 <option>received_recipients</option>: The recipients of a message are listed in the main log
65383 as soon as the message is received. The list appears at the end of the log line
65384 that is written when a message is received, preceded by the word <quote>for</quote>. The
65385 addresses are listed after they have been qualified, but before any rewriting
65386 has taken place.
65387 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
65388 in the list.
65389 </para>
65390 </listitem>
65391 <listitem>
65392 <para>
65393 <indexterm role="concept">
65394 <primary>log</primary>
65395 <secondary>sender reception</secondary>
65396 </indexterm>
65397 <option>received_sender</option>: The unrewritten original sender of a message is added to
65398 the end of the log line that records the message&#x2019;s arrival, after the word
65399 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
65400 </para>
65401 </listitem>
65402 <listitem>
65403 <para>
65404 <indexterm role="concept">
65405 <primary>log</primary>
65406 <secondary>header lines for rejection</secondary>
65407 </indexterm>
65408 <option>rejected_header</option>: If a message&#x2019;s header has been received at the time a
65409 rejection is written to the reject log, the complete header is added to the
65410 log. Header logging can be turned off individually for messages that are
65411 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
65412 </para>
65413 </listitem>
65414 <listitem>
65415 <para>
65416 <indexterm role="concept">
65417 <primary>log</primary>
65418 <secondary>retry defer</secondary>
65419 </indexterm>
65420 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
65421 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
65422 message is always omitted from individual message logs after the first delivery
65423 attempt.
65424 </para>
65425 </listitem>
65426 <listitem>
65427 <para>
65428 <indexterm role="concept">
65429 <primary>log</primary>
65430 <secondary>return path</secondary>
65431 </indexterm>
65432 <option>return_path_on_delivery</option>: The return path that is being transmitted with
65433 the message is included in delivery and bounce lines, using the tag P=.
65434 This is omitted if no delivery actually happens, for example, if routing fails,
65435 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
65436 </para>
65437 </listitem>
65438 <listitem>
65439 <para>
65440 <indexterm role="concept">
65441 <primary>log</primary>
65442 <secondary>sender on delivery</secondary>
65443 </indexterm>
65444 <option>sender_on_delivery</option>: The message&#x2019;s sender address is added to every delivery
65445 and bounce line, tagged by F= (for <quote>from</quote>).
65446 This is the original sender that was received with the message; it is not
65447 necessarily the same as the outgoing return path.
65448 </para>
65449 </listitem>
65450 <listitem>
65451 <para>
65452 <indexterm role="concept">
65453 <primary>log</primary>
65454 <secondary>sender verify failure</secondary>
65455 </indexterm>
65456 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
65457 gives details of a sender verification failure is not written. Log lines for
65458 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
65459 detail is lost.
65460 </para>
65461 </listitem>
65462 <listitem>
65463 <para>
65464 <indexterm role="concept">
65465 <primary>log</primary>
65466 <secondary>size rejection</secondary>
65467 </indexterm>
65468 <option>size_reject</option>: A log line is written whenever a message is rejected because
65469 it is too big.
65470 </para>
65471 </listitem>
65472 <listitem>
65473 <para>
65474 <indexterm role="concept">
65475 <primary>log</primary>
65476 <secondary>frozen messages; skipped</secondary>
65477 </indexterm>
65478 <indexterm role="concept">
65479 <primary>frozen messages</primary>
65480 <secondary>logging skipping</secondary>
65481 </indexterm>
65482 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
65483 queue run because it is frozen or because another process is already delivering
65484 it.
65485 <indexterm role="concept">
65486 <primary><quote>spool file is locked</quote></primary>
65487 </indexterm>
65488 The message that is written is <quote>spool file is locked</quote>.
65489 </para>
65490 </listitem>
65491 <listitem>
65492 <para>
65493 <indexterm role="concept">
65494 <primary>log</primary>
65495 <secondary>smtp confirmation</secondary>
65496 </indexterm>
65497 <indexterm role="concept">
65498 <primary>SMTP</primary>
65499 <secondary>logging confirmation</secondary>
65500 </indexterm>
65501 <indexterm role="concept">
65502 <primary>LMTP</primary>
65503 <secondary>logging confirmation</secondary>
65504 </indexterm>
65505 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP or LMTP dialogue for
65506 outgoing messages is added to delivery log lines in the form <literal>C=</literal>&lt;<emphasis>text</emphasis>&gt;.
65507 A number of MTAs (including Exim) return an identifying string in this
65508 response.
65509 </para>
65510 </listitem>
65511 <listitem>
65512 <para>
65513 <indexterm role="concept">
65514 <primary>log</primary>
65515 <secondary>SMTP connections</secondary>
65516 </indexterm>
65517 <indexterm role="concept">
65518 <primary>SMTP</primary>
65519 <secondary>logging connections</secondary>
65520 </indexterm>
65521 <option>smtp_connection</option>: A log line is written whenever an incoming SMTP connection is
65522 established or closed, unless the connection is from a host that matches
65523 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
65524 only when the closure is unexpected.) This applies to connections from local
65525 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
65526 dropped in the middle of a message, a log line is always written, whether or
65527 not this selector is set, but otherwise nothing is written at the start and end
65528 of connections unless this selector is enabled.
65529 </para>
65530 <para>
65531 For TCP/IP connections to an Exim daemon, the current number of connections is
65532 included in the log message for each new connection, but note that the count is
65533 reset if the daemon is restarted.
65534 Also, because connections are closed (and the closure is logged) in
65535 subprocesses, the count may not include connections that have been closed but
65536 whose termination the daemon has not yet noticed. Thus, while it is possible to
65537 match up the opening and closing of connections in the log, the value of the
65538 logged counts may not be entirely accurate.
65539 </para>
65540 </listitem>
65541 <listitem>
65542 <para>
65543 <indexterm role="concept">
65544 <primary>log</primary>
65545 <secondary>SMTP transaction; incomplete</secondary>
65546 </indexterm>
65547 <indexterm role="concept">
65548 <primary>SMTP</primary>
65549 <secondary>logging incomplete transactions</secondary>
65550 </indexterm>
65551 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
65552 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
65553 and the message sender plus any accepted recipients are included in the log
65554 line. This can provide evidence of dictionary attacks.
65555 </para>
65556 </listitem>
65557 <listitem>
65558 <para>
65559 <indexterm role="concept">
65560 <primary>log</primary>
65561 <secondary>non-MAIL SMTP sessions</secondary>
65562 </indexterm>
65563 <indexterm role="concept">
65564 <primary>MAIL</primary>
65565 <secondary>logging session without</secondary>
65566 </indexterm>
65567 <option>smtp_no_mail</option>: A line is written to the main log whenever an accepted SMTP
65568 connection terminates without having issued a MAIL command. This includes both
65569 the case when the connection is dropped, and the case when QUIT is used. It
65570 does not include cases where the connection is rejected right at the start (by
65571 an ACL, or because there are too many connections, or whatever). These cases
65572 already have their own log lines.
65573 </para>
65574 <para>
65575 The log line that is written contains the identity of the client in the usual
65576 way, followed by D= and a time, which records the duration of the connection.
65577 If the connection was authenticated, this fact is logged exactly as it is for
65578 an incoming message, with an A= item. If the connection was encrypted, CV=,
65579 DN=, and X= items may appear as they do for an incoming message, controlled by
65580 the same logging options.
65581 </para>
65582 <para>
65583 Finally, if any SMTP commands were issued during the connection, a C= item
65584 is added to the line, listing the commands that were used. For example,
65585 </para>
65586 <literallayout class="monospaced">
65587 C=EHLO,QUIT
65588 </literallayout>
65589 <para>
65590 shows that the client issued QUIT straight after EHLO. If there were fewer
65591 than 20 commands, they are all listed. If there were more than 20 commands,
65592 the last 20 are listed, preceded by <quote>...</quote>. However, with the default
65593 setting of 10 for <option>smtp_accept_max_nonmail</option>, the connection will in any case
65594 have been aborted before 20 non-mail commands are processed.
65595 </para>
65596 </listitem>
65597 <listitem>
65598 <para>
65599 <option>smtp_mailauth</option>: A third subfield with the authenticated sender,
65600 colon-separated, is appended to the A= item for a message arrival or delivery
65601 log line, if an AUTH argument to the SMTP MAIL command (see <xref linkend="SECTauthparamail"/>)
65602 was accepted or used.
65603 </para>
65604 </listitem>
65605 <listitem>
65606 <para>
65607 <indexterm role="concept">
65608 <primary>log</primary>
65609 <secondary>SMTP protocol error</secondary>
65610 </indexterm>
65611 <indexterm role="concept">
65612 <primary>SMTP</primary>
65613 <secondary>logging protocol error</secondary>
65614 </indexterm>
65615 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
65616 encountered. Exim does not have perfect detection of all protocol errors
65617 because of transmission delays and the use of pipelining. If PIPELINING has
65618 been advertised to a client, an Exim server assumes that the client will use
65619 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
65620 received after rejecting MAIL) as protocol errors.
65621 </para>
65622 </listitem>
65623 <listitem>
65624 <para>
65625 <indexterm role="concept">
65626 <primary>SMTP</primary>
65627 <secondary>logging syntax errors</secondary>
65628 </indexterm>
65629 <indexterm role="concept">
65630 <primary>SMTP</primary>
65631 <secondary>syntax errors; logging</secondary>
65632 </indexterm>
65633 <indexterm role="concept">
65634 <primary>SMTP</primary>
65635 <secondary>unknown command; logging</secondary>
65636 </indexterm>
65637 <indexterm role="concept">
65638 <primary>log</primary>
65639 <secondary>unknown SMTP command</secondary>
65640 </indexterm>
65641 <indexterm role="concept">
65642 <primary>log</primary>
65643 <secondary>SMTP syntax error</secondary>
65644 </indexterm>
65645 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
65646 encountered. An unrecognized command is treated as a syntax error. For an
65647 external connection, the host identity is given; for an internal connection
65648 using <option>-bs</option> the sender identification (normally the calling user) is given.
65649 </para>
65650 </listitem>
65651 <listitem>
65652 <para>
65653 <indexterm role="concept">
65654 <primary>log</primary>
65655 <secondary>subject</secondary>
65656 </indexterm>
65657 <indexterm role="concept">
65658 <primary>subject, logging</primary>
65659 </indexterm>
65660 <option>subject</option>: The subject of the message is added to the arrival log line,
65661 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
65662 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
65663 specifies whether characters with values greater than 127 should be logged
65664 unchanged, or whether they should be rendered as escape sequences.
65665 </para>
65666 </listitem>
65667 <listitem>
65668 <para>
65669 <indexterm role="concept">
65670 <primary>log</primary>
65671 <secondary>certificate verification</secondary>
65672 </indexterm>
65673 <option>tls_certificate_verified</option>: An extra item is added to &lt;= and =&gt; log lines
65674 when TLS is in use. The item is <literal>CV=yes</literal> if the peer&#x2019;s certificate was
65675 verified, and <literal>CV=no</literal> if not.
65676 </para>
65677 </listitem>
65678 <listitem>
65679 <para>
65680 <indexterm role="concept">
65681 <primary>log</primary>
65682 <secondary>TLS cipher</secondary>
65683 </indexterm>
65684 <indexterm role="concept">
65685 <primary>TLS</primary>
65686 <secondary>logging cipher</secondary>
65687 </indexterm>
65688 <option>tls_cipher</option>: When a message is sent or received over an encrypted
65689 connection, the cipher suite used is added to the log line, preceded by X=.
65690 </para>
65691 </listitem>
65692 <listitem>
65693 <para>
65694 <indexterm role="concept">
65695 <primary>log</primary>
65696 <secondary>TLS peer DN</secondary>
65697 </indexterm>
65698 <indexterm role="concept">
65699 <primary>TLS</primary>
65700 <secondary>logging peer DN</secondary>
65701 </indexterm>
65702 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
65703 connection, and a certificate is supplied by the remote host, the peer DN is
65704 added to the log line, preceded by DN=.
65705 </para>
65706 </listitem>
65707 <listitem>
65708 <para>
65709 <indexterm role="concept">
65710 <primary>log</primary>
65711 <secondary>TLS SNI</secondary>
65712 </indexterm>
65713 <indexterm role="concept">
65714 <primary>TLS</primary>
65715 <secondary>logging SNI</secondary>
65716 </indexterm>
65717 <option>tls_sni</option>: When a message is received over an encrypted connection, and
65718 the remote host provided the Server Name Indication extension, the SNI is
65719 added to the log line, preceded by SNI=.
65720 </para>
65721 </listitem>
65722 <listitem>
65723 <para>
65724 <indexterm role="concept">
65725 <primary>log</primary>
65726 <secondary>DNS failure in list</secondary>
65727 </indexterm>
65728 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
65729 result of a list match is failure because a DNS lookup failed.
65730 </para>
65731 </listitem>
65732 </itemizedlist>
65733 </section>
65734 <section id="SECID260">
65735 <title>Message log</title>
65736 <para>
65737 <indexterm role="concept">
65738 <primary>message</primary>
65739 <secondary>log file for</secondary>
65740 </indexterm>
65741 <indexterm role="concept">
65742 <primary>log</primary>
65743 <secondary>message log; description of</secondary>
65744 </indexterm>
65745 <indexterm role="concept">
65746 <primary><filename>msglog</filename> directory</primary>
65747 </indexterm>
65748 <indexterm role="option">
65749 <primary><option>preserve_message_logs</option></primary>
65750 </indexterm>
65751 In addition to the general log files, Exim writes a log file for each message
65752 that it handles. The names of these per-message logs are the message ids, and
65753 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
65754 message log contains copies of the log lines that apply to the message. This
65755 makes it easier to inspect the status of an individual message without having
65756 to search the main log. A message log is deleted when processing of the message
65757 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
65758 only with great care because they can fill up your disk very quickly.
65759 </para>
65760 <para>
65761 On a heavily loaded system, it may be desirable to disable the use of
65762 per-message logs, in order to reduce disk I/O. This can be done by setting the
65763 <option>message_logs</option> option false.
65764 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
65765 </para>
65766 </section>
65767 </chapter>
65768
65769 <chapter id="CHAPutils">
65770 <title>Exim utilities</title>
65771 <para>
65772 <indexterm role="concept" id="IIDutils" class="startofrange">
65773 <primary>utilities</primary>
65774 </indexterm>
65775 A number of utility scripts and programs are supplied with Exim and are
65776 described in this chapter. There is also the Exim Monitor, which is covered in
65777 the next chapter. The utilities described here are:
65778 </para>
65779 <informaltable frame="none">
65780 <tgroup cols="3" colsep="0" rowsep="0">
65781 <colspec colwidth="7*" align="left"/>
65782 <colspec colwidth="15*" align="left"/>
65783 <colspec colwidth="40*" align="left"/>
65784 <tbody>
65785 <row>
65786 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinoutwha"/></entry>
65787 <entry><emphasis>exiwhat</emphasis></entry>
65788 <entry>list what Exim processes are doing</entry>
65789 </row>
65790 <row>
65791 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTgreptheque"/></entry>
65792 <entry><emphasis>exiqgrep</emphasis></entry>
65793 <entry>grep the queue</entry>
65794 </row>
65795 <row>
65796 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTsumtheque"/></entry>
65797 <entry><emphasis>exiqsumm</emphasis></entry>
65798 <entry>summarize the queue</entry>
65799 </row>
65800 <row>
65801 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTextspeinf"/></entry>
65802 <entry><emphasis>exigrep</emphasis></entry>
65803 <entry>search the main log</entry>
65804 </row>
65805 <row>
65806 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTexipick"/></entry>
65807 <entry><emphasis>exipick</emphasis></entry>
65808 <entry>select messages on various criteria</entry>
65809 </row>
65810 <row>
65811 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcyclogfil"/></entry>
65812 <entry><emphasis>exicyclog</emphasis></entry>
65813 <entry>cycle (rotate) log files</entry>
65814 </row>
65815 <row>
65816 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailstat"/></entry>
65817 <entry><emphasis>eximstats</emphasis></entry>
65818 <entry>extract statistics from the log</entry>
65819 </row>
65820 <row>
65821 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcheckaccess"/></entry>
65822 <entry><emphasis>exim_checkaccess</emphasis></entry>
65823 <entry>check address acceptance from given IP</entry>
65824 </row>
65825 <row>
65826 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTdbmbuild"/></entry>
65827 <entry><emphasis>exim_dbmbuild</emphasis></entry>
65828 <entry>build a DBM file</entry>
65829 </row>
65830 <row>
65831 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinindret"/></entry>
65832 <entry><emphasis>exinext</emphasis></entry>
65833 <entry>extract retry information</entry>
65834 </row>
65835 <row>
65836 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
65837 <entry><emphasis>exim_dumpdb</emphasis></entry>
65838 <entry>dump a hints database</entry>
65839 </row>
65840 <row>
65841 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
65842 <entry><emphasis>exim_tidydb</emphasis></entry>
65843 <entry>clean up a hints database</entry>
65844 </row>
65845 <row>
65846 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
65847 <entry><emphasis>exim_fixdb</emphasis></entry>
65848 <entry>patch a hints database</entry>
65849 </row>
65850 <row>
65851 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailboxmaint"/></entry>
65852 <entry><emphasis>exim_lock</emphasis></entry>
65853 <entry>lock a mailbox file</entry>
65854 </row>
65855 </tbody>
65856 </tgroup>
65857 </informaltable>
65858 <para>
65859 Another utility that might be of use to sites with many MTAs is Tom Kistner&#x2019;s
65860 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
65861 <emphasis role="bold"><ulink url="http://duncanthrax.net/exilog/">http://duncanthrax.net/exilog/</ulink></emphasis> for details.
65862 </para>
65863 <section id="SECTfinoutwha">
65864 <title>Finding out what Exim processes are doing (exiwhat)</title>
65865 <para>
65866 <indexterm role="concept">
65867 <primary><emphasis>exiwhat</emphasis></primary>
65868 </indexterm>
65869 <indexterm role="concept">
65870 <primary>process, querying</primary>
65871 </indexterm>
65872 <indexterm role="concept">
65873 <primary>SIGUSR1</primary>
65874 </indexterm>
65875 On operating systems that can restart a system call after receiving a signal
65876 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
65877 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
65878 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
65879 processes it can find, having first emptied the file. It then waits for one
65880 second to allow the Exim processes to react before displaying the results. In
65881 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
65882 send the signal to the Exim processes, so it is normally run as root.
65883 </para>
65884 <para>
65885 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
65886 use by system administrators. It is not sensible, for example, to set up a
65887 script that sends SIGUSR1 signals to Exim processes at short intervals.
65888 </para>
65889 <para>
65890 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
65891 varies in different operating systems. Not only are different options used,
65892 but the format of the output is different. For this reason, there are some
65893 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
65894 it doesn&#x2019;t seem to be working for you, check the following compile-time
65895 options:
65896 </para>
65897 <literallayout>
65898 <literal>EXIWHAT_PS_CMD    </literal> the command for running <emphasis>ps</emphasis>
65899 <literal>EXIWHAT_PS_ARG    </literal> the argument for <emphasis>ps</emphasis>
65900 <literal>EXIWHAT_EGREP_ARG </literal> the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output
65901 <literal>EXIWHAT_KILL_ARG  </literal> the argument for the <emphasis>kill</emphasis> command
65902 </literallayout>
65903 <para>
65904 An example of typical output from <emphasis>exiwhat</emphasis> is
65905 </para>
65906 <literallayout class="monospaced">
65907 164 daemon: -q1h, listening on port 25
65908 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
65909 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
65910   [10.19.42.42] (editor@ref.example)
65911 10592 handling incoming call from [192.168.243.242]
65912 10628 accepting a local non-SMTP message
65913 </literallayout>
65914 <para>
65915 The first number in the output line is the process number. The third line has
65916 been split here, in order to fit it on the page.
65917 </para>
65918 </section>
65919 <section id="SECTgreptheque">
65920 <title>Selective queue listing (exiqgrep)</title>
65921 <para>
65922 <indexterm role="concept">
65923 <primary><emphasis>exiqgrep</emphasis></primary>
65924 </indexterm>
65925 <indexterm role="concept">
65926 <primary>queue</primary>
65927 <secondary>grepping</secondary>
65928 </indexterm>
65929 This utility is a Perl script contributed by Matt Hubbard. It runs
65930 </para>
65931 <literallayout class="monospaced">
65932 exim -bpu
65933 </literallayout>
65934 <para>
65935 or (in case <emphasis role="bold">-a</emphasis> switch is specified)
65936 </para>
65937 <literallayout class="monospaced">
65938 exim -bp
65939 </literallayout>
65940 <para>
65941 The <emphasis role="bold">-C</emphasis> option is used to specify an alternate <filename>exim.conf</filename> which might
65942 contain alternate exim configuration the queue management might be using.
65943 </para>
65944 <para>
65945 to obtain a queue listing, and then greps the output to select messages
65946 that match given criteria. The following selection options are available:
65947 </para>
65948 <variablelist>
65949 <varlistentry>
65950 <term><emphasis role="bold">-f</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
65951 <listitem>
65952 <para>
65953 Match the sender address using a case-insensitive search. The field that is
65954 tested is enclosed in angle brackets, so you can test for bounce messages with
65955 </para>
65956 <literallayout class="monospaced">
65957 exiqgrep -f '^&lt;&gt;$'
65958 </literallayout>
65959 </listitem></varlistentry>
65960 <varlistentry>
65961 <term><emphasis role="bold">-r</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
65962 <listitem>
65963 <para>
65964 Match a recipient address using a case-insensitive search. The field that is
65965 tested is not enclosed in angle brackets.
65966 </para>
65967 </listitem></varlistentry>
65968 <varlistentry>
65969 <term><emphasis role="bold">-s</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
65970 <listitem>
65971 <para>
65972 Match against the size field.
65973 </para>
65974 </listitem></varlistentry>
65975 <varlistentry>
65976 <term><emphasis role="bold">-y</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
65977 <listitem>
65978 <para>
65979 Match messages that are younger than the given time.
65980 </para>
65981 </listitem></varlistentry>
65982 <varlistentry>
65983 <term><emphasis role="bold">-o</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
65984 <listitem>
65985 <para>
65986 Match messages that are older than the given time.
65987 </para>
65988 </listitem></varlistentry>
65989 <varlistentry>
65990 <term><emphasis role="bold">-z</emphasis></term>
65991 <listitem>
65992 <para>
65993 Match only frozen messages.
65994 </para>
65995 </listitem></varlistentry>
65996 <varlistentry>
65997 <term><emphasis role="bold">-x</emphasis></term>
65998 <listitem>
65999 <para>
66000 Match only non-frozen messages.
66001 </para>
66002 </listitem></varlistentry>
66003 </variablelist>
66004 <para>
66005 The following options control the format of the output:
66006 </para>
66007 <variablelist>
66008 <varlistentry>
66009 <term><emphasis role="bold">-c</emphasis></term>
66010 <listitem>
66011 <para>
66012 Display only the count of matching messages.
66013 </para>
66014 </listitem></varlistentry>
66015 <varlistentry>
66016 <term><emphasis role="bold">-l</emphasis></term>
66017 <listitem>
66018 <para>
66019 Long format &ndash; display the full message information as output by Exim. This is
66020 the default.
66021 </para>
66022 </listitem></varlistentry>
66023 <varlistentry>
66024 <term><emphasis role="bold">-i</emphasis></term>
66025 <listitem>
66026 <para>
66027 Display message ids only.
66028 </para>
66029 </listitem></varlistentry>
66030 <varlistentry>
66031 <term><emphasis role="bold">-b</emphasis></term>
66032 <listitem>
66033 <para>
66034 Brief format &ndash; one line per message.
66035 </para>
66036 </listitem></varlistentry>
66037 <varlistentry>
66038 <term><emphasis role="bold">-R</emphasis></term>
66039 <listitem>
66040 <para>
66041 Display messages in reverse order.
66042 </para>
66043 </listitem></varlistentry>
66044 <varlistentry>
66045 <term><emphasis role="bold">-a</emphasis></term>
66046 <listitem>
66047 <para>
66048 Include delivered recipients in queue listing.
66049 </para>
66050 </listitem></varlistentry>
66051 </variablelist>
66052 <para>
66053 There is one more option, <option>-h</option>, which outputs a list of options.
66054 </para>
66055 </section>
66056 <section id="SECTsumtheque">
66057 <title>Summarizing the queue (exiqsumm)</title>
66058 <para>
66059 <indexterm role="concept">
66060 <primary><emphasis>exiqsumm</emphasis></primary>
66061 </indexterm>
66062 <indexterm role="concept">
66063 <primary>queue</primary>
66064 <secondary>summary</secondary>
66065 </indexterm>
66066 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
66067 -bp</literal> and produces a summary of the messages on the queue. Thus, you use it by
66068 running a command such as
66069 </para>
66070 <literallayout class="monospaced">
66071 exim -bp | exiqsumm
66072 </literallayout>
66073 <para>
66074 The output consists of one line for each domain that has messages waiting for
66075 it, as in the following example:
66076 </para>
66077 <literallayout class="monospaced">
66078 3   2322   74m   66m  msn.com.example
66079 </literallayout>
66080 <para>
66081 Each line lists the number of pending deliveries for a domain, their total
66082 volume, and the length of time that the oldest and the newest messages have
66083 been waiting. Note that the number of pending deliveries is greater than the
66084 number of messages when messages have more than one recipient.
66085 </para>
66086 <para>
66087 A summary line is output at the end. By default the output is sorted on the
66088 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
66089 the output to be sorted by oldest message and by count of messages,
66090 respectively. There are also three options that split the messages for each
66091 domain into two or more subcounts: <option>-b</option> separates bounce messages, <option>-f</option>
66092 separates frozen messages, and <option>-s</option> separates messages according to their
66093 sender.
66094 </para>
66095 <para>
66096 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
66097 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
66098 generated by aliasing or forwarding are included (unless the <option>one_time</option>
66099 option of the <command>redirect</command> router has been used to convert them into <quote>top
66100 level</quote> addresses).
66101 </para>
66102 </section>
66103 <section id="SECTextspeinf">
66104 <title>Extracting specific information from the log (exigrep)</title>
66105 <para>
66106 <indexterm role="concept">
66107 <primary><emphasis>exigrep</emphasis></primary>
66108 </indexterm>
66109 <indexterm role="concept">
66110 <primary>log</primary>
66111 <secondary>extracts; grepping for</secondary>
66112 </indexterm>
66113 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
66114 files for entries that match a given pattern. When it finds a match, it
66115 extracts all the log entries for the relevant message, not just those that
66116 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
66117 given message, or all mail for a given user, or for a given host, for example.
66118 The input files can be in Exim log format or syslog format.
66119 If a matching log line is not associated with a specific message, it is
66120 included in <emphasis>exigrep</emphasis>&#x2019;s output without any additional lines. The usage is:
66121 </para>
66122 <literallayout>
66123 <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>
66124 </literallayout>
66125 <para>
66126 If no log file names are given on the command line, the standard input is read.
66127 </para>
66128 <para>
66129 The <option>-t</option> argument specifies a number of seconds. It adds an additional
66130 condition for message selection. Messages that are complete are shown only if
66131 they spent more than &lt;<emphasis>n</emphasis>&gt; seconds on the queue.
66132 </para>
66133 <para>
66134 By default, <emphasis>exigrep</emphasis> does case-insensitive matching. The <option>-I</option> option
66135 makes it case-sensitive. This may give a performance improvement when searching
66136 large log files. Without <option>-I</option>, the Perl pattern matches use Perl&#x2019;s <literal>/i</literal>
66137 option; with <option>-I</option> they do not. In both cases it is possible to change the
66138 case sensitivity within the pattern by using <literal>(?i)</literal> or <literal>(?-i)</literal>.
66139 </para>
66140 <para>
66141 The <option>-l</option> option means <quote>literal</quote>, that is, treat all characters in the
66142 pattern as standing for themselves. Otherwise the pattern must be a Perl
66143 regular expression.
66144 </para>
66145 <para>
66146 The <option>-v</option> option inverts the matching condition. That is, a line is selected
66147 if it does <emphasis>not</emphasis> match the pattern.
66148 </para>
66149 <para>
66150 The <option>-M</option> options means <quote>related messages</quote>. <emphasis>exigrep</emphasis> will show messages
66151 that are generated as a result/response to a message that <emphasis>exigrep</emphasis> matched
66152 normally.
66153 </para>
66154 <para>
66155 Example of <option>-M</option>:
66156 user_a sends a message to user_b, which generates a bounce back to user_b. If
66157 <emphasis>exigrep</emphasis> is used to search for <quote>user_a</quote>, only the first message will be
66158 displayed.  But if <emphasis>exigrep</emphasis> is used to search for <quote>user_b</quote>, the first and
66159 the second (bounce) message will be displayed. Using <option>-M</option> with <emphasis>exigrep</emphasis>
66160 when searching for <quote>user_a</quote> will show both messages since the bounce is
66161 <quote>related</quote> to or a <quote>result</quote> of the first message that was found by the
66162 search term.
66163 </para>
66164 <para>
66165 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
66166 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
66167 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
66168 If the ZCAT_COMMAND is not executable, <emphasis>exigrep</emphasis> tries to use
66169 autodetection of some well known compression extensions.
66170 </para>
66171 </section>
66172 <section id="SECTexipick">
66173 <title>Selecting messages by various criteria (exipick)</title>
66174 <para>
66175 <indexterm role="concept">
66176 <primary><emphasis>exipick</emphasis></primary>
66177 </indexterm>
66178 John Jetmore&#x2019;s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
66179 lists messages from the queue according to a variety of criteria. For details
66180 of <emphasis>exipick</emphasis>&#x2019;s facilities, visit the web page at
66181 <emphasis role="bold"><ulink url="http://www.exim.org/eximwiki/ToolExipickManPage">http://www.exim.org/eximwiki/ToolExipickManPage</ulink></emphasis> or run <emphasis>exipick</emphasis> with
66182 the <option>--help</option> option.
66183 </para>
66184 </section>
66185 <section id="SECTcyclogfil">
66186 <title>Cycling log files (exicyclog)</title>
66187 <para>
66188 <indexterm role="concept">
66189 <primary>log</primary>
66190 <secondary>cycling local files</secondary>
66191 </indexterm>
66192 <indexterm role="concept">
66193 <primary>cycling logs</primary>
66194 </indexterm>
66195 <indexterm role="concept">
66196 <primary><emphasis>exicyclog</emphasis></primary>
66197 </indexterm>
66198 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
66199 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
66200 you are using log files with datestamps in their names (see section
66201 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
66202 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
66203 There are two command line options for <emphasis>exicyclog</emphasis>:
66204 </para>
66205 <itemizedlist>
66206 <listitem>
66207 <para>
66208 <option>-k</option> &lt;<emphasis>count</emphasis>&gt; specifies the number of log files to keep, overriding the
66209 default that is set when Exim is built. The default default is 10.
66210 </para>
66211 </listitem>
66212 <listitem>
66213 <para>
66214 <option>-l</option> &lt;<emphasis>path</emphasis>&gt; specifies the log file path, in the same format as Exim&#x2019;s
66215 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
66216 overriding the script&#x2019;s default, which is to find the setting from Exim&#x2019;s
66217 configuration.
66218 </para>
66219 </listitem>
66220 </itemizedlist>
66221 <para>
66222 Each time <emphasis>exicyclog</emphasis> is run the file names get <quote>shuffled down</quote> by one. If
66223 the main log file name is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
66224 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
66225 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
66226 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
66227 logs are handled similarly.
66228 </para>
66229 <para>
66230 If the limit is greater than 99, the script uses 3-digit numbers such as
66231 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
66232 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
66233 any existing log files.
66234 </para>
66235 <para>
66236 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
66237 the end are deleted. All files with numbers greater than 01 are compressed,
66238 using a compression command which is configured by the COMPRESS_COMMAND
66239 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
66240 root <option>crontab</option> entry of the form
66241 </para>
66242 <literallayout class="monospaced">
66243 1 0 * * * su exim -c /usr/exim/bin/exicyclog
66244 </literallayout>
66245 <para>
66246 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
66247 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
66248 </para>
66249 </section>
66250 <section id="SECTmailstat">
66251 <title>Mail statistics (eximstats)</title>
66252 <para>
66253 <indexterm role="concept">
66254 <primary>statistics</primary>
66255 </indexterm>
66256 <indexterm role="concept">
66257 <primary><emphasis>eximstats</emphasis></primary>
66258 </indexterm>
66259 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
66260 information from log files. The output is either plain text, or HTML.
66261 Exim log files are also supported by the <emphasis>Lire</emphasis> system produced by the
66262 LogReport Foundation <emphasis role="bold"><ulink url="http://www.logreport.org">http://www.logreport.org</ulink></emphasis>.
66263 </para>
66264 <para>
66265 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
66266 latest version is the result of some extensive revision by Steve Campbell. A
66267 lot of information is given by default, but there are options for suppressing
66268 various parts of it. Following any options, the arguments to the script are a
66269 list of files, which should be main log files. For example:
66270 </para>
66271 <literallayout class="monospaced">
66272 eximstats -nr /var/spool/exim/log/mainlog.01
66273 </literallayout>
66274 <para>
66275 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
66276 messages received from or delivered to various hosts. The information is sorted
66277 both by message count and by volume, and the top fifty hosts in each category
66278 are listed on the standard output. Similar information, based on email
66279 addresses or domains instead of hosts can be requested by means of various
66280 options. For messages delivered and received locally, similar statistics are
66281 also produced per user.
66282 </para>
66283 <para>
66284 The output also includes total counts and statistics about delivery errors, and
66285 histograms showing the number of messages received and deliveries made in each
66286 hour of the day. A delivery with more than one address in its envelope (for
66287 example, an SMTP transaction with more than one RCPT command) is counted
66288 as a single delivery by <emphasis>eximstats</emphasis>.
66289 </para>
66290 <para>
66291 Though normally more deliveries than receipts are reported (as messages may
66292 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
66293 messages received than delivered, even though the queue is empty at the start
66294 and end of the period in question. If an incoming message contains no valid
66295 recipients, no deliveries are recorded for it. A bounce message is handled as
66296 an entirely separate message.
66297 </para>
66298 <para>
66299 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
66300 of messages received and deliveries made, and the number of hosts involved in
66301 each case. It also outputs the number of messages that were delayed (that is,
66302 not completely delivered at the first attempt), and the number that had at
66303 least one address that failed.
66304 </para>
66305 <para>
66306 The remainder of the output is in sections that can be independently disabled
66307 or modified by various options. It consists of a summary of deliveries by
66308 transport, histograms of messages received and delivered per time interval
66309 (default per hour), information about the time messages spent on the queue,
66310 a list of relayed messages, lists of the top fifty sending hosts, local
66311 senders, destination hosts, and destination local users by count and by volume,
66312 and a list of delivery errors that occurred.
66313 </para>
66314 <para>
66315 The relay information lists messages that were actually relayed, that is, they
66316 came from a remote host and were directly delivered to some other remote host,
66317 without being processed (for example, for aliasing or forwarding) locally.
66318 </para>
66319 <para>
66320 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
66321 outputs. These are documented in the Perl script itself, and can be extracted
66322 by running the command <command>perldoc</command> on the script. For example:
66323 </para>
66324 <literallayout class="monospaced">
66325 perldoc /usr/exim/bin/eximstats
66326 </literallayout>
66327 </section>
66328 <section id="SECTcheckaccess">
66329 <title>Checking access policy (exim_checkaccess)</title>
66330 <para>
66331 <indexterm role="concept">
66332 <primary><emphasis>exim_checkaccess</emphasis></primary>
66333 </indexterm>
66334 <indexterm role="concept">
66335 <primary>policy control</primary>
66336 <secondary>checking access</secondary>
66337 </indexterm>
66338 <indexterm role="concept">
66339 <primary>checking access</primary>
66340 </indexterm>
66341 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
66342 debugging output, in order to check what Exim is doing when it is applying
66343 policy controls to incoming SMTP mail. However, not everybody is sufficiently
66344 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
66345 sometimes you just want to answer the question <quote>Does this address have
66346 access?</quote> without bothering with any further details.
66347 </para>
66348 <para>
66349 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
66350 two arguments, an IP address and an email address:
66351 </para>
66352 <literallayout class="monospaced">
66353 exim_checkaccess 10.9.8.7 A.User@a.domain.example
66354 </literallayout>
66355 <para>
66356 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
66357 given email address would be accepted in a RCPT command in a TCP/IP
66358 connection from the host with the given IP address. The output of the utility
66359 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
66360 </para>
66361 <literallayout class="monospaced">
66362 Rejected:
66363 550 Relay not permitted
66364 </literallayout>
66365 <para>
66366 When running this test, the utility uses <literal>&lt;&gt;</literal> as the envelope sender address
66367 for the MAIL command, but you can change this by providing additional
66368 options. These are passed directly to the Exim command. For example, to specify
66369 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
66370 you can use:
66371 </para>
66372 <literallayout class="monospaced">
66373 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
66374                  -f himself@there.example
66375 </literallayout>
66376 <para>
66377 Note that these additional Exim command line items must be given after the two
66378 mandatory arguments.
66379 </para>
66380 <para>
66381 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
66382 while running its checks. You can run checks that include callouts by using
66383 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
66384 </para>
66385 </section>
66386 <section id="SECTdbmbuild">
66387 <title>Making DBM files (exim_dbmbuild)</title>
66388 <para>
66389 <indexterm role="concept">
66390 <primary>DBM</primary>
66391 <secondary>building dbm files</secondary>
66392 </indexterm>
66393 <indexterm role="concept">
66394 <primary>building DBM files</primary>
66395 </indexterm>
66396 <indexterm role="concept">
66397 <primary><emphasis>exim_dbmbuild</emphasis></primary>
66398 </indexterm>
66399 <indexterm role="concept">
66400 <primary>lower casing</primary>
66401 </indexterm>
66402 <indexterm role="concept">
66403 <primary>binary zero</primary>
66404 <secondary>in lookup key</secondary>
66405 </indexterm>
66406 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
66407 the format used by the <command>lsearch</command> lookup (see section
66408 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
66409 names as keys and the remainder of the information as data. The lower-casing
66410 can be prevented by calling the program with the <option>-nolc</option> option.
66411 </para>
66412 <para>
66413 A terminating zero is included as part of the key string. This is expected by
66414 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
66415 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
66416 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
66417 files.
66418 </para>
66419 <para>
66420 The program requires two arguments: the name of the input file (which can be a
66421 single hyphen to indicate the standard input), and the name of the output file.
66422 It creates the output under a temporary name, and then renames it if all went
66423 well.
66424 </para>
66425 <para>
66426 <indexterm role="concept">
66427 <primary>USE_DB</primary>
66428 </indexterm>
66429 If the native DB interface is in use (USE_DB is set in a compile-time
66430 configuration file &ndash; this is common in free versions of Unix) the two file
66431 names must be different, because in this mode the Berkeley DB functions create
66432 a single output file using exactly the name given. For example,
66433 </para>
66434 <literallayout class="monospaced">
66435 exim_dbmbuild /etc/aliases /etc/aliases.db
66436 </literallayout>
66437 <para>
66438 reads the system alias file and creates a DBM version of it in
66439 <filename>/etc/aliases.db</filename>.
66440 </para>
66441 <para>
66442 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
66443 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
66444 environment, the suffixes are added to the second argument of
66445 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
66446 when the Berkeley functions are used in compatibility mode (though this is not
66447 recommended), because in that case it adds a <filename>.db</filename> suffix to the file name.
66448 </para>
66449 <para>
66450 If a duplicate key is encountered, the program outputs a warning, and when it
66451 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
66452 option is used. By default, only the first of a set of duplicates is used &ndash;
66453 this makes it compatible with <command>lsearch</command> lookups. There is an option
66454 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
66455 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
66456 <option>stderr</option>. For other errors, where it doesn&#x2019;t actually make a new file, the
66457 return code is 2.
66458 </para>
66459 </section>
66460 <section id="SECTfinindret">
66461 <title>Finding individual retry times (exinext)</title>
66462 <para>
66463 <indexterm role="concept">
66464 <primary>retry</primary>
66465 <secondary>times</secondary>
66466 </indexterm>
66467 <indexterm role="concept">
66468 <primary><emphasis>exinext</emphasis></primary>
66469 </indexterm>
66470 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
66471 fish specific information out of the retry database. Given a mail domain (or a
66472 complete address), it looks up the hosts for that domain, and outputs any retry
66473 information for the hosts or for the domain. At present, the retry information
66474 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
66475 output. For example:
66476 </para>
66477 <literallayout class="monospaced">
66478 $ exinext piglet@milne.fict.example
66479 kanga.milne.example:192.168.8.1 error 146: Connection refused
66480   first failed: 21-Feb-1996 14:57:34
66481   last tried:   21-Feb-1996 14:57:34
66482   next try at:  21-Feb-1996 15:02:34
66483 roo.milne.example:192.168.8.3 error 146: Connection refused
66484   first failed: 20-Jan-1996 13:12:08
66485   last tried:   21-Feb-1996 11:42:03
66486   next try at:  21-Feb-1996 19:42:03
66487   past final cutoff time
66488 </literallayout>
66489 <para>
66490 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
66491 will give any retry information for that local part in your default domain.
66492 A message id can be used to obtain retry information pertaining to a specific
66493 message. This exists only when an attempt to deliver a message to a remote host
66494 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
66495 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
66496 run very often.
66497 </para>
66498 <para>
66499 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
66500 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
66501 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
66502 configuration file, and the second sets macros for use within the configuration
66503 file. These features are mainly to help in testing, but might also be useful in
66504 environments where more than one configuration file is in use.
66505 </para>
66506 </section>
66507 <section id="SECThindatmai">
66508 <title>Hints database maintenance</title>
66509 <para>
66510 <indexterm role="concept">
66511 <primary>hints database</primary>
66512 <secondary>maintenance</secondary>
66513 </indexterm>
66514 <indexterm role="concept">
66515 <primary>maintaining Exim&#x2019;s hints database</primary>
66516 </indexterm>
66517 Three utility programs are provided for maintaining the DBM files that Exim
66518 uses to contain its delivery hint information. Each program requires two
66519 arguments. The first specifies the name of Exim&#x2019;s spool directory, and the
66520 second is the name of the database it is to operate on. These are as follows:
66521 </para>
66522 <itemizedlist>
66523 <listitem>
66524 <para>
66525 <emphasis>retry</emphasis>: the database of retry information
66526 </para>
66527 </listitem>
66528 <listitem>
66529 <para>
66530 <emphasis>wait-</emphasis>&lt;<emphasis>transport name</emphasis>&gt;: databases of information about messages waiting
66531 for remote hosts
66532 </para>
66533 </listitem>
66534 <listitem>
66535 <para>
66536 <emphasis>callout</emphasis>: the callout cache
66537 </para>
66538 </listitem>
66539 <listitem>
66540 <para>
66541 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
66542 </para>
66543 </listitem>
66544 <listitem>
66545 <para>
66546 <emphasis>misc</emphasis>: other hints data
66547 </para>
66548 </listitem>
66549 </itemizedlist>
66550 <para>
66551 The <emphasis>misc</emphasis> database is used for
66552 </para>
66553 <itemizedlist>
66554 <listitem>
66555 <para>
66556 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
66557 </para>
66558 </listitem>
66559 <listitem>
66560 <para>
66561 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
66562 <command>smtp</command> transport)
66563 </para>
66564 </listitem>
66565 <listitem>
66566 <para>
66567 Limiting the concurrency of specific transports (when <option>max_parallel</option> is set
66568 in a transport)
66569 </para>
66570 </listitem>
66571 </itemizedlist>
66572 </section>
66573 <section id="SECID261">
66574 <title>exim_dumpdb</title>
66575 <para>
66576 <indexterm role="concept">
66577 <primary><emphasis>exim_dumpdb</emphasis></primary>
66578 </indexterm>
66579 The entire contents of a database are written to the standard output by the
66580 <emphasis>exim_dumpdb</emphasis> program, which has no options or arguments other than the
66581 spool and database names. For example, to dump the retry database:
66582 </para>
66583 <literallayout class="monospaced">
66584 exim_dumpdb /var/spool/exim retry
66585 </literallayout>
66586 <para>
66587 Two lines of output are produced for each entry:
66588 </para>
66589 <literallayout class="monospaced">
66590 T:mail.ref.example:192.168.242.242 146 77 Connection refused
66591 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
66592 </literallayout>
66593 <para>
66594 The first item on the first line is the key of the record. It starts with one
66595 of the letters R, or T, depending on whether it refers to a routing or
66596 transport retry. For a local delivery, the next part is the local address; for
66597 a remote delivery it is the name of the remote host, followed by its failing IP
66598 address (unless <option>retry_include_ip_address</option> is set false on the <command>smtp</command>
66599 transport). If the remote port is not the standard one (port 25), it is added
66600 to the IP address. Then there follows an error code, an additional error code,
66601 and a textual description of the error.
66602 </para>
66603 <para>
66604 The three times on the second line are the time of first failure, the time of
66605 the last delivery attempt, and the computed time for the next attempt. The line
66606 ends with an asterisk if the cutoff time for the last retry rule has been
66607 exceeded.
66608 </para>
66609 <para>
66610 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
66611 consists of a host name followed by a list of ids for messages that are or were
66612 waiting to be delivered to that host. If there are a very large number for any
66613 one host, continuation records, with a sequence number added to the host name,
66614 may be seen. The data in these records is often out of date, because a message
66615 may be routed to several alternative hosts, and Exim makes no effort to keep
66616 cross-references.
66617 </para>
66618 </section>
66619 <section id="SECID262">
66620 <title>exim_tidydb</title>
66621 <para>
66622 <indexterm role="concept">
66623 <primary><emphasis>exim_tidydb</emphasis></primary>
66624 </indexterm>
66625 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
66626 database. If run with no options, it removes all records that are more than 30
66627 days old. The age is calculated from the date and time that the record was last
66628 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
66629 since the first delivery failure. Information about a host that has been down
66630 for more than 30 days will remain in the database, provided that the record is
66631 updated sufficiently often.
66632 </para>
66633 <para>
66634 The cutoff date can be altered by means of the <option>-t</option> option, which must be
66635 followed by a time. For example, to remove all records older than a week from
66636 the retry database:
66637 </para>
66638 <literallayout class="monospaced">
66639 exim_tidydb -t 7d /var/spool/exim retry
66640 </literallayout>
66641 <para>
66642 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
66643 message ids. In the former these appear as data in records keyed by host &ndash;
66644 they were messages that were waiting for that host &ndash; and in the latter they
66645 are the keys for retry information for messages that have suffered certain
66646 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
66647 message ids in database records are those of messages that are still on the
66648 queue. Message ids for messages that no longer exist are removed from
66649 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
66650 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
66651 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
66652 whenever it removes information from the database.
66653 </para>
66654 <para>
66655 Certain records are automatically removed by Exim when they are no longer
66656 needed, but others are not. For example, if all the MX hosts for a domain are
66657 down, a retry record is created for each one. If the primary MX host comes back
66658 first, its record is removed when Exim successfully delivers to it, but the
66659 records for the others remain because Exim has not tried to use those hosts.
66660 </para>
66661 <para>
66662 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
66663 hints databases. You should do this at a quiet time of day, because it requires
66664 a database to be locked (and therefore inaccessible to Exim) while it does its
66665 work. Removing records from a DBM file does not normally make the file smaller,
66666 but all the common DBM libraries are able to re-use the space that is released.
66667 After an initial phase of increasing in size, the databases normally reach a
66668 point at which they no longer get any bigger, as long as they are regularly
66669 tidied.
66670 </para>
66671 <para>
66672 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
66673 databases is likely to keep on increasing.
66674 </para>
66675 </section>
66676 <section id="SECID263">
66677 <title>exim_fixdb</title>
66678 <para>
66679 <indexterm role="concept">
66680 <primary><emphasis>exim_fixdb</emphasis></primary>
66681 </indexterm>
66682 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
66683 Its main use is for testing Exim, but it might also be occasionally useful for
66684 getting round problems in a live system. It has no options, and its interface
66685 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
66686 key of a database record can then be entered, and the data for that record is
66687 displayed.
66688 </para>
66689 <para>
66690 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
66691 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
66692 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
66693 data for individual fields can be changed by typing the field number followed
66694 by new data, for example:
66695 </para>
66696 <literallayout class="monospaced">
66697 &gt; 4 951102:1000
66698 </literallayout>
66699 <para>
66700 resets the time of the next delivery attempt. Time values are given as a
66701 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
66702 used as optional separators.
66703 </para>
66704 </section>
66705 <section id="SECTmailboxmaint">
66706 <title>Mailbox maintenance (exim_lock)</title>
66707 <para>
66708 <indexterm role="concept">
66709 <primary>mailbox</primary>
66710 <secondary>maintenance</secondary>
66711 </indexterm>
66712 <indexterm role="concept">
66713 <primary><emphasis>exim_lock</emphasis></primary>
66714 </indexterm>
66715 <indexterm role="concept">
66716 <primary>locking mailboxes</primary>
66717 </indexterm>
66718 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
66719 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
66720 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
66721 a user agent while investigating a problem. The utility requires the name of
66722 the file as its first argument. If the locking is successful, the second
66723 argument is run as a command (using C&#x2019;s <function>system()</function> function); if there is no
66724 second argument, the value of the SHELL environment variable is used; if this
66725 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
66726 is unlocked and the utility ends. The following options are available:
66727 </para>
66728 <variablelist>
66729 <varlistentry>
66730 <term><option>-fcntl</option></term>
66731 <listitem>
66732 <para>
66733 Use <function>fcntl()</function> locking on the open mailbox.
66734 </para>
66735 </listitem></varlistentry>
66736 <varlistentry>
66737 <term><option>-flock</option></term>
66738 <listitem>
66739 <para>
66740 Use <function>flock()</function> locking on the open mailbox, provided the operating system
66741 supports it.
66742 </para>
66743 </listitem></varlistentry>
66744 <varlistentry>
66745 <term><option>-interval</option></term>
66746 <listitem>
66747 <para>
66748 This must be followed by a number, which is a number of seconds; it sets the
66749 interval to sleep between retries (default 3).
66750 </para>
66751 </listitem></varlistentry>
66752 <varlistentry>
66753 <term><option>-lockfile</option></term>
66754 <listitem>
66755 <para>
66756 Create a lock file before opening the mailbox.
66757 </para>
66758 </listitem></varlistentry>
66759 <varlistentry>
66760 <term><option>-mbx</option></term>
66761 <listitem>
66762 <para>
66763 Lock the mailbox using MBX rules.
66764 </para>
66765 </listitem></varlistentry>
66766 <varlistentry>
66767 <term><option>-q</option></term>
66768 <listitem>
66769 <para>
66770 Suppress verification output.
66771 </para>
66772 </listitem></varlistentry>
66773 <varlistentry>
66774 <term><option>-retries</option></term>
66775 <listitem>
66776 <para>
66777 This must be followed by a number; it sets the number of times to try to get
66778 the lock (default 10).
66779 </para>
66780 </listitem></varlistentry>
66781 <varlistentry>
66782 <term><option>-restore_time</option></term>
66783 <listitem>
66784 <para>
66785 This option causes <option>exim_lock</option> to restore the modified and read times to the
66786 locked file before exiting. This allows you to access a locked mailbox (for
66787 example, to take a backup copy) without disturbing the times that the user
66788 subsequently sees.
66789 </para>
66790 </listitem></varlistentry>
66791 <varlistentry>
66792 <term><option>-timeout</option></term>
66793 <listitem>
66794 <para>
66795 This must be followed by a number, which is a number of seconds; it sets a
66796 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
66797 default), a non-blocking call is used.
66798 </para>
66799 </listitem></varlistentry>
66800 <varlistentry>
66801 <term><option>-v</option></term>
66802 <listitem>
66803 <para>
66804 Generate verbose output.
66805 </para>
66806 </listitem></varlistentry>
66807 </variablelist>
66808 <para>
66809 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
66810 default is to create a lock file and also to use <function>fcntl()</function> locking on the
66811 mailbox, which is the same as Exim&#x2019;s default. The use of <option>-flock</option> or
66812 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
66813 requires that the directory containing the file be writeable. Locking by lock
66814 file does not last for ever; Exim assumes that a lock file is expired if it is
66815 more than 30 minutes old.
66816 </para>
66817 <para>
66818 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
66819 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
66820 to be taken out on the open mailbox, and an exclusive lock on the file
66821 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
66822 number of the mailbox file. When the locking is released, if an exclusive lock
66823 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
66824 </para>
66825 <para>
66826 The default output contains verification of the locking that takes place. The
66827 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
66828 suppresses all output except error messages.
66829 </para>
66830 <para>
66831 A command such as
66832 </para>
66833 <literallayout class="monospaced">
66834 exim_lock /var/spool/mail/spqr
66835 </literallayout>
66836 <para>
66837 runs an interactive shell while the file is locked, whereas
66838 </para>
66839 <literallayout>
66840 <literal>exim_lock -q /var/spool/mail/spqr &lt;&lt;End</literal>
66841 &lt;<emphasis>some commands</emphasis>&gt;
66842 <literal>End</literal>
66843 </literallayout>
66844 <para>
66845 runs a specific non-interactive sequence of commands while the file is locked,
66846 suppressing all verification output. A single command can be run by a command
66847 such as
66848 </para>
66849 <literallayout class="monospaced">
66850 exim_lock -q /var/spool/mail/spqr \
66851   "cp /var/spool/mail/spqr /some/where"
66852 </literallayout>
66853 <para>
66854 Note that if a command is supplied, it must be entirely contained within the
66855 second argument &ndash; hence the quotes.
66856 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
66857 </para>
66858 </section>
66859 </chapter>
66860
66861 <chapter id="CHAPeximon">
66862 <title>The Exim monitor</title>
66863 <para>
66864 <indexterm role="concept" id="IIDeximon" class="startofrange">
66865 <primary>Exim monitor</primary>
66866 <secondary>description</secondary>
66867 </indexterm>
66868 <indexterm role="concept">
66869 <primary>X-windows</primary>
66870 </indexterm>
66871 <indexterm role="concept">
66872 <primary><emphasis>eximon</emphasis></primary>
66873 </indexterm>
66874 <indexterm role="concept">
66875 <primary>Local/eximon.conf</primary>
66876 </indexterm>
66877 <indexterm role="concept">
66878 <primary><filename>exim_monitor/EDITME</filename></primary>
66879 </indexterm>
66880 The Exim monitor is an application which displays in an X window information
66881 about the state of Exim&#x2019;s queue and what Exim is doing. An admin user can
66882 perform certain operations on messages from this GUI interface; however all
66883 such facilities are also available from the command line, and indeed, the
66884 monitor itself makes use of the command line to perform any actions requested.
66885 </para>
66886 <section id="SECID264">
66887 <title>Running the monitor</title>
66888 <para>
66889 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
66890 script that sets up a number of environment variables, and then runs the
66891 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
66892 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
66893 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
66894 parameters are for.
66895 </para>
66896 <para>
66897 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
66898 a particular invocation by setting up environment variables of the same names,
66899 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
66900 </para>
66901 <literallayout class="monospaced">
66902 EXIMON_LOG_DEPTH=400 eximon
66903 </literallayout>
66904 <para>
66905 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
66906 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
66907 overrides the Exim log file configuration. This makes it possible to have
66908 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
66909 syslog messages are routed to a file on the local host.
66910 </para>
66911 <para>
66912 X resources can be used to change the appearance of the window in the normal
66913 way. For example, a resource setting of the form
66914 </para>
66915 <literallayout class="monospaced">
66916 Eximon*background: gray94
66917 </literallayout>
66918 <para>
66919 changes the colour of the background to light grey rather than white. The
66920 stripcharts are drawn with both the data lines and the reference lines in
66921 black. This means that the reference lines are not visible when on top of the
66922 data. However, their colour can be changed by setting a resource called
66923 <quote>highlight</quote> (an odd name, but that&#x2019;s what the Athena stripchart widget uses).
66924 For example, if your X server is running Unix, you could set up lighter
66925 reference lines in the stripcharts by obeying
66926 </para>
66927 <literallayout class="monospaced">
66928 xrdb -merge &lt;&lt;End
66929 Eximon*highlight: gray
66930 End
66931 </literallayout>
66932 <para>
66933 <indexterm role="concept">
66934 <primary>admin user</primary>
66935 </indexterm>
66936 In order to see the contents of messages on the queue, and to operate on them,
66937 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
66938 </para>
66939 <para>
66940 The command-line parameters of <emphasis>eximon</emphasis> are passed to <filename>eximon.bin</filename> and may
66941 contain X11 resource parameters interpreted by the X11 library.  In addition,
66942 if the first parameter starts with the string "gdb" then it is removed and the
66943 binary is invoked under gdb (the parameter is used as the gdb command-name, so
66944 versioned variants of gdb can be invoked).
66945 </para>
66946 <para>
66947 The monitor&#x2019;s window is divided into three parts. The first contains one or
66948 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
66949 main log file, and the third is a display of the queue of messages awaiting
66950 delivery, with two more action buttons. The following sections describe these
66951 different parts of the display.
66952 </para>
66953 </section>
66954 <section id="SECID265">
66955 <title>The stripcharts</title>
66956 <para>
66957 <indexterm role="concept">
66958 <primary>stripchart</primary>
66959 </indexterm>
66960 The first stripchart is always a count of messages on the queue. Its name can
66961 be configured by setting QUEUE_STRIPCHART_NAME in the
66962 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
66963 configuration script by regular expression matches on log file entries, making
66964 it possible to display, for example, counts of messages delivered to certain
66965 hosts or using certain transports. The supplied defaults display counts of
66966 received and delivered messages, and of local and SMTP deliveries. The default
66967 period between stripchart updates is one minute; this can be adjusted by a
66968 parameter in the <filename>Local/eximon.conf</filename> file.
66969 </para>
66970 <para>
66971 The stripchart displays rescale themselves automatically as the value they are
66972 displaying changes. There are always 10 horizontal lines in each chart; the
66973 title string indicates the value of each division when it is greater than one.
66974 For example, <quote>x2</quote> means that each division represents a value of 2.
66975 </para>
66976 <para>
66977 It is also possible to have a stripchart which shows the percentage fullness of
66978 a particular disk partition, which is useful when local deliveries are confined
66979 to a single partition.
66980 </para>
66981 <para>
66982 <indexterm role="concept">
66983 <primary><option>statvfs</option> function</primary>
66984 </indexterm>
66985 This relies on the availability of the <function>statvfs()</function> function or equivalent in
66986 the operating system. Most, but not all versions of Unix that support Exim have
66987 this. For this particular stripchart, the top of the chart always represents
66988 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
66989 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
66990 <filename>Local/eximon.conf</filename> file.
66991 </para>
66992 </section>
66993 <section id="SECID266">
66994 <title>Main action buttons</title>
66995 <para>
66996 <indexterm role="concept">
66997 <primary>size</primary>
66998 <secondary>of monitor window</secondary>
66999 </indexterm>
67000 <indexterm role="concept">
67001 <primary>Exim monitor</primary>
67002 <secondary>window size</secondary>
67003 </indexterm>
67004 <indexterm role="concept">
67005 <primary>window size</primary>
67006 </indexterm>
67007 Below the stripcharts there is an action button for quitting the monitor. Next
67008 to this is another button marked <quote>Size</quote>. They are placed here so that
67009 shrinking the window to its default minimum size leaves just the queue count
67010 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
67011 the window to expand to its maximum size, unless it is already at the maximum,
67012 in which case it is reduced to its minimum.
67013 </para>
67014 <para>
67015 When expanding to the maximum, if the window cannot be fully seen where it
67016 currently is, it is moved back to where it was the last time it was at full
67017 size. When it is expanding from its minimum size, the old position is
67018 remembered, and next time it is reduced to the minimum it is moved back there.
67019 </para>
67020 <para>
67021 The idea is that you can keep a reduced window just showing one or two
67022 stripcharts at a convenient place on your screen, easily expand it to show
67023 the full window when required, and just as easily put it back to what it was.
67024 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
67025 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
67026 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
67027 </para>
67028 <para>
67029 Normally, the monitor starts up with the window at its full size, but it can be
67030 built so that it starts up with the window at its smallest size, by setting
67031 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
67032 </para>
67033 </section>
67034 <section id="SECID267">
67035 <title>The log display</title>
67036 <para>
67037 <indexterm role="concept">
67038 <primary>log</primary>
67039 <secondary>tail of; in monitor</secondary>
67040 </indexterm>
67041 The second section of the window is an area in which a display of the tail of
67042 the main log is maintained.
67043 To save space on the screen, the timestamp on each log line is shortened by
67044 removing the date and, if <option>log_timezone</option> is set, the timezone.
67045 The log tail is not available when the only destination for logging data is
67046 syslog, unless the syslog lines are routed to a local file whose name is passed
67047 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
67048 </para>
67049 <para>
67050 The log sub-window has a scroll bar at its lefthand side which can be used to
67051 move back to look at earlier text, and the up and down arrow keys also have a
67052 scrolling effect. The amount of log that is kept depends on the setting of
67053 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
67054 to use. When this is full, the earlier 50% of data is discarded &ndash; this is
67055 much more efficient than throwing it away line by line. The sub-window also has
67056 a horizontal scroll bar for accessing the ends of long log lines. This is the
67057 only means of horizontal scrolling; the right and left arrow keys are not
67058 available. Text can be cut from this part of the window using the mouse in the
67059 normal way. The size of this subwindow is controlled by parameters in the
67060 configuration file <filename>Local/eximon.conf</filename>.
67061 </para>
67062 <para>
67063 Searches of the text in the log window can be carried out by means of the ^R
67064 and ^S keystrokes, which default to a reverse and a forward search,
67065 respectively. The search covers only the text that is displayed in the window.
67066 It cannot go further back up the log.
67067 </para>
67068 <para>
67069 The point from which the search starts is indicated by a caret marker. This is
67070 normally at the end of the text in the window, but can be positioned explicitly
67071 by pointing and clicking with the left mouse button, and is moved automatically
67072 by a successful search. If new text arrives in the window when it is scrolled
67073 back, the caret remains where it is, but if the window is not scrolled back,
67074 the caret is moved to the end of the new text.
67075 </para>
67076 <para>
67077 Pressing ^R or ^S pops up a window into which the search text can be typed.
67078 There are buttons for selecting forward or reverse searching, for carrying out
67079 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
67080 happens and the window remains so that further searches can be done. If the
67081 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
67082 ^C is typed the search is cancelled.
67083 </para>
67084 <para>
67085 The searching facility is implemented using the facilities of the Athena text
67086 widget. By default this pops up a window containing both <quote>search</quote> and
67087 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
67088 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
67089 However, the linkers in BSDI and HP-UX seem unable to handle an externally
67090 provided version of <option>TextPop</option> when the remaining parts of the text widget
67091 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
67092 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
67093 on these systems, at the expense of having unwanted items in the search popup
67094 window.
67095 </para>
67096 </section>
67097 <section id="SECID268">
67098 <title>The queue display</title>
67099 <para>
67100 <indexterm role="concept">
67101 <primary>queue</primary>
67102 <secondary>display in monitor</secondary>
67103 </indexterm>
67104 The bottom section of the monitor window contains a list of all messages that
67105 are on the queue, which includes those currently being received or delivered,
67106 as well as those awaiting delivery. The size of this subwindow is controlled by
67107 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
67108 at which it is updated is controlled by another parameter in the same file &ndash;
67109 the default is 5 minutes, since queue scans can be quite expensive. However,
67110 there is an <quote>Update</quote> action button just above the display which can be used
67111 to force an update of the queue display at any time.
67112 </para>
67113 <para>
67114 When a host is down for some time, a lot of pending mail can build up for it,
67115 and this can make it hard to deal with other messages on the queue. To help
67116 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
67117 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
67118 type anything in here and press <quote>Return</quote>, the text is added to a chain of
67119 such texts, and if every undelivered address in a message matches at least one
67120 of the texts, the message is not displayed.
67121 </para>
67122 <para>
67123 If there is an address that does not match any of the texts, all the addresses
67124 are displayed as normal. The matching happens on the ends of addresses so, for
67125 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
67126 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
67127 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
67128 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
67129 a hide request is automatically cancelled after one hour.
67130 </para>
67131 <para>
67132 While the dialogue box is displayed, you can&#x2019;t press any buttons or do anything
67133 else to the monitor window. For this reason, if you want to cut text from the
67134 queue display to use in the dialogue box, you have to do the cutting before
67135 pressing the <quote>Hide</quote> button.
67136 </para>
67137 <para>
67138 The queue display contains, for each unhidden queued message, the length of
67139 time it has been on the queue, the size of the message, the message id, the
67140 message sender, and the first undelivered recipient, all on one line. If it is
67141 a bounce message, the sender is shown as <quote>&lt;&gt;</quote>. If there is more than one
67142 recipient to which the message has not yet been delivered, subsequent ones are
67143 listed on additional lines, up to a maximum configured number, following which
67144 an ellipsis is displayed. Recipients that have already received the message are
67145 not shown.
67146 </para>
67147 <para>
67148 <indexterm role="concept">
67149 <primary>frozen messages</primary>
67150 <secondary>display</secondary>
67151 </indexterm>
67152 If a message is frozen, an asterisk is displayed at the left-hand side.
67153 </para>
67154 <para>
67155 The queue display has a vertical scroll bar, and can also be scrolled by means
67156 of the arrow keys. Text can be cut from it using the mouse in the normal way.
67157 The text searching facilities, as described above for the log window, are also
67158 available, but the caret is always moved to the end of the text when the queue
67159 display is updated.
67160 </para>
67161 </section>
67162 <section id="SECID269">
67163 <title>The queue menu</title>
67164 <para>
67165 <indexterm role="concept">
67166 <primary>queue</primary>
67167 <secondary>menu in monitor</secondary>
67168 </indexterm>
67169 If the <option>shift</option> key is held down and the left button is clicked when the mouse
67170 pointer is over the text for any message, an action menu pops up, and the first
67171 line of the queue display for the message is highlighted. This does not affect
67172 any selected text.
67173 </para>
67174 <para>
67175 If you want to use some other event for popping up the menu, you can set the
67176 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
67177 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
67178 value set in this parameter is a standard X event description. For example, to
67179 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
67180 </para>
67181 <literallayout class="monospaced">
67182 EXIMON_MENU_EVENT='Ctrl&lt;Btn1Down&gt;' eximon
67183 </literallayout>
67184 <para>
67185 The title of the menu is the message id, and it contains entries which act as
67186 follows:
67187 </para>
67188 <itemizedlist>
67189 <listitem>
67190 <para>
67191 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
67192 in a new text window.
67193 </para>
67194 </listitem>
67195 <listitem>
67196 <para>
67197 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
67198 information and headers is displayed in a new text window. See chapter
67199 <xref linkend="CHAPspool"/> for a description of the format of spool files.
67200 </para>
67201 </listitem>
67202 <listitem>
67203 <para>
67204 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
67205 displayed in a new text window. There is a default limit of 20,000 bytes to the
67206 amount of data displayed. This can be changed by setting the BODY_MAX
67207 option at compile time, or the EXIMON_BODY_MAX option at run time.
67208 </para>
67209 </listitem>
67210 <listitem>
67211 <para>
67212 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
67213 delivery of the message. This causes an automatic thaw if the message is
67214 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
67215 a new text window. The delivery is run in a separate process, to avoid holding
67216 up the monitor while the delivery proceeds.
67217 </para>
67218 </listitem>
67219 <listitem>
67220 <para>
67221 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
67222 that the message be frozen.
67223 </para>
67224 </listitem>
67225 <listitem>
67226 <para>
67227 <indexterm role="concept">
67228 <primary>thawing messages</primary>
67229 </indexterm>
67230 <indexterm role="concept">
67231 <primary>unfreezing messages</primary>
67232 </indexterm>
67233 <indexterm role="concept">
67234 <primary>frozen messages</primary>
67235 <secondary>thawing</secondary>
67236 </indexterm>
67237 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
67238 that the message be thawed.
67239 </para>
67240 </listitem>
67241 <listitem>
67242 <para>
67243 <indexterm role="concept">
67244 <primary>delivery</primary>
67245 <secondary>forcing failure</secondary>
67246 </indexterm>
67247 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
67248 that Exim gives up trying to deliver the message. A bounce message is generated
67249 for any remaining undelivered addresses.
67250 </para>
67251 </listitem>
67252 <listitem>
67253 <para>
67254 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
67255 that the message be deleted from the system without generating a bounce
67256 message.
67257 </para>
67258 </listitem>
67259 <listitem>
67260 <para>
67261 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
67262 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
67263 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
67264 Otherwise it must be entered as a fully qualified address. Pressing RETURN
67265 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
67266 additional recipient be added to the message, unless the entry box is empty, in
67267 which case no action is taken.
67268 </para>
67269 </listitem>
67270 <listitem>
67271 <para>
67272 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
67273 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
67274 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
67275 Otherwise it must be entered as a fully qualified address. Pressing RETURN
67276 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
67277 recipient address as already delivered, unless the entry box is empty, in which
67278 case no action is taken.
67279 </para>
67280 </listitem>
67281 <listitem>
67282 <para>
67283 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
67284 mark all recipient addresses as already delivered.
67285 </para>
67286 </listitem>
67287 <listitem>
67288 <para>
67289 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
67290 sender&#x2019;s address. Pressing RETURN causes a call to Exim to be made using the
67291 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
67292 in which case no action is taken. If you want to set an empty sender (as in
67293 bounce messages), you must specify it as <quote>&lt;&gt;</quote>. Otherwise, if the address is
67294 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
67295 the address is qualified with that domain.
67296 </para>
67297 </listitem>
67298 </itemizedlist>
67299 <para>
67300 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
67301 other cases when a call to Exim is made, if there is any output from Exim (in
67302 particular, if the command fails) a window containing the command and the
67303 output is displayed. Otherwise, the results of the action are normally apparent
67304 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
67305 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
67306 if no output is generated.
67307 </para>
67308 <para>
67309 The queue display is automatically updated for actions such as freezing and
67310 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
67311 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
67312 force an update of the display after one of these actions.
67313 </para>
67314 <para>
67315 In any text window that is displayed as result of a menu action, the normal
67316 cut-and-paste facility is available, and searching can be carried out using ^R
67317 and ^S, as described above for the log tail window.
67318 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
67319 </para>
67320 </section>
67321 </chapter>
67322
67323 <chapter id="CHAPsecurity">
67324 <title>Security considerations</title>
67325 <para>
67326 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
67327 <primary>security</primary>
67328 <secondary>discussion of</secondary>
67329 </indexterm>
67330 This chapter discusses a number of issues concerned with security, some of
67331 which are also covered in other parts of this manual.
67332 </para>
67333 <para>
67334 For reasons that this author does not understand, some people have promoted
67335 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
67336 existence of this chapter in the documentation. However, the intent of the
67337 chapter is simply to describe the way Exim works in relation to certain
67338 security concerns, not to make any specific claims about the effectiveness of
67339 its security as compared with other MTAs.
67340 </para>
67341 <para>
67342 What follows is a description of the way Exim is supposed to be. Best efforts
67343 have been made to try to ensure that the code agrees with the theory, but an
67344 absence of bugs can never be guaranteed. Any that are reported will get fixed
67345 as soon as possible.
67346 </para>
67347 <section id="SECID286">
67348 <title>Building a more <quote>hardened</quote> Exim</title>
67349 <para>
67350 <indexterm role="concept">
67351 <primary>security</primary>
67352 <secondary>build-time features</secondary>
67353 </indexterm>
67354 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
67355 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
67356 Exim administrator who does not have the root password, or by someone who has
67357 penetrated the Exim (but not the root) account. These options are as follows:
67358 </para>
67359 <itemizedlist>
67360 <listitem>
67361 <para>
67362 ALT_CONFIG_PREFIX can be set to a string that is required to match the
67363 start of any file names used with the <option>-C</option> option. When it is set, these file
67364 names are also not allowed to contain the sequence <quote>/../</quote>. (However, if the
67365 value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
67366 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
67367 default setting for <option>ALT_CONFIG_PREFIX</option>.
67368 </para>
67369 <para>
67370 If the permitted configuration files are confined to a directory to
67371 which only root has access, this guards against someone who has broken
67372 into the Exim account from running a privileged Exim with an arbitrary
67373 configuration file, and using it to break into other accounts.
67374 </para>
67375 </listitem>
67376 <listitem>
67377 <para>
67378 If a non-trusted configuration file (i.e. not the default configuration file
67379 or one which is trusted by virtue of being listed in the TRUSTED_CONFIG_LIST
67380 file) is specified with <option>-C</option>, or if macros are given with <option>-D</option> (but see
67381 the next item), then root privilege is retained only if the caller of Exim is
67382 root. This locks out the possibility of testing a configuration using <option>-C</option>
67383 right through message reception and delivery, even if the caller is root. The
67384 reception works, but by that time, Exim is running as the Exim user, so when
67385 it re-execs to regain privilege for the delivery, the use of <option>-C</option> causes
67386 privilege to be lost. However, root can test reception and delivery using two
67387 separate commands.
67388 </para>
67389 </listitem>
67390 <listitem>
67391 <para>
67392 The WHITELIST_D_MACROS build option declares some macros to be safe to override
67393 with <option>-D</option> if the real uid is one of root, the Exim run-time user or the
67394 CONFIGURE_OWNER, if defined.  The potential impact of this option is limited by
67395 requiring the run-time value supplied to <option>-D</option> to match a regex that errs on
67396 the restrictive side.  Requiring build-time selection of safe macros is onerous
67397 but this option is intended solely as a transition mechanism to permit
67398 previously-working configurations to continue to work after release 4.73.
67399 </para>
67400 </listitem>
67401 <listitem>
67402 <para>
67403 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
67404 is disabled.
67405 </para>
67406 </listitem>
67407 <listitem>
67408 <para>
67409 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
67410 never to be used for any deliveries. This is like the <option>never_users</option> runtime
67411 option, but it cannot be overridden; the runtime option adds additional users
67412 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
67413 is permitted to modify the runtime file from using Exim as a way to get root.
67414 </para>
67415 </listitem>
67416 </itemizedlist>
67417 </section>
67418 <section id="SECID270">
67419 <title>Root privilege</title>
67420 <para>
67421 <indexterm role="concept">
67422 <primary>setuid</primary>
67423 </indexterm>
67424 <indexterm role="concept">
67425 <primary>root privilege</primary>
67426 </indexterm>
67427 The Exim binary is normally setuid to root, which means that it gains root
67428 privilege (runs as root) when it starts execution. In some special cases (for
67429 example, when the daemon is not in use and there are no local deliveries), it
67430 may be possible to run Exim setuid to some user other than root. This is
67431 discussed in the next section. However, in most installations, root privilege
67432 is required for two things:
67433 </para>
67434 <itemizedlist>
67435 <listitem>
67436 <para>
67437 To set up a socket connected to the standard SMTP port (25) when initialising
67438 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
67439 not required.
67440 </para>
67441 </listitem>
67442 <listitem>
67443 <para>
67444 To be able to change uid and gid in order to read users&#x2019; <filename>.forward</filename> files and
67445 perform local deliveries as the receiving user or as specified in the
67446 configuration.
67447 </para>
67448 </listitem>
67449 </itemizedlist>
67450 <para>
67451 It is not necessary to be root to do any of the other things Exim does, such as
67452 receiving messages and delivering them externally over SMTP, and it is
67453 obviously more secure if Exim does not run as root except when necessary.
67454 For this reason, a user and group for Exim to use must be defined in
67455 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
67456 group</quote>. Their values can be changed by the run time configuration, though this
67457 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
67458 <emphasis>mail</emphasis> or another user name altogether.
67459 </para>
67460 <para>
67461 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
67462 abdication; the process cannot regain root afterwards. Prior to release 4.00,
67463 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
67464 </para>
67465 <para>
67466 After a new Exim process has interpreted its command line options, it changes
67467 uid and gid in the following cases:
67468 </para>
67469 <itemizedlist>
67470 <listitem>
67471 <para>
67472 <indexterm role="option">
67473 <primary><option>-C</option></primary>
67474 </indexterm>
67475 <indexterm role="option">
67476 <primary><option>-D</option></primary>
67477 </indexterm>
67478 If the <option>-C</option> option is used to specify an alternate configuration file, or if
67479 the <option>-D</option> option is used to define macro values for the configuration, and the
67480 calling process is not running as root, the uid and gid are changed to those of
67481 the calling process.
67482 However, if DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the <option>-D</option>
67483 option may not be used at all.
67484 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename>, then some macro values
67485 can be supplied if the calling process is running as root, the Exim run-time
67486 user or CONFIGURE_OWNER, if defined.
67487 </para>
67488 </listitem>
67489 <listitem>
67490 <para>
67491 <indexterm role="option">
67492 <primary><option>-be</option></primary>
67493 </indexterm>
67494 <indexterm role="option">
67495 <primary><option>-bf</option></primary>
67496 </indexterm>
67497 <indexterm role="option">
67498 <primary><option>-bF</option></primary>
67499 </indexterm>
67500 If the expansion test option (<option>-be</option>) or one of the filter testing options
67501 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
67502 calling process.
67503 </para>
67504 </listitem>
67505 <listitem>
67506 <para>
67507 If the process is not a daemon process or a queue runner process or a delivery
67508 process or a process for testing address routing (started with <option>-bt</option>), the
67509 uid and gid are changed to the Exim user and group. This means that Exim always
67510 runs under its own uid and gid when receiving messages. This also applies when
67511 testing address verification
67512 <indexterm role="option">
67513 <primary><option>-bv</option></primary>
67514 </indexterm>
67515 <indexterm role="option">
67516 <primary><option>-bh</option></primary>
67517 </indexterm>
67518 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
67519 option).
67520 </para>
67521 </listitem>
67522 <listitem>
67523 <para>
67524 For a daemon, queue runner, delivery, or address testing process, the uid
67525 remains as root at this stage, but the gid is changed to the Exim group.
67526 </para>
67527 </listitem>
67528 </itemizedlist>
67529 <para>
67530 The processes that initially retain root privilege behave as follows:
67531 </para>
67532 <itemizedlist>
67533 <listitem>
67534 <para>
67535 A daemon process changes the gid to the Exim group and the uid to the Exim
67536 user after setting up one or more listening sockets. The <function>initgroups()</function>
67537 function is called, so that if the Exim user is in any additional groups, they
67538 will be used during message reception.
67539 </para>
67540 </listitem>
67541 <listitem>
67542 <para>
67543 A queue runner process retains root privilege throughout its execution. Its
67544 job is to fork a controlled sequence of delivery processes.
67545 </para>
67546 </listitem>
67547 <listitem>
67548 <para>
67549 A delivery process retains root privilege throughout most of its execution,
67550 but any actual deliveries (that is, the transports themselves) are run in
67551 subprocesses which always change to a non-root uid and gid. For local
67552 deliveries this is typically the uid and gid of the owner of the mailbox; for
67553 remote deliveries, the Exim uid and gid are used. Once all the delivery
67554 subprocesses have been run, a delivery process changes to the Exim uid and gid
67555 while doing post-delivery tidying up such as updating the retry database and
67556 generating bounce and warning messages.
67557 </para>
67558 <para>
67559 While the recipient addresses in a message are being routed, the delivery
67560 process runs as root. However, if a user&#x2019;s filter file has to be processed,
67561 this is done in a subprocess that runs under the individual user&#x2019;s uid and
67562 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
67563 </para>
67564 </listitem>
67565 <listitem>
67566 <para>
67567 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
67568 the routing is done in the same environment as a message delivery.
67569 </para>
67570 </listitem>
67571 </itemizedlist>
67572 </section>
67573 <section id="SECTrunexiwitpri">
67574 <title>Running Exim without privilege</title>
67575 <para>
67576 <indexterm role="concept">
67577 <primary>privilege, running without</primary>
67578 </indexterm>
67579 <indexterm role="concept">
67580 <primary>unprivileged running</primary>
67581 </indexterm>
67582 <indexterm role="concept">
67583 <primary>root privilege</primary>
67584 <secondary>running without</secondary>
67585 </indexterm>
67586 Some installations like to run Exim in an unprivileged state for more of its
67587 operation, for added security. Support for this mode of operation is provided
67588 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
67589 gid are changed to the Exim user and group at the start of a delivery process
67590 (and also queue runner and address testing processes). This means that address
67591 routing is no longer run as root, and the deliveries themselves cannot change
67592 to any other uid.
67593 </para>
67594 <para>
67595 <indexterm role="concept">
67596 <primary>SIGHUP</primary>
67597 </indexterm>
67598 <indexterm role="concept">
67599 <primary>daemon</primary>
67600 <secondary>restarting</secondary>
67601 </indexterm>
67602 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
67603 that the daemon can still be started in the usual way, and it can respond
67604 correctly to SIGHUP because the re-invocation regains root privilege.
67605 </para>
67606 <para>
67607 An alternative approach is to make Exim setuid to the Exim user and also setgid
67608 to the Exim group. If you do this, the daemon must be started from a root
67609 process. (Calling Exim from a root process makes it behave in the way it does
67610 when it is setuid root.) However, the daemon cannot restart itself after a
67611 SIGHUP signal because it cannot regain privilege.
67612 </para>
67613 <para>
67614 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
67615 stops Exim from trying to re-invoke itself to do a delivery after a message has
67616 been received. Such a re-invocation is a waste of resources because it has no
67617 effect.
67618 </para>
67619 <para>
67620 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
67621 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
67622 to the Exim user seems a clean approach, but there is one complication:
67623 </para>
67624 <para>
67625 In this style of operation, Exim is running with the real uid and gid set to
67626 those of the calling process, and the effective uid/gid set to Exim&#x2019;s values.
67627 Ideally, any association with the calling process&#x2019; uid/gid should be dropped,
67628 that is, the real uid/gid should be reset to the effective values so as to
67629 discard any privileges that the caller may have. While some operating systems
67630 have a function that permits this action for a non-root effective uid, quite a
67631 number of them do not. Because of this lack of standardization, Exim does not
67632 address this problem at this time.
67633 </para>
67634 <para>
67635 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
67636 is to keep the Exim binary setuid to root, and to set
67637 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
67638 be used in the most straightforward way.
67639 </para>
67640 <para>
67641 If you configure Exim not to run delivery processes as root, there are a
67642 number of restrictions on what you can do:
67643 </para>
67644 <itemizedlist>
67645 <listitem>
67646 <para>
67647 You can deliver only as the Exim user/group. You should  explicitly use the
67648 <option>user</option> and <option>group</option> options to override routers or local transports that
67649 normally deliver as the recipient. This makes sure that configurations that
67650 work in this mode function the same way in normal mode. Any implicit or
67651 explicit specification of another user causes an error.
67652 </para>
67653 </listitem>
67654 <listitem>
67655 <para>
67656 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
67657 not worthwhile to include them in the configuration.
67658 </para>
67659 </listitem>
67660 <listitem>
67661 <para>
67662 Users who wish to use <filename>.forward</filename> would have to make their home directory and
67663 the file itself accessible to the Exim user. Pipe and append-to-file entries,
67664 and their equivalents in Exim filters, cannot be used. While they could be
67665 enabled in the Exim user&#x2019;s name, that would be insecure and not very useful.
67666 </para>
67667 </listitem>
67668 <listitem>
67669 <para>
67670 Unless the local user mailboxes are all owned by the Exim user (possible in
67671 some POP3 or IMAP-only environments):
67672 </para>
67673 <orderedlist numeration="arabic">
67674 <listitem>
67675 <para>
67676 They must be owned by the Exim group and be writeable by that group. This
67677 implies you must set <option>mode</option> in the appendfile configuration, as well as the
67678 mode of the mailbox files themselves.
67679 </para>
67680 </listitem>
67681 <listitem>
67682 <para>
67683 You must set <option>no_check_owner</option>, since most or all of the files will not be
67684 owned by the Exim user.
67685 </para>
67686 </listitem>
67687 <listitem>
67688 <para>
67689 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
67690 on a newly created mailbox when unprivileged. This also implies that new
67691 mailboxes need to be created manually.
67692 </para>
67693 </listitem>
67694 </orderedlist>
67695 </listitem>
67696 </itemizedlist>
67697 <para>
67698 These restrictions severely restrict what can be done in local deliveries.
67699 However, there are no restrictions on remote deliveries. If you are running a
67700 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
67701 gives more security at essentially no cost.
67702 </para>
67703 <para>
67704 If you are using the <option>mua_wrapper</option> facility (see chapter
67705 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
67706 </para>
67707 </section>
67708 <section id="SECID271">
67709 <title>Delivering to local files</title>
67710 <para>
67711 Full details of the checks applied by <command>appendfile</command> before it writes to a file
67712 are given in chapter <xref linkend="CHAPappendfile"/>.
67713 </para>
67714 </section>
67715 <section id="SECTsecconslocalcmds">
67716 <title>Running local commands</title>
67717 <para>
67718 <indexterm role="concept">
67719 <primary>security</primary>
67720 <secondary>local commands</secondary>
67721 </indexterm>
67722 <indexterm role="concept">
67723 <primary>security</primary>
67724 <secondary>command injection attacks</secondary>
67725 </indexterm>
67726 There are a number of ways in which an administrator can configure Exim to run
67727 commands based upon received, untrustworthy, data. Further, in some
67728 configurations a user who can control a <filename>.forward</filename> file can also arrange to
67729 run commands. Configuration to check includes, but is not limited to:
67730 </para>
67731 <itemizedlist>
67732 <listitem>
67733 <para>
67734 Use of <option>use_shell</option> in the pipe transport: various forms of shell command
67735 injection may be possible with this option present. It is dangerous and should
67736 be used only with considerable caution. Consider constraints which whitelist
67737 allowed characters in a variable which is to be used in a pipe transport that
67738 has <option>use_shell</option> enabled.
67739 </para>
67740 </listitem>
67741 <listitem>
67742 <para>
67743 A number of options such as <option>forbid_filter_run</option>, <option>forbid_filter_perl</option>,
67744 <option>forbid_filter_dlfunc</option> and so forth which restrict facilities available to
67745 <filename>.forward</filename> files in a redirect router. If Exim is running on a central mail
67746 hub to which ordinary users do not have shell access, but home directories are
67747 NFS mounted (for instance) then administrators should review the list of these
67748 forbid options available, and should bear in mind that the options that may
67749 need forbidding can change as new features are added between releases.
67750 </para>
67751 </listitem>
67752 <listitem>
67753 <para>
67754 The <option>${run...}</option> expansion item does not use a shell by default, but
67755 administrators can configure use of <filename>/bin/sh</filename> as part of the command.
67756 Such invocations should be viewed with prejudicial suspicion.
67757 </para>
67758 </listitem>
67759 <listitem>
67760 <para>
67761 Administrators who use embedded Perl are advised to explore how Perl&#x2019;s
67762 taint checking might apply to their usage.
67763 </para>
67764 </listitem>
67765 <listitem>
67766 <para>
67767 Use of <option>${expand...}</option> is somewhat analogous to shell&#x2019;s eval builtin and
67768 administrators are well advised to view its use with suspicion, in case (for
67769 instance) it allows a local-part to contain embedded Exim directives.
67770 </para>
67771 </listitem>
67772 <listitem>
67773 <para>
67774 Use of <option>${match_local_part...}</option> and friends becomes more dangerous if
67775 Exim was built with EXPAND_LISTMATCH_RHS defined: the second string in
67776 each can reference arbitrary lists and files, rather than just being a list
67777 of opaque strings.
67778 The EXPAND_LISTMATCH_RHS option was added and set false by default because of
67779 real-world security vulnerabilities caused by its use with untrustworthy data
67780 injected in, for SQL injection attacks.
67781 Consider the use of the <option>inlisti</option> expansion condition instead.
67782 </para>
67783 </listitem>
67784 </itemizedlist>
67785 </section>
67786 <section id="SECTsecconfdata">
67787 <title>Trust in configuration data</title>
67788 <para>
67789 <indexterm role="concept">
67790 <primary>security</primary>
67791 <secondary>data sources</secondary>
67792 </indexterm>
67793 <indexterm role="concept">
67794 <primary>security</primary>
67795 <secondary>regular expressions</secondary>
67796 </indexterm>
67797 <indexterm role="concept">
67798 <primary>regular expressions</primary>
67799 <secondary>security</secondary>
67800 </indexterm>
67801 <indexterm role="concept">
67802 <primary>PCRE</primary>
67803 <secondary>security</secondary>
67804 </indexterm>
67805 If configuration data for Exim can come from untrustworthy sources, there
67806 are some issues to be aware of:
67807 </para>
67808 <itemizedlist>
67809 <listitem>
67810 <para>
67811 Use of <option>${expand...}</option> may provide a path for shell injection attacks.
67812 </para>
67813 </listitem>
67814 <listitem>
67815 <para>
67816 Letting untrusted data provide a regular expression is unwise.
67817 </para>
67818 </listitem>
67819 <listitem>
67820 <para>
67821 Using <option>${match...}</option> to apply a fixed regular expression against untrusted
67822 data may result in pathological behaviour within PCRE.  Be aware of what
67823 "backtracking" means and consider options for being more strict with a regular
67824 expression. Avenues to explore include limiting what can match (avoiding <literal>.</literal>
67825 when <literal>[a-z0-9]</literal> or other character class will do), use of atomic grouping and
67826 possessive quantifiers or just not using regular expressions against untrusted
67827 data.
67828 </para>
67829 </listitem>
67830 <listitem>
67831 <para>
67832 It can be important to correctly use <option>${quote:...}</option>,
67833 <option>${quote_local_part:...}</option> and <option>${quote_</option>&lt;<emphasis>lookup-type</emphasis>&gt;<option>:...}</option> expansion
67834 items to ensure that data is correctly constructed.
67835 </para>
67836 </listitem>
67837 <listitem>
67838 <para>
67839 Some lookups might return multiple results, even though normal usage is only
67840 expected to yield one result.
67841 </para>
67842 </listitem>
67843 </itemizedlist>
67844 </section>
67845 <section id="SECID272">
67846 <title>IPv4 source routing</title>
67847 <para>
67848 <indexterm role="concept">
67849 <primary>source routing</primary>
67850 <secondary>in IP packets</secondary>
67851 </indexterm>
67852 <indexterm role="concept">
67853 <primary>IP source routing</primary>
67854 </indexterm>
67855 Many operating systems suppress IP source-routed packets in the kernel, but
67856 some cannot be made to do this, so Exim does its own check. It logs incoming
67857 IPv4 source-routed TCP calls, and then drops them. Things are all different in
67858 IPv6. No special checking is currently done.
67859 </para>
67860 </section>
67861 <section id="SECID273">
67862 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
67863 <para>
67864 Support for these SMTP commands is disabled by default. If required, they can
67865 be enabled by defining suitable ACLs.
67866 </para>
67867 </section>
67868 <section id="SECID274">
67869 <title>Privileged users</title>
67870 <para>
67871 <indexterm role="concept">
67872 <primary>trusted users</primary>
67873 </indexterm>
67874 <indexterm role="concept">
67875 <primary>admin user</primary>
67876 </indexterm>
67877 <indexterm role="concept">
67878 <primary>privileged user</primary>
67879 </indexterm>
67880 <indexterm role="concept">
67881 <primary>user</primary>
67882 <secondary>trusted</secondary>
67883 </indexterm>
67884 <indexterm role="concept">
67885 <primary>user</primary>
67886 <secondary>admin</secondary>
67887 </indexterm>
67888 Exim recognizes two sets of users with special privileges. Trusted users are
67889 able to submit new messages to Exim locally, but supply their own sender
67890 addresses and information about a sending host. For other users submitting
67891 local messages, Exim sets up the sender address from the uid, and doesn&#x2019;t
67892 permit a remote host to be specified.
67893 </para>
67894 <para>
67895 <indexterm role="option">
67896 <primary><option>-f</option></primary>
67897 </indexterm>
67898 However, an untrusted user is permitted to use the <option>-f</option> command line option
67899 in the special form <option>-f &lt;&gt;</option> to indicate that a delivery failure for the
67900 message should not cause an error report. This affects the message&#x2019;s envelope,
67901 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
67902 permitted to use specific forms of address with the <option>-f</option> option by setting
67903 the <option>untrusted_set_sender</option> option.
67904 </para>
67905 <para>
67906 Trusted users are used to run processes that receive mail messages from some
67907 other mail domain and pass them on to Exim for delivery either locally, or over
67908 the Internet. Exim trusts a caller that is running as root, as the Exim user,
67909 as any user listed in the <option>trusted_users</option> configuration option, or under any
67910 group listed in the <option>trusted_groups</option> option.
67911 </para>
67912 <para>
67913 Admin users are permitted to do things to the messages on Exim&#x2019;s queue. They
67914 can freeze or thaw messages, cause them to be returned to their senders, remove
67915 them entirely, or modify them in various ways. In addition, admin users can run
67916 the Exim monitor and see all the information it is capable of providing, which
67917 includes the contents of files on the spool.
67918 </para>
67919 <para>
67920 <indexterm role="option">
67921 <primary><option>-M</option></primary>
67922 </indexterm>
67923 <indexterm role="option">
67924 <primary><option>-q</option></primary>
67925 </indexterm>
67926 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
67927 delivery of messages on its queue is restricted to admin users. This
67928 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
67929 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
67930 queue is also restricted to admin users. This restriction can be relaxed by
67931 setting <option>no_queue_list_requires_admin</option>.
67932 </para>
67933 <para>
67934 Exim recognizes an admin user if the calling process is running as root or as
67935 the Exim user or if any of the groups associated with the calling process is
67936 the Exim group. It is not necessary actually to be running under the Exim
67937 group. However, if admin users who are not root or the Exim user are to access
67938 the contents of files on the spool via the Exim monitor (which runs
67939 unprivileged), Exim must be built to allow group read access to its spool
67940 files.
67941 </para>
67942 </section>
67943 <section id="SECID275">
67944 <title>Spool files</title>
67945 <para>
67946 <indexterm role="concept">
67947 <primary>spool directory</primary>
67948 <secondary>files</secondary>
67949 </indexterm>
67950 Exim&#x2019;s spool directory and everything it contains is owned by the Exim user and
67951 set to the Exim group. The mode for spool files is defined in the
67952 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
67953 any user who is a member of the Exim group can access these files.
67954 </para>
67955 </section>
67956 <section id="SECID276">
67957 <title>Use of argv[0]</title>
67958 <para>
67959 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
67960 of specific strings, Exim assumes certain options. For example, calling Exim
67961 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
67962 to calling it with the option <option>-bS</option>. There are no security implications in
67963 this.
67964 </para>
67965 </section>
67966 <section id="SECID277">
67967 <title>Use of %f formatting</title>
67968 <para>
67969 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
67970 are actually stored in integer variables as 1000 times the load average.
67971 Consequently, their range is limited and so therefore is the length of the
67972 converted output.
67973 </para>
67974 </section>
67975 <section id="SECID278">
67976 <title>Embedded Exim path</title>
67977 <para>
67978 Exim uses its own path name, which is embedded in the code, only when it needs
67979 to re-exec in order to regain root privilege. Therefore, it is not root when it
67980 does so. If some bug allowed the path to get overwritten, it would lead to an
67981 arbitrary program&#x2019;s being run as exim, not as root.
67982 </para>
67983 </section>
67984 <section id="SECTdynmoddir">
67985 <title>Dynamic module directory</title>
67986 <para>
67987 Any dynamically loadable modules must be installed into the directory
67988 defined in <literal>LOOKUP_MODULE_DIR</literal> in <filename>Local/Makefile</filename> for Exim to permit
67989 loading it.
67990 </para>
67991 </section>
67992 <section id="SECID279">
67993 <title>Use of sprintf()</title>
67994 <para>
67995 <indexterm role="concept">
67996 <primary><function>sprintf()</function></primary>
67997 </indexterm>
67998 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
67999 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc&#x2019;d store.
68000 The intermediate formatting is done into a large fixed buffer by a function
68001 that runs through the format string itself, and checks the length of each
68002 conversion before performing it, thus preventing buffer overruns.
68003 </para>
68004 <para>
68005 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
68006 the output buffer is known to be sufficiently long to contain the converted
68007 string.
68008 </para>
68009 </section>
68010 <section id="SECID280">
68011 <title>Use of debug_printf() and log_write()</title>
68012 <para>
68013 Arbitrary strings are passed to both these functions, but they do their
68014 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
68015 the format string itself, and checks the length of each conversion.
68016 </para>
68017 </section>
68018 <section id="SECID281">
68019 <title>Use of strcat() and strcpy()</title>
68020 <para>
68021 These are used only in cases where the output buffer is known to be large
68022 enough to hold the result.
68023 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
68024 </para>
68025 </section>
68026 </chapter>
68027
68028 <chapter id="CHAPspool">
68029 <title>Format of spool files</title>
68030 <para>
68031 <indexterm role="concept" id="IIDforspo1" class="startofrange">
68032 <primary>format</primary>
68033 <secondary>spool files</secondary>
68034 </indexterm>
68035 <indexterm role="concept" id="IIDforspo2" class="startofrange">
68036 <primary>spool directory</primary>
68037 <secondary>format of files</secondary>
68038 </indexterm>
68039 <indexterm role="concept" id="IIDforspo3" class="startofrange">
68040 <primary>spool files</primary>
68041 <secondary>format of</secondary>
68042 </indexterm>
68043 <indexterm role="concept">
68044 <primary>spool files</primary>
68045 <secondary>editing</secondary>
68046 </indexterm>
68047 A message on Exim&#x2019;s queue consists of two files, whose names are the message id
68048 followed by -D and -H, respectively. The data portion of the message is kept in
68049 the -D file on its own. The message&#x2019;s envelope, status, and headers are all
68050 kept in the -H file, whose format is described in this chapter. Each of these
68051 two files contains the final component of its own name as its first line. This
68052 is insurance against disk crashes where the directory is lost but the files
68053 themselves are recoverable.
68054 </para>
68055 <para>
68056 Some people are tempted into editing -D files in order to modify messages. You
68057 need to be extremely careful if you do this; it is not recommended and you are
68058 on your own if you do it. Here are some of the pitfalls:
68059 </para>
68060 <itemizedlist>
68061 <listitem>
68062 <para>
68063 You must ensure that Exim does not try to deliver the message while you are
68064 fiddling with it. The safest way is to take out a write lock on the -D file,
68065 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
68066 place, the lock will be retained. If you write a new file and rename it, the
68067 lock will be lost at the instant of rename.
68068 </para>
68069 </listitem>
68070 <listitem>
68071 <para>
68072 <indexterm role="variable">
68073 <primary><varname>$body_linecount</varname></primary>
68074 </indexterm>
68075 If you change the number of lines in the file, the value of
68076 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect. At
68077 present, this value is not used by Exim, but there is no guarantee that this
68078 will always be the case.
68079 </para>
68080 </listitem>
68081 <listitem>
68082 <para>
68083 If the message is in MIME format, you must take care not to break it.
68084 </para>
68085 </listitem>
68086 <listitem>
68087 <para>
68088 If the message is cryptographically signed, any change will invalidate the
68089 signature.
68090 </para>
68091 </listitem>
68092 </itemizedlist>
68093 <para>
68094 All in all, modifying -D files is fraught with danger.
68095 </para>
68096 <para>
68097 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
68098 its subdirectories when <option>split_spool_directory</option> is set). These are journal
68099 files, used to record addresses to which the message has been delivered during
68100 the course of a delivery attempt. If there are still undelivered recipients at
68101 the end, the -H file is updated, and the -J file is deleted. If, however, there
68102 is some kind of crash (for example, a power outage) before this happens, the -J
68103 file remains in existence. When Exim next processes the message, it notices the
68104 -J file and uses it to update the -H file before starting the next delivery
68105 attempt.
68106 </para>
68107 <section id="SECID282">
68108 <title>Format of the -H file</title>
68109 <para>
68110 <indexterm role="concept">
68111 <primary>uid (user id)</primary>
68112 <secondary>in spool file</secondary>
68113 </indexterm>
68114 <indexterm role="concept">
68115 <primary>gid (group id)</primary>
68116 <secondary>in spool file</secondary>
68117 </indexterm>
68118 The second line of the -H file contains the login name for the uid of the
68119 process that called Exim to read the message, followed by the numerical uid and
68120 gid. For a locally generated message, this is normally the user who sent the
68121 message. For a message received over TCP/IP via the daemon, it is
68122 normally the Exim user.
68123 </para>
68124 <para>
68125 The third line of the file contains the address of the message&#x2019;s sender as
68126 transmitted in the envelope, contained in angle brackets. The sender address is
68127 empty for bounce messages. For incoming SMTP mail, the sender address is given
68128 in the MAIL command. For locally generated mail, the sender address is
68129 created by Exim from the login name of the current user and the configured
68130 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
68131 leading <quote>From&nbsp;</quote> line if the caller is trusted, or if the supplied address is
68132 <quote>&lt;&gt;</quote> or an address that matches <option>untrusted_set_senders</option>.
68133 </para>
68134 <para>
68135 The fourth line contains two numbers. The first is the time that the message
68136 was received, in the conventional Unix form &ndash; the number of seconds since the
68137 start of the epoch. The second number is a count of the number of messages
68138 warning of delayed delivery that have been sent to the sender.
68139 </para>
68140 <para>
68141 There follow a number of lines starting with a hyphen. These can appear in any
68142 order, and are omitted when not relevant:
68143 </para>
68144 <variablelist>
68145 <varlistentry>
68146 <term><option>-acl</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
68147 <listitem>
68148 <para>
68149 This item is obsolete, and is not generated from Exim release 4.61 onwards;
68150 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
68151 recognized, to provide backward compatibility. In the old format, a line of
68152 this form is present for every ACL variable that is not empty. The number
68153 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0&ndash;9 and
68154 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10&ndash;19. The length is the length of
68155 the data string for the variable. The string itself starts at the beginning of
68156 the next line, and is followed by a newline character. It may contain internal
68157 newlines.
68158 </para>
68159 </listitem></varlistentry>
68160 <varlistentry>
68161 <term><option>-aclc</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
68162 <listitem>
68163 <para>
68164 A line of this form is present for every ACL connection variable that is
68165 defined. Note that there is a space between <option>-aclc</option> and the rest of the name.
68166 The length is the length of the data string for the variable. The string itself
68167 starts at the beginning of the next line, and is followed by a newline
68168 character. It may contain internal newlines.
68169 </para>
68170 </listitem></varlistentry>
68171 <varlistentry>
68172 <term><option>-aclm</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
68173 <listitem>
68174 <para>
68175 A line of this form is present for every ACL message variable that is defined.
68176 Note that there is a space between <option>-aclm</option> and the rest of the name. The
68177 length is the length of the data string for the variable. The string itself
68178 starts at the beginning of the next line, and is followed by a newline
68179 character. It may contain internal newlines.
68180 </para>
68181 </listitem></varlistentry>
68182 <varlistentry>
68183 <term><option>-active_hostname</option>&nbsp;&lt;<emphasis>hostname</emphasis>&gt;</term>
68184 <listitem>
68185 <para>
68186 This is present if, when the message was received over SMTP, the value of
68187 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
68188 </para>
68189 </listitem></varlistentry>
68190 <varlistentry>
68191 <term><option>-allow_unqualified_recipient</option></term>
68192 <listitem>
68193 <para>
68194 This is present if unqualified recipient addresses are permitted in header
68195 lines (to stop such addresses from being qualified if rewriting occurs at
68196 transport time). Local messages that were input using <option>-bnq</option> and remote
68197 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
68198 </para>
68199 </listitem></varlistentry>
68200 <varlistentry>
68201 <term><option>-allow_unqualified_sender</option></term>
68202 <listitem>
68203 <para>
68204 This is present if unqualified sender addresses are permitted in header lines
68205 (to stop such addresses from being qualified if rewriting occurs at transport
68206 time). Local messages that were input using <option>-bnq</option> and remote messages from
68207 hosts that match <option>sender_unqualified_hosts</option> set this flag.
68208 </para>
68209 </listitem></varlistentry>
68210 <varlistentry>
68211 <term><option>-auth_id</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
68212 <listitem>
68213 <para>
68214 The id information for a message received on an authenticated SMTP connection
68215 &ndash; the value of the <varname>$authenticated_id</varname> variable.
68216 </para>
68217 </listitem></varlistentry>
68218 <varlistentry>
68219 <term><option>-auth_sender</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
68220 <listitem>
68221 <para>
68222 The address of an authenticated sender &ndash; the value of the
68223 <varname>$authenticated_sender</varname> variable.
68224 </para>
68225 </listitem></varlistentry>
68226 <varlistentry>
68227 <term><option>-body_linecount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
68228 <listitem>
68229 <para>
68230 This records the number of lines in the body of the message, and is always
68231 present.
68232 </para>
68233 </listitem></varlistentry>
68234 <varlistentry>
68235 <term><option>-body_zerocount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
68236 <listitem>
68237 <para>
68238 This records the number of binary zero bytes in the body of the message, and is
68239 present if the number is greater than zero.
68240 </para>
68241 </listitem></varlistentry>
68242 <varlistentry>
68243 <term><option>-deliver_firsttime</option></term>
68244 <listitem>
68245 <para>
68246 This is written when a new message is first added to the spool. When the spool
68247 file is updated after a deferral, it is omitted.
68248 </para>
68249 </listitem></varlistentry>
68250 <varlistentry>
68251 <term><option>-frozen</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
68252 <listitem>
68253 <para>
68254 <indexterm role="concept">
68255 <primary>frozen messages</primary>
68256 <secondary>spool data</secondary>
68257 </indexterm>
68258 The message is frozen, and the freezing happened at &lt;<emphasis>time</emphasis>&gt;.
68259 </para>
68260 </listitem></varlistentry>
68261 <varlistentry>
68262 <term><option>-helo_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
68263 <listitem>
68264 <para>
68265 This records the host name as specified by a remote host in a HELO or EHLO
68266 command.
68267 </para>
68268 </listitem></varlistentry>
68269 <varlistentry>
68270 <term><option>-host_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
68271 <listitem>
68272 <para>
68273 This records the IP address of the host from which the message was received and
68274 the remote port number that was used. It is omitted for locally generated
68275 messages.
68276 </para>
68277 </listitem></varlistentry>
68278 <varlistentry>
68279 <term><option>-host_auth</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
68280 <listitem>
68281 <para>
68282 If the message was received on an authenticated SMTP connection, this records
68283 the name of the authenticator &ndash; the value of the
68284 <varname>$sender_host_authenticated</varname> variable.
68285 </para>
68286 </listitem></varlistentry>
68287 <varlistentry>
68288 <term><option>-host_lookup_failed</option></term>
68289 <listitem>
68290 <para>
68291 This is present if an attempt to look up the sending host&#x2019;s name from its IP
68292 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
68293 </para>
68294 </listitem></varlistentry>
68295 <varlistentry>
68296 <term><option>-host_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
68297 <listitem>
68298 <para>
68299 <indexterm role="concept">
68300 <primary>reverse DNS lookup</primary>
68301 </indexterm>
68302 <indexterm role="concept">
68303 <primary>DNS</primary>
68304 <secondary>reverse lookup</secondary>
68305 </indexterm>
68306 This records the name of the remote host from which the message was received,
68307 if the host name was looked up from the IP address when the message was being
68308 received. It is not present if no reverse lookup was done.
68309 </para>
68310 </listitem></varlistentry>
68311 <varlistentry>
68312 <term><option>-ident</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
68313 <listitem>
68314 <para>
68315 For locally submitted messages, this records the login of the originating user,
68316 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
68317 ident value. For messages received over TCP/IP, this records the ident string
68318 supplied by the remote host, if any.
68319 </para>
68320 </listitem></varlistentry>
68321 <varlistentry>
68322 <term><option>-interface_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
68323 <listitem>
68324 <para>
68325 This records the IP address of the local interface and the port number through
68326 which a message was received from a remote host. It is omitted for locally
68327 generated messages.
68328 </para>
68329 </listitem></varlistentry>
68330 <varlistentry>
68331 <term><option>-local</option></term>
68332 <listitem>
68333 <para>
68334 The message is from a local sender.
68335 </para>
68336 </listitem></varlistentry>
68337 <varlistentry>
68338 <term><option>-localerror</option></term>
68339 <listitem>
68340 <para>
68341 The message is a locally-generated bounce message.
68342 </para>
68343 </listitem></varlistentry>
68344 <varlistentry>
68345 <term><option>-local_scan</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
68346 <listitem>
68347 <para>
68348 This records the data string that was returned by the <function>local_scan()</function> function
68349 when the message was received &ndash; the value of the <varname>$local_scan_data</varname>
68350 variable. It is omitted if no data was returned.
68351 </para>
68352 </listitem></varlistentry>
68353 <varlistentry>
68354 <term><option>-manual_thaw</option></term>
68355 <listitem>
68356 <para>
68357 The message was frozen but has been thawed manually, that is, by an explicit
68358 Exim command rather than via the auto-thaw process.
68359 </para>
68360 </listitem></varlistentry>
68361 <varlistentry>
68362 <term><option>-N</option></term>
68363 <listitem>
68364 <para>
68365 A testing delivery process was started using the <option>-N</option> option to suppress any
68366 actual deliveries, but delivery was deferred. At any further delivery attempts,
68367 <option>-N</option> is assumed.
68368 </para>
68369 </listitem></varlistentry>
68370 <varlistentry>
68371 <term><option>-received_protocol</option></term>
68372 <listitem>
68373 <para>
68374 This records the value of the <varname>$received_protocol</varname> variable, which contains
68375 the name of the protocol by which the message was received.
68376 </para>
68377 </listitem></varlistentry>
68378 <varlistentry>
68379 <term><option>-sender_set_untrusted</option></term>
68380 <listitem>
68381 <para>
68382 The envelope sender of this message was set by an untrusted local caller (used
68383 to ensure that the caller is displayed in queue listings).
68384 </para>
68385 </listitem></varlistentry>
68386 <varlistentry>
68387 <term><option>-spam_score_int</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
68388 <listitem>
68389 <para>
68390 If a message was scanned by SpamAssassin, this is present. It records the value
68391 of <varname>$spam_score_int</varname>.
68392 </para>
68393 </listitem></varlistentry>
68394 <varlistentry>
68395 <term><option>-tls_certificate_verified</option></term>
68396 <listitem>
68397 <para>
68398 A TLS certificate was received from the client that sent this message, and the
68399 certificate was verified by the server.
68400 </para>
68401 </listitem></varlistentry>
68402 <varlistentry>
68403 <term><option>-tls_cipher</option>&nbsp;&lt;<emphasis>cipher name</emphasis>&gt;</term>
68404 <listitem>
68405 <para>
68406 When the message was received over an encrypted connection, this records the
68407 name of the cipher suite that was used.
68408 </para>
68409 </listitem></varlistentry>
68410 <varlistentry>
68411 <term><option>-tls_peerdn</option>&nbsp;&lt;<emphasis>peer DN</emphasis>&gt;</term>
68412 <listitem>
68413 <para>
68414 When the message was received over an encrypted connection, and a certificate
68415 was received from the client, this records the Distinguished Name from that
68416 certificate.
68417 </para>
68418 </listitem></varlistentry>
68419 </variablelist>
68420 <para>
68421 Following the options there is a list of those addresses to which the message
68422 is not to be delivered. This set of addresses is initialized from the command
68423 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
68424 is set; otherwise it starts out empty. Whenever a successful delivery is made,
68425 the address is added to this set. The addresses are kept internally as a
68426 balanced binary tree, and it is a representation of that tree which is written
68427 to the spool file. If an address is expanded via an alias or forward file, the
68428 original address is added to the tree when deliveries to all its child
68429 addresses are complete.
68430 </para>
68431 <para>
68432 If the tree is empty, there is a single line in the spool file containing just
68433 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
68434 Y or N, followed by an address. The address is the value for the node of the
68435 tree, and the letters indicate whether the node has a left branch and/or a
68436 right branch attached to it, respectively. If branches exist, they immediately
68437 follow. Here is an example of a three-node tree:
68438 </para>
68439 <literallayout class="monospaced">
68440 YY darcy@austen.fict.example
68441 NN alice@wonderland.fict.example
68442 NN editor@thesaurus.ref.example
68443 </literallayout>
68444 <para>
68445 After the non-recipients tree, there is a list of the message&#x2019;s recipients.
68446 This is a simple list, preceded by a count. It includes all the original
68447 recipients of the message, including those to whom the message has already been
68448 delivered. In the simplest case, the list contains one address per line. For
68449 example:
68450 </para>
68451 <literallayout class="monospaced">
68452 4
68453 editor@thesaurus.ref.example
68454 darcy@austen.fict.example
68455 rdo@foundation
68456 alice@wonderland.fict.example
68457 </literallayout>
68458 <para>
68459 However, when a child address has been added to the top-level addresses as a
68460 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
68461 line is of the following form:
68462 </para>
68463 <literallayout>
68464 &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;
68465 </literallayout>
68466 <para>
68467 The 01 flag bit indicates the presence of the three other fields that follow
68468 the top-level address. Other bits may be used in future to support additional
68469 fields. The &lt;<emphasis>parent number</emphasis>&gt; is the offset in the recipients list of the
68470 original parent of the <quote>one time</quote> address. The first two fields are the
68471 envelope sender that is associated with this address and its length. If the
68472 length is zero, there is no special envelope sender (there are then two space
68473 characters in the line). A non-empty field can arise from a <command>redirect</command> router
68474 that has an <option>errors_to</option> setting.
68475 </para>
68476 <para>
68477 A blank line separates the envelope and status information from the headers
68478 which follow. A header may occupy several lines of the file, and to save effort
68479 when reading it in, each header is preceded by a number and an identifying
68480 character. The number is the number of characters in the header, including any
68481 embedded newlines and the terminating newline. The character is one of the
68482 following:
68483 </para>
68484 <informaltable frame="none">
68485 <tgroup cols="2" colsep="0" rowsep="0">
68486 <colspec colwidth="50pt" align="left"/>
68487 <colspec colwidth="254pt" align="left"/>
68488 <tbody>
68489 <row>
68490 <entry>&lt;<emphasis>blank</emphasis>&gt;</entry>
68491 <entry>header in which Exim has no special interest</entry>
68492 </row>
68493 <row>
68494 <entry><literal>B</literal></entry>
68495 <entry><emphasis>Bcc:</emphasis> header</entry>
68496 </row>
68497 <row>
68498 <entry><literal>C</literal></entry>
68499 <entry><emphasis>Cc:</emphasis> header</entry>
68500 </row>
68501 <row>
68502 <entry><literal>F</literal></entry>
68503 <entry><emphasis>From:</emphasis> header</entry>
68504 </row>
68505 <row>
68506 <entry><literal>I</literal></entry>
68507 <entry><emphasis>Message-id:</emphasis> header</entry>
68508 </row>
68509 <row>
68510 <entry><literal>P</literal></entry>
68511 <entry><emphasis>Received:</emphasis> header &ndash; P for <quote>postmark</quote></entry>
68512 </row>
68513 <row>
68514 <entry><literal>R</literal></entry>
68515 <entry><emphasis>Reply-To:</emphasis> header</entry>
68516 </row>
68517 <row>
68518 <entry><literal>S</literal></entry>
68519 <entry><emphasis>Sender:</emphasis> header</entry>
68520 </row>
68521 <row>
68522 <entry><literal>T</literal></entry>
68523 <entry><emphasis>To:</emphasis> header</entry>
68524 </row>
68525 <row>
68526 <entry><literal>*</literal></entry>
68527 <entry>replaced or deleted header</entry>
68528 </row>
68529 </tbody>
68530 </tgroup>
68531 </informaltable>
68532 <para>
68533 Deleted or replaced (rewritten) headers remain in the spool file for debugging
68534 purposes. They are not transmitted when the message is delivered. Here is a
68535 typical set of headers:
68536 </para>
68537 <literallayout class="monospaced">
68538 111P Received: by hobbit.fict.example with local (Exim 4.00)
68539 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
68540 049  Message-Id: &lt;E14y9EI-00026G-00@hobbit.fict.example&gt;
68541 038* X-rewrote-sender: bb@hobbit.fict.example
68542 042* From: Bilbo Baggins &lt;bb@hobbit.fict.example&gt;
68543 049F From: Bilbo Baggins &lt;B.Baggins@hobbit.fict.example&gt;
68544 099* To: alice@wonderland.fict.example, rdo@foundation,
68545 darcy@austen.fict.example, editor@thesaurus.ref.example
68546 104T To: alice@wonderland.fict.example, rdo@foundation.example,
68547 darcy@austen.fict.example, editor@thesaurus.ref.example
68548 038  Date: Fri, 11 May 2001 10:28:59 +0100
68549 </literallayout>
68550 <para>
68551 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
68552 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
68553 unqualified domain <emphasis>foundation</emphasis>.
68554 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
68555 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
68556 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
68557 </para>
68558 </section>
68559 </chapter>
68560
68561 <chapter id="CHAPdkim">
68562 <title>Support for DKIM (DomainKeys Identified Mail)</title>
68563 <titleabbrev>DKIM Support</titleabbrev>
68564 <para>
68565 <indexterm role="concept">
68566 <primary>DKIM</primary>
68567 </indexterm>
68568 </para>
68569 <para>
68570 DKIM is a mechanism by which messages sent by some entity can be provably
68571 linked to a domain which that entity controls.  It permits reputation to
68572 be tracked on a per-domain basis, rather than merely upon source IP address.
68573 DKIM is documented in RFC 4871.
68574 </para>
68575 <para revisionflag="changed">
68576 DKIM support is compiled into Exim by default if TLS support is present.
68577 </para>
68578 <para>
68579 It can be disabled by setting DISABLE_DKIM=yes in <filename>Local/Makefile</filename>.
68580 </para>
68581 <para>
68582 Exim&#x2019;s DKIM implementation allows to
68583 </para>
68584 <orderedlist numeration="arabic">
68585 <listitem>
68586 <para>
68587 Sign outgoing messages: This function is implemented in the SMTP transport.
68588 It can co-exist with all other Exim features
68589 (including transport filters)
68590 except cutthrough delivery.
68591 </para>
68592 </listitem>
68593 <listitem>
68594 <para>
68595 Verify signatures in incoming messages: This is implemented by an additional
68596 ACL (acl_smtp_dkim), which can be called several times per message, with
68597 different signature contexts.
68598 </para>
68599 </listitem>
68600 </orderedlist>
68601 <para>
68602 In typical Exim style, the verification implementation does not include any
68603 default "policy". Instead it enables you to build your own policy using
68604 Exim&#x2019;s standard controls.
68605 </para>
68606 <para>
68607 Please note that verification of DKIM signatures in incoming mail is turned
68608 on by default for logging purposes. For each signature in incoming email,
68609 exim will log a line displaying the most important signature details, and the
68610 signature status. Here is an example (with line-breaks added for clarity):
68611 </para>
68612 <literallayout class="monospaced">
68613 2009-09-09 10:22:28 1MlIRf-0003LU-U3 DKIM:
68614     d=facebookmail.com s=q1-2009b
68615     c=relaxed/relaxed a=rsa-sha1
68616     i=@facebookmail.com t=1252484542 [verification succeeded]
68617 </literallayout>
68618 <para>
68619 You might want to turn off DKIM verification processing entirely for internal
68620 or relay mail sources. To do that, set the <option>dkim_disable_verify</option> ACL
68621 control modifier. This should typically be done in the RCPT ACL, at points
68622 where you accept mail from relay sources (internal hosts or authenticated
68623 senders).
68624 </para>
68625 <section id="SECDKIMSIGN">
68626 <title>Signing outgoing messages</title>
68627 <para>
68628 <indexterm role="concept">
68629 <primary>DKIM</primary>
68630 <secondary>signing</secondary>
68631 </indexterm>
68632 </para>
68633 <para>
68634 Signing is implemented by setting private options on the SMTP transport.
68635 These options take (expandable) strings as arguments.
68636 </para>
68637 <para>
68638 <indexterm role="option">
68639 <primary><option>dkim_domain</option></primary>
68640 </indexterm>
68641 </para>
68642 <informaltable frame="all">
68643 <tgroup cols="4" colsep="0" rowsep="0">
68644 <colspec colwidth="8*" align="left"/>
68645 <colspec colwidth="6*" align="center"/>
68646 <colspec colwidth="6*" align="center"/>
68647 <colspec colwidth="6*" align="right"/>
68648 <tbody>
68649 <row>
68650 <entry><option>dkim_domain</option></entry>
68651 <entry>Use: <emphasis>smtp</emphasis></entry>
68652 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
68653 <entry>Default: <emphasis>unset</emphasis></entry>
68654 </row>
68655 </tbody>
68656 </tgroup>
68657 </informaltable>
68658 <para>
68659 MANDATORY:
68660 The domain you want to sign with. The result of this expanded
68661 option is put into the <option>$dkim_domain</option> expansion variable.
68662 </para>
68663 <para>
68664 <indexterm role="option">
68665 <primary><option>dkim_selector</option></primary>
68666 </indexterm>
68667 </para>
68668 <informaltable frame="all">
68669 <tgroup cols="4" colsep="0" rowsep="0">
68670 <colspec colwidth="8*" align="left"/>
68671 <colspec colwidth="6*" align="center"/>
68672 <colspec colwidth="6*" align="center"/>
68673 <colspec colwidth="6*" align="right"/>
68674 <tbody>
68675 <row>
68676 <entry><option>dkim_selector</option></entry>
68677 <entry>Use: <emphasis>smtp</emphasis></entry>
68678 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
68679 <entry>Default: <emphasis>unset</emphasis></entry>
68680 </row>
68681 </tbody>
68682 </tgroup>
68683 </informaltable>
68684 <para>
68685 MANDATORY:
68686 This sets the key selector string. You can use the <option>$dkim_domain</option> expansion
68687 variable to look up a matching selector. The result is put in the expansion
68688 variable <option>$dkim_selector</option> which may be used in the <option>dkim_private_key</option>
68689 option along with <option>$dkim_domain</option>.
68690 </para>
68691 <para>
68692 <indexterm role="option">
68693 <primary><option>dkim_private_key</option></primary>
68694 </indexterm>
68695 </para>
68696 <informaltable frame="all">
68697 <tgroup cols="4" colsep="0" rowsep="0">
68698 <colspec colwidth="8*" align="left"/>
68699 <colspec colwidth="6*" align="center"/>
68700 <colspec colwidth="6*" align="center"/>
68701 <colspec colwidth="6*" align="right"/>
68702 <tbody>
68703 <row>
68704 <entry><option>dkim_private_key</option></entry>
68705 <entry>Use: <emphasis>smtp</emphasis></entry>
68706 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
68707 <entry>Default: <emphasis>unset</emphasis></entry>
68708 </row>
68709 </tbody>
68710 </tgroup>
68711 </informaltable>
68712 <para>
68713 MANDATORY:
68714 This sets the private key to use. You can use the <option>$dkim_domain</option> and
68715 <option>$dkim_selector</option> expansion variables to determine the private key to use.
68716 The result can either
68717 </para>
68718 <itemizedlist>
68719 <listitem>
68720 <para>
68721 be a valid RSA private key in ASCII armor, including line breaks.
68722 </para>
68723 </listitem>
68724 <listitem>
68725 <para>
68726 start with a slash, in which case it is treated as a file that contains
68727 the private key.
68728 </para>
68729 </listitem>
68730 <listitem>
68731 <para>
68732 be "0", "false" or the empty string, in which case the message will not
68733 be signed. This case will not result in an error, even if <option>dkim_strict</option>
68734 is set.
68735 </para>
68736 </listitem>
68737 </itemizedlist>
68738 <para>
68739 <indexterm role="option">
68740 <primary><option>dkim_canon</option></primary>
68741 </indexterm>
68742 </para>
68743 <informaltable frame="all">
68744 <tgroup cols="4" colsep="0" rowsep="0">
68745 <colspec colwidth="8*" align="left"/>
68746 <colspec colwidth="6*" align="center"/>
68747 <colspec colwidth="6*" align="center"/>
68748 <colspec colwidth="6*" align="right"/>
68749 <tbody>
68750 <row>
68751 <entry><option>dkim_canon</option></entry>
68752 <entry>Use: <emphasis>smtp</emphasis></entry>
68753 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
68754 <entry>Default: <emphasis>unset</emphasis></entry>
68755 </row>
68756 </tbody>
68757 </tgroup>
68758 </informaltable>
68759 <para>
68760 OPTIONAL:
68761 This option sets the canonicalization method used when signing a message.
68762 The DKIM RFC currently supports two methods: "simple" and "relaxed".
68763 The option defaults to "relaxed" when unset. Note: the current implementation
68764 only supports using the same canonicalization method for both headers and body.
68765 </para>
68766 <para>
68767 <indexterm role="option">
68768 <primary><option>dkim_strict</option></primary>
68769 </indexterm>
68770 </para>
68771 <informaltable frame="all">
68772 <tgroup cols="4" colsep="0" rowsep="0">
68773 <colspec colwidth="8*" align="left"/>
68774 <colspec colwidth="6*" align="center"/>
68775 <colspec colwidth="6*" align="center"/>
68776 <colspec colwidth="6*" align="right"/>
68777 <tbody>
68778 <row>
68779 <entry><option>dkim_strict</option></entry>
68780 <entry>Use: <emphasis>smtp</emphasis></entry>
68781 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
68782 <entry>Default: <emphasis>unset</emphasis></entry>
68783 </row>
68784 </tbody>
68785 </tgroup>
68786 </informaltable>
68787 <para>
68788 OPTIONAL:
68789 This  option  defines  how  Exim  behaves  when  signing a message that
68790 should be signed fails for some reason.  When the expansion evaluates to
68791 either "1" or "true", Exim will defer. Otherwise Exim will send the message
68792 unsigned. You can use the <option>$dkim_domain</option> and <option>$dkim_selector</option> expansion
68793 variables here.
68794 </para>
68795 <para>
68796 <indexterm role="option">
68797 <primary><option>dkim_sign_headers</option></primary>
68798 </indexterm>
68799 </para>
68800 <informaltable frame="all">
68801 <tgroup cols="4" colsep="0" rowsep="0">
68802 <colspec colwidth="8*" align="left"/>
68803 <colspec colwidth="6*" align="center"/>
68804 <colspec colwidth="6*" align="center"/>
68805 <colspec colwidth="6*" align="right"/>
68806 <tbody>
68807 <row>
68808 <entry><option>dkim_sign_headers</option></entry>
68809 <entry>Use: <emphasis>smtp</emphasis></entry>
68810 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
68811 <entry>Default: <emphasis>unset</emphasis></entry>
68812 </row>
68813 </tbody>
68814 </tgroup>
68815 </informaltable>
68816 <para>
68817 OPTIONAL:
68818 When set, this option must expand to (or be specified as) a colon-separated
68819 list of header names. Headers with these names will be included in the message
68820 signature. When unspecified, the header names recommended in RFC4871 will be
68821 used.
68822 </para>
68823 </section>
68824 <section id="SECID514">
68825 <title>Verifying DKIM signatures in incoming mail</title>
68826 <para>
68827 <indexterm role="concept">
68828 <primary>DKIM</primary>
68829 <secondary>verification</secondary>
68830 </indexterm>
68831 </para>
68832 <para>
68833 Verification of DKIM signatures in incoming email is implemented via the
68834 <option>acl_smtp_dkim</option> ACL. By default, this ACL is called once for each
68835 syntactically(!) correct signature in the incoming message.
68836 A missing ACL definition defaults to accept.
68837 If any ACL call does not accept, the message is not accepted.
68838 If a cutthrough delivery was in progress for the message it is
68839 summarily dropped (having wasted the transmission effort).
68840 </para>
68841 <para>
68842 To evaluate the signature in the ACL a large number of expansion variables
68843 containing the signature status and its details are set up during the
68844 runtime of the ACL.
68845 </para>
68846 <para>
68847 Calling the ACL only for existing signatures is not sufficient to build
68848 more advanced policies. For that reason, the global option
68849 <option>dkim_verify_signers</option>, and a global expansion variable
68850 <option>$dkim_signers</option> exist.
68851 </para>
68852 <para>
68853 The global option <option>dkim_verify_signers</option> can be set to a colon-separated
68854 list of DKIM domains or identities for which the ACL <option>acl_smtp_dkim</option> is
68855 called. It is expanded when the message has been received. At this point,
68856 the expansion variable <option>$dkim_signers</option> already contains a colon-separated
68857 list of signer domains and identities for the message. When
68858 <option>dkim_verify_signers</option> is not specified in the main configuration,
68859 it defaults as:
68860 </para>
68861 <literallayout class="monospaced">
68862 dkim_verify_signers = $dkim_signers
68863 </literallayout>
68864 <para>
68865 This leads to the default behaviour of calling <option>acl_smtp_dkim</option> for each
68866 DKIM signature in the message. Current DKIM verifiers may want to explicitly
68867 call the ACL for known domains or identities. This would be achieved as follows:
68868 </para>
68869 <literallayout class="monospaced">
68870 dkim_verify_signers = paypal.com:ebay.com:$dkim_signers
68871 </literallayout>
68872 <para>
68873 This would result in <option>acl_smtp_dkim</option> always being called for "paypal.com"
68874 and "ebay.com", plus all domains and identities that have signatures in the message.
68875 You can also be more creative in constructing your policy. For example:
68876 </para>
68877 <literallayout class="monospaced">
68878 dkim_verify_signers = $sender_address_domain:$dkim_signers
68879 </literallayout>
68880 <para>
68881 If a domain or identity is listed several times in the (expanded) value of
68882 <option>dkim_verify_signers</option>, the ACL is only called once for that domain or identity.
68883 </para>
68884 <para>
68885 Inside the <option>acl_smtp_dkim</option>, the following expansion variables are
68886 available (from most to least important):
68887 </para>
68888 <variablelist>
68889 <varlistentry>
68890 <term><option>$dkim_cur_signer</option></term>
68891 <listitem>
68892 <para>
68893 The signer that is being evaluated in this ACL run. This can be a domain or
68894 an identity. This is one of the list items from the expanded main option
68895 <option>dkim_verify_signers</option> (see above).
68896 </para>
68897 </listitem></varlistentry>
68898 <varlistentry>
68899 <term><option>$dkim_verify_status</option></term>
68900 <listitem>
68901 <para>
68902 A string describing the general status of the signature. One of
68903 </para>
68904 <itemizedlist>
68905 <listitem>
68906 <para>
68907 <option>none</option>: There is no signature in the message for the current domain or
68908 identity (as reflected by <option>$dkim_cur_signer</option>).
68909 </para>
68910 </listitem>
68911 <listitem>
68912 <para>
68913 <option>invalid</option>: The signature could not be verified due to a processing error.
68914 More detail is available in <option>$dkim_verify_reason</option>.
68915 </para>
68916 </listitem>
68917 <listitem>
68918 <para>
68919 <option>fail</option>: Verification of the signature failed.  More detail is
68920 available in <option>$dkim_verify_reason</option>.
68921 </para>
68922 </listitem>
68923 <listitem>
68924 <para>
68925 <option>pass</option>: The signature passed verification. It is valid.
68926 </para>
68927 </listitem>
68928 </itemizedlist>
68929 </listitem></varlistentry>
68930 <varlistentry>
68931 <term><option>$dkim_verify_reason</option></term>
68932 <listitem>
68933 <para>
68934 A string giving a little bit more detail when <option>$dkim_verify_status</option> is either
68935 "fail" or "invalid". One of
68936 </para>
68937 <itemizedlist>
68938 <listitem>
68939 <para>
68940 <option>pubkey_unavailable</option> (when <option>$dkim_verify_status</option>="invalid"): The public
68941 key for the domain could not be retrieved. This may be a temporary problem.
68942 </para>
68943 </listitem>
68944 <listitem>
68945 <para>
68946 <option>pubkey_syntax</option> (when <option>$dkim_verify_status</option>="invalid"): The public key
68947 record for the domain is syntactically invalid.
68948 </para>
68949 </listitem>
68950 <listitem>
68951 <para>
68952 <option>bodyhash_mismatch</option> (when <option>$dkim_verify_status</option>="fail"): The calculated
68953 body hash does not match the one specified in the signature header. This
68954 means that the message body was modified in transit.
68955 </para>
68956 </listitem>
68957 <listitem>
68958 <para>
68959 <option>signature_incorrect</option> (when <option>$dkim_verify_status</option>="fail"): The signature
68960 could not be verified. This may mean that headers were modified,
68961 re-written or otherwise changed in a way which is incompatible with
68962 DKIM verification. It may of course also mean that the signature is forged.
68963 </para>
68964 </listitem>
68965 </itemizedlist>
68966 </listitem></varlistentry>
68967 <varlistentry>
68968 <term><option>$dkim_domain</option></term>
68969 <listitem>
68970 <para>
68971 The signing domain. IMPORTANT: This variable is only populated if there is
68972 an actual signature in the message for the current domain or identity (as
68973 reflected by <option>$dkim_cur_signer</option>).
68974 </para>
68975 </listitem></varlistentry>
68976 <varlistentry>
68977 <term><option>$dkim_identity</option></term>
68978 <listitem>
68979 <para>
68980 The signing identity, if present. IMPORTANT: This variable is only populated
68981 if there is an actual signature in the message for the current domain or
68982 identity (as reflected by <option>$dkim_cur_signer</option>).
68983 </para>
68984 </listitem></varlistentry>
68985 <varlistentry>
68986 <term><option>$dkim_selector</option></term>
68987 <listitem>
68988 <para>
68989 The key record selector string.
68990 </para>
68991 </listitem></varlistentry>
68992 <varlistentry>
68993 <term><option>$dkim_algo</option></term>
68994 <listitem>
68995 <para>
68996 The algorithm used. One of &#x2019;rsa-sha1&#x2019; or &#x2019;rsa-sha256&#x2019;.
68997 </para>
68998 </listitem></varlistentry>
68999 <varlistentry>
69000 <term><option>$dkim_canon_body</option></term>
69001 <listitem>
69002 <para>
69003 The body canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
69004 </para>
69005 </listitem></varlistentry>
69006 <varlistentry>
69007 <term><option>dkim_canon_headers</option></term>
69008 <listitem>
69009 <para>
69010 The header canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
69011 </para>
69012 </listitem></varlistentry>
69013 <varlistentry>
69014 <term><option>$dkim_copiedheaders</option></term>
69015 <listitem>
69016 <para>
69017 A transcript of headers and their values which are included in the signature
69018 (copied from the &#x2019;z=&#x2019; tag of the signature).
69019 </para>
69020 </listitem></varlistentry>
69021 <varlistentry>
69022 <term><option>$dkim_bodylength</option></term>
69023 <listitem>
69024 <para>
69025 The number of signed body bytes. If zero ("0"), the body is unsigned. If no
69026 limit was set by the signer, "9999999999999" is returned. This makes sure
69027 that this variable always expands to an integer value.
69028 </para>
69029 </listitem></varlistentry>
69030 <varlistentry>
69031 <term><option>$dkim_created</option></term>
69032 <listitem>
69033 <para>
69034 UNIX timestamp reflecting the date and time when the signature was created.
69035 When this was not specified by the signer, "0" is returned.
69036 </para>
69037 </listitem></varlistentry>
69038 <varlistentry>
69039 <term><option>$dkim_expires</option></term>
69040 <listitem>
69041 <para>
69042 UNIX timestamp reflecting the date and time when the signer wants the
69043 signature to be treated as "expired". When this was not specified by the
69044 signer, "9999999999999" is returned. This makes it possible to do useful
69045 integer size comparisons against this value.
69046 </para>
69047 </listitem></varlistentry>
69048 <varlistentry>
69049 <term><option>$dkim_headernames</option></term>
69050 <listitem>
69051 <para>
69052 A colon-separated list of names of headers included in the signature.
69053 </para>
69054 </listitem></varlistentry>
69055 <varlistentry>
69056 <term><option>$dkim_key_testing</option></term>
69057 <listitem>
69058 <para>
69059 "1" if the key record has the "testing" flag set, "0" if not.
69060 </para>
69061 </listitem></varlistentry>
69062 <varlistentry>
69063 <term><option>$dkim_key_nosubdomains</option></term>
69064 <listitem>
69065 <para>
69066 "1" if the key record forbids subdomaining, "0" otherwise.
69067 </para>
69068 </listitem></varlistentry>
69069 <varlistentry>
69070 <term><option>$dkim_key_srvtype</option></term>
69071 <listitem>
69072 <para>
69073 Service type (tag s=) from the key record. Defaults to "*" if not specified
69074 in the key record.
69075 </para>
69076 </listitem></varlistentry>
69077 <varlistentry>
69078 <term><option>$dkim_key_granularity</option></term>
69079 <listitem>
69080 <para>
69081 Key granularity (tag g=) from the key record. Defaults to "*" if not specified
69082 in the key record.
69083 </para>
69084 </listitem></varlistentry>
69085 <varlistentry>
69086 <term><option>$dkim_key_notes</option></term>
69087 <listitem>
69088 <para>
69089 Notes from the key record (tag n=).
69090 </para>
69091 </listitem></varlistentry>
69092 <varlistentry>
69093 <term><option>$dkim_key_length</option></term>
69094 <listitem>
69095 <para>
69096 Number of bits in the key.
69097 </para>
69098 </listitem></varlistentry>
69099 </variablelist>
69100 <para>
69101 In addition, two ACL conditions are provided:
69102 </para>
69103 <variablelist>
69104 <varlistentry>
69105 <term><option>dkim_signers</option></term>
69106 <listitem>
69107 <para>
69108 ACL condition that checks a colon-separated list of domains or identities
69109 for a match against the domain or identity that the ACL is currently verifying
69110 (reflected by <option>$dkim_cur_signer</option>). This is typically used to restrict an ACL
69111 verb to a group of domains or identities. For example:
69112 </para>
69113 <literallayout class="monospaced">
69114 # Warn when Mail purportedly from GMail has no signature at all
69115 warn log_message = GMail sender without DKIM signature
69116      sender_domains = gmail.com
69117      dkim_signers = gmail.com
69118      dkim_status = none
69119 </literallayout>
69120 </listitem></varlistentry>
69121 <varlistentry>
69122 <term><option>dkim_status</option></term>
69123 <listitem>
69124 <para>
69125 ACL condition that checks a colon-separated list of possible DKIM verification
69126 results against the actual result of verification. This is typically used
69127 to restrict an ACL verb to a list of verification outcomes, for example:
69128 </para>
69129 <literallayout class="monospaced">
69130 deny message = Mail from Paypal with invalid/missing signature
69131      sender_domains = paypal.com:paypal.de
69132      dkim_signers = paypal.com:paypal.de
69133      dkim_status = none:invalid:fail
69134 </literallayout>
69135 <para>
69136 The possible status keywords are: &#x2019;none&#x2019;,&#x2019;invalid&#x2019;,&#x2019;fail&#x2019; and &#x2019;pass&#x2019;. Please
69137 see the documentation of the <option>$dkim_verify_status</option> expansion variable above
69138 for more information of what they mean.
69139 </para>
69140 </listitem></varlistentry>
69141 </variablelist>
69142 </section>
69143 </chapter>
69144
69145 <chapter id="CHAPproxies">
69146 <title>Proxies</title>
69147 <titleabbrev>Proxy support</titleabbrev>
69148 <para>
69149 <indexterm role="concept">
69150 <primary>proxy support</primary>
69151 </indexterm>
69152 <indexterm role="concept">
69153 <primary>proxy</primary>
69154 <secondary>access via</secondary>
69155 </indexterm>
69156 </para>
69157 <para revisionflag="changed">
69158 A proxy is an intermediate system through which communication is passed.
69159 Proxies may provide a security, availability or load-distribution function.
69160 </para>
69161 <section id="SECTproxyInbound" revisionflag="changed">
69162 <title>Inbound proxies</title>
69163 <para revisionflag="changed">
69164 <indexterm role="concept">
69165 <primary>proxy</primary>
69166 <secondary>inbound</secondary>
69167 </indexterm>
69168 <indexterm role="concept">
69169 <primary>proxy</primary>
69170 <secondary>server side</secondary>
69171 </indexterm>
69172 <indexterm role="concept">
69173 <primary>proxy</primary>
69174 <secondary>Proxy protocol</secondary>
69175 </indexterm>
69176 <indexterm role="concept">
69177 <primary>Proxy protocol</primary>
69178 <secondary>proxy</secondary>
69179 </indexterm>
69180 </para>
69181 <para revisionflag="changed">
69182 Exim has support for receiving inbound SMTP connections via a proxy
69183 that uses <quote>Proxy Protocol</quote> to speak to it.
69184 To include this support, include <quote>SUPPORT_PROXY=yes</quote>
69185 in Local/Makefile.
69186 </para>
69187 <para revisionflag="changed">
69188 It was built on specifications from:
69189 http://haproxy.1wt.eu/download/1.5/doc/proxy-protocol.txt
69190 That URL was revised in May 2014 to version 2 spec:
69191 http://git.1wt.eu/web?p=haproxy.git;a=commitdiff;h=afb768340c9d7e50d8e
69192 </para>
69193 <para revisionflag="changed">
69194 The purpose of this facility is so that an application load balancer,
69195 such as HAProxy, can sit in front of several Exim servers
69196 to distribute load.
69197 Exim uses the local protocol communication with the proxy to obtain
69198 the remote SMTP system IP address and port information.
69199 There is no logging if a host passes or
69200 fails Proxy Protocol negotiation, but it can easily be determined and
69201 recorded in an ACL (example is below).
69202 </para>
69203 <para revisionflag="changed">
69204 Use of a proxy is enabled by setting the <option>hosts_proxy</option>
69205 main configuration option to a hostlist; connections from these
69206 hosts will use Proxy Protocol.
69207 </para>
69208 <para revisionflag="changed">
69209 The following expansion variables are usable
69210 (<quote>internal</quote> and <quote>external</quote> here refer to the interfaces
69211 of the proxy):
69212 </para>
69213 <literallayout revisionflag="changed">
69214 <emphasis>proxy_host_address   </emphasis> internal IP address of the proxy
69215 <emphasis>proxy_host_port      </emphasis> internal TCP port of the proxy
69216 <emphasis>proxy_target_address </emphasis> external IP address of the proxy
69217 <emphasis>proxy_target_port    </emphasis> external TCP port of the proxy
69218 <emphasis>proxy_session        </emphasis> boolean: SMTP connection via proxy
69219 </literallayout>
69220 <para revisionflag="changed">
69221 If <varname>$proxy_session</varname> is set but <varname>$proxy_host_address</varname> is empty
69222 there was a protocol error.
69223 </para>
69224 <para revisionflag="changed">
69225 Since the real connections are all coming from the proxy, and the
69226 per host connection tracking is done before Proxy Protocol is
69227 evaluated, <option>smtp_accept_max_per_host</option> must be set high enough to
69228 handle all of the parallel volume you expect per inbound proxy.
69229 With the option set so high, you lose the ability
69230 to protect your server from many connections from one IP.
69231 In order to prevent your server from overload, you
69232 need to add a per connection ratelimit to your connect ACL.
69233 A possible solution is:
69234 </para>
69235 <literallayout revisionflag="changed">
69236   # Set max number of connections per host
69237   LIMIT   = 5
69238   # Or do some kind of IP lookup in a flat file or database
69239   # LIMIT = ${lookup{$sender_host_address}iplsearch{/etc/exim/proxy_limits}}
69240
69241   defer   message        = Too many connections from this IP right now
69242           ratelimit      = LIMIT / 5s / per_conn / strict
69243 </literallayout>
69244 </section>
69245 <section id="SECTproxySOCKS" revisionflag="changed">
69246 <title>Outbound proxies</title>
69247 <para revisionflag="changed">
69248 <indexterm role="concept">
69249 <primary>proxy</primary>
69250 <secondary>outbound</secondary>
69251 </indexterm>
69252 <indexterm role="concept">
69253 <primary>proxy</primary>
69254 <secondary>client side</secondary>
69255 </indexterm>
69256 <indexterm role="concept">
69257 <primary>proxy</primary>
69258 <secondary>SOCKS</secondary>
69259 </indexterm>
69260 <indexterm role="concept">
69261 <primary>SOCKS</primary>
69262 <secondary>proxy</secondary>
69263 </indexterm>
69264 Exim has support for sending outbound SMTP via a proxy
69265 using a protocol called SOCKS5 (defined by RFC1928).
69266 The support can be optionally included by defining SUPPORT_SOCKS=yes in
69267 Local/Makefile.
69268 </para>
69269 <para revisionflag="changed">
69270 Use of a proxy is enabled by setting the <option>socks_proxy</option> option
69271 on an smtp transport.
69272 The option value is expanded and should then be a list
69273 (colon-separated by default) of proxy specifiers.
69274 Each proxy specifier is a list
69275 (space-separated by default) where the initial element
69276 is an IP address and any subsequent elements are options.
69277 </para>
69278 <para revisionflag="changed">
69279 Options are a string &lt;name&gt;=&lt;value&gt;.
69280 The list of options is in the following table:
69281 </para>
69282 <literallayout revisionflag="changed">
69283 <emphasis>auth   </emphasis> authentication method
69284 <emphasis>name   </emphasis> authentication username
69285 <emphasis>pass   </emphasis> authentication password
69286 <emphasis>port   </emphasis> tcp port
69287 <emphasis>tmo    </emphasis> connection timeout
69288 <emphasis>pri    </emphasis> priority
69289 <emphasis>weight </emphasis> selection bias
69290 </literallayout>
69291 <para revisionflag="changed">
69292 More details on each of these options follows:
69293 </para>
69294 <itemizedlist revisionflag="changed">
69295 <listitem>
69296 <para revisionflag="changed">
69297 <indexterm role="concept">
69298 <primary>authentication</primary>
69299 <secondary>to proxy</secondary>
69300 </indexterm>
69301 <indexterm role="concept">
69302 <primary>proxy</primary>
69303 <secondary>authentication</secondary>
69304 </indexterm>
69305 <option>auth</option>: Either <quote>none</quote> (default) or <quote>name</quote>.
69306 Using <quote>name</quote> selects username/password authentication per RFC 1929
69307 for access to the proxy.
69308 Default is <quote>none</quote>.
69309 </para>
69310 </listitem>
69311 <listitem>
69312 <para revisionflag="changed">
69313 <option>name</option>: sets the username for the <quote>name</quote> authentication method.
69314 Default is empty.
69315 </para>
69316 </listitem>
69317 <listitem>
69318 <para revisionflag="changed">
69319 <option>pass</option>: sets the password for the <quote>name</quote> authentication method.
69320 Default is empty.
69321 </para>
69322 </listitem>
69323 <listitem>
69324 <para revisionflag="changed">
69325 <option>port</option>: the TCP port number to use for the connection to the proxy.
69326 Default is 1080.
69327 </para>
69328 </listitem>
69329 <listitem>
69330 <para revisionflag="changed">
69331 <option>tmo</option>: sets a connection timeout in seconds for this proxy.
69332 Default is 5.
69333 </para>
69334 </listitem>
69335 <listitem>
69336 <para revisionflag="changed">
69337 <option>pri</option>: specifies a priority for the proxy within the list,
69338 higher values being tried first.
69339 The default priority is 1.
69340 </para>
69341 </listitem>
69342 <listitem>
69343 <para revisionflag="changed">
69344 <option>weight</option>: specifies a selection bias.
69345 Within a priority set servers are queried in a random fashion,
69346 weighted by this value.
69347 The default value for selection bias is 1.
69348 </para>
69349 </listitem>
69350 </itemizedlist>
69351 <para revisionflag="changed">
69352 Proxies from the list are tried according to their priority
69353 and weight settings until one responds.  The timeout for the
69354 overall connection applies to the set of proxied attempts.
69355 </para>
69356 </section>
69357 <section id="SECTproxyLog" revisionflag="changed">
69358 <title>Logging</title>
69359 <para revisionflag="changed">
69360 To log the (local) IP of a proxy in the incoming or delivery logline,
69361 add <quote>+proxy</quote> to the <option>log_selector</option> option.
69362 This will add a component tagged with <quote>PRX=</quote> to the line.
69363 </para>
69364 </section>
69365 </chapter>
69366
69367 <chapter id="CHAPi18n">
69368 <title>Internationalisation</title>
69369 <titleabbrev>Internationalisation"</titleabbrev>
69370 <para>
69371 <indexterm role="concept">
69372 <primary>internationalisation</primary>
69373 <secondary>email address</secondary>
69374 </indexterm>
69375 <indexterm role="concept">
69376 <primary>EAI</primary>
69377 </indexterm>
69378 <indexterm role="concept">
69379 <primary>i18n</primary>
69380 </indexterm>
69381 <indexterm role="concept">
69382 <primary>UTF-8</primary>
69383 <secondary>mail name handling</secondary>
69384 </indexterm>
69385 </para>
69386 <para revisionflag="changed">
69387 Exim has support for Internationalised mail names.
69388 To include this it must be built with SUPPORT_I18N and the libidn library.
69389 Standards supported are RFCs 2060, 5890, 6530 and 6533.
69390 </para>
69391 <section id="SECTi18nMTA" revisionflag="changed">
69392 <title>MTA operations</title>
69393 <para revisionflag="changed">
69394 <indexterm role="concept">
69395 <primary>SMTPUTF8</primary>
69396 <secondary>ESMTP option</secondary>
69397 </indexterm>
69398 The main configuration option <option>smtputf8_advertise_hosts</option> specifies
69399 a host list.  If this matches the sending host and
69400 accept_8bitmime is true (the default) then the ESMTP option
69401 SMTPUTF8 will be advertised.
69402 </para>
69403 <para revisionflag="changed">
69404 If the sender specifies the SMTPUTF8 option on a MAIL command
69405 international handling for the message is enabled and
69406 the expansion variable <varname>$message_smtputf8</varname> will have value TRUE.
69407 </para>
69408 <para revisionflag="changed">
69409 The option <option>allow_utf8_domains</option> is set to true for this
69410 message. All DNS lookups are converted to a-label form
69411 whatever the setting of <option>allow_utf8_domains</option>
69412 when Exim is built with SUPPORT_I18N.
69413 </para>
69414 <para revisionflag="changed">
69415 Both localparts and domain are maintained as the original
69416 UTF-8 form internally; any comparison or regular-expression use will
69417 require appropriate care.  Filenames created, eg. by
69418 the appendfile transport, will have UTF-8 names.
69419 </para>
69420 <para revisionflag="changed">
69421 HELO names sent by the smtp transport will have any UTF-8
69422 components expanded to a-label form,
69423 and any certificate name checks will be done using the a-label
69424 form of the name.
69425 </para>
69426 <para revisionflag="changed">
69427 <indexterm role="concept">
69428 <primary>log</primary>
69429 <secondary>protocol</secondary>
69430 </indexterm>
69431 <indexterm role="concept">
69432 <primary>SMTPUTF8</primary>
69433 <secondary>logging</secondary>
69434 </indexterm>
69435 Log lines and Received-by: header lines will acquire a "utf8"
69436 prefix on the protocol element, eg. utf8esmtp.
69437 </para>
69438 <para revisionflag="changed">
69439 The following expansion operator can be used:
69440 </para>
69441 <literallayout class="monospaced" revisionflag="changed">
69442 ${utf8_domain_to_alabel:str}
69443 ${utf8_domain_from_alabel:str}
69444 ${utf8_localpart_to_alabel:str}
69445 ${utf8_localpart_from_alabel:str}
69446 </literallayout>
69447 <para revisionflag="changed">
69448 ACLs may use the following modifier:
69449 </para>
69450 <literallayout revisionflag="changed">
69451 control = utf8_downconvert
69452 control = utf8_downconvert/&lt;value&gt;
69453 </literallayout>
69454 <para revisionflag="changed">
69455 This sets a flag requiring that addresses are converted to
69456 a-label form before smtp delivery, for use in a
69457 Message Submission Agent context.
69458 If a value is appended it may be:
69459 </para>
69460 <literallayout revisionflag="changed">
69461 <literal>1  </literal> (default) mandatory downconversion
69462 <literal>0  </literal> no downconversion
69463 <literal>-1 </literal> if SMTPUTF8 not supported by destination host
69464 </literallayout>
69465 <para revisionflag="changed">
69466 If mua_wrapper is set, the utf8_downconvert control
69467 is initially set to -1.
69468 </para>
69469 <para revisionflag="changed">
69470 There is no explicit support for VRFY and EXPN.
69471 Configurations supporting these should inspect
69472 <varname>$smtp_command_argument</varname> for an SMTPUTF8 argument.
69473 </para>
69474 <para revisionflag="changed">
69475 There is no support for LMTP on Unix sockets.
69476 Using the "lmtp" protocol option on an smtp transport,
69477 for LMTP over TCP, should work as expected.
69478 </para>
69479 <para revisionflag="changed">
69480 There is no support for DSN unitext handling,
69481 and no provision for converting logging from or to UTF-8.
69482 </para>
69483 </section>
69484 <section id="SECTi18nMDA" revisionflag="changed">
69485 <title>MDA operations</title>
69486 <para revisionflag="changed">
69487 To aid in constructing names suitable for IMAP folders
69488 the following expansion operator can be used:
69489 </para>
69490 <literallayout class="monospaced" revisionflag="changed">
69491 ${imapfolder {&lt;string&gt;} {&lt;sep&gt;} {&lt;specials&gt;}}
69492 </literallayout>
69493 <para revisionflag="changed">
69494 The string is converted from the charset specified by
69495 the "headers charset" command (in a filter file)
69496 or <option>headers_charset</option> main configuration option (otherwise),
69497 to the
69498 modified UTF-7 encoding specified by RFC 2060,
69499 with the following exception: All occurences of &lt;sep&gt;
69500 (which has to be a single character)
69501 are replaced with periods ("."), and all periods and slashes that are not
69502 &lt;sep&gt; and are not in the &lt;specials&gt; string are BASE64 encoded.
69503 </para>
69504 <para revisionflag="changed">
69505 The third argument can be omitted, defaulting to an empty string.
69506 The second argument can be omitted, defaulting to "/".
69507 </para>
69508 <para revisionflag="changed">
69509 This is the encoding used by Courier for Maildir names on disk, and followed
69510 by many other IMAP servers.
69511 </para>
69512 <para revisionflag="changed">
69513 Examples:
69514 </para>
69515 <literallayout revisionflag="changed">
69516 <literal>${imapfolder {Foo/Bar}}       </literal> yields <literal>Foo.Bar</literal>
69517 <literal>${imapfolder {Foo/Bar}{.}{/}} </literal> yields <literal>Foo&amp;AC8-Bar</literal>
69518 <literal>${imapfolder {Räksmörgås}}    </literal> yields <literal>R&amp;AOQ-ksm&amp;APY-rg&amp;AOU-s</literal>
69519 </literallayout>
69520 <para revisionflag="changed">
69521 Note that the source charset setting is vital, and also that characters
69522 must be representable in UTF-16.
69523 </para>
69524 </section>
69525 </chapter>
69526
69527 <chapter id="CHAPevents">
69528 <title>Events</title>
69529 <titleabbrev>Events</titleabbrev>
69530 <para>
69531 <indexterm role="concept">
69532 <primary>events</primary>
69533 </indexterm>
69534 </para>
69535 <para revisionflag="changed">
69536 The events mechanism in Exim can be used to intercept processing at a number
69537 of points.  It was originally invented to giave a way to do customised logging
69538 actions (for example, to a database) but can also be used to modify some
69539 processing actions.
69540 </para>
69541 <para revisionflag="changed">
69542 Most installations will never need to use Events.
69543 The support can be left out of a build by defining DISABLE_EVENT=yes
69544 in <filename>Local/Makefile</filename>.
69545 </para>
69546 <para revisionflag="changed">
69547 There are two major classes of events: main and transport.
69548 The main configuration option <option>event_action</option> controls reception events;
69549 a transport option <option>event_action</option> controls delivery events.
69550 </para>
69551 <para revisionflag="changed">
69552 Both options are a string which is expanded when the event fires.
69553 An example might look like:
69554 <indexterm role="concept">
69555 <primary>logging</primary>
69556 <secondary>custom</secondary>
69557 </indexterm>
69558 </para>
69559 <literallayout class="monospaced" revisionflag="changed">
69560 event_action = ${if eq {msg:delivery}{$event_name} \
69561 {${lookup pgsql {SELECT * FROM record_Delivery( \
69562     '${quote_pgsql:$sender_address_domain}',\
69563     '${quote_pgsql:${lc:$sender_address_local_part}}', \
69564     '${quote_pgsql:$domain}', \
69565     '${quote_pgsql:${lc:$local_part}}', \
69566     '${quote_pgsql:$host_address}', \
69567     '${quote_pgsql:${lc:$host}}', \
69568     '${quote_pgsql:$message_exim_id}')}} \
69569 } {}}
69570 </literallayout>
69571 <para revisionflag="changed">
69572 Events have names which correspond to the point in process at which they fire.
69573 The name is placed in the variable <varname>$event_name</varname> and the event action
69574 expansion must check this, as it will be called for every possible event type.
69575 </para>
69576 <para revisionflag="changed">
69577 The current list of events is:
69578 </para>
69579 <literallayout revisionflag="changed">
69580 <literal>msg:complete           after    main       </literal> per message
69581 <literal>msg:delivery           after    transport  </literal> per recipient
69582 <literal>msg:rcpt:host:defer    after    transport  </literal> per recipient per host
69583 <literal>msg:rcpt:defer         after    transport  </literal> per recipient
69584 <literal>msg:host:defer         after    transport  </literal> per attempt
69585 <literal>msg:fail:delivery      after    main       </literal> per recipient
69586 <literal>msg:fail:internal      after    main       </literal> per recipient
69587 <literal>tcp:connect            before   transport  </literal> per connection
69588 <literal>tcp:close              after    transport  </literal> per connection
69589 <literal>tls:cert               before   both       </literal> per certificate in verification chain
69590 <literal>smtp:connect           after    transport  </literal> per connection
69591 </literallayout>
69592 <para revisionflag="changed">
69593 New event types may be added in future.
69594 </para>
69595 <para revisionflag="changed">
69596 The event name is a colon-separated list, defining the type of
69597 event in a tree of possibilities.  It may be used as a list
69598 or just matched on as a whole.  There will be no spaces in the name.
69599 </para>
69600 <para revisionflag="changed">
69601 The second column in the table above describes whether the event fires
69602 before or after the action is associates with.  Those which fire before
69603 can be used to affect that action (more on this below).
69604 </para>
69605 <para revisionflag="changed">
69606 An additional variable, <varname>$event_data</varname>, is filled with information varying
69607 with the event type:
69608 </para>
69609 <literallayout revisionflag="changed">
69610 <literal>msg:delivery         </literal> smtp confirmation mssage
69611 <literal>msg:rcpt:host:defer  </literal> error string
69612 <literal>msg:rcpt:defer       </literal> error string
69613 <literal>msg:host:defer       </literal> error string
69614 <literal>tls:cert             </literal> verification chain depth
69615 <literal>smtp:connect         </literal> smtp banner
69616 </literallayout>
69617 <para revisionflag="changed">
69618 The :defer events populate one extra variable: <varname>$event_defer_errno</varname>.
69619 </para>
69620 <para revisionflag="changed">
69621 For complex operations an ACL expansion can be used in <option>event_action</option>
69622 however due to the multiple contextx that Exim operates in during
69623 the course of its processing:
69624 </para>
69625 <itemizedlist revisionflag="changed">
69626 <listitem>
69627 <para revisionflag="changed">
69628 variables set in transport events will not be visible outside that
69629 transport call
69630 </para>
69631 </listitem>
69632 <listitem>
69633 <para revisionflag="changed">
69634 acl_m variables in a server context are lost on a new connection,
69635 and after smtp helo/ehlo/mail/starttls/rset commands
69636 </para>
69637 </listitem>
69638 </itemizedlist>
69639 <para revisionflag="changed">
69640 Using an ACL expansion with the logwrite modifier can be
69641 a useful way of writing to the main log.
69642 </para>
69643 <para revisionflag="changed">
69644 The expansion of the event_action option should normally
69645 return an empty string.  Should it return anything else the
69646 following will be forced:
69647 </para>
69648 <literallayout revisionflag="changed">
69649 <literal>msg:delivery     </literal>  (ignored)
69650 <literal>msg:host:defer   </literal>  (ignored)
69651 <literal>msg:fail:delivery</literal>  (ignored)
69652 <literal>tcp:connect      </literal>  do not connect
69653 <literal>tcp:close        </literal>  (ignored)
69654 <literal>tls:cert         </literal>  refuse verification
69655 <literal>smtp:connect     </literal>  close connection
69656 </literallayout>
69657 <para revisionflag="changed">
69658 No other use is made of the result string.
69659 </para>
69660 <para revisionflag="changed">
69661 For a tcp:connect event, if the connection is being made to a proxy
69662 then the address and port variables will be that of the proxy and not
69663 the target system.
69664 </para>
69665 <para revisionflag="changed">
69666 For tls:cert events, if GnuTLS is in use this will trigger only per
69667 chain element received on the connection.
69668 For OpenSSL it will trigger for every chain element including those
69669 loaded locally.
69670 </para>
69671 </chapter>
69672
69673 <chapter id="CHID13">
69674 <title>Adding new drivers or lookup types</title>
69675 <titleabbrev>Adding drivers or lookups</titleabbrev>
69676 <para>
69677 <indexterm role="concept">
69678 <primary>adding drivers</primary>
69679 </indexterm>
69680 <indexterm role="concept">
69681 <primary>new drivers, adding</primary>
69682 </indexterm>
69683 <indexterm role="concept">
69684 <primary>drivers</primary>
69685 <secondary>adding new</secondary>
69686 </indexterm>
69687 The following actions have to be taken in order to add a new router, transport,
69688 authenticator, or lookup type to Exim:
69689 </para>
69690 <orderedlist numeration="arabic">
69691 <listitem>
69692 <para>
69693 Choose a name for the driver or lookup type that does not conflict with any
69694 existing name; I will use <quote>newdriver</quote> in what follows.
69695 </para>
69696 </listitem>
69697 <listitem>
69698 <para>
69699 Add to <filename>src/EDITME</filename> the line:
69700 </para>
69701 <literallayout>
69702 &lt;<emphasis>type</emphasis>&gt;<literal>_NEWDRIVER=yes</literal>
69703 </literallayout>
69704 <para>
69705 where &lt;<emphasis>type</emphasis>&gt; is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
69706 code is not to be included in the binary by default, comment this line out. You
69707 should also add any relevant comments about the driver or lookup type.
69708 </para>
69709 </listitem>
69710 <listitem>
69711 <para>
69712 Add to <filename>src/config.h.defaults</filename> the line:
69713 </para>
69714 <literallayout class="monospaced">
69715 #define &lt;type&gt;_NEWDRIVER
69716 </literallayout>
69717 </listitem>
69718 <listitem>
69719 <para>
69720 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
69721 and create a table entry as is done for all the other drivers and lookup types.
69722 </para>
69723 </listitem>
69724 <listitem>
69725 <para>
69726 Edit <filename>scripts/lookups-Makefile</filename> if this is a new lookup; there is a for-loop
69727 near the bottom, ranging the <literal>name_mod</literal> variable over a list of all lookups.
69728 Add your <literal>NEWDRIVER</literal> to that list.
69729 As long as the dynamic module would be named <filename>newdriver.so</filename>, you can use the
69730 simple form that most lookups have.
69731 </para>
69732 </listitem>
69733 <listitem>
69734 <para>
69735 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
69736 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
69737 driver or lookup type and add it to the definition of OBJ.
69738 </para>
69739 </listitem>
69740 <listitem>
69741 <para>
69742 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
69743 <filename>src</filename>.
69744 </para>
69745 </listitem>
69746 <listitem>
69747 <para>
69748 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
69749 as for other drivers and lookups.
69750 </para>
69751 </listitem>
69752 </orderedlist>
69753 <para>
69754 Then all you need to do is write the code! A good way to start is to make a
69755 proforma by copying an existing module of the same type, globally changing all
69756 occurrences of the name, and cutting out most of the code. Note that any
69757 options you create must be listed in alphabetical order, because the tables are
69758 searched using a binary chop procedure.
69759 </para>
69760 <para>
69761 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
69762 the interface that is expected.
69763 </para>
69764 <?sdop
69765   format="newpage"
69766   foot_right_recto="&chaptertitle;"
69767   foot_right_verso="&chaptertitle;"
69768 ?>
69769 </chapter>
69770
69771 <index role="option">
69772 <title>Options index</title>
69773 </index>
69774
69775 <index role="variable">
69776 <title>Variables index</title>
69777 </index>
69778
69779 <index role="concept">
69780 <title>Concept index</title>
69781 </index>
69782
69783 </book>