Add docbok documentation for 4.8{4,5,6}.{1.2}
[exim-website.git] / docbook / 4.85.2 / spec.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
3
4
5 <?sdop
6   foot_right_recto="&chaptertitle; (&chapternumber;)"
7   foot_right_verso="&chaptertitle; (&chapternumber;)"
8   toc_chapter_blanks="yes,yes"
9   table_warn_overflow="overprint"
10 ?>
11 <book>
12 <bookinfo>
13 <title>Specification of the Exim Mail Transfer Agent</title>
14 <titleabbrev>The Exim MTA</titleabbrev>
15 <date>
16 02 Mar 2016
17 </date>
18 <author><firstname>Exim</firstname><surname>Maintainers</surname></author>
19 <authorinitials>EM</authorinitials>
20 <revhistory><revision>
21 <revnumber>4.85.2</revnumber>
22 <date>02 Mar 2016</date>
23   <authorinitials>EM</authorinitials>
24 </revision></revhistory>
25 <copyright><year>
26 2014
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.85.2 of Exim.
206 Substantive changes from the 4.84 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 </indexterm>
2053 Exim makes a note in its hints database, and whenever a successful
2054 SMTP delivery has happened, it looks to see if any other messages are waiting
2055 for the same host. If any are found, they are sent over the same SMTP
2056 connection, subject to a configuration limit as to the maximum number in any
2057 one connection.
2058 </para>
2059 </section>
2060 <section id="SECID21">
2061 <title>Permanent delivery failure</title>
2062 <para>
2063 <indexterm role="concept">
2064 <primary>delivery</primary>
2065 <secondary>permanent failure</secondary>
2066 </indexterm>
2067 <indexterm role="concept">
2068 <primary>bounce message</primary>
2069 <secondary>when generated</secondary>
2070 </indexterm>
2071 When a message cannot be delivered to some or all of its intended recipients, a
2072 bounce message is generated. Temporary delivery failures turn into permanent
2073 errors when their timeout expires. All the addresses that fail in a given
2074 delivery attempt are listed in a single message. If the original message has
2075 many recipients, it is possible for some addresses to fail in one delivery
2076 attempt and others to fail subsequently, giving rise to more than one bounce
2077 message. The wording of bounce messages can be customized by the administrator.
2078 See chapter <xref linkend="CHAPemsgcust"/> for details.
2079 </para>
2080 <para>
2081 <indexterm role="concept">
2082 <primary><emphasis>X-Failed-Recipients:</emphasis> header line</primary>
2083 </indexterm>
2084 Bounce messages contain an <emphasis>X-Failed-Recipients:</emphasis> header line that lists the
2085 failed addresses, for the benefit of programs that try to analyse such messages
2086 automatically.
2087 </para>
2088 <para>
2089 <indexterm role="concept">
2090 <primary>bounce message</primary>
2091 <secondary>recipient of</secondary>
2092 </indexterm>
2093 A bounce message is normally sent to the sender of the original message, as
2094 obtained from the message&#x2019;s envelope. For incoming SMTP messages, this is the
2095 address given in the MAIL command. However, when an address is expanded via a
2096 forward or alias file, an alternative address can be specified for delivery
2097 failures of the generated addresses. For a mailing list expansion (see section
2098 <xref linkend="SECTmailinglists"/>) it is common to direct bounce messages to the manager
2099 of the list.
2100 </para>
2101 </section>
2102 <section id="SECID22">
2103 <title>Failures to deliver bounce messages</title>
2104 <para>
2105 <indexterm role="concept">
2106 <primary>bounce message</primary>
2107 <secondary>failure to deliver</secondary>
2108 </indexterm>
2109 If a bounce message (either locally generated or received from a remote host)
2110 itself suffers a permanent delivery failure, the message is left on the queue,
2111 but it is frozen, awaiting the attention of an administrator. There are options
2112 that can be used to make Exim discard such failed messages, or to keep them
2113 for only a short time (see <option>timeout_frozen_after</option> and
2114 <option>ignore_bounce_errors_after</option>).
2115 </para>
2116 </section>
2117 </chapter>
2118
2119 <chapter id="CHID3">
2120 <title>Building and installing Exim</title>
2121 <para>
2122 <indexterm role="concept" id="IIDbuex" class="startofrange">
2123 <primary>building Exim</primary>
2124 </indexterm>
2125 </para>
2126 <section id="SECID23">
2127 <title>Unpacking</title>
2128 <para>
2129 Exim is distributed as a gzipped or bzipped tar file which, when unpacked,
2130 creates a directory with the name of the current release (for example,
2131 <filename>exim-4.85.2</filename>) into which the following files are placed:
2132 </para>
2133 <informaltable frame="none">
2134 <tgroup cols="2" colsep="0" rowsep="0">
2135 <colspec colwidth="140pt" align="left"/>
2136 <colspec colwidth="254pt" align="left"/>
2137 <tbody>
2138 <row>
2139 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>ACKNOWLEDGMENTS</filename></entry>
2140 <entry>contains some acknowledgments</entry>
2141 </row>
2142 <row>
2143 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>CHANGES</filename></entry>
2144 <entry>contains a reference to where changes are documented</entry>
2145 </row>
2146 <row>
2147 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>LICENCE</filename></entry>
2148 <entry>the GNU General Public Licence</entry>
2149 </row>
2150 <row>
2151 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Makefile</filename></entry>
2152 <entry>top-level make file</entry>
2153 </row>
2154 <row>
2155 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>NOTICE</filename></entry>
2156 <entry>conditions for the use of Exim</entry>
2157 </row>
2158 <row>
2159 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>README</filename></entry>
2160 <entry>list of files, directories and simple build instructions</entry>
2161 </row>
2162 </tbody>
2163 </tgroup>
2164 </informaltable>
2165 <para>
2166 Other files whose names begin with <filename>README</filename> may also be present. The
2167 following subdirectories are created:
2168 </para>
2169 <informaltable frame="none">
2170 <tgroup cols="2" colsep="0" rowsep="0">
2171 <colspec colwidth="140pt" align="left"/>
2172 <colspec colwidth="254pt" align="left"/>
2173 <tbody>
2174 <row>
2175 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Local</filename></entry>
2176 <entry>an empty directory for local configuration files</entry>
2177 </row>
2178 <row>
2179 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>OS</filename></entry>
2180 <entry>OS-specific files</entry>
2181 </row>
2182 <row>
2183 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>doc</filename></entry>
2184 <entry>documentation files</entry>
2185 </row>
2186 <row>
2187 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>exim_monitor</filename></entry>
2188 <entry>source files for the Exim monitor</entry>
2189 </row>
2190 <row>
2191 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>scripts</filename></entry>
2192 <entry>scripts used in the build process</entry>
2193 </row>
2194 <row>
2195 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>src</filename></entry>
2196 <entry>remaining source files</entry>
2197 </row>
2198 <row>
2199 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>util</filename></entry>
2200 <entry>independent utilities</entry>
2201 </row>
2202 </tbody>
2203 </tgroup>
2204 </informaltable>
2205 <para>
2206 The main utility programs are contained in the <filename>src</filename> directory, and are built
2207 with the Exim binary. The <filename>util</filename> directory contains a few optional scripts
2208 that may be useful to some sites.
2209 </para>
2210 </section>
2211 <section id="SECID24">
2212 <title>Multiple machine architectures and operating systems</title>
2213 <para>
2214 <indexterm role="concept">
2215 <primary>building Exim</primary>
2216 <secondary>multiple OS/architectures</secondary>
2217 </indexterm>
2218 The building process for Exim is arranged to make it easy to build binaries for
2219 a number of different architectures and operating systems from the same set of
2220 source files. Compilation does not take place in the <filename>src</filename> directory.
2221 Instead, a <emphasis>build directory</emphasis> is created for each architecture and operating
2222 system.
2223 <indexterm role="concept">
2224 <primary>symbolic link</primary>
2225 <secondary>to build directory</secondary>
2226 </indexterm>
2227 Symbolic links to the sources are installed in this directory, which is where
2228 the actual building takes place. In most cases, Exim can discover the machine
2229 architecture and operating system for itself, but the defaults can be
2230 overridden if necessary.
2231 </para>
2232 </section>
2233 <section id="SECTpcre">
2234 <title>PCRE library</title>
2235 <para>
2236 <indexterm role="concept">
2237 <primary>PCRE library</primary>
2238 </indexterm>
2239 Exim no longer has an embedded PCRE library as the vast majority of
2240 modern systems include PCRE as a system library, although you may need
2241 to install the PCRE or PCRE development package for your operating
2242 system. If your system has a normal PCRE installation the Exim build
2243 process will need no further configuration. If the library or the
2244 headers are in an unusual location you will need to either set the PCRE_LIBS
2245 and INCLUDE directives appropriately,
2246 or set PCRE_CONFIG=yes to use the installed <command>pcre-config</command> command.
2247 If your operating system has no
2248 PCRE support then you will need to obtain and build the current PCRE
2249 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>.
2250 More information on PCRE is available at <emphasis role="bold"><ulink url="http://www.pcre.org/">http://www.pcre.org/</ulink></emphasis>.
2251 </para>
2252 </section>
2253 <section id="SECTdb">
2254 <title>DBM libraries</title>
2255 <para>
2256 <indexterm role="concept">
2257 <primary>DBM libraries</primary>
2258 <secondary>discussion of</secondary>
2259 </indexterm>
2260 <indexterm role="concept">
2261 <primary>hints database</primary>
2262 <secondary>DBM files used for</secondary>
2263 </indexterm>
2264 Even if you do not use any DBM files in your configuration, Exim still needs a
2265 DBM library in order to operate, because it uses indexed files for its hints
2266 databases. Unfortunately, there are a number of DBM libraries in existence, and
2267 different operating systems often have different ones installed.
2268 </para>
2269 <para>
2270 <indexterm role="concept">
2271 <primary>Solaris</primary>
2272 <secondary>DBM library for</secondary>
2273 </indexterm>
2274 <indexterm role="concept">
2275 <primary>IRIX, DBM library for</primary>
2276 </indexterm>
2277 <indexterm role="concept">
2278 <primary>BSD, DBM library for</primary>
2279 </indexterm>
2280 <indexterm role="concept">
2281 <primary>Linux, DBM library for</primary>
2282 </indexterm>
2283 If you are using Solaris, IRIX, one of the modern BSD systems, or a modern
2284 Linux distribution, the DBM configuration should happen automatically, and you
2285 may be able to ignore this section. Otherwise, you may have to learn more than
2286 you would like about DBM libraries from what follows.
2287 </para>
2288 <para>
2289 <indexterm role="concept">
2290 <primary><emphasis>ndbm</emphasis> DBM library</primary>
2291 </indexterm>
2292 Licensed versions of Unix normally contain a library of DBM functions operating
2293 via the <emphasis>ndbm</emphasis> interface, and this is what Exim expects by default. Free
2294 versions of Unix seem to vary in what they contain as standard. In particular,
2295 some early versions of Linux have no default DBM library, and different
2296 distributors have chosen to bundle different libraries with their packaged
2297 versions. However, the more recent releases seem to have standardized on the
2298 Berkeley DB library.
2299 </para>
2300 <para>
2301 Different DBM libraries have different conventions for naming the files they
2302 use. When a program opens a file called <filename>dbmfile</filename>, there are several
2303 possibilities:
2304 </para>
2305 <orderedlist numeration="arabic">
2306 <listitem>
2307 <para>
2308 A traditional <emphasis>ndbm</emphasis> implementation, such as that supplied as part of
2309 Solaris, operates on two files called <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>.
2310 </para>
2311 </listitem>
2312 <listitem>
2313 <para>
2314 <indexterm role="concept">
2315 <primary><emphasis>gdbm</emphasis> DBM library</primary>
2316 </indexterm>
2317 The GNU library, <emphasis>gdbm</emphasis>, operates on a single file. If used via its <emphasis>ndbm</emphasis>
2318 compatibility interface it makes two different hard links to it with names
2319 <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>, but if used via its native interface, the
2320 file name is used unmodified.
2321 </para>
2322 </listitem>
2323 <listitem>
2324 <para>
2325 <indexterm role="concept">
2326 <primary>Berkeley DB library</primary>
2327 </indexterm>
2328 The Berkeley DB package, if called via its <emphasis>ndbm</emphasis> compatibility interface,
2329 operates on a single file called <filename>dbmfile.db</filename>, but otherwise looks to the
2330 programmer exactly the same as the traditional <emphasis>ndbm</emphasis> implementation.
2331 </para>
2332 </listitem>
2333 <listitem>
2334 <para>
2335 If the Berkeley package is used in its native mode, it operates on a single
2336 file called <filename>dbmfile</filename>; the programmer&#x2019;s interface is somewhat different to
2337 the traditional <emphasis>ndbm</emphasis> interface.
2338 </para>
2339 </listitem>
2340 <listitem>
2341 <para>
2342 To complicate things further, there are several very different versions of the
2343 Berkeley DB package. Version 1.85 was stable for a very long time, releases
2344 2.<emphasis>x</emphasis> and 3.<emphasis>x</emphasis> were current for a while, but the latest versions are now
2345 numbered 4.<emphasis>x</emphasis>. Maintenance of some of the earlier releases has ceased. All
2346 versions of Berkeley DB can be obtained from
2347 <emphasis role="bold"><ulink url="http://www.sleepycat.com/">http://www.sleepycat.com/</ulink></emphasis>.
2348 </para>
2349 </listitem>
2350 <listitem>
2351 <para>
2352 <indexterm role="concept">
2353 <primary><emphasis>tdb</emphasis> DBM library</primary>
2354 </indexterm>
2355 Yet another DBM library, called <emphasis>tdb</emphasis>, is available from
2356 <emphasis role="bold"><ulink url="http://download.sourceforge.net/tdb">http://download.sourceforge.net/tdb</ulink></emphasis>. It has its own interface, and also
2357 operates on a single file.
2358 </para>
2359 </listitem>
2360 </orderedlist>
2361 <para>
2362 <indexterm role="concept">
2363 <primary>USE_DB</primary>
2364 </indexterm>
2365 <indexterm role="concept">
2366 <primary>DBM libraries</primary>
2367 <secondary>configuration for building</secondary>
2368 </indexterm>
2369 Exim and its utilities can be compiled to use any of these interfaces. In order
2370 to use any version of the Berkeley DB package in native mode, you must set
2371 USE_DB in an appropriate configuration file (typically
2372 <filename>Local/Makefile</filename>). For example:
2373 </para>
2374 <literallayout class="monospaced">
2375 USE_DB=yes
2376 </literallayout>
2377 <para>
2378 Similarly, for gdbm you set USE_GDBM, and for tdb you set USE_TDB. An
2379 error is diagnosed if you set more than one of these.
2380 </para>
2381 <para>
2382 At the lowest level, the build-time configuration sets none of these options,
2383 thereby assuming an interface of type (1). However, some operating system
2384 configuration files (for example, those for the BSD operating systems and
2385 Linux) assume type (4) by setting USE_DB as their default, and the
2386 configuration files for Cygwin set USE_GDBM. Anything you set in
2387 <filename>Local/Makefile</filename>, however, overrides these system defaults.
2388 </para>
2389 <para>
2390 As well as setting USE_DB, USE_GDBM, or USE_TDB, it may also be
2391 necessary to set DBMLIB, to cause inclusion of the appropriate library, as
2392 in one of these lines:
2393 </para>
2394 <literallayout class="monospaced">
2395 DBMLIB = -ldb
2396 DBMLIB = -ltdb
2397 </literallayout>
2398 <para>
2399 Settings like that will work if the DBM library is installed in the standard
2400 place. Sometimes it is not, and the library&#x2019;s header file may also not be in
2401 the default path. You may need to set INCLUDE to specify where the header
2402 file is, and to specify the path to the library more fully in DBMLIB, as in
2403 this example:
2404 </para>
2405 <literallayout class="monospaced">
2406 INCLUDE=-I/usr/local/include/db-4.1
2407 DBMLIB=/usr/local/lib/db-4.1/libdb.a
2408 </literallayout>
2409 <para>
2410 There is further detailed discussion about the various DBM libraries in the
2411 file <filename>doc/dbm.discuss.txt</filename> in the Exim distribution.
2412 </para>
2413 </section>
2414 <section id="SECID25">
2415 <title>Pre-building configuration</title>
2416 <para>
2417 <indexterm role="concept">
2418 <primary>building Exim</primary>
2419 <secondary>pre-building configuration</secondary>
2420 </indexterm>
2421 <indexterm role="concept">
2422 <primary>configuration for building Exim</primary>
2423 </indexterm>
2424 <indexterm role="concept">
2425 <primary><filename>Local/Makefile</filename></primary>
2426 </indexterm>
2427 <indexterm role="concept">
2428 <primary><filename>src/EDITME</filename></primary>
2429 </indexterm>
2430 Before building Exim, a local configuration file that specifies options
2431 independent of any operating system has to be created with the name
2432 <filename>Local/Makefile</filename>. A template for this file is supplied as the file
2433 <filename>src/EDITME</filename>, and it contains full descriptions of all the option settings
2434 therein. These descriptions are therefore not repeated here. If you are
2435 building Exim for the first time, the simplest thing to do is to copy
2436 <filename>src/EDITME</filename> to <filename>Local/Makefile</filename>, then read it and edit it appropriately.
2437 </para>
2438 <para>
2439 There are three settings that you must supply, because Exim will not build
2440 without them. They are the location of the run time configuration file
2441 (CONFIGURE_FILE), the directory in which Exim binaries will be installed
2442 (BIN_DIRECTORY), and the identity of the Exim user (EXIM_USER and
2443 maybe EXIM_GROUP as well). The value of CONFIGURE_FILE can in fact be
2444 a colon-separated list of file names; Exim uses the first of them that exists.
2445 </para>
2446 <para>
2447 There are a few other parameters that can be specified either at build time or
2448 at run time, to enable the same binary to be used on a number of different
2449 machines. However, if the locations of Exim&#x2019;s spool directory and log file
2450 directory (if not within the spool directory) are fixed, it is recommended that
2451 you specify them in <filename>Local/Makefile</filename> instead of at run time, so that errors
2452 detected early in Exim&#x2019;s execution (such as a malformed configuration file) can
2453 be logged.
2454 </para>
2455 <para>
2456 <indexterm role="concept">
2457 <primary>content scanning</primary>
2458 <secondary>specifying at build time</secondary>
2459 </indexterm>
2460 Exim&#x2019;s interfaces for calling virus and spam scanning software directly from
2461 access control lists are not compiled by default. If you want to include these
2462 facilities, you need to set
2463 </para>
2464 <literallayout class="monospaced">
2465 WITH_CONTENT_SCAN=yes
2466 </literallayout>
2467 <para>
2468 in your <filename>Local/Makefile</filename>. For details of the facilities themselves, see
2469 chapter <xref linkend="CHAPexiscan"/>.
2470 </para>
2471 <para>
2472 <indexterm role="concept">
2473 <primary><filename>Local/eximon.conf</filename></primary>
2474 </indexterm>
2475 <indexterm role="concept">
2476 <primary><filename>exim_monitor/EDITME</filename></primary>
2477 </indexterm>
2478 If you are going to build the Exim monitor, a similar configuration process is
2479 required. The file <filename>exim_monitor/EDITME</filename> must be edited appropriately for
2480 your installation and saved under the name <filename>Local/eximon.conf</filename>. If you are
2481 happy with the default settings described in <filename>exim_monitor/EDITME</filename>,
2482 <filename>Local/eximon.conf</filename> can be empty, but it must exist.
2483 </para>
2484 <para>
2485 This is all the configuration that is needed in straightforward cases for known
2486 operating systems. However, the building process is set up so that it is easy
2487 to override options that are set by default or by operating-system-specific
2488 configuration files, for example to change the name of the C compiler, which
2489 defaults to <option>gcc</option>. See section <xref linkend="SECToverride"/> below for details of how to
2490 do this.
2491 </para>
2492 </section>
2493 <section id="SECID26">
2494 <title>Support for iconv()</title>
2495 <para>
2496 <indexterm role="concept">
2497 <primary><function>iconv()</function> support</primary>
2498 </indexterm>
2499 <indexterm role="concept">
2500 <primary>RFC 2047</primary>
2501 </indexterm>
2502 The contents of header lines in messages may be encoded according to the rules
2503 described RFC 2047. This makes it possible to transmit characters that are not
2504 in the ASCII character set, and to label them as being in a particular
2505 character set. When Exim is inspecting header lines by means of the <option>$h_</option>
2506 mechanism, it decodes them, and translates them into a specified character set
2507 (default ISO-8859-1). The translation is possible only if the operating system
2508 supports the <function>iconv()</function> function.
2509 </para>
2510 <para>
2511 However, some of the operating systems that supply <function>iconv()</function> do not support
2512 very many conversions. The GNU <option>libiconv</option> library (available from
2513 <emphasis role="bold"><ulink url="http://www.gnu.org/software/libiconv/">http://www.gnu.org/software/libiconv/</ulink></emphasis>) can be installed on such
2514 systems to remedy this deficiency, as well as on systems that do not supply
2515 <function>iconv()</function> at all. After installing <option>libiconv</option>, you should add
2516 </para>
2517 <literallayout class="monospaced">
2518 HAVE_ICONV=yes
2519 </literallayout>
2520 <para>
2521 to your <filename>Local/Makefile</filename> and rebuild Exim.
2522 </para>
2523 </section>
2524 <section id="SECTinctlsssl">
2525 <title>Including TLS/SSL encryption support</title>
2526 <para>
2527 <indexterm role="concept">
2528 <primary>TLS</primary>
2529 <secondary>including support for TLS</secondary>
2530 </indexterm>
2531 <indexterm role="concept">
2532 <primary>encryption</primary>
2533 <secondary>including support for</secondary>
2534 </indexterm>
2535 <indexterm role="concept">
2536 <primary>SUPPORT_TLS</primary>
2537 </indexterm>
2538 <indexterm role="concept">
2539 <primary>OpenSSL</primary>
2540 <secondary>building Exim with</secondary>
2541 </indexterm>
2542 <indexterm role="concept">
2543 <primary>GnuTLS</primary>
2544 <secondary>building Exim with</secondary>
2545 </indexterm>
2546 Exim can be built to support encrypted SMTP connections, using the STARTTLS
2547 command as per RFC 2487. It can also support legacy clients that expect to
2548 start a TLS session immediately on connection to a non-standard port (see the
2549 <option>tls_on_connect_ports</option> runtime option and the <option>-tls-on-connect</option> command
2550 line option).
2551 </para>
2552 <para>
2553 If you want to build Exim with TLS support, you must first install either the
2554 OpenSSL or GnuTLS library. There is no cryptographic code in Exim itself for
2555 implementing SSL.
2556 </para>
2557 <para>
2558 If OpenSSL is installed, you should set
2559 </para>
2560 <literallayout class="monospaced">
2561 SUPPORT_TLS=yes
2562 TLS_LIBS=-lssl -lcrypto
2563 </literallayout>
2564 <para>
2565 in <filename>Local/Makefile</filename>. You may also need to specify the locations of the
2566 OpenSSL library and include files. For example:
2567 </para>
2568 <literallayout class="monospaced">
2569 SUPPORT_TLS=yes
2570 TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto
2571 TLS_INCLUDE=-I/usr/local/openssl/include/
2572 </literallayout>
2573 <para>
2574 <indexterm role="concept">
2575 <primary>pkg-config</primary>
2576 <secondary>OpenSSL</secondary>
2577 </indexterm>
2578 If you have <emphasis>pkg-config</emphasis> available, then instead you can just use:
2579 </para>
2580 <literallayout class="monospaced">
2581 SUPPORT_TLS=yes
2582 USE_OPENSSL_PC=openssl
2583 </literallayout>
2584 <para>
2585 <indexterm role="concept">
2586 <primary>USE_GNUTLS</primary>
2587 </indexterm>
2588 If GnuTLS is installed, you should set
2589 </para>
2590 <literallayout class="monospaced">
2591 SUPPORT_TLS=yes
2592 USE_GNUTLS=yes
2593 TLS_LIBS=-lgnutls -ltasn1 -lgcrypt
2594 </literallayout>
2595 <para>
2596 in <filename>Local/Makefile</filename>, and again you may need to specify the locations of the
2597 library and include files. For example:
2598 </para>
2599 <literallayout class="monospaced">
2600 SUPPORT_TLS=yes
2601 USE_GNUTLS=yes
2602 TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt
2603 TLS_INCLUDE=-I/usr/gnu/include
2604 </literallayout>
2605 <para>
2606 <indexterm role="concept">
2607 <primary>pkg-config</primary>
2608 <secondary>GnuTLS</secondary>
2609 </indexterm>
2610 If you have <emphasis>pkg-config</emphasis> available, then instead you can just use:
2611 </para>
2612 <literallayout class="monospaced">
2613 SUPPORT_TLS=yes
2614 USE_GNUTLS=yes
2615 USE_GNUTLS_PC=gnutls
2616 </literallayout>
2617 <para>
2618 You do not need to set TLS_INCLUDE if the relevant directory is already
2619 specified in INCLUDE. Details of how to configure Exim to make use of TLS are
2620 given in chapter <xref linkend="CHAPTLS"/>.
2621 </para>
2622 </section>
2623 <section id="SECID27">
2624 <title>Use of tcpwrappers</title>
2625 <para>
2626 <indexterm role="concept">
2627 <primary>tcpwrappers, building Exim to support</primary>
2628 </indexterm>
2629 <indexterm role="concept">
2630 <primary>USE_TCP_WRAPPERS</primary>
2631 </indexterm>
2632 <indexterm role="concept">
2633 <primary>TCP_WRAPPERS_DAEMON_NAME</primary>
2634 </indexterm>
2635 <indexterm role="concept">
2636 <primary>tcp_wrappers_daemon_name</primary>
2637 </indexterm>
2638 Exim can be linked with the <emphasis>tcpwrappers</emphasis> library in order to check incoming
2639 SMTP calls using the <emphasis>tcpwrappers</emphasis> control files. This may be a convenient
2640 alternative to Exim&#x2019;s own checking facilities for installations that are
2641 already making use of <emphasis>tcpwrappers</emphasis> for other purposes. To do this, you
2642 should set USE_TCP_WRAPPERS in <filename>Local/Makefile</filename>, arrange for the file
2643 <filename>tcpd.h</filename> to be available at compile time, and also ensure that the library
2644 <filename>libwrap.a</filename> is available at link time, typically by including <option>-lwrap</option> in
2645 EXTRALIBS_EXIM. For example, if <emphasis>tcpwrappers</emphasis> is installed in <filename>/usr/local</filename>,
2646 you might have
2647 </para>
2648 <literallayout class="monospaced">
2649 USE_TCP_WRAPPERS=yes
2650 CFLAGS=-O -I/usr/local/include
2651 EXTRALIBS_EXIM=-L/usr/local/lib -lwrap
2652 </literallayout>
2653 <para>
2654 in <filename>Local/Makefile</filename>. The daemon name to use in the <emphasis>tcpwrappers</emphasis> control
2655 files is <quote>exim</quote>. For example, the line
2656 </para>
2657 <literallayout class="monospaced">
2658 exim : LOCAL  192.168.1.  .friendly.domain.example
2659 </literallayout>
2660 <para>
2661 in your <filename>/etc/hosts.allow</filename> file allows connections from the local host, from
2662 the subnet 192.168.1.0/24, and from all hosts in <emphasis>friendly.domain.example</emphasis>.
2663 All other connections are denied. The daemon name used by <emphasis>tcpwrappers</emphasis>
2664 can be changed at build time by setting TCP_WRAPPERS_DAEMON_NAME in
2665 <filename>Local/Makefile</filename>, or by setting tcp_wrappers_daemon_name in the
2666 configure file. Consult the <emphasis>tcpwrappers</emphasis> documentation for
2667 further details.
2668 </para>
2669 </section>
2670 <section id="SECID28">
2671 <title>Including support for IPv6</title>
2672 <para>
2673 <indexterm role="concept">
2674 <primary>IPv6</primary>
2675 <secondary>including support for</secondary>
2676 </indexterm>
2677 Exim contains code for use on systems that have IPv6 support. Setting
2678 <literal>HAVE_IPV6=YES</literal> in <filename>Local/Makefile</filename> causes the IPv6 code to be included;
2679 it may also be necessary to set IPV6_INCLUDE and IPV6_LIBS on systems
2680 where the IPv6 support is not fully integrated into the normal include and
2681 library files.
2682 </para>
2683 <para>
2684 Two different types of DNS record for handling IPv6 addresses have been
2685 defined. AAAA records (analogous to A records for IPv4) are in use, and are
2686 currently seen as the mainstream. Another record type called A6 was proposed
2687 as better than AAAA because it had more flexibility. However, it was felt to be
2688 over-complex, and its status was reduced to <quote>experimental</quote>. It is not known
2689 if anyone is actually using A6 records. Exim has support for A6 records, but
2690 this is included only if you set <literal>SUPPORT_A6=YES</literal> in <filename>Local/Makefile</filename>. The
2691 support has not been tested for some time.
2692 </para>
2693 </section>
2694 <section id="SECTdynamicmodules">
2695 <title>Dynamically loaded lookup module support</title>
2696 <para>
2697 <indexterm role="concept">
2698 <primary>lookup modules</primary>
2699 </indexterm>
2700 <indexterm role="concept">
2701 <primary>dynamic modules</primary>
2702 </indexterm>
2703 <indexterm role="concept">
2704 <primary>.so building</primary>
2705 </indexterm>
2706 On some platforms, Exim supports not compiling all lookup types directly into
2707 the main binary, instead putting some into external modules which can be loaded
2708 on demand.
2709 This permits packagers to build Exim with support for lookups with extensive
2710 library dependencies without requiring all users to install all of those
2711 dependencies.
2712 Most, but not all, lookup types can be built this way.
2713 </para>
2714 <para>
2715 Set <literal>LOOKUP_MODULE_DIR</literal> to the directory into which the modules will be
2716 installed; Exim will only load modules from that directory, as a security
2717 measure.  You will need to set <literal>CFLAGS_DYNAMIC</literal> if not already defined
2718 for your OS; see <filename>OS/Makefile-Linux</filename> for an example.
2719 Some other requirements for adjusting <literal>EXTRALIBS</literal> may also be necessary,
2720 see <filename>src/EDITME</filename> for details.
2721 </para>
2722 <para>
2723 Then, for each module to be loaded dynamically, define the relevant
2724 <literal>LOOKUP_</literal>&lt;<emphasis>lookup_type</emphasis>&gt; flags to have the value "2" instead of "yes".
2725 For example, this will build in lsearch but load sqlite and mysql support
2726 on demand:
2727 </para>
2728 <literallayout class="monospaced">
2729 LOOKUP_LSEARCH=yes
2730 LOOKUP_SQLITE=2
2731 LOOKUP_MYSQL=2
2732 </literallayout>
2733 </section>
2734 <section id="SECID29">
2735 <title>The building process</title>
2736 <para>
2737 <indexterm role="concept">
2738 <primary>build directory</primary>
2739 </indexterm>
2740 Once <filename>Local/Makefile</filename> (and <filename>Local/eximon.conf</filename>, if required) have been
2741 created, run <emphasis>make</emphasis> at the top level. It determines the architecture and
2742 operating system types, and creates a build directory if one does not exist.
2743 For example, on a Sun system running Solaris 8, the directory
2744 <filename>build-SunOS5-5.8-sparc</filename> is created.
2745 <indexterm role="concept">
2746 <primary>symbolic link</primary>
2747 <secondary>to source files</secondary>
2748 </indexterm>
2749 Symbolic links to relevant source files are installed in the build directory.
2750 </para>
2751 <para>
2752 <emphasis role="bold">Warning</emphasis>: The <option>-j</option> (parallel) flag must not be used with <emphasis>make</emphasis>; the
2753 building process fails if it is set.
2754 </para>
2755 <para>
2756 If this is the first time <emphasis>make</emphasis> has been run, it calls a script that builds
2757 a make file inside the build directory, using the configuration files from the
2758 <filename>Local</filename> directory. The new make file is then passed to another instance of
2759 <emphasis>make</emphasis>. This does the real work, building a number of utility scripts, and
2760 then compiling and linking the binaries for the Exim monitor (if configured), a
2761 number of utility programs, and finally Exim itself. The command <literal>make
2762 makefile</literal> can be used to force a rebuild of the make file in the build
2763 directory, should this ever be necessary.
2764 </para>
2765 <para>
2766 If you have problems building Exim, check for any comments there may be in the
2767 <filename>README</filename> file concerning your operating system, and also take a look at the
2768 FAQ, where some common problems are covered.
2769 </para>
2770 </section>
2771 <section id="SECID283">
2772 <title>Output from <quote>make</quote></title>
2773 <para>
2774 The output produced by the <emphasis>make</emphasis> process for compile lines is often very
2775 unreadable, because these lines can be very long. For this reason, the normal
2776 output is suppressed by default, and instead output similar to that which
2777 appears when compiling the 2.6 Linux kernel is generated: just a short line for
2778 each module that is being compiled or linked. However, it is still possible to
2779 get the full output, by calling <emphasis>make</emphasis> like this:
2780 </para>
2781 <literallayout class="monospaced">
2782 FULLECHO='' make -e
2783 </literallayout>
2784 <para>
2785 The value of FULLECHO defaults to <quote>@</quote>, the flag character that suppresses
2786 command reflection in <emphasis>make</emphasis>. When you ask for the full output, it is
2787 given in addition to the short output.
2788 </para>
2789 </section>
2790 <section id="SECToverride">
2791 <title>Overriding build-time options for Exim</title>
2792 <para>
2793 <indexterm role="concept">
2794 <primary>build-time options, overriding</primary>
2795 </indexterm>
2796 The main make file that is created at the beginning of the building process
2797 consists of the concatenation of a number of files which set configuration
2798 values, followed by a fixed set of <emphasis>make</emphasis> instructions. If a value is set
2799 more than once, the last setting overrides any previous ones. This provides a
2800 convenient way of overriding defaults. The files that are concatenated are, in
2801 order:
2802 </para>
2803 <literallayout>
2804 <filename>OS/Makefile-Default</filename>
2805 <filename>OS/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2806 <filename>Local/Makefile</filename>
2807 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2808 <filename>Local/Makefile-</filename>&lt;<emphasis>archtype</emphasis>&gt;
2809 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
2810 <filename>OS/Makefile-Base</filename>
2811 </literallayout>
2812 <para>
2813 <indexterm role="concept">
2814 <primary><filename>Local/Makefile</filename></primary>
2815 </indexterm>
2816 <indexterm role="concept">
2817 <primary>building Exim</primary>
2818 <secondary>operating system type</secondary>
2819 </indexterm>
2820 <indexterm role="concept">
2821 <primary>building Exim</primary>
2822 <secondary>architecture type</secondary>
2823 </indexterm>
2824 where &lt;<emphasis>ostype</emphasis>&gt; is the operating system type and &lt;<emphasis>archtype</emphasis>&gt; is the
2825 architecture type. <filename>Local/Makefile</filename> is required to exist, and the building
2826 process fails if it is absent. The other three <filename>Local</filename> files are optional,
2827 and are often not needed.
2828 </para>
2829 <para>
2830 The values used for &lt;<emphasis>ostype</emphasis>&gt; and &lt;<emphasis>archtype</emphasis>&gt; are obtained from scripts
2831 called <filename>scripts/os-type</filename> and <filename>scripts/arch-type</filename> respectively. If either of
2832 the environment variables EXIM_OSTYPE or EXIM_ARCHTYPE is set, their
2833 values are used, thereby providing a means of forcing particular settings.
2834 Otherwise, the scripts try to get values from the <option>uname</option> command. If this
2835 fails, the shell variables OSTYPE and ARCHTYPE are inspected. A number
2836 of <emphasis>ad hoc</emphasis> transformations are then applied, to produce the standard names
2837 that Exim expects. You can run these scripts directly from the shell in order
2838 to find out what values are being used on your system.
2839 </para>
2840 <para>
2841 <filename>OS/Makefile-Default</filename> contains comments about the variables that are set
2842 therein. Some (but not all) are mentioned below. If there is something that
2843 needs changing, review the contents of this file and the contents of the make
2844 file for your operating system (<filename>OS/Makefile-&lt;ostype&gt;</filename>) to see what the
2845 default values are.
2846 </para>
2847 <para>
2848 <indexterm role="concept">
2849 <primary>building Exim</primary>
2850 <secondary>overriding default settings</secondary>
2851 </indexterm>
2852 If you need to change any of the values that are set in <filename>OS/Makefile-Default</filename>
2853 or in <filename>OS/Makefile-&lt;ostype&gt;</filename>, or to add any new definitions, you do not
2854 need to change the original files. Instead, you should make the changes by
2855 putting the new values in an appropriate <filename>Local</filename> file. For example,
2856 <indexterm role="concept">
2857 <primary>Tru64-Unix build-time settings</primary>
2858 </indexterm>
2859 when building Exim in many releases of the Tru64-Unix (formerly Digital UNIX,
2860 formerly DEC-OSF1) operating system, it is necessary to specify that the C
2861 compiler is called <emphasis>cc</emphasis> rather than <emphasis>gcc</emphasis>. Also, the compiler must be
2862 called with the option <option>-std1</option>, to make it recognize some of the features of
2863 Standard C that Exim uses. (Most other compilers recognize Standard C by
2864 default.) To do this, you should create a file called <filename>Local/Makefile-OSF1</filename>
2865 containing the lines
2866 </para>
2867 <literallayout class="monospaced">
2868 CC=cc
2869 CFLAGS=-std1
2870 </literallayout>
2871 <para>
2872 If you are compiling for just one operating system, it may be easier to put
2873 these lines directly into <filename>Local/Makefile</filename>.
2874 </para>
2875 <para>
2876 Keeping all your local configuration settings separate from the distributed
2877 files makes it easy to transfer them to new versions of Exim simply by copying
2878 the contents of the <filename>Local</filename> directory.
2879 </para>
2880 <para>
2881 <indexterm role="concept">
2882 <primary>NIS lookup type</primary>
2883 <secondary>including support for</secondary>
2884 </indexterm>
2885 <indexterm role="concept">
2886 <primary>NIS+ lookup type</primary>
2887 <secondary>including support for</secondary>
2888 </indexterm>
2889 <indexterm role="concept">
2890 <primary>LDAP</primary>
2891 <secondary>including support for</secondary>
2892 </indexterm>
2893 <indexterm role="concept">
2894 <primary>lookup</primary>
2895 <secondary>inclusion in binary</secondary>
2896 </indexterm>
2897 Exim contains support for doing LDAP, NIS, NIS+, and other kinds of file
2898 lookup, but not all systems have these components installed, so the default is
2899 not to include the relevant code in the binary. All the different kinds of file
2900 and database lookup that Exim supports are implemented as separate code modules
2901 which are included only if the relevant compile-time options are set. In the
2902 case of LDAP, NIS, and NIS+, the settings for <filename>Local/Makefile</filename> are:
2903 </para>
2904 <literallayout class="monospaced">
2905 LOOKUP_LDAP=yes
2906 LOOKUP_NIS=yes
2907 LOOKUP_NISPLUS=yes
2908 </literallayout>
2909 <para>
2910 and similar settings apply to the other lookup types. They are all listed in
2911 <filename>src/EDITME</filename>. In many cases the relevant include files and interface
2912 libraries need to be installed before compiling Exim.
2913 <indexterm role="concept">
2914 <primary>cdb</primary>
2915 <secondary>including support for</secondary>
2916 </indexterm>
2917 However, there are some optional lookup types (such as cdb) for which
2918 the code is entirely contained within Exim, and no external include
2919 files or libraries are required. When a lookup type is not included in the
2920 binary, attempts to configure Exim to use it cause run time configuration
2921 errors.
2922 </para>
2923 <para>
2924 <indexterm role="concept">
2925 <primary>pkg-config</primary>
2926 <secondary>lookups</secondary>
2927 </indexterm>
2928 <indexterm role="concept">
2929 <primary>pkg-config</primary>
2930 <secondary>authenticators</secondary>
2931 </indexterm>
2932 Many systems now use a tool called <emphasis>pkg-config</emphasis> to encapsulate information
2933 about how to compile against a library; Exim has some initial support for
2934 being able to use pkg-config for lookups and authenticators.  For any given
2935 makefile variable which starts <literal>LOOKUP_</literal> or <literal>AUTH_</literal>, you can add a new
2936 variable with the <literal>_PC</literal> suffix in the name and assign as the value the
2937 name of the package to be queried.  The results of querying via the
2938 <emphasis>pkg-config</emphasis> command will be added to the appropriate Makefile variables
2939 with <literal>+=</literal> directives, so your version of <emphasis>make</emphasis> will need to support that
2940 syntax.  For instance:
2941 </para>
2942 <literallayout class="monospaced">
2943 LOOKUP_SQLITE=yes
2944 LOOKUP_SQLITE_PC=sqlite3
2945 AUTH_GSASL=yes
2946 AUTH_GSASL_PC=libgsasl
2947 AUTH_HEIMDAL_GSSAPI=yes
2948 AUTH_HEIMDAL_GSSAPI_PC=heimdal-gssapi
2949 </literallayout>
2950 <para>
2951 <indexterm role="concept">
2952 <primary>Perl</primary>
2953 <secondary>including support for</secondary>
2954 </indexterm>
2955 Exim can be linked with an embedded Perl interpreter, allowing Perl
2956 subroutines to be called during string expansion. To enable this facility,
2957 </para>
2958 <literallayout class="monospaced">
2959 EXIM_PERL=perl.o
2960 </literallayout>
2961 <para>
2962 must be defined in <filename>Local/Makefile</filename>. Details of this facility are given in
2963 chapter <xref linkend="CHAPperl"/>.
2964 </para>
2965 <para>
2966 <indexterm role="concept">
2967 <primary>X11 libraries, location of</primary>
2968 </indexterm>
2969 The location of the X11 libraries is something that varies a lot between
2970 operating systems, and there may be different versions of X11 to cope
2971 with. Exim itself makes no use of X11, but if you are compiling the Exim
2972 monitor, the X11 libraries must be available.
2973 The following three variables are set in <filename>OS/Makefile-Default</filename>:
2974 </para>
2975 <literallayout class="monospaced">
2976 X11=/usr/X11R6
2977 XINCLUDE=-I$(X11)/include
2978 XLFLAGS=-L$(X11)/lib
2979 </literallayout>
2980 <para>
2981 These are overridden in some of the operating-system configuration files. For
2982 example, in <filename>OS/Makefile-SunOS5</filename> there is
2983 </para>
2984 <literallayout class="monospaced">
2985 X11=/usr/openwin
2986 XINCLUDE=-I$(X11)/include
2987 XLFLAGS=-L$(X11)/lib -R$(X11)/lib
2988 </literallayout>
2989 <para>
2990 If you need to override the default setting for your operating system, place a
2991 definition of all three of these variables into your
2992 <filename>Local/Makefile-&lt;ostype&gt;</filename> file.
2993 </para>
2994 <para>
2995 <indexterm role="concept">
2996 <primary>EXTRALIBS</primary>
2997 </indexterm>
2998 If you need to add any extra libraries to the link steps, these can be put in a
2999 variable called EXTRALIBS, which appears in all the link commands, but by
3000 default is not defined. In contrast, EXTRALIBS_EXIM is used only on the
3001 command for linking the main Exim binary, and not for any associated utilities.
3002 </para>
3003 <para>
3004 <indexterm role="concept">
3005 <primary>DBM libraries</primary>
3006 <secondary>configuration for building</secondary>
3007 </indexterm>
3008 There is also DBMLIB, which appears in the link commands for binaries that
3009 use DBM functions (see also section <xref linkend="SECTdb"/>). Finally, there is
3010 EXTRALIBS_EXIMON, which appears only in the link step for the Exim monitor
3011 binary, and which can be used, for example, to include additional X11
3012 libraries.
3013 </para>
3014 <para>
3015 <indexterm role="concept">
3016 <primary>configuration file</primary>
3017 <secondary>editing</secondary>
3018 </indexterm>
3019 The make file copes with rebuilding Exim correctly if any of the configuration
3020 files are edited. However, if an optional configuration file is deleted, it is
3021 necessary to touch the associated non-optional file (that is,
3022 <filename>Local/Makefile</filename> or <filename>Local/eximon.conf</filename>) before rebuilding.
3023 </para>
3024 </section>
3025 <section id="SECID30">
3026 <title>OS-specific header files</title>
3027 <para>
3028 <indexterm role="concept">
3029 <primary><filename>os.h</filename></primary>
3030 </indexterm>
3031 <indexterm role="concept">
3032 <primary>building Exim</primary>
3033 <secondary>OS-specific C header files</secondary>
3034 </indexterm>
3035 The <filename>OS</filename> directory contains a number of files with names of the form
3036 <filename>os.h-&lt;ostype&gt;</filename>. These are system-specific C header files that should not
3037 normally need to be changed. There is a list of macro settings that are
3038 recognized in the file <filename>OS/os.configuring</filename>, which should be consulted if you
3039 are porting Exim to a new operating system.
3040 </para>
3041 </section>
3042 <section id="SECID31">
3043 <title>Overriding build-time options for the monitor</title>
3044 <para>
3045 <indexterm role="concept">
3046 <primary>building Eximon</primary>
3047 </indexterm>
3048 A similar process is used for overriding things when building the Exim monitor,
3049 where the files that are involved are
3050 </para>
3051 <literallayout>
3052 <filename>OS/eximon.conf-Default</filename>
3053 <filename>OS/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
3054 <filename>Local/eximon.conf</filename>
3055 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
3056 <filename>Local/eximon.conf-</filename>&lt;<emphasis>archtype</emphasis>&gt;
3057 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
3058 </literallayout>
3059 <para>
3060 <indexterm role="concept">
3061 <primary><filename>Local/eximon.conf</filename></primary>
3062 </indexterm>
3063 As with Exim itself, the final three files need not exist, and in this case the
3064 <filename>OS/eximon.conf-&lt;ostype&gt;</filename> file is also optional. The default values in
3065 <filename>OS/eximon.conf-Default</filename> can be overridden dynamically by setting environment
3066 variables of the same name, preceded by EXIMON_. For example, setting
3067 EXIMON_LOG_DEPTH in the environment overrides the value of
3068 LOG_DEPTH at run time.
3069 <indexterm role="concept" startref="IIDbuex" class="endofrange"/>
3070 </para>
3071 </section>
3072 <section id="SECID32">
3073 <title>Installing Exim binaries and scripts</title>
3074 <para>
3075 <indexterm role="concept">
3076 <primary>installing Exim</primary>
3077 </indexterm>
3078 <indexterm role="concept">
3079 <primary>BIN_DIRECTORY</primary>
3080 </indexterm>
3081 The command <literal>make install</literal> runs the <command>exim_install</command> script with no
3082 arguments. The script copies binaries and utility scripts into the directory
3083 whose name is specified by the BIN_DIRECTORY setting in <filename>Local/Makefile</filename>.
3084 <indexterm role="concept">
3085 <primary>setuid</primary>
3086 <secondary>installing Exim with</secondary>
3087 </indexterm>
3088 The install script copies files only if they are newer than the files they are
3089 going to replace. The Exim binary is required to be owned by root and have the
3090 <emphasis>setuid</emphasis> bit set, for normal configurations. Therefore, you must run <literal>make
3091 install</literal> as root so that it can set up the Exim binary in this way. However, in
3092 some special situations (for example, if a host is doing no local deliveries)
3093 it may be possible to run Exim without making the binary setuid root (see
3094 chapter <xref linkend="CHAPsecurity"/> for details).
3095 </para>
3096 <para>
3097 <indexterm role="concept">
3098 <primary>CONFIGURE_FILE</primary>
3099 </indexterm>
3100 Exim&#x2019;s run time configuration file is named by the CONFIGURE_FILE setting
3101 in <filename>Local/Makefile</filename>. If this names a single file, and the file does not
3102 exist, the default configuration file <filename>src/configure.default</filename> is copied there
3103 by the installation script. If a run time configuration file already exists, it
3104 is left alone. If CONFIGURE_FILE is a colon-separated list, naming several
3105 alternative files, no default is installed.
3106 </para>
3107 <para>
3108 <indexterm role="concept">
3109 <primary>system aliases file</primary>
3110 </indexterm>
3111 <indexterm role="concept">
3112 <primary><filename>/etc/aliases</filename></primary>
3113 </indexterm>
3114 One change is made to the default configuration file when it is installed: the
3115 default configuration contains a router that references a system aliases file.
3116 The path to this file is set to the value specified by
3117 SYSTEM_ALIASES_FILE in <filename>Local/Makefile</filename> (<filename>/etc/aliases</filename> by default).
3118 If the system aliases file does not exist, the installation script creates it,
3119 and outputs a comment to the user.
3120 </para>
3121 <para>
3122 The created file contains no aliases, but it does contain comments about the
3123 aliases a site should normally have. Mail aliases have traditionally been
3124 kept in <filename>/etc/aliases</filename>. However, some operating systems are now using
3125 <filename>/etc/mail/aliases</filename>. You should check if yours is one of these, and change
3126 Exim&#x2019;s configuration if necessary.
3127 </para>
3128 <para>
3129 The default configuration uses the local host&#x2019;s name as the only local domain,
3130 and is set up to do local deliveries into the shared directory <filename>/var/mail</filename>,
3131 running as the local user. System aliases and <filename>.forward</filename> files in users&#x2019; home
3132 directories are supported, but no NIS or NIS+ support is configured. Domains
3133 other than the name of the local host are routed using the DNS, with delivery
3134 over SMTP.
3135 </para>
3136 <para>
3137 It is possible to install Exim for special purposes (such as building a binary
3138 distribution) in a private part of the file system. You can do this by a
3139 command such as
3140 </para>
3141 <literallayout class="monospaced">
3142 make DESTDIR=/some/directory/ install
3143 </literallayout>
3144 <para>
3145 This has the effect of pre-pending the specified directory to all the file
3146 paths, except the name of the system aliases file that appears in the default
3147 configuration. (If a default alias file is created, its name <emphasis>is</emphasis> modified.)
3148 For backwards compatibility, ROOT is used if DESTDIR is not set,
3149 but this usage is deprecated.
3150 </para>
3151 <para>
3152 <indexterm role="concept">
3153 <primary>installing Exim</primary>
3154 <secondary>what is not installed</secondary>
3155 </indexterm>
3156 Running <emphasis>make install</emphasis> does not copy the Exim 4 conversion script
3157 <emphasis>convert4r4</emphasis>. You will probably run this only once if you are
3158 upgrading from Exim 3. None of the documentation files in the <filename>doc</filename>
3159 directory are copied, except for the info files when you have set
3160 INFO_DIRECTORY, as described in section <xref linkend="SECTinsinfdoc"/> below.
3161 </para>
3162 <para>
3163 For the utility programs, old versions are renamed by adding the suffix <filename>.O</filename>
3164 to their names. The Exim binary itself, however, is handled differently. It is
3165 installed under a name that includes the version number and the compile number,
3166 for example <filename>exim-4.85.2-1</filename>. The script then arranges for a symbolic link
3167 called <filename>exim</filename> to point to the binary. If you are updating a previous version
3168 of Exim, the script takes care to ensure that the name <filename>exim</filename> is never absent
3169 from the directory (as seen by other processes).
3170 </para>
3171 <para>
3172 <indexterm role="concept">
3173 <primary>installing Exim</primary>
3174 <secondary>testing the script</secondary>
3175 </indexterm>
3176 If you want to see what the <emphasis>make install</emphasis> will do before running it for
3177 real, you can pass the <option>-n</option> option to the installation script by this
3178 command:
3179 </para>
3180 <literallayout class="monospaced">
3181 make INSTALL_ARG=-n install
3182 </literallayout>
3183 <para>
3184 The contents of the variable INSTALL_ARG are passed to the installation
3185 script. You do not need to be root to run this test. Alternatively, you can run
3186 the installation script directly, but this must be from within the build
3187 directory. For example, from the top-level Exim directory you could use this
3188 command:
3189 </para>
3190 <literallayout class="monospaced">
3191 (cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n)
3192 </literallayout>
3193 <para>
3194 <indexterm role="concept">
3195 <primary>installing Exim</primary>
3196 <secondary>install script options</secondary>
3197 </indexterm>
3198 There are two other options that can be supplied to the installation script.
3199 </para>
3200 <itemizedlist>
3201 <listitem>
3202 <para>
3203 <option>-no_chown</option> bypasses the call to change the owner of the installed binary
3204 to root, and the call to make it a setuid binary.
3205 </para>
3206 </listitem>
3207 <listitem>
3208 <para>
3209 <option>-no_symlink</option> bypasses the setting up of the symbolic link <filename>exim</filename> to the
3210 installed binary.
3211 </para>
3212 </listitem>
3213 </itemizedlist>
3214 <para>
3215 INSTALL_ARG can be used to pass these options to the script. For example:
3216 </para>
3217 <literallayout class="monospaced">
3218 make INSTALL_ARG=-no_symlink install
3219 </literallayout>
3220 <para>
3221 The installation script can also be given arguments specifying which files are
3222 to be copied. For example, to install just the Exim binary, and nothing else,
3223 without creating the symbolic link, you could use:
3224 </para>
3225 <literallayout class="monospaced">
3226 make INSTALL_ARG='-no_symlink exim' install
3227 </literallayout>
3228 </section>
3229 <section id="SECTinsinfdoc">
3230 <title>Installing info documentation</title>
3231 <para>
3232 <indexterm role="concept">
3233 <primary>installing Exim</primary>
3234 <secondary><emphasis>info</emphasis> documentation</secondary>
3235 </indexterm>
3236 Not all systems use the GNU <emphasis>info</emphasis> system for documentation, and for this
3237 reason, the Texinfo source of Exim&#x2019;s documentation is not included in the main
3238 distribution. Instead it is available separately from the ftp site (see section
3239 <xref linkend="SECTavail"/>).
3240 </para>
3241 <para>
3242 If you have defined INFO_DIRECTORY in <filename>Local/Makefile</filename> and the Texinfo
3243 source of the documentation is found in the source tree, running <literal>make
3244 install</literal> automatically builds the info files and installs them.
3245 </para>
3246 </section>
3247 <section id="SECID33">
3248 <title>Setting up the spool directory</title>
3249 <para>
3250 <indexterm role="concept">
3251 <primary>spool directory</primary>
3252 <secondary>creating</secondary>
3253 </indexterm>
3254 When it starts up, Exim tries to create its spool directory if it does not
3255 exist. The Exim uid and gid are used for the owner and group of the spool
3256 directory. Sub-directories are automatically created in the spool directory as
3257 necessary.
3258 </para>
3259 </section>
3260 <section id="SECID34">
3261 <title>Testing</title>
3262 <para>
3263 <indexterm role="concept">
3264 <primary>testing</primary>
3265 <secondary>installation</secondary>
3266 </indexterm>
3267 Having installed Exim, you can check that the run time configuration file is
3268 syntactically valid by running the following command, which assumes that the
3269 Exim binary directory is within your PATH environment variable:
3270 </para>
3271 <literallayout class="monospaced">
3272 exim -bV
3273 </literallayout>
3274 <para>
3275 If there are any errors in the configuration file, Exim outputs error messages.
3276 Otherwise it outputs the version number and build date,
3277 the DBM library that is being used, and information about which drivers and
3278 other optional code modules are included in the binary.
3279 Some simple routing tests can be done by using the address testing option. For
3280 example,
3281 </para>
3282 <literallayout>
3283 <literal>exim -bt</literal> &lt;<emphasis>local username</emphasis>&gt;
3284 </literallayout>
3285 <para>
3286 should verify that it recognizes a local mailbox, and
3287 </para>
3288 <literallayout>
3289 <literal>exim -bt</literal> &lt;<emphasis>remote address</emphasis>&gt;
3290 </literallayout>
3291 <para>
3292 a remote one. Then try getting it to deliver mail, both locally and remotely.
3293 This can be done by passing messages directly to Exim, without going through a
3294 user agent. For example:
3295 </para>
3296 <literallayout class="monospaced">
3297 exim -v postmaster@your.domain.example
3298 From: user@your.domain.example
3299 To: postmaster@your.domain.example
3300 Subject: Testing Exim
3301
3302 This is a test message.
3303 ^D
3304 </literallayout>
3305 <para>
3306 The <option>-v</option> option causes Exim to output some verification of what it is doing.
3307 In this case you should see copies of three log lines, one for the message&#x2019;s
3308 arrival, one for its delivery, and one containing <quote>Completed</quote>.
3309 </para>
3310 <para>
3311 <indexterm role="concept">
3312 <primary>delivery</primary>
3313 <secondary>problems with</secondary>
3314 </indexterm>
3315 If you encounter problems, look at Exim&#x2019;s log files (<emphasis>mainlog</emphasis> and
3316 <emphasis>paniclog</emphasis>) to see if there is any relevant information there. Another source
3317 of information is running Exim with debugging turned on, by specifying the
3318 <option>-d</option> option. If a message is stuck on Exim&#x2019;s spool, you can force a delivery
3319 with debugging turned on by a command of the form
3320 </para>
3321 <literallayout>
3322 <literal>exim -d -M</literal> &lt;<emphasis>exim-message-id</emphasis>&gt;
3323 </literallayout>
3324 <para>
3325 You must be root or an <quote>admin user</quote> in order to do this. The <option>-d</option> option
3326 produces rather a lot of output, but you can cut this down to specific areas.
3327 For example, if you use <option>-d-all+route</option> only the debugging information
3328 relevant to routing is included. (See the <option>-d</option> option in chapter
3329 <xref linkend="CHAPcommandline"/> for more details.)
3330 </para>
3331 <para>
3332 <indexterm role="concept">
3333 <primary><quote>sticky</quote> bit</primary>
3334 </indexterm>
3335 <indexterm role="concept">
3336 <primary>lock files</primary>
3337 </indexterm>
3338 One specific problem that has shown up on some sites is the inability to do
3339 local deliveries into a shared mailbox directory, because it does not have the
3340 <quote>sticky bit</quote> set on it. By default, Exim tries to create a lock file before
3341 writing to a mailbox file, and if it cannot create the lock file, the delivery
3342 is deferred. You can get round this either by setting the <quote>sticky bit</quote> on the
3343 directory, or by setting a specific group for local deliveries and allowing
3344 that group to create files in the directory (see the comments above the
3345 <command>local_delivery</command> transport in the default configuration file). Another
3346 approach is to configure Exim not to use lock files, but just to rely on
3347 <function>fcntl()</function> locking instead. However, you should do this only if all user
3348 agents also use <function>fcntl()</function> locking. For further discussion of locking issues,
3349 see chapter <xref linkend="CHAPappendfile"/>.
3350 </para>
3351 <para>
3352 One thing that cannot be tested on a system that is already running an MTA is
3353 the receipt of incoming SMTP mail on the standard SMTP port. However, the
3354 <option>-oX</option> option can be used to run an Exim daemon that listens on some other
3355 port, or <emphasis>inetd</emphasis> can be used to do this. The <option>-bh</option> option and the
3356 <emphasis>exim_checkaccess</emphasis> utility can be used to check out policy controls on
3357 incoming SMTP mail.
3358 </para>
3359 <para>
3360 Testing a new version on a system that is already running Exim can most easily
3361 be done by building a binary with a different CONFIGURE_FILE setting. From
3362 within the run time configuration, all other file and directory names
3363 that Exim uses can be altered, in order to keep it entirely clear of the
3364 production version.
3365 </para>
3366 </section>
3367 <section id="SECID35">
3368 <title>Replacing another MTA with Exim</title>
3369 <para>
3370 <indexterm role="concept">
3371 <primary>replacing another MTA</primary>
3372 </indexterm>
3373 Building and installing Exim for the first time does not of itself put it in
3374 general use. The name by which the system&#x2019;s MTA is called by mail user agents
3375 is either <filename>/usr/sbin/sendmail</filename>, or <filename>/usr/lib/sendmail</filename> (depending on the
3376 operating system), and it is necessary to make this name point to the <emphasis>exim</emphasis>
3377 binary in order to get the user agents to pass messages to Exim. This is
3378 normally done by renaming any existing file and making <filename>/usr/sbin/sendmail</filename>
3379 or <filename>/usr/lib/sendmail</filename>
3380 <indexterm role="concept">
3381 <primary>symbolic link</primary>
3382 <secondary>to <emphasis>exim</emphasis> binary</secondary>
3383 </indexterm>
3384 a symbolic link to the <emphasis>exim</emphasis> binary. It is a good idea to remove any setuid
3385 privilege and executable status from the old MTA. It is then necessary to stop
3386 and restart the mailer daemon, if one is running.
3387 </para>
3388 <para>
3389 <indexterm role="concept">
3390 <primary>FreeBSD, MTA indirection</primary>
3391 </indexterm>
3392 <indexterm role="concept">
3393 <primary><filename>/etc/mail/mailer.conf</filename></primary>
3394 </indexterm>
3395 Some operating systems have introduced alternative ways of switching MTAs. For
3396 example, if you are running FreeBSD, you need to edit the file
3397 <filename>/etc/mail/mailer.conf</filename> instead of setting up a symbolic link as just
3398 described. A typical example of the contents of this file for running Exim is
3399 as follows:
3400 </para>
3401 <literallayout class="monospaced">
3402 sendmail            /usr/exim/bin/exim
3403 send-mail           /usr/exim/bin/exim
3404 mailq               /usr/exim/bin/exim -bp
3405 newaliases          /usr/bin/true
3406 </literallayout>
3407 <para>
3408 Once you have set up the symbolic link, or edited <filename>/etc/mail/mailer.conf</filename>,
3409 your Exim installation is <quote>live</quote>. Check it by sending a message from your
3410 favourite user agent.
3411 </para>
3412 <para>
3413 You should consider what to tell your users about the change of MTA. Exim may
3414 have different capabilities to what was previously running, and there are
3415 various operational differences such as the text of messages produced by
3416 command line options and in bounce messages. If you allow your users to make
3417 use of Exim&#x2019;s filtering capabilities, you should make the document entitled
3418 <emphasis>Exim&#x2019;s interface to mail filtering</emphasis> available to them.
3419 </para>
3420 </section>
3421 <section id="SECID36">
3422 <title>Upgrading Exim</title>
3423 <para>
3424 <indexterm role="concept">
3425 <primary>upgrading Exim</primary>
3426 </indexterm>
3427 If you are already running Exim on your host, building and installing a new
3428 version automatically makes it available to MUAs, or any other programs that
3429 call the MTA directly. However, if you are running an Exim daemon, you do need
3430 to send it a HUP signal, to make it re-execute itself, and thereby pick up the
3431 new binary. You do not need to stop processing mail in order to install a new
3432 version of Exim. The install script does not modify an existing runtime
3433 configuration file.
3434 </para>
3435 </section>
3436 <section id="SECID37">
3437 <title>Stopping the Exim daemon on Solaris</title>
3438 <para>
3439 <indexterm role="concept">
3440 <primary>Solaris</primary>
3441 <secondary>stopping Exim on</secondary>
3442 </indexterm>
3443 The standard command for stopping the mailer daemon on Solaris is
3444 </para>
3445 <literallayout class="monospaced">
3446 /etc/init.d/sendmail stop
3447 </literallayout>
3448 <para>
3449 If <filename>/usr/lib/sendmail</filename> has been turned into a symbolic link, this script
3450 fails to stop Exim because it uses the command <emphasis>ps -e</emphasis> and greps the output
3451 for the text <quote>sendmail</quote>; this is not present because the actual program name
3452 (that is, <quote>exim</quote>) is given by the <emphasis>ps</emphasis> command with these options. A
3453 solution is to replace the line that finds the process id with something like
3454 </para>
3455 <literallayout class="monospaced">
3456 pid=`cat /var/spool/exim/exim-daemon.pid`
3457 </literallayout>
3458 <para>
3459 to obtain the daemon&#x2019;s pid directly from the file that Exim saves it in.
3460 </para>
3461 <para>
3462 Note, however, that stopping the daemon does not <quote>stop Exim</quote>. Messages can
3463 still be received from local processes, and if automatic delivery is configured
3464 (the normal case), deliveries will still occur.
3465 </para>
3466 </section>
3467 </chapter>
3468
3469 <chapter id="CHAPcommandline">
3470 <title>The Exim command line</title>
3471 <para>
3472 <indexterm role="concept" id="IIDclo1" class="startofrange">
3473 <primary>command line</primary>
3474 <secondary>options</secondary>
3475 </indexterm>
3476 <indexterm role="concept" id="IIDclo2" class="startofrange">
3477 <primary>options</primary>
3478 <secondary>command line</secondary>
3479 </indexterm>
3480 Exim&#x2019;s command line takes the standard Unix form of a sequence of options,
3481 each starting with a hyphen character, followed by a number of arguments. The
3482 options are compatible with the main options of Sendmail, and there are also
3483 some additional options, some of which are compatible with Smail 3. Certain
3484 combinations of options do not make sense, and provoke an error if used.
3485 The form of the arguments depends on which options are set.
3486 </para>
3487 <section id="SECID38">
3488 <title>Setting options by program name</title>
3489 <para>
3490 <indexterm role="concept">
3491 <primary><emphasis>mailq</emphasis></primary>
3492 </indexterm>
3493 If Exim is called under the name <emphasis>mailq</emphasis>, it behaves as if the option <option>-bp</option>
3494 were present before any other options.
3495 The <option>-bp</option> option requests a listing of the contents of the mail queue on the
3496 standard output.
3497 This feature is for compatibility with some systems that contain a command of
3498 that name in one of the standard libraries, symbolically linked to
3499 <filename>/usr/sbin/sendmail</filename> or <filename>/usr/lib/sendmail</filename>.
3500 </para>
3501 <para>
3502 <indexterm role="concept">
3503 <primary><emphasis>rsmtp</emphasis></primary>
3504 </indexterm>
3505 If Exim is called under the name <emphasis>rsmtp</emphasis> it behaves as if the option <option>-bS</option>
3506 were present before any other options, for compatibility with Smail. The
3507 <option>-bS</option> option is used for reading in a number of messages in batched SMTP
3508 format.
3509 </para>
3510 <para>
3511 <indexterm role="concept">
3512 <primary><emphasis>rmail</emphasis></primary>
3513 </indexterm>
3514 If Exim is called under the name <emphasis>rmail</emphasis> it behaves as if the <option>-i</option> and
3515 <option>-oee</option> options were present before any other options, for compatibility with
3516 Smail. The name <emphasis>rmail</emphasis> is used as an interface by some UUCP systems.
3517 </para>
3518 <para>
3519 <indexterm role="concept">
3520 <primary><emphasis>runq</emphasis></primary>
3521 </indexterm>
3522 <indexterm role="concept">
3523 <primary>queue runner</primary>
3524 </indexterm>
3525 If Exim is called under the name <emphasis>runq</emphasis> it behaves as if the option <option>-q</option>
3526 were present before any other options, for compatibility with Smail. The <option>-q</option>
3527 option causes a single queue runner process to be started.
3528 </para>
3529 <para>
3530 <indexterm role="concept">
3531 <primary><emphasis>newaliases</emphasis></primary>
3532 </indexterm>
3533 <indexterm role="concept">
3534 <primary>alias file</primary>
3535 <secondary>building</secondary>
3536 </indexterm>
3537 <indexterm role="concept">
3538 <primary>Sendmail compatibility</primary>
3539 <secondary>calling Exim as <emphasis>newaliases</emphasis></secondary>
3540 </indexterm>
3541 If Exim is called under the name <emphasis>newaliases</emphasis> it behaves as if the option
3542 <option>-bi</option> were present before any other options, for compatibility with Sendmail.
3543 This option is used for rebuilding Sendmail&#x2019;s alias file. Exim does not have
3544 the concept of a single alias file, but can be configured to run a given
3545 command if called with the <option>-bi</option> option.
3546 </para>
3547 </section>
3548 <section id="SECTtrustedadmin">
3549 <title>Trusted and admin users</title>
3550 <para>
3551 Some Exim options are available only to <emphasis>trusted users</emphasis> and others are
3552 available only to <emphasis>admin users</emphasis>. In the description below, the phrases <quote>Exim
3553 user</quote> and <quote>Exim group</quote> mean the user and group defined by EXIM_USER and
3554 EXIM_GROUP in <filename>Local/Makefile</filename> or set by the <option>exim_user</option> and
3555 <option>exim_group</option> options. These do not necessarily have to use the name <quote>exim</quote>.
3556 </para>
3557 <itemizedlist>
3558 <listitem>
3559 <para>
3560 <indexterm role="concept">
3561 <primary>trusted users</primary>
3562 <secondary>definition of</secondary>
3563 </indexterm>
3564 <indexterm role="concept">
3565 <primary>user</primary>
3566 <secondary>trusted definition of</secondary>
3567 </indexterm>
3568 The trusted users are root, the Exim user, any user listed in the
3569 <option>trusted_users</option> configuration option, and any user whose current group or any
3570 supplementary group is one of those listed in the <option>trusted_groups</option>
3571 configuration option. Note that the Exim group is not automatically trusted.
3572 </para>
3573 <para>
3574 <indexterm role="concept">
3575 <primary><quote>From</quote> line</primary>
3576 </indexterm>
3577 <indexterm role="concept">
3578 <primary>envelope sender</primary>
3579 </indexterm>
3580 Trusted users are always permitted to use the <option>-f</option> option or a leading
3581 <quote>From&nbsp;</quote> line to specify the envelope sender of a message that is passed to
3582 Exim through the local interface (see the <option>-bm</option> and <option>-f</option> options below).
3583 See the <option>untrusted_set_sender</option> option for a way of permitting non-trusted
3584 users to set envelope senders.
3585 </para>
3586 <para>
3587 <indexterm role="concept">
3588 <primary><emphasis>From:</emphasis> header line</primary>
3589 </indexterm>
3590 <indexterm role="concept">
3591 <primary><emphasis>Sender:</emphasis> header line</primary>
3592 </indexterm>
3593 For a trusted user, there is never any check on the contents of the <emphasis>From:</emphasis>
3594 header line, and a <emphasis>Sender:</emphasis> line is never added. Furthermore, any existing
3595 <emphasis>Sender:</emphasis> line in incoming local (non-TCP/IP) messages is not removed.
3596 </para>
3597 <para>
3598 Trusted users may also specify a host name, host address, interface address,
3599 protocol name, ident value, and authentication data when submitting a message
3600 locally. Thus, they are able to insert messages into Exim&#x2019;s queue locally that
3601 have the characteristics of messages received from a remote host. Untrusted
3602 users may in some circumstances use <option>-f</option>, but can never set the other values
3603 that are available to trusted users.
3604 </para>
3605 </listitem>
3606 <listitem>
3607 <para>
3608 <indexterm role="concept">
3609 <primary>user</primary>
3610 <secondary>admin definition of</secondary>
3611 </indexterm>
3612 <indexterm role="concept">
3613 <primary>admin user</primary>
3614 <secondary>definition of</secondary>
3615 </indexterm>
3616 The admin users are root, the Exim user, and any user that is a member of the
3617 Exim group or of any group listed in the <option>admin_groups</option> configuration option.
3618 The current group does not have to be one of these groups.
3619 </para>
3620 <para>
3621 Admin users are permitted to list the queue, and to carry out certain
3622 operations on messages, for example, to force delivery failures. It is also
3623 necessary to be an admin user in order to see the full information provided by
3624 the Exim monitor, and full debugging output.
3625 </para>
3626 <para>
3627 By default, the use of the <option>-M</option>, <option>-q</option>, <option>-R</option>, and <option>-S</option> options to cause
3628 Exim to attempt delivery of messages on its queue is restricted to admin users.
3629 However, this restriction can be relaxed by setting the <option>prod_requires_admin</option>
3630 option false (that is, specifying <option>no_prod_requires_admin</option>).
3631 </para>
3632 <para>
3633 Similarly, the use of the <option>-bp</option> option to list all the messages in the queue
3634 is restricted to admin users unless <option>queue_list_requires_admin</option> is set
3635 false.
3636 </para>
3637 </listitem>
3638 </itemizedlist>
3639 <para>
3640 <emphasis role="bold">Warning</emphasis>: If you configure your system so that admin users are able to
3641 edit Exim&#x2019;s configuration file, you are giving those users an easy way of
3642 getting root. There is further discussion of this issue at the start of chapter
3643 <xref linkend="CHAPconf"/>.
3644 </para>
3645 </section>
3646 <section id="SECID39">
3647 <title>Command line options</title>
3648 <para>
3649 Exim&#x2019;s command line options are described in alphabetical order below. If none
3650 of the options that specifies a specific action (such as starting the daemon or
3651 a queue runner, or testing an address, or receiving a message in a specific
3652 format, or listing the queue) are present, and there is at least one argument
3653 on the command line, <option>-bm</option> (accept a local message on the standard input,
3654 with the arguments specifying the recipients) is assumed. Otherwise, Exim
3655 outputs a brief message about itself and exits.
3656 </para>
3657 <!-- === Start of command line options === -->
3658 <variablelist>
3659 <varlistentry>
3660 <term><option>--</option></term>
3661 <listitem>
3662 <para>
3663 <indexterm role="option">
3664 <primary>--</primary>
3665 </indexterm>
3666 <indexterm role="concept">
3667 <primary>options</primary>
3668 <secondary>command line; terminating</secondary>
3669 </indexterm>
3670 This is a pseudo-option whose only purpose is to terminate the options and
3671 therefore to cause subsequent command line items to be treated as arguments
3672 rather than options, even if they begin with hyphens.
3673 </para>
3674 </listitem></varlistentry>
3675 <varlistentry>
3676 <term><option>--help</option></term>
3677 <listitem>
3678 <para>
3679 <indexterm role="option">
3680 <primary><option>--help</option></primary>
3681 </indexterm>
3682 This option causes Exim to output a few sentences stating what it is.
3683 The same output is generated if the Exim binary is called with no options and
3684 no arguments.
3685 </para>
3686 </listitem></varlistentry>
3687 <varlistentry>
3688 <term><option>--version</option></term>
3689 <listitem>
3690 <para>
3691 <indexterm role="option">
3692 <primary><option>--version</option></primary>
3693 </indexterm>
3694 This option is an alias for <option>-bV</option> and causes version information to be
3695 displayed.
3696 </para>
3697 </listitem></varlistentry>
3698 <varlistentry>
3699 <term><option>-Ac</option></term>
3700 <term><option>-Am</option></term>
3701 <listitem>
3702 <para>
3703 <indexterm role="option">
3704 <primary><option>-Ac</option></primary>
3705 </indexterm>
3706 <indexterm role="option">
3707 <primary><option>-Am</option></primary>
3708 </indexterm>
3709 These options are used by Sendmail for selecting configuration files and are
3710 ignored by Exim.
3711 </para>
3712 </listitem></varlistentry>
3713 <varlistentry>
3714 <term><option>-B</option>&lt;<emphasis>type</emphasis>&gt;</term>
3715 <listitem>
3716 <para>
3717 <indexterm role="option">
3718 <primary><option>-B</option></primary>
3719 </indexterm>
3720 <indexterm role="concept">
3721 <primary>8-bit characters</primary>
3722 </indexterm>
3723 <indexterm role="concept">
3724 <primary>Sendmail compatibility</primary>
3725 <secondary>8-bit characters</secondary>
3726 </indexterm>
3727 This is a Sendmail option for selecting 7 or 8 bit processing. Exim is 8-bit
3728 clean; it ignores this option.
3729 </para>
3730 </listitem></varlistentry>
3731 <varlistentry>
3732 <term><option>-bd</option></term>
3733 <listitem>
3734 <para>
3735 <indexterm role="option">
3736 <primary><option>-bd</option></primary>
3737 </indexterm>
3738 <indexterm role="concept">
3739 <primary>daemon</primary>
3740 </indexterm>
3741 <indexterm role="concept">
3742 <primary>SMTP</primary>
3743 <secondary>listener</secondary>
3744 </indexterm>
3745 <indexterm role="concept">
3746 <primary>queue runner</primary>
3747 </indexterm>
3748 This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually
3749 the <option>-bd</option> option is combined with the <option>-q</option>&lt;<emphasis>time</emphasis>&gt; option, to specify
3750 that the daemon should also initiate periodic queue runs.
3751 </para>
3752 <para>
3753 The <option>-bd</option> option can be used only by an admin user. If either of the <option>-d</option>
3754 (debugging) or <option>-v</option> (verifying) options are set, the daemon does not
3755 disconnect from the controlling terminal. When running this way, it can be
3756 stopped by pressing ctrl-C.
3757 </para>
3758 <para>
3759 By default, Exim listens for incoming connections to the standard SMTP port on
3760 all the host&#x2019;s running interfaces. However, it is possible to listen on other
3761 ports, on multiple ports, and only on specific interfaces. Chapter
3762 <xref linkend="CHAPinterfaces"/> contains a description of the options that control this.
3763 </para>
3764 <para>
3765 When a listening daemon
3766 <indexterm role="concept">
3767 <primary>daemon</primary>
3768 <secondary>process id (pid)</secondary>
3769 </indexterm>
3770 <indexterm role="concept">
3771 <primary>pid (process id)</primary>
3772 <secondary>of daemon</secondary>
3773 </indexterm>
3774 is started without the use of <option>-oX</option> (that is, without overriding the normal
3775 configuration), it writes its process id to a file called <filename>exim-daemon.pid</filename>
3776 in Exim&#x2019;s spool directory. This location can be overridden by setting
3777 PID_FILE_PATH in <filename>Local/Makefile</filename>. The file is written while Exim is still
3778 running as root.
3779 </para>
3780 <para>
3781 When <option>-oX</option> is used on the command line to start a listening daemon, the
3782 process id is not written to the normal pid file path. However, <option>-oP</option> can be
3783 used to specify a path on the command line if a pid file is required.
3784 </para>
3785 <para>
3786 The SIGHUP signal
3787 <indexterm role="concept">
3788 <primary>SIGHUP</primary>
3789 </indexterm>
3790 <indexterm role="concept">
3791 <primary>daemon</primary>
3792 <secondary>restarting</secondary>
3793 </indexterm>
3794 can be used to cause the daemon to re-execute itself. This should be done
3795 whenever Exim&#x2019;s configuration file, or any file that is incorporated into it by
3796 means of the <option>.include</option> facility, is changed, and also whenever a new version
3797 of Exim is installed. It is not necessary to do this when other files that are
3798 referenced from the configuration (for example, alias files) are changed,
3799 because these are reread each time they are used.
3800 </para>
3801 </listitem></varlistentry>
3802 <varlistentry>
3803 <term><option>-bdf</option></term>
3804 <listitem>
3805 <para>
3806 <indexterm role="option">
3807 <primary><option>-bdf</option></primary>
3808 </indexterm>
3809 This option has the same effect as <option>-bd</option> except that it never disconnects
3810 from the controlling terminal, even when no debugging is specified.
3811 </para>
3812 </listitem></varlistentry>
3813 <varlistentry>
3814 <term><option>-be</option></term>
3815 <listitem>
3816 <para>
3817 <indexterm role="option">
3818 <primary><option>-be</option></primary>
3819 </indexterm>
3820 <indexterm role="concept">
3821 <primary>testing</primary>
3822 <secondary>string expansion</secondary>
3823 </indexterm>
3824 <indexterm role="concept">
3825 <primary>expansion</primary>
3826 <secondary>testing</secondary>
3827 </indexterm>
3828 Run Exim in expansion testing mode. Exim discards its root privilege, to
3829 prevent ordinary users from using this mode to read otherwise inaccessible
3830 files. If no arguments are given, Exim runs interactively, prompting for lines
3831 of data. Otherwise, it processes each argument in turn.
3832 </para>
3833 <para>
3834 If Exim was built with USE_READLINE=yes in <filename>Local/Makefile</filename>, it tries
3835 to load the <option>libreadline</option> library dynamically whenever the <option>-be</option> option is
3836 used without command line arguments. If successful, it uses the <function>readline()</function>
3837 function, which provides extensive line-editing facilities, for reading the
3838 test data. A line history is supported.
3839 </para>
3840 <para>
3841 Long expansion expressions can be split over several lines by using backslash
3842 continuations. As in Exim&#x2019;s run time configuration, white space at the start of
3843 continuation lines is ignored. Each argument or data line is passed through the
3844 string expansion mechanism, and the result is output. Variable values from the
3845 configuration file (for example, <varname>$qualify_domain</varname>) are available, but no
3846 message-specific values (such as <varname>$sender_domain</varname>) are set, because no message
3847 is being processed (but see <option>-bem</option> and <option>-Mset</option>).
3848 </para>
3849 <para>
3850 <emphasis role="bold">Note</emphasis>: If you use this mechanism to test lookups, and you change the data
3851 files or databases you are using, you must exit and restart Exim before trying
3852 the same lookup again. Otherwise, because each Exim process caches the results
3853 of lookups, you will just get the same result as before.
3854 </para>
3855 </listitem></varlistentry>
3856 <varlistentry>
3857 <term><option>-bem</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3858 <listitem>
3859 <para>
3860 <indexterm role="option">
3861 <primary><option>-bem</option></primary>
3862 </indexterm>
3863 <indexterm role="concept">
3864 <primary>testing</primary>
3865 <secondary>string expansion</secondary>
3866 </indexterm>
3867 <indexterm role="concept">
3868 <primary>expansion</primary>
3869 <secondary>testing</secondary>
3870 </indexterm>
3871 This option operates like <option>-be</option> except that it must be followed by the name
3872 of a file. For example:
3873 </para>
3874 <literallayout class="monospaced">
3875 exim -bem /tmp/testmessage
3876 </literallayout>
3877 <para>
3878 The file is read as a message (as if receiving a locally-submitted non-SMTP
3879 message) before any of the test expansions are done. Thus, message-specific
3880 variables such as <varname>$message_size</varname> and <varname>$header_from:</varname> are available. However,
3881 no <emphasis>Received:</emphasis> header is added to the message. If the <option>-t</option> option is set,
3882 recipients are read from the headers in the normal way, and are shown in the
3883 <varname>$recipients</varname> variable. Note that recipients cannot be given on the command
3884 line, because further arguments are taken as strings to expand (just like
3885 <option>-be</option>).
3886 </para>
3887 </listitem></varlistentry>
3888 <varlistentry>
3889 <term><option>-bF</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3890 <listitem>
3891 <para>
3892 <indexterm role="option">
3893 <primary><option>-bF</option></primary>
3894 </indexterm>
3895 <indexterm role="concept">
3896 <primary>system filter</primary>
3897 <secondary>testing</secondary>
3898 </indexterm>
3899 <indexterm role="concept">
3900 <primary>testing</primary>
3901 <secondary>system filter</secondary>
3902 </indexterm>
3903 This option is the same as <option>-bf</option> except that it assumes that the filter being
3904 tested is a system filter. The additional commands that are available only in
3905 system filters are recognized.
3906 </para>
3907 </listitem></varlistentry>
3908 <varlistentry>
3909 <term><option>-bf</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3910 <listitem>
3911 <para>
3912 <indexterm role="option">
3913 <primary><option>-bf</option></primary>
3914 </indexterm>
3915 <indexterm role="concept">
3916 <primary>filter</primary>
3917 <secondary>testing</secondary>
3918 </indexterm>
3919 <indexterm role="concept">
3920 <primary>testing</primary>
3921 <secondary>filter file</secondary>
3922 </indexterm>
3923 <indexterm role="concept">
3924 <primary>forward file</primary>
3925 <secondary>testing</secondary>
3926 </indexterm>
3927 <indexterm role="concept">
3928 <primary>testing</primary>
3929 <secondary>forward file</secondary>
3930 </indexterm>
3931 <indexterm role="concept">
3932 <primary>Sieve filter</primary>
3933 <secondary>testing</secondary>
3934 </indexterm>
3935 This option runs Exim in user filter testing mode; the file is the filter file
3936 to be tested, and a test message must be supplied on the standard input. If
3937 there are no message-dependent tests in the filter, an empty file can be
3938 supplied.
3939 </para>
3940 <para>
3941 If you want to test a system filter file, use <option>-bF</option> instead of <option>-bf</option>. You
3942 can use both <option>-bF</option> and <option>-bf</option> on the same command, in order to test a system
3943 filter and a user filter in the same run. For example:
3944 </para>
3945 <literallayout class="monospaced">
3946 exim -bF /system/filter -bf /user/filter &lt;/test/message
3947 </literallayout>
3948 <para>
3949 This is helpful when the system filter adds header lines or sets filter
3950 variables that are used by the user filter.
3951 </para>
3952 <para>
3953 If the test filter file does not begin with one of the special lines
3954 </para>
3955 <literallayout class="monospaced">
3956 # Exim filter
3957 # Sieve filter
3958 </literallayout>
3959 <para>
3960 it is taken to be a normal <filename>.forward</filename> file, and is tested for validity under
3961 that interpretation. See sections <xref linkend="SECTitenonfilred"/> to
3962 <xref linkend="SECTspecitredli"/> for a description of the possible contents of non-filter
3963 redirection lists.
3964 </para>
3965 <para>
3966 The result of an Exim command that uses <option>-bf</option>, provided no errors are
3967 detected, is a list of the actions that Exim would try to take if presented
3968 with the message for real. More details of filter testing are given in the
3969 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
3970 </para>
3971 <para>
3972 When testing a filter file,
3973 <indexterm role="concept">
3974 <primary><quote>From</quote> line</primary>
3975 </indexterm>
3976 <indexterm role="concept">
3977 <primary>envelope sender</primary>
3978 </indexterm>
3979 <indexterm role="option">
3980 <primary><option>-f</option></primary>
3981 <secondary>for filter testing</secondary>
3982 </indexterm>
3983 the envelope sender can be set by the <option>-f</option> option,
3984 or by a <quote>From&nbsp;</quote> line at the start of the test message. Various parameters
3985 that would normally be taken from the envelope recipient address of the message
3986 can be set by means of additional command line options (see the next four
3987 options).
3988 </para>
3989 </listitem></varlistentry>
3990 <varlistentry>
3991 <term><option>-bfd</option>&nbsp;&lt;<emphasis>domain</emphasis>&gt;</term>
3992 <listitem>
3993 <para>
3994 <indexterm role="option">
3995 <primary><option>-bfd</option></primary>
3996 </indexterm>
3997 <indexterm role="variable">
3998 <primary><varname>$qualify_domain</varname></primary>
3999 </indexterm>
4000 This sets the domain of the recipient address when a filter file is being
4001 tested by means of the <option>-bf</option> option. The default is the value of
4002 <varname>$qualify_domain</varname>.
4003 </para>
4004 </listitem></varlistentry>
4005 <varlistentry>
4006 <term><option>-bfl</option>&nbsp;&lt;<emphasis>local&nbsp;part</emphasis>&gt;</term>
4007 <listitem>
4008 <para>
4009 <indexterm role="option">
4010 <primary><option>-bfl</option></primary>
4011 </indexterm>
4012 This sets the local part of the recipient address when a filter file is being
4013 tested by means of the <option>-bf</option> option. The default is the username of the
4014 process that calls Exim. A local part should be specified with any prefix or
4015 suffix stripped, because that is how it appears to the filter when a message is
4016 actually being delivered.
4017 </para>
4018 </listitem></varlistentry>
4019 <varlistentry>
4020 <term><option>-bfp</option>&nbsp;&lt;<emphasis>prefix</emphasis>&gt;</term>
4021 <listitem>
4022 <para>
4023 <indexterm role="option">
4024 <primary><option>-bfp</option></primary>
4025 </indexterm>
4026 This sets the prefix of the local part of the recipient address when a filter
4027 file is being tested by means of the <option>-bf</option> option. The default is an empty
4028 prefix.
4029 </para>
4030 </listitem></varlistentry>
4031 <varlistentry>
4032 <term><option>-bfs</option>&nbsp;&lt;<emphasis>suffix</emphasis>&gt;</term>
4033 <listitem>
4034 <para>
4035 <indexterm role="option">
4036 <primary><option>-bfs</option></primary>
4037 </indexterm>
4038 This sets the suffix of the local part of the recipient address when a filter
4039 file is being tested by means of the <option>-bf</option> option. The default is an empty
4040 suffix.
4041 </para>
4042 </listitem></varlistentry>
4043 <varlistentry>
4044 <term><option>-bh</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4045 <listitem>
4046 <para>
4047 <indexterm role="option">
4048 <primary><option>-bh</option></primary>
4049 </indexterm>
4050 <indexterm role="concept">
4051 <primary>testing</primary>
4052 <secondary>incoming SMTP</secondary>
4053 </indexterm>
4054 <indexterm role="concept">
4055 <primary>SMTP</primary>
4056 <secondary>testing incoming</secondary>
4057 </indexterm>
4058 <indexterm role="concept">
4059 <primary>testing</primary>
4060 <secondary>relay control</secondary>
4061 </indexterm>
4062 <indexterm role="concept">
4063 <primary>relaying</primary>
4064 <secondary>testing configuration</secondary>
4065 </indexterm>
4066 <indexterm role="concept">
4067 <primary>policy control</primary>
4068 <secondary>testing</secondary>
4069 </indexterm>
4070 <indexterm role="concept">
4071 <primary>debugging</primary>
4072 <secondary><option>-bh</option> option</secondary>
4073 </indexterm>
4074 This option runs a fake SMTP session as if from the given IP address, using the
4075 standard input and output. The IP address may include a port number at the end,
4076 after a full stop. For example:
4077 </para>
4078 <literallayout class="monospaced">
4079 exim -bh 10.9.8.7.1234
4080 exim -bh fe80::a00:20ff:fe86:a061.5678
4081 </literallayout>
4082 <para>
4083 When an IPv6 address is given, it is converted into canonical form. In the case
4084 of the second example above, the value of <varname>$sender_host_address</varname> after
4085 conversion to the canonical form is
4086 <literal>fe80:0000:0000:0a00:20ff:fe86:a061.5678</literal>.
4087 </para>
4088 <para>
4089 Comments as to what is going on are written to the standard error file. These
4090 include lines beginning with <quote>LOG</quote> for anything that would have been logged.
4091 This facility is provided for testing configuration options for incoming
4092 messages, to make sure they implement the required policy. For example, you can
4093 test your relay controls using <option>-bh</option>.
4094 </para>
4095 <para>
4096 <emphasis role="bold">Warning 1</emphasis>:
4097 <indexterm role="concept">
4098 <primary>RFC 1413</primary>
4099 </indexterm>
4100 You can test features of the configuration that rely on ident (RFC 1413)
4101 information by using the <option>-oMt</option> option. However, Exim cannot actually perform
4102 an ident callout when testing using <option>-bh</option> because there is no incoming SMTP
4103 connection.
4104 </para>
4105 <para>
4106 <emphasis role="bold">Warning 2</emphasis>: Address verification callouts (see section <xref linkend="SECTcallver"/>)
4107 are also skipped when testing using <option>-bh</option>. If you want these callouts to
4108 occur, use <option>-bhc</option> instead.
4109 </para>
4110 <para>
4111 Messages supplied during the testing session are discarded, and nothing is
4112 written to any of the real log files. There may be pauses when DNS (and other)
4113 lookups are taking place, and of course these may time out. The <option>-oMi</option> option
4114 can be used to specify a specific IP interface and port if this is important,
4115 and <option>-oMaa</option> and <option>-oMai</option> can be used to set parameters as if the SMTP
4116 session were authenticated.
4117 </para>
4118 <para>
4119 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option> whose
4120 output just states whether a given recipient address from a given host is
4121 acceptable or not. See section <xref linkend="SECTcheckaccess"/>.
4122 </para>
4123 <para>
4124 Features such as authentication and encryption, where the client input is not
4125 plain text, cannot easily be tested with <option>-bh</option>. Instead, you should use a
4126 specialized SMTP test program such as
4127 <emphasis role="bold"><ulink url="http://jetmore.org/john/code/#swaks">swaks</ulink></emphasis>.
4128 </para>
4129 </listitem></varlistentry>
4130 <varlistentry>
4131 <term><option>-bhc</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4132 <listitem>
4133 <para>
4134 <indexterm role="option">
4135 <primary><option>-bhc</option></primary>
4136 </indexterm>
4137 This option operates in the same way as <option>-bh</option>, except that address
4138 verification callouts are performed if required. This includes consulting and
4139 updating the callout cache database.
4140 </para>
4141 </listitem></varlistentry>
4142 <varlistentry>
4143 <term><option>-bi</option></term>
4144 <listitem>
4145 <para>
4146 <indexterm role="option">
4147 <primary><option>-bi</option></primary>
4148 </indexterm>
4149 <indexterm role="concept">
4150 <primary>alias file</primary>
4151 <secondary>building</secondary>
4152 </indexterm>
4153 <indexterm role="concept">
4154 <primary>building alias file</primary>
4155 </indexterm>
4156 <indexterm role="concept">
4157 <primary>Sendmail compatibility</primary>
4158 <secondary><option>-bi</option> option</secondary>
4159 </indexterm>
4160 Sendmail interprets the <option>-bi</option> option as a request to rebuild its alias file.
4161 Exim does not have the concept of a single alias file, and so it cannot mimic
4162 this behaviour. However, calls to <filename>/usr/lib/sendmail</filename> with the <option>-bi</option> option
4163 tend to appear in various scripts such as NIS make files, so the option must be
4164 recognized.
4165 </para>
4166 <para>
4167 If <option>-bi</option> is encountered, the command specified by the <option>bi_command</option>
4168 configuration option is run, under the uid and gid of the caller of Exim. If
4169 the <option>-oA</option> option is used, its value is passed to the command as an argument.
4170 The command set by <option>bi_command</option> may not contain arguments. The command can
4171 use the <emphasis>exim_dbmbuild</emphasis> utility, or some other means, to rebuild alias files
4172 if this is required. If the <option>bi_command</option> option is not set, calling Exim with
4173 <option>-bi</option> is a no-op.
4174 </para>
4175 </listitem></varlistentry>
4176 <varlistentry>
4177 <term><option>-bI:help</option></term>
4178 <listitem>
4179 <para>
4180 <indexterm role="option">
4181 <primary><option>-bI:help</option></primary>
4182 </indexterm>
4183 <indexterm role="concept">
4184 <primary>querying exim information</primary>
4185 </indexterm>
4186 We shall provide various options starting <literal>-bI:</literal> for querying Exim for
4187 information.  The output of many of these will be intended for machine
4188 consumption.  This one is not.  The <option>-bI:help</option> option asks Exim for a
4189 synopsis of supported options beginning <literal>-bI:</literal>.  Use of any of these
4190 options shall cause Exim to exit after producing the requested output.
4191 </para>
4192 </listitem></varlistentry>
4193 <varlistentry>
4194 <term><option>-bI:dscp</option></term>
4195 <listitem>
4196 <para>
4197 <indexterm role="option">
4198 <primary><option>-bI:dscp</option></primary>
4199 </indexterm>
4200 <indexterm role="concept">
4201 <primary>DSCP</primary>
4202 <secondary>values</secondary>
4203 </indexterm>
4204 This option causes Exim to emit an alphabetically sorted list of all
4205 recognised DSCP names.
4206 </para>
4207 </listitem></varlistentry>
4208 <varlistentry>
4209 <term><option>-bI:sieve</option></term>
4210 <listitem>
4211 <para>
4212 <indexterm role="option">
4213 <primary><option>-bI:sieve</option></primary>
4214 </indexterm>
4215 <indexterm role="concept">
4216 <primary>Sieve filter</primary>
4217 <secondary>capabilities</secondary>
4218 </indexterm>
4219 This option causes Exim to emit an alphabetically sorted list of all supported
4220 Sieve protocol extensions on stdout, one per line.  This is anticipated to be
4221 useful for ManageSieve (RFC 5804) implementations, in providing that protocol&#x2019;s
4222 <literal>SIEVE</literal> capability response line.  As the precise list may depend upon
4223 compile-time build options, which this option will adapt to, this is the only
4224 way to guarantee a correct response.
4225 </para>
4226 </listitem></varlistentry>
4227 <varlistentry>
4228 <term><option>-bm</option></term>
4229 <listitem>
4230 <para>
4231 <indexterm role="option">
4232 <primary><option>-bm</option></primary>
4233 </indexterm>
4234 <indexterm role="concept">
4235 <primary>local message reception</primary>
4236 </indexterm>
4237 This option runs an Exim receiving process that accepts an incoming,
4238 locally-generated message on the standard input. The recipients are given as the
4239 command arguments (except when <option>-t</option> is also present &ndash; see below). Each
4240 argument can be a comma-separated list of RFC 2822 addresses. This is the
4241 default option for selecting the overall action of an Exim call; it is assumed
4242 if no other conflicting option is present.
4243 </para>
4244 <para>
4245 If any addresses in the message are unqualified (have no domain), they are
4246 qualified by the values of the <option>qualify_domain</option> or <option>qualify_recipient</option>
4247 options, as appropriate. The <option>-bnq</option> option (see below) provides a way of
4248 suppressing this for special cases.
4249 </para>
4250 <para>
4251 Policy checks on the contents of local messages can be enforced by means of
4252 the non-SMTP ACL. See chapter <xref linkend="CHAPACL"/> for details.
4253 </para>
4254 <para>
4255 <indexterm role="concept">
4256 <primary>return code</primary>
4257 <secondary>for <option>-bm</option></secondary>
4258 </indexterm>
4259 The return code is zero if the message is successfully accepted. Otherwise, the
4260 action is controlled by the <option>-oe</option><emphasis>x</emphasis> option setting &ndash; see below.
4261 </para>
4262 <para>
4263 The format
4264 <indexterm role="concept">
4265 <primary>message</primary>
4266 <secondary>format</secondary>
4267 </indexterm>
4268 <indexterm role="concept">
4269 <primary>format</primary>
4270 <secondary>message</secondary>
4271 </indexterm>
4272 <indexterm role="concept">
4273 <primary><quote>From</quote> line</primary>
4274 </indexterm>
4275 <indexterm role="concept">
4276 <primary>UUCP</primary>
4277 <secondary><quote>From</quote> line</secondary>
4278 </indexterm>
4279 <indexterm role="concept">
4280 <primary>Sendmail compatibility</primary>
4281 <secondary><quote>From</quote> line</secondary>
4282 </indexterm>
4283 of the message must be as defined in RFC 2822, except that, for
4284 compatibility with Sendmail and Smail, a line in one of the forms
4285 </para>
4286 <literallayout class="monospaced">
4287 From sender Fri Jan  5 12:55 GMT 1997
4288 From sender Fri, 5 Jan 97 12:55:01
4289 </literallayout>
4290 <para>
4291 (with the weekday optional, and possibly with additional text after the date)
4292 is permitted to appear at the start of the message. There appears to be no
4293 authoritative specification of the format of this line. Exim recognizes it by
4294 matching against the regular expression defined by the <option>uucp_from_pattern</option>
4295 option, which can be changed if necessary.
4296 </para>
4297 <para>
4298 <indexterm role="option">
4299 <primary><option>-f</option></primary>
4300 <secondary>overriding <quote>From</quote> line</secondary>
4301 </indexterm>
4302 The specified sender is treated as if it were given as the argument to the
4303 <option>-f</option> option, but if a <option>-f</option> option is also present, its argument is used in
4304 preference to the address taken from the message. The caller of Exim must be a
4305 trusted user for the sender of a message to be set in this way.
4306 </para>
4307 </listitem></varlistentry>
4308 <varlistentry>
4309 <term><option>-bmalware</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
4310 <listitem>
4311 <para>
4312 <indexterm role="option">
4313 <primary><option>-bmalware</option></primary>
4314 </indexterm>
4315 <indexterm role="concept">
4316 <primary>testing</primary>
4317 <secondary>,</secondary>
4318 </indexterm>
4319 <indexterm role="concept">
4320 <primary>malware scan test</primary>
4321 </indexterm>
4322 This debugging option causes Exim to scan the given file,
4323 using the malware scanning framework.  The option of <option>av_scanner</option> influences
4324 this option, so if <option>av_scanner</option>&#x2019;s value is dependent upon an expansion then
4325 the expansion should have defaults which apply to this invocation.  ACLs are
4326 not invoked, so if <option>av_scanner</option> references an ACL variable then that variable
4327 will never be populated and <option>-bmalware</option> will fail.
4328 </para>
4329 <para>
4330 Exim will have changed working directory before resolving the filename, so
4331 using fully qualified pathnames is advisable.  Exim will be running as the Exim
4332 user when it tries to open the file, rather than as the invoking user.
4333 This option requires admin privileges.
4334 </para>
4335 <para>
4336 The <option>-bmalware</option> option will not be extended to be more generally useful,
4337 there are better tools for file-scanning.  This option exists to help
4338 administrators verify their Exim and AV scanner configuration.
4339 </para>
4340 </listitem></varlistentry>
4341 <varlistentry>
4342 <term><option>-bnq</option></term>
4343 <listitem>
4344 <para>
4345 <indexterm role="option">
4346 <primary><option>-bnq</option></primary>
4347 </indexterm>
4348 <indexterm role="concept">
4349 <primary>address qualification, suppressing</primary>
4350 </indexterm>
4351 By default, Exim automatically qualifies unqualified addresses (those
4352 without domains) that appear in messages that are submitted locally (that
4353 is, not over TCP/IP). This qualification applies both to addresses in
4354 envelopes, and addresses in header lines. Sender addresses are qualified using
4355 <option>qualify_domain</option>, and recipient addresses using <option>qualify_recipient</option> (which
4356 defaults to the value of <option>qualify_domain</option>).
4357 </para>
4358 <para>
4359 Sometimes, qualification is not wanted. For example, if <option>-bS</option> (batch SMTP) is
4360 being used to re-submit messages that originally came from remote hosts after
4361 content scanning, you probably do not want to qualify unqualified addresses in
4362 header lines. (Such lines will be present only if you have not enabled a header
4363 syntax check in the appropriate ACL.)
4364 </para>
4365 <para>
4366 The <option>-bnq</option> option suppresses all qualification of unqualified addresses in
4367 messages that originate on the local host. When this is used, unqualified
4368 addresses in the envelope provoke errors (causing message rejection) and
4369 unqualified addresses in header lines are left alone.
4370 </para>
4371 </listitem></varlistentry>
4372 <varlistentry>
4373 <term><option>-bP</option></term>
4374 <listitem>
4375 <para>
4376 <indexterm role="option">
4377 <primary><option>-bP</option></primary>
4378 </indexterm>
4379 <indexterm role="concept">
4380 <primary>configuration options</primary>
4381 <secondary>extracting</secondary>
4382 </indexterm>
4383 <indexterm role="concept">
4384 <primary>options</primary>
4385 <secondary>configuration &ndash; extracting</secondary>
4386 </indexterm>
4387 If this option is given with no arguments, it causes the values of all Exim&#x2019;s
4388 main configuration options to be written to the standard output. The values
4389 of one or more specific options can be requested by giving their names as
4390 arguments, for example:
4391 </para>
4392 <literallayout class="monospaced">
4393 exim -bP qualify_domain hold_domains
4394 </literallayout>
4395 <para>
4396 <indexterm role="concept">
4397 <primary>hiding configuration option values</primary>
4398 </indexterm>
4399 <indexterm role="concept">
4400 <primary>configuration options</primary>
4401 <secondary>hiding value of</secondary>
4402 </indexterm>
4403 <indexterm role="concept">
4404 <primary>options</primary>
4405 <secondary>hiding value of</secondary>
4406 </indexterm>
4407 However, any option setting that is preceded by the word <quote>hide</quote> in the
4408 configuration file is not shown in full, except to an admin user. For other
4409 users, the output is as in this example:
4410 </para>
4411 <literallayout class="monospaced">
4412 mysql_servers = &lt;value not displayable&gt;
4413 </literallayout>
4414 <para>
4415 If <option>configure_file</option> is given as an argument, the name of the run time
4416 configuration file is output.
4417 If a list of configuration files was supplied, the value that is output here
4418 is the name of the file that was actually used.
4419 </para>
4420 <para>
4421 <indexterm role="concept">
4422 <primary>options</primary>
4423 <secondary>hiding name of</secondary>
4424 </indexterm>
4425 If the <option>-n</option> flag is given, then for most modes of <option>-bP</option> operation the
4426 name will not be output.
4427 </para>
4428 <para>
4429 <indexterm role="concept">
4430 <primary>daemon</primary>
4431 <secondary>process id (pid)</secondary>
4432 </indexterm>
4433 <indexterm role="concept">
4434 <primary>pid (process id)</primary>
4435 <secondary>of daemon</secondary>
4436 </indexterm>
4437 If <option>log_file_path</option> or <option>pid_file_path</option> are given, the names of the
4438 directories where log files and daemon pid files are written are output,
4439 respectively. If these values are unset, log files are written in a
4440 sub-directory of the spool directory called <option>log</option>, and the pid file is
4441 written directly into the spool directory.
4442 </para>
4443 <para>
4444 If <option>-bP</option> is followed by a name preceded by <literal>+</literal>, for example,
4445 </para>
4446 <literallayout class="monospaced">
4447 exim -bP +local_domains
4448 </literallayout>
4449 <para>
4450 it searches for a matching named list of any type (domain, host, address, or
4451 local part) and outputs what it finds.
4452 </para>
4453 <para>
4454 <indexterm role="concept">
4455 <primary>options</primary>
4456 <secondary>router &ndash; extracting</secondary>
4457 </indexterm>
4458 <indexterm role="concept">
4459 <primary>options</primary>
4460 <secondary>transport &ndash; extracting</secondary>
4461 </indexterm>
4462 <indexterm role="concept">
4463 <primary>options</primary>
4464 <secondary>authenticator &ndash; extracting</secondary>
4465 </indexterm>
4466 If one of the words <option>router</option>, <option>transport</option>, or <option>authenticator</option> is given,
4467 followed by the name of an appropriate driver instance, the option settings for
4468 that driver are output. For example:
4469 </para>
4470 <literallayout class="monospaced">
4471 exim -bP transport local_delivery
4472 </literallayout>
4473 <para>
4474 The generic driver options are output first, followed by the driver&#x2019;s private
4475 options. A list of the names of drivers of a particular type can be obtained by
4476 using one of the words <option>router_list</option>, <option>transport_list</option>, or
4477 <option>authenticator_list</option>, and a complete list of all drivers with their option
4478 settings can be obtained by using <option>routers</option>, <option>transports</option>, or
4479 <option>authenticators</option>.
4480 </para>
4481 <para>
4482 <indexterm role="concept">
4483 <primary>environment</primary>
4484 </indexterm>
4485 If <option>environment</option> is given as an argument, the set of environment
4486 variables is output, line by line. Using the <option>-n</option> flag supresses the value of the
4487 variables.
4488 </para>
4489 <para>
4490 <indexterm role="concept">
4491 <primary>options</primary>
4492 <secondary>macro &ndash; extracting</secondary>
4493 </indexterm>
4494 If invoked by an admin user, then <option>macro</option>, <option>macro_list</option> and <option>macros</option>
4495 are available, similarly to the drivers.  Because macros are sometimes used
4496 for storing passwords, this option is restricted.
4497 The output format is one item per line.
4498 </para>
4499 </listitem></varlistentry>
4500 <varlistentry>
4501 <term><option>-bp</option></term>
4502 <listitem>
4503 <para>
4504 <indexterm role="option">
4505 <primary><option>-bp</option></primary>
4506 </indexterm>
4507 <indexterm role="concept">
4508 <primary>queue</primary>
4509 <secondary>listing messages on</secondary>
4510 </indexterm>
4511 <indexterm role="concept">
4512 <primary>listing</primary>
4513 <secondary>messages on the queue</secondary>
4514 </indexterm>
4515 This option requests a listing of the contents of the mail queue on the
4516 standard output. If the <option>-bp</option> option is followed by a list of message ids,
4517 just those messages are listed. By default, this option can be used only by an
4518 admin user. However, the <option>queue_list_requires_admin</option> option can be set false
4519 to allow any user to see the queue.
4520 </para>
4521 <para>
4522 Each message on the queue is displayed as in the following example:
4523 </para>
4524 <literallayout class="monospaced">
4525 25m  2.9K 0t5C6f-0000c8-00 &lt;alice@wonderland.fict.example&gt;
4526           red.king@looking-glass.fict.example
4527           &lt;other addresses&gt;
4528 </literallayout>
4529 <para>
4530 <indexterm role="concept">
4531 <primary>message</primary>
4532 <secondary>size in queue listing</secondary>
4533 </indexterm>
4534 <indexterm role="concept">
4535 <primary>size</primary>
4536 <secondary>of message</secondary>
4537 </indexterm>
4538 The first line contains the length of time the message has been on the queue
4539 (in this case 25 minutes), the size of the message (2.9K), the unique local
4540 identifier for the message, and the message sender, as contained in the
4541 envelope. For bounce messages, the sender address is empty, and appears as
4542 <quote>&lt;&gt;</quote>. If the message was submitted locally by an untrusted user who overrode
4543 the default sender address, the user&#x2019;s login name is shown in parentheses
4544 before the sender address.
4545 </para>
4546 <para>
4547 <indexterm role="concept">
4548 <primary>frozen messages</primary>
4549 <secondary>in queue listing</secondary>
4550 </indexterm>
4551 If the message is frozen (attempts to deliver it are suspended) then the text
4552 <quote>*** frozen ***</quote> is displayed at the end of this line.
4553 </para>
4554 <para>
4555 The recipients of the message (taken from the envelope, not the headers) are
4556 displayed on subsequent lines. Those addresses to which the message has already
4557 been delivered are marked with the letter D. If an original address gets
4558 expanded into several addresses via an alias or forward file, the original is
4559 displayed with a D only when deliveries for all of its child addresses are
4560 complete.
4561 </para>
4562 </listitem></varlistentry>
4563 <varlistentry>
4564 <term><option>-bpa</option></term>
4565 <listitem>
4566 <para>
4567 <indexterm role="option">
4568 <primary><option>-bpa</option></primary>
4569 </indexterm>
4570 This option operates like <option>-bp</option>, but in addition it shows delivered addresses
4571 that were generated from the original top level address(es) in each message by
4572 alias or forwarding operations. These addresses are flagged with <quote>+D</quote> instead
4573 of just <quote>D</quote>.
4574 </para>
4575 </listitem></varlistentry>
4576 <varlistentry>
4577 <term><option>-bpc</option></term>
4578 <listitem>
4579 <para>
4580 <indexterm role="option">
4581 <primary><option>-bpc</option></primary>
4582 </indexterm>
4583 <indexterm role="concept">
4584 <primary>queue</primary>
4585 <secondary>count of messages on</secondary>
4586 </indexterm>
4587 This option counts the number of messages on the queue, and writes the total
4588 to the standard output. It is restricted to admin users, unless
4589 <option>queue_list_requires_admin</option> is set false.
4590 </para>
4591 </listitem></varlistentry>
4592 <varlistentry>
4593 <term><option>-bpr</option></term>
4594 <listitem>
4595 <para>
4596 <indexterm role="option">
4597 <primary><option>-bpr</option></primary>
4598 </indexterm>
4599 This option operates like <option>-bp</option>, but the output is not sorted into
4600 chronological order of message arrival. This can speed it up when there are
4601 lots of messages on the queue, and is particularly useful if the output is
4602 going to be post-processed in a way that doesn&#x2019;t need the sorting.
4603 </para>
4604 </listitem></varlistentry>
4605 <varlistentry>
4606 <term><option>-bpra</option></term>
4607 <listitem>
4608 <para>
4609 <indexterm role="option">
4610 <primary><option>-bpra</option></primary>
4611 </indexterm>
4612 This option is a combination of <option>-bpr</option> and <option>-bpa</option>.
4613 </para>
4614 </listitem></varlistentry>
4615 <varlistentry>
4616 <term><option>-bpru</option></term>
4617 <listitem>
4618 <para>
4619 <indexterm role="option">
4620 <primary><option>-bpru</option></primary>
4621 </indexterm>
4622 This option is a combination of <option>-bpr</option> and <option>-bpu</option>.
4623 </para>
4624 </listitem></varlistentry>
4625 <varlistentry>
4626 <term><option>-bpu</option></term>
4627 <listitem>
4628 <para>
4629 <indexterm role="option">
4630 <primary><option>-bpu</option></primary>
4631 </indexterm>
4632 This option operates like <option>-bp</option> but shows only undelivered top-level
4633 addresses for each message displayed. Addresses generated by aliasing or
4634 forwarding are not shown, unless the message was deferred after processing by a
4635 router with the <option>one_time</option> option set.
4636 </para>
4637 </listitem></varlistentry>
4638 <varlistentry>
4639 <term><option>-brt</option></term>
4640 <listitem>
4641 <para>
4642 <indexterm role="option">
4643 <primary><option>-brt</option></primary>
4644 </indexterm>
4645 <indexterm role="concept">
4646 <primary>testing</primary>
4647 <secondary>retry configuration</secondary>
4648 </indexterm>
4649 <indexterm role="concept">
4650 <primary>retry</primary>
4651 <secondary>configuration testing</secondary>
4652 </indexterm>
4653 This option is for testing retry rules, and it must be followed by up to three
4654 arguments. It causes Exim to look for a retry rule that matches the values
4655 and to write it to the standard output. For example:
4656 </para>
4657 <literallayout class="monospaced">
4658 exim -brt bach.comp.mus.example
4659 Retry rule: *.comp.mus.example  F,2h,15m; F,4d,30m;
4660 </literallayout>
4661 <para>
4662 See chapter <xref linkend="CHAPretry"/> for a description of Exim&#x2019;s retry rules. The first
4663 argument, which is required, can be a complete address in the form
4664 <emphasis>local_part@domain</emphasis>, or it can be just a domain name. If the second argument
4665 contains a dot, it is interpreted as an optional second domain name; if no
4666 retry rule is found for the first argument, the second is tried. This ties in
4667 with Exim&#x2019;s behaviour when looking for retry rules for remote hosts &ndash; if no
4668 rule is found that matches the host, one that matches the mail domain is
4669 sought. Finally, an argument that is the name of a specific delivery error, as
4670 used in setting up retry rules, can be given. For example:
4671 </para>
4672 <literallayout class="monospaced">
4673 exim -brt haydn.comp.mus.example quota_3d
4674 Retry rule: *@haydn.comp.mus.example quota_3d  F,1h,15m
4675 </literallayout>
4676 </listitem></varlistentry>
4677 <varlistentry>
4678 <term><option>-brw</option></term>
4679 <listitem>
4680 <para>
4681 <indexterm role="option">
4682 <primary><option>-brw</option></primary>
4683 </indexterm>
4684 <indexterm role="concept">
4685 <primary>testing</primary>
4686 <secondary>rewriting</secondary>
4687 </indexterm>
4688 <indexterm role="concept">
4689 <primary>rewriting</primary>
4690 <secondary>testing</secondary>
4691 </indexterm>
4692 This option is for testing address rewriting rules, and it must be followed by
4693 a single argument, consisting of either a local part without a domain, or a
4694 complete address with a fully qualified domain. Exim outputs how this address
4695 would be rewritten for each possible place it might appear. See chapter
4696 <xref linkend="CHAPrewrite"/> for further details.
4697 </para>
4698 </listitem></varlistentry>
4699 <varlistentry>
4700 <term><option>-bS</option></term>
4701 <listitem>
4702 <para>
4703 <indexterm role="option">
4704 <primary><option>-bS</option></primary>
4705 </indexterm>
4706 <indexterm role="concept">
4707 <primary>SMTP</primary>
4708 <secondary>batched incoming</secondary>
4709 </indexterm>
4710 <indexterm role="concept">
4711 <primary>batched SMTP input</primary>
4712 </indexterm>
4713 This option is used for batched SMTP input, which is an alternative interface
4714 for non-interactive local message submission. A number of messages can be
4715 submitted in a single run. However, despite its name, this is not really SMTP
4716 input. Exim reads each message&#x2019;s envelope from SMTP commands on the standard
4717 input, but generates no responses. If the caller is trusted, or
4718 <option>untrusted_set_sender</option> is set, the senders in the SMTP MAIL commands are
4719 believed; otherwise the sender is always the caller of Exim.
4720 </para>
4721 <para>
4722 The message itself is read from the standard input, in SMTP format (leading
4723 dots doubled), terminated by a line containing just a single dot. An error is
4724 provoked if the terminating dot is missing. A further message may then follow.
4725 </para>
4726 <para>
4727 As for other local message submissions, the contents of incoming batch SMTP
4728 messages can be checked using the non-SMTP ACL (see chapter <xref linkend="CHAPACL"/>).
4729 Unqualified addresses are automatically qualified using <option>qualify_domain</option> and
4730 <option>qualify_recipient</option>, as appropriate, unless the <option>-bnq</option> option is used.
4731 </para>
4732 <para>
4733 Some other SMTP commands are recognized in the input. HELO and EHLO act
4734 as RSET; VRFY, EXPN, ETRN, and HELP act as NOOP;
4735 QUIT quits, ignoring the rest of the standard input.
4736 </para>
4737 <para>
4738 <indexterm role="concept">
4739 <primary>return code</primary>
4740 <secondary>for <option>-bS</option></secondary>
4741 </indexterm>
4742 If any error is encountered, reports are written to the standard output and
4743 error streams, and Exim gives up immediately. The return code is 0 if no error
4744 was detected; it is 1 if one or more messages were accepted before the error
4745 was detected; otherwise it is 2.
4746 </para>
4747 <para>
4748 More details of input using batched SMTP are given in section
4749 <xref linkend="SECTincomingbatchedSMTP"/>.
4750 </para>
4751 </listitem></varlistentry>
4752 <varlistentry>
4753 <term><option>-bs</option></term>
4754 <listitem>
4755 <para>
4756 <indexterm role="option">
4757 <primary><option>-bs</option></primary>
4758 </indexterm>
4759 <indexterm role="concept">
4760 <primary>SMTP</primary>
4761 <secondary>local input</secondary>
4762 </indexterm>
4763 <indexterm role="concept">
4764 <primary>local SMTP input</primary>
4765 </indexterm>
4766 This option causes Exim to accept one or more messages by reading SMTP commands
4767 on the standard input, and producing SMTP replies on the standard output. SMTP
4768 policy controls, as defined in ACLs (see chapter <xref linkend="CHAPACL"/>) are applied.
4769 Some user agents use this interface as a way of passing locally-generated
4770 messages to the MTA.
4771 </para>
4772 <para>
4773 In
4774 <indexterm role="concept">
4775 <primary>sender</primary>
4776 <secondary>source of</secondary>
4777 </indexterm>
4778 this usage, if the caller of Exim is trusted, or <option>untrusted_set_sender</option> is
4779 set, the senders of messages are taken from the SMTP MAIL commands.
4780 Otherwise the content of these commands is ignored and the sender is set up as
4781 the calling user. Unqualified addresses are automatically qualified using
4782 <option>qualify_domain</option> and <option>qualify_recipient</option>, as appropriate, unless the
4783 <option>-bnq</option> option is used.
4784 </para>
4785 <para>
4786 <indexterm role="concept">
4787 <primary>inetd</primary>
4788 </indexterm>
4789 The
4790 <option>-bs</option> option is also used to run Exim from <emphasis>inetd</emphasis>, as an alternative to
4791 using a listening daemon. Exim can distinguish the two cases by checking
4792 whether the standard input is a TCP/IP socket. When Exim is called from
4793 <emphasis>inetd</emphasis>, the source of the mail is assumed to be remote, and the comments
4794 above concerning senders and qualification do not apply. In this situation,
4795 Exim behaves in exactly the same way as it does when receiving a message via
4796 the listening daemon.
4797 </para>
4798 </listitem></varlistentry>
4799 <varlistentry>
4800 <term><option>-bt</option></term>
4801 <listitem>
4802 <para>
4803 <indexterm role="option">
4804 <primary><option>-bt</option></primary>
4805 </indexterm>
4806 <indexterm role="concept">
4807 <primary>testing</primary>
4808 <secondary>addresses</secondary>
4809 </indexterm>
4810 <indexterm role="concept">
4811 <primary>address</primary>
4812 <secondary>testing</secondary>
4813 </indexterm>
4814 This option runs Exim in address testing mode, in which each argument is taken
4815 as a recipient address to be tested for deliverability. The results are
4816 written to the standard output. If a test fails, and the caller is not an admin
4817 user, no details of the failure are output, because these might contain
4818 sensitive information such as usernames and passwords for database lookups.
4819 </para>
4820 <para>
4821 If no arguments are given, Exim runs in an interactive manner, prompting with a
4822 right angle bracket for addresses to be tested.
4823 </para>
4824 <para>
4825 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4826 <function>readline()</function> function, because it is running as <emphasis>root</emphasis> and there are
4827 security issues.
4828 </para>
4829 <para>
4830 Each address is handled as if it were the recipient address of a message
4831 (compare the <option>-bv</option> option). It is passed to the routers and the result is
4832 written to the standard output. However, any router that has
4833 <option>no_address_test</option> set is bypassed. This can make <option>-bt</option> easier to use for
4834 genuine routing tests if your first router passes everything to a scanner
4835 program.
4836 </para>
4837 <para>
4838 <indexterm role="concept">
4839 <primary>return code</primary>
4840 <secondary>for <option>-bt</option></secondary>
4841 </indexterm>
4842 The return code is 2 if any address failed outright; it is 1 if no address
4843 failed outright but at least one could not be resolved for some reason. Return
4844 code 0 is given only when all addresses succeed.
4845 </para>
4846 <para>
4847 <indexterm role="concept">
4848 <primary>duplicate addresses</primary>
4849 </indexterm>
4850 <emphasis role="bold">Note</emphasis>: When actually delivering a message, Exim removes duplicate recipient
4851 addresses after routing is complete, so that only one delivery takes place.
4852 This does not happen when testing with <option>-bt</option>; the full results of routing are
4853 always shown.
4854 </para>
4855 <para>
4856 <emphasis role="bold">Warning</emphasis>: <option>-bt</option> can only do relatively simple testing. If any of the
4857 routers in the configuration makes any tests on the sender address of a
4858 message,
4859 <indexterm role="option">
4860 <primary><option>-f</option></primary>
4861 <secondary>for address testing</secondary>
4862 </indexterm>
4863 you can use the <option>-f</option> option to set an appropriate sender when running
4864 <option>-bt</option> tests. Without it, the sender is assumed to be the calling user at the
4865 default qualifying domain. However, if you have set up (for example) routers
4866 whose behaviour depends on the contents of an incoming message, you cannot test
4867 those conditions using <option>-bt</option>. The <option>-N</option> option provides a possible way of
4868 doing such tests.
4869 </para>
4870 </listitem></varlistentry>
4871 <varlistentry>
4872 <term><option>-bV</option></term>
4873 <listitem>
4874 <para>
4875 <indexterm role="option">
4876 <primary><option>-bV</option></primary>
4877 </indexterm>
4878 <indexterm role="concept">
4879 <primary>version number of Exim</primary>
4880 </indexterm>
4881 This option causes Exim to write the current version number, compilation
4882 number, and compilation date of the <emphasis>exim</emphasis> binary to the standard output.
4883 It also lists the DBM library that is being used, the optional modules (such as
4884 specific lookup types), the drivers that are included in the binary, and the
4885 name of the run time configuration file that is in use.
4886 </para>
4887 <para>
4888 As part of its operation, <option>-bV</option> causes Exim to read and syntax check its
4889 configuration file. However, this is a static check only. It cannot check
4890 values that are to be expanded. For example, although a misspelt ACL verb is
4891 detected, an error in the verb&#x2019;s arguments is not. You cannot rely on <option>-bV</option>
4892 alone to discover (for example) all the typos in the configuration; some
4893 realistic testing is needed. The <option>-bh</option> and <option>-N</option> options provide more
4894 dynamic testing facilities.
4895 </para>
4896 </listitem></varlistentry>
4897 <varlistentry>
4898 <term><option>-bv</option></term>
4899 <listitem>
4900 <para>
4901 <indexterm role="option">
4902 <primary><option>-bv</option></primary>
4903 </indexterm>
4904 <indexterm role="concept">
4905 <primary>verifying address</primary>
4906 <secondary>using <option>-bv</option></secondary>
4907 </indexterm>
4908 <indexterm role="concept">
4909 <primary>address</primary>
4910 <secondary>verification</secondary>
4911 </indexterm>
4912 This option runs Exim in address verification mode, in which each argument is
4913 taken as a recipient address to be verified by the routers. (This does
4914 not involve any verification callouts). During normal operation, verification
4915 happens mostly as a consequence processing a <option>verify</option> condition in an ACL
4916 (see chapter <xref linkend="CHAPACL"/>). If you want to test an entire ACL, possibly
4917 including callouts, see the <option>-bh</option> and <option>-bhc</option> options.
4918 </para>
4919 <para>
4920 If verification fails, and the caller is not an admin user, no details of the
4921 failure are output, because these might contain sensitive information such as
4922 usernames and passwords for database lookups.
4923 </para>
4924 <para>
4925 If no arguments are given, Exim runs in an interactive manner, prompting with a
4926 right angle bracket for addresses to be verified.
4927 </para>
4928 <para>
4929 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4930 <function>readline()</function> function, because it is running as <emphasis>exim</emphasis> and there are
4931 security issues.
4932 </para>
4933 <para>
4934 Verification differs from address testing (the <option>-bt</option> option) in that routers
4935 that have <option>no_verify</option> set are skipped, and if the address is accepted by a
4936 router that has <option>fail_verify</option> set, verification fails. The address is
4937 verified as a recipient if <option>-bv</option> is used; to test verification for a sender
4938 address, <option>-bvs</option> should be used.
4939 </para>
4940 <para>
4941 If the <option>-v</option> option is not set, the output consists of a single line for each
4942 address, stating whether it was verified or not, and giving a reason in the
4943 latter case. Without <option>-v</option>, generating more than one address by redirection
4944 causes verification to end successfully, without considering the generated
4945 addresses. However, if just one address is generated, processing continues,
4946 and the generated address must verify successfully for the overall verification
4947 to succeed.
4948 </para>
4949 <para>
4950 When <option>-v</option> is set, more details are given of how the address has been handled,
4951 and in the case of address redirection, all the generated addresses are also
4952 considered. Verification may succeed for some and fail for others.
4953 </para>
4954 <para>
4955 The
4956 <indexterm role="concept">
4957 <primary>return code</primary>
4958 <secondary>for <option>-bv</option></secondary>
4959 </indexterm>
4960 return code is 2 if any address failed outright; it is 1 if no address
4961 failed outright but at least one could not be resolved for some reason. Return
4962 code 0 is given only when all addresses succeed.
4963 </para>
4964 <para>
4965 If any of the routers in the configuration makes any tests on the sender
4966 address of a message, you should use the <option>-f</option> option to set an appropriate
4967 sender when running <option>-bv</option> tests. Without it, the sender is assumed to be the
4968 calling user at the default qualifying domain.
4969 </para>
4970 </listitem></varlistentry>
4971 <varlistentry>
4972 <term><option>-bvs</option></term>
4973 <listitem>
4974 <para>
4975 <indexterm role="option">
4976 <primary><option>-bvs</option></primary>
4977 </indexterm>
4978 This option acts like <option>-bv</option>, but verifies the address as a sender rather
4979 than a recipient address. This affects any rewriting and qualification that
4980 might happen.
4981 </para>
4982 </listitem></varlistentry>
4983 <varlistentry>
4984 <term><option>-bw</option></term>
4985 <listitem>
4986 <para>
4987 <indexterm role="option">
4988 <primary><option>-bw</option></primary>
4989 </indexterm>
4990 <indexterm role="concept">
4991 <primary>daemon</primary>
4992 </indexterm>
4993 <indexterm role="concept">
4994 <primary>inetd</primary>
4995 </indexterm>
4996 <indexterm role="concept">
4997 <primary>inetd</primary>
4998 <secondary>wait mode</secondary>
4999 </indexterm>
5000 This option runs Exim as a daemon, awaiting incoming SMTP connections,
5001 similarly to the <option>-bd</option> option.  All port specifications on the command-line
5002 and in the configuration file are ignored.  Queue-running may not be specified.
5003 </para>
5004 <para>
5005 In this mode, Exim expects to be passed a socket as fd 0 (stdin) which is
5006 listening for connections.  This permits the system to start up and have
5007 inetd (or equivalent) listen on the SMTP ports, starting an Exim daemon for
5008 each port only when the first connection is received.
5009 </para>
5010 <para>
5011 If the option is given as <option>-bw</option>&lt;<emphasis>time</emphasis>&gt; then the time is a timeout, after
5012 which the daemon will exit, which should cause inetd to listen once more.
5013 </para>
5014 </listitem></varlistentry>
5015 <varlistentry>
5016 <term><option>-C</option>&nbsp;&lt;<emphasis>filelist</emphasis>&gt;</term>
5017 <listitem>
5018 <para>
5019 <indexterm role="option">
5020 <primary><option>-C</option></primary>
5021 </indexterm>
5022 <indexterm role="concept">
5023 <primary>configuration file</primary>
5024 <secondary>alternate</secondary>
5025 </indexterm>
5026 <indexterm role="concept">
5027 <primary>CONFIGURE_FILE</primary>
5028 </indexterm>
5029 <indexterm role="concept">
5030 <primary>alternate configuration file</primary>
5031 </indexterm>
5032 This option causes Exim to find the run time configuration file from the given
5033 list instead of from the list specified by the CONFIGURE_FILE
5034 compile-time setting. Usually, the list will consist of just a single file
5035 name, but it can be a colon-separated list of names. In this case, the first
5036 file that exists is used. Failure to open an existing file stops Exim from
5037 proceeding any further along the list, and an error is generated.
5038 </para>
5039 <para>
5040 The file names need to be absolute names.
5041 </para>
5042 <para>
5043 When this option is used by a caller other than root, and the list is different
5044 from the compiled-in list, Exim gives up its root privilege immediately, and
5045 runs with the real and effective uid and gid set to those of the caller.
5046 However, if a TRUSTED_CONFIG_LIST file is defined in <filename>Local/Makefile</filename>, that
5047 file contains a list of full pathnames, one per line, for configuration files
5048 which are trusted. Root privilege is retained for any configuration file so
5049 listed, as long as the caller is the Exim user (or the user specified in the
5050 CONFIGURE_OWNER option, if any), and as long as the configuration file is
5051 not writeable by inappropriate users or groups.
5052 </para>
5053 <para>
5054 Leaving TRUSTED_CONFIG_LIST unset precludes the possibility of testing a
5055 configuration using <option>-C</option> right through message reception and delivery,
5056 even if the caller is root. The reception works, but by that time, Exim is
5057 running as the Exim user, so when it re-executes to regain privilege for the
5058 delivery, the use of <option>-C</option> causes privilege to be lost. However, root can
5059 test reception and delivery using two separate commands (one to put a message
5060 on the queue, using <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
5061 </para>
5062 <para>
5063 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
5064 prefix string with which any file named in a <option>-C</option> command line option
5065 must start. In addition, the file name must not contain the sequence <literal>/../</literal>.
5066 However, if the value of the <option>-C</option> option is identical to the value of
5067 CONFIGURE_FILE in <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as
5068 usual. There is no default setting for ALT_CONFIG_PREFIX; when it is
5069 unset, any file name can be used with <option>-C</option>.
5070 </para>
5071 <para>
5072 ALT_CONFIG_PREFIX can be used to confine alternative configuration files
5073 to a directory to which only root has access. This prevents someone who has
5074 broken into the Exim account from running a privileged Exim with an arbitrary
5075 configuration file.
5076 </para>
5077 <para>
5078 The <option>-C</option> facility is useful for ensuring that configuration files are
5079 syntactically correct, but cannot be used for test deliveries, unless the
5080 caller is privileged, or unless it is an exotic configuration that does not
5081 require privilege. No check is made on the owner or group of the files
5082 specified by this option.
5083 </para>
5084 </listitem></varlistentry>
5085 <varlistentry>
5086 <term><option>-D</option>&lt;<emphasis>macro</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;</term>
5087 <listitem>
5088 <para>
5089 <indexterm role="option">
5090 <primary><option>-D</option></primary>
5091 </indexterm>
5092 <indexterm role="concept">
5093 <primary>macro</primary>
5094 <secondary>setting on command line</secondary>
5095 </indexterm>
5096 This option can be used to override macro definitions in the configuration file
5097 (see section <xref linkend="SECTmacrodefs"/>). However, like <option>-C</option>, if it is used by an
5098 unprivileged caller, it causes Exim to give up its root privilege.
5099 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
5100 completely disabled, and its use causes an immediate error exit.
5101 </para>
5102 <para>
5103 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename> then it should be a
5104 colon-separated list of macros which are considered safe and, if <option>-D</option> only
5105 supplies macros from this list, and the values are acceptable, then Exim will
5106 not give up root privilege if the caller is root, the Exim run-time user, or
5107 the CONFIGURE_OWNER, if set.  This is a transition mechanism and is expected
5108 to be removed in the future.  Acceptable values for the macros satisfy the
5109 regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
5110 </para>
5111 <para>
5112 The entire option (including equals sign if present) must all be within one
5113 command line item. <option>-D</option> can be used to set the value of a macro to the empty
5114 string, in which case the equals sign is optional. These two commands are
5115 synonymous:
5116 </para>
5117 <literallayout class="monospaced">
5118 exim -DABC  ...
5119 exim -DABC= ...
5120 </literallayout>
5121 <para>
5122 To include spaces in a macro definition item, quotes must be used. If you use
5123 quotes, spaces are permitted around the macro name and the equals sign. For
5124 example:
5125 </para>
5126 <literallayout class="monospaced">
5127 exim '-D ABC = something' ...
5128 </literallayout>
5129 <para>
5130 <option>-D</option> may be repeated up to 10 times on a command line.
5131 </para>
5132 </listitem></varlistentry>
5133 <varlistentry>
5134 <term><option>-d</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5135 <listitem>
5136 <para>
5137 <indexterm role="option">
5138 <primary><option>-d</option></primary>
5139 </indexterm>
5140 <indexterm role="concept">
5141 <primary>debugging</primary>
5142 <secondary>list of selectors</secondary>
5143 </indexterm>
5144 <indexterm role="concept">
5145 <primary>debugging</primary>
5146 <secondary><option>-d</option> option</secondary>
5147 </indexterm>
5148 This option causes debugging information to be written to the standard
5149 error stream. It is restricted to admin users because debugging output may show
5150 database queries that contain password information. Also, the details of users&#x2019;
5151 filter files should be protected. If a non-admin user uses <option>-d</option>, Exim
5152 writes an error message to the standard error stream and exits with a non-zero
5153 return code.
5154 </para>
5155 <para>
5156 When <option>-d</option> is used, <option>-v</option> is assumed. If <option>-d</option> is given on its own, a lot of
5157 standard debugging data is output. This can be reduced, or increased to include
5158 some more rarely needed information, by directly following <option>-d</option> with a string
5159 made up of names preceded by plus or minus characters. These add or remove sets
5160 of debugging data, respectively. For example, <option>-d+filter</option> adds filter
5161 debugging, whereas <option>-d-all+filter</option> selects only filter debugging. Note that
5162 no spaces are allowed in the debug setting. The available debugging categories
5163 are:
5164 </para>
5165 <literallayout>
5166 <literal>acl            </literal> ACL interpretation
5167 <literal>auth           </literal> authenticators
5168 <literal>deliver        </literal> general delivery logic
5169 <literal>dns            </literal> DNS lookups (see also resolver)
5170 <literal>dnsbl          </literal> DNS black list (aka RBL) code
5171 <literal>exec           </literal> arguments for <function>execv()</function> calls
5172 <literal>expand         </literal> detailed debugging for string expansions
5173 <literal>filter         </literal> filter handling
5174 <literal>hints_lookup   </literal> hints data lookups
5175 <literal>host_lookup    </literal> all types of name-to-IP address handling
5176 <literal>ident          </literal> ident lookup
5177 <literal>interface      </literal> lists of local interfaces
5178 <literal>lists          </literal> matching things in lists
5179 <literal>load           </literal> system load checks
5180 <literal>local_scan     </literal> can be used by <function>local_scan()</function> (see chapter <xref linkend="CHAPlocalscan"/>)
5181 <literal>lookup         </literal> general lookup code and all lookups
5182 <literal>memory         </literal> memory handling
5183 <literal>pid            </literal> add pid to debug output lines
5184 <literal>process_info   </literal> setting info for the process log
5185 <literal>queue_run      </literal> queue runs
5186 <literal>receive        </literal> general message reception logic
5187 <literal>resolver       </literal> turn on the DNS resolver&#x2019;s debugging output
5188 <literal>retry          </literal> retry handling
5189 <literal>rewrite        </literal> address rewriting
5190 <literal>route          </literal> address routing
5191 <literal>timestamp      </literal> add timestamp to debug output lines
5192 <literal>tls            </literal> TLS logic
5193 <literal>transport      </literal> transports
5194 <literal>uid            </literal> changes of uid/gid and looking up uid/gid
5195 <literal>verify         </literal> address verification logic
5196 <literal>all            </literal> almost all of the above (see below), and also <option>-v</option>
5197 </literallayout>
5198 <para>
5199 The <literal>all</literal> option excludes <literal>memory</literal> when used as <literal>+all</literal>, but includes it
5200 for <literal>-all</literal>. The reason for this is that <literal>+all</literal> is something that people
5201 tend to use when generating debug output for Exim maintainers. If <literal>+memory</literal>
5202 is included, an awful lot of output that is very rarely of interest is
5203 generated, so it now has to be explicitly requested. However, <literal>-all</literal> does
5204 turn everything off.
5205 </para>
5206 <para>
5207 <indexterm role="concept">
5208 <primary>resolver, debugging output</primary>
5209 </indexterm>
5210 <indexterm role="concept">
5211 <primary>DNS resolver, debugging output</primary>
5212 </indexterm>
5213 The <literal>resolver</literal> option produces output only if the DNS resolver was compiled
5214 with DEBUG enabled. This is not the case in some operating systems. Also,
5215 unfortunately, debugging output from the DNS resolver is written to stdout
5216 rather than stderr.
5217 </para>
5218 <para>
5219 The default (<option>-d</option> with no argument) omits <literal>expand</literal>, <literal>filter</literal>,
5220 <literal>interface</literal>, <literal>load</literal>, <literal>memory</literal>, <literal>pid</literal>, <literal>resolver</literal>, and <literal>timestamp</literal>.
5221 However, the <literal>pid</literal> selector is forced when debugging is turned on for a
5222 daemon, which then passes it on to any re-executed Exims. Exim also
5223 automatically adds the pid to debug lines when several remote deliveries are
5224 run in parallel.
5225 </para>
5226 <para>
5227 The <literal>timestamp</literal> selector causes the current time to be inserted at the start
5228 of all debug output lines. This can be useful when trying to track down delays
5229 in processing.
5230 </para>
5231 <para>
5232 If the <option>debug_print</option> option is set in any driver, it produces output whenever
5233 any debugging is selected, or if <option>-v</option> is used.
5234 </para>
5235 </listitem></varlistentry>
5236 <varlistentry>
5237 <term><option>-dd</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5238 <listitem>
5239 <para>
5240 <indexterm role="option">
5241 <primary><option>-dd</option></primary>
5242 </indexterm>
5243 This option behaves exactly like <option>-d</option> except when used on a command that
5244 starts a daemon process. In that case, debugging is turned off for the
5245 subprocesses that the daemon creates. Thus, it is useful for monitoring the
5246 behaviour of the daemon without creating as much output as full debugging does.
5247 </para>
5248 </listitem></varlistentry>
5249 <varlistentry>
5250 <term><option>-dropcr</option></term>
5251 <listitem>
5252 <para>
5253 <indexterm role="option">
5254 <primary><option>-dropcr</option></primary>
5255 </indexterm>
5256 This is an obsolete option that is now a no-op. It used to affect the way Exim
5257 handled CR and LF characters in incoming messages. What happens now is
5258 described in section <xref linkend="SECTlineendings"/>.
5259 </para>
5260 </listitem></varlistentry>
5261 <varlistentry>
5262 <term><option>-E</option></term>
5263 <listitem>
5264 <para>
5265 <indexterm role="option">
5266 <primary><option>-E</option></primary>
5267 </indexterm>
5268 <indexterm role="concept">
5269 <primary>bounce message</primary>
5270 <secondary>generating</secondary>
5271 </indexterm>
5272 This option specifies that an incoming message is a locally-generated delivery
5273 failure report. It is used internally by Exim when handling delivery failures
5274 and is not intended for external use. Its only effect is to stop Exim
5275 generating certain messages to the postmaster, as otherwise message cascades
5276 could occur in some situations. As part of the same option, a message id may
5277 follow the characters <option>-E</option>. If it does, the log entry for the receipt of the
5278 new message contains the id, following <quote>R=</quote>, as a cross-reference.
5279 </para>
5280 </listitem></varlistentry>
5281 <varlistentry>
5282 <term><option>-e</option><emphasis>x</emphasis></term>
5283 <listitem>
5284 <para>
5285 <indexterm role="option">
5286 <primary><option>-e</option><emphasis>x</emphasis></primary>
5287 </indexterm>
5288 There are a number of Sendmail options starting with <option>-oe</option> which seem to be
5289 called by various programs without the leading <option>o</option> in the option. For
5290 example, the <option>vacation</option> program uses <option>-eq</option>. Exim treats all options of the
5291 form <option>-e</option><emphasis>x</emphasis> as synonymous with the corresponding <option>-oe</option><emphasis>x</emphasis> options.
5292 </para>
5293 </listitem></varlistentry>
5294 <varlistentry>
5295 <term><option>-F</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
5296 <listitem>
5297 <para>
5298 <indexterm role="option">
5299 <primary><option>-F</option></primary>
5300 </indexterm>
5301 <indexterm role="concept">
5302 <primary>sender</primary>
5303 <secondary>name</secondary>
5304 </indexterm>
5305 <indexterm role="concept">
5306 <primary>name</primary>
5307 <secondary>of sender</secondary>
5308 </indexterm>
5309 This option sets the sender&#x2019;s full name for use when a locally-generated
5310 message is being accepted. In the absence of this option, the user&#x2019;s <emphasis>gecos</emphasis>
5311 entry from the password data is used. As users are generally permitted to alter
5312 their <emphasis>gecos</emphasis> entries, no security considerations are involved. White space
5313 between <option>-F</option> and the &lt;<emphasis>string</emphasis>&gt; is optional.
5314 </para>
5315 </listitem></varlistentry>
5316 <varlistentry>
5317 <term><option>-f</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5318 <listitem>
5319 <para>
5320 <indexterm role="option">
5321 <primary><option>-f</option></primary>
5322 </indexterm>
5323 <indexterm role="concept">
5324 <primary>sender</primary>
5325 <secondary>address</secondary>
5326 </indexterm>
5327 <indexterm role="concept">
5328 <primary>address</primary>
5329 <secondary>sender</secondary>
5330 </indexterm>
5331 <indexterm role="concept">
5332 <primary>trusted users</primary>
5333 </indexterm>
5334 <indexterm role="concept">
5335 <primary>envelope sender</primary>
5336 </indexterm>
5337 <indexterm role="concept">
5338 <primary>user</primary>
5339 <secondary>trusted</secondary>
5340 </indexterm>
5341 This option sets the address of the envelope sender of a locally-generated
5342 message (also known as the return path). The option can normally be used only
5343 by a trusted user, but <option>untrusted_set_sender</option> can be set to allow untrusted
5344 users to use it.
5345 </para>
5346 <para>
5347 Processes running as root or the Exim user are always trusted. Other
5348 trusted users are defined by the <option>trusted_users</option> or <option>trusted_groups</option>
5349 options. In the absence of <option>-f</option>, or if the caller is not trusted, the sender
5350 of a local message is set to the caller&#x2019;s login name at the default qualify
5351 domain.
5352 </para>
5353 <para>
5354 There is one exception to the restriction on the use of <option>-f</option>: an empty sender
5355 can be specified by any user, trusted or not, to create a message that can
5356 never provoke a bounce. An empty sender can be specified either as an empty
5357 string, or as a pair of angle brackets with nothing between them, as in these
5358 examples of shell commands:
5359 </para>
5360 <literallayout class="monospaced">
5361 exim -f '&lt;&gt;' user@domain
5362 exim -f "" user@domain
5363 </literallayout>
5364 <para>
5365 In addition, the use of <option>-f</option> is not restricted when testing a filter file
5366 with <option>-bf</option> or when testing or verifying addresses using the <option>-bt</option> or
5367 <option>-bv</option> options.
5368 </para>
5369 <para>
5370 Allowing untrusted users to change the sender address does not of itself make
5371 it possible to send anonymous mail. Exim still checks that the <emphasis>From:</emphasis> header
5372 refers to the local user, and if it does not, it adds a <emphasis>Sender:</emphasis> header,
5373 though this can be overridden by setting <option>no_local_from_check</option>.
5374 </para>
5375 <para>
5376 White
5377 <indexterm role="concept">
5378 <primary><quote>From</quote> line</primary>
5379 </indexterm>
5380 space between <option>-f</option> and the &lt;<emphasis>address</emphasis>&gt; is optional (that is, they can be
5381 given as two arguments or one combined argument). The sender of a
5382 locally-generated message can also be set (when permitted) by an initial
5383 <quote>From&nbsp;</quote> line in the message &ndash; see the description of <option>-bm</option> above &ndash; but
5384 if <option>-f</option> is also present, it overrides <quote>From&nbsp;</quote>.
5385 </para>
5386 </listitem></varlistentry>
5387 <varlistentry>
5388 <term><option>-G</option></term>
5389 <listitem>
5390 <para>
5391 <indexterm role="option">
5392 <primary><option>-G</option></primary>
5393 </indexterm>
5394 <indexterm role="concept">
5395 <primary>submission fixups, suppressing (command-line)</primary>
5396 </indexterm>
5397 This option is equivalent to an ACL applying:
5398 </para>
5399 <literallayout class="monospaced">
5400 control = suppress_local_fixups
5401 </literallayout>
5402 <para>
5403 for every message received.  Note that Sendmail will complain about such
5404 bad formatting, where Exim silently just does not fix it up.  This may change
5405 in future.
5406 </para>
5407 <para>
5408 As this affects audit information, the caller must be a trusted user to use
5409 this option.
5410 </para>
5411 </listitem></varlistentry>
5412 <varlistentry>
5413 <term><option>-h</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
5414 <listitem>
5415 <para>
5416 <indexterm role="option">
5417 <primary><option>-h</option></primary>
5418 </indexterm>
5419 <indexterm role="concept">
5420 <primary>Sendmail compatibility</primary>
5421 <secondary><option>-h</option> option ignored</secondary>
5422 </indexterm>
5423 This option is accepted for compatibility with Sendmail, but has no effect. (In
5424 Sendmail it overrides the <quote>hop count</quote> obtained by counting <emphasis>Received:</emphasis>
5425 headers.)
5426 </para>
5427 </listitem></varlistentry>
5428 <varlistentry>
5429 <term><option>-i</option></term>
5430 <listitem>
5431 <para>
5432 <indexterm role="option">
5433 <primary><option>-i</option></primary>
5434 </indexterm>
5435 <indexterm role="concept">
5436 <primary>Solaris</primary>
5437 <secondary><emphasis>mail</emphasis> command</secondary>
5438 </indexterm>
5439 <indexterm role="concept">
5440 <primary>dot</primary>
5441 <secondary>in incoming non-SMTP message</secondary>
5442 </indexterm>
5443 This option, which has the same effect as <option>-oi</option>, specifies that a dot on a
5444 line by itself should not terminate an incoming, non-SMTP message. I can find
5445 no documentation for this option in Solaris 2.4 Sendmail, but the <emphasis>mailx</emphasis>
5446 command in Solaris 2.4 uses it. See also <option>-ti</option>.
5447 </para>
5448 </listitem></varlistentry>
5449 <varlistentry>
5450 <term><option>-L</option>&nbsp;&lt;<emphasis>tag</emphasis>&gt;</term>
5451 <listitem>
5452 <para>
5453 <indexterm role="option">
5454 <primary><option>-L</option></primary>
5455 </indexterm>
5456 <indexterm role="concept">
5457 <primary>syslog</primary>
5458 <secondary>process name; set with flag</secondary>
5459 </indexterm>
5460 This option is equivalent to setting <option>syslog_processname</option> in the config
5461 file and setting <option>log_file_path</option> to <literal>syslog</literal>.
5462 Its use is restricted to administrators.  The configuration file has to be
5463 read and parsed, to determine access rights, before this is set and takes
5464 effect, so early configuration file errors will not honour this flag.
5465 </para>
5466 <para>
5467 The tag should not be longer than 32 characters.
5468 </para>
5469 </listitem></varlistentry>
5470 <varlistentry>
5471 <term><option>-M</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5472 <listitem>
5473 <para>
5474 <indexterm role="option">
5475 <primary><option>-M</option></primary>
5476 </indexterm>
5477 <indexterm role="concept">
5478 <primary>forcing delivery</primary>
5479 </indexterm>
5480 <indexterm role="concept">
5481 <primary>delivery</primary>
5482 <secondary>forcing attempt</secondary>
5483 </indexterm>
5484 <indexterm role="concept">
5485 <primary>frozen messages</primary>
5486 <secondary>forcing delivery</secondary>
5487 </indexterm>
5488 This option requests Exim to run a delivery attempt on each message in turn. If
5489 any of the messages are frozen, they are automatically thawed before the
5490 delivery attempt. The settings of <option>queue_domains</option>, <option>queue_smtp_domains</option>,
5491 and <option>hold_domains</option> are ignored.
5492 </para>
5493 <para>
5494 Retry
5495 <indexterm role="concept">
5496 <primary>hints database</primary>
5497 <secondary>overriding retry hints</secondary>
5498 </indexterm>
5499 hints for any of the addresses are overridden &ndash; Exim tries to deliver even if
5500 the normal retry time has not yet been reached. This option requires the caller
5501 to be an admin user. However, there is an option called <option>prod_requires_admin</option>
5502 which can be set false to relax this restriction (and also the same requirement
5503 for the <option>-q</option>, <option>-R</option>, and <option>-S</option> options).
5504 </para>
5505 <para>
5506 The deliveries happen synchronously, that is, the original Exim process does
5507 not terminate until all the delivery attempts have finished. No output is
5508 produced unless there is a serious error. If you want to see what is happening,
5509 use the <option>-v</option> option as well, or inspect Exim&#x2019;s main log.
5510 </para>
5511 </listitem></varlistentry>
5512 <varlistentry>
5513 <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>
5514 <listitem>
5515 <para>
5516 <indexterm role="option">
5517 <primary><option>-Mar</option></primary>
5518 </indexterm>
5519 <indexterm role="concept">
5520 <primary>message</primary>
5521 <secondary>adding recipients</secondary>
5522 </indexterm>
5523 <indexterm role="concept">
5524 <primary>recipient</primary>
5525 <secondary>adding</secondary>
5526 </indexterm>
5527 This option requests Exim to add the addresses to the list of recipients of the
5528 message (<quote>ar</quote> for <quote>add recipients</quote>). The first argument must be a message
5529 id, and the remaining ones must be email addresses. However, if the message is
5530 active (in the middle of a delivery attempt), it is not altered. This option
5531 can be used only by an admin user.
5532 </para>
5533 </listitem></varlistentry>
5534 <varlistentry>
5535 <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>
5536 <listitem>
5537 <para>
5538 <indexterm role="option">
5539 <primary><option>-MC</option></primary>
5540 </indexterm>
5541 <indexterm role="concept">
5542 <primary>SMTP</primary>
5543 <secondary>passed connection</secondary>
5544 </indexterm>
5545 <indexterm role="concept">
5546 <primary>SMTP</primary>
5547 <secondary>multiple deliveries</secondary>
5548 </indexterm>
5549 <indexterm role="concept">
5550 <primary>multiple SMTP deliveries</primary>
5551 </indexterm>
5552 This option is not intended for use by external callers. It is used internally
5553 by Exim to invoke another instance of itself to deliver a waiting message using
5554 an existing SMTP connection, which is passed as the standard input. Details are
5555 given in chapter <xref linkend="CHAPSMTP"/>. This must be the final option, and the caller
5556 must be root or the Exim user in order to use it.
5557 </para>
5558 </listitem></varlistentry>
5559 <varlistentry>
5560 <term><option>-MCA</option></term>
5561 <listitem>
5562 <para>
5563 <indexterm role="option">
5564 <primary><option>-MCA</option></primary>
5565 </indexterm>
5566 This option is not intended for use by external callers. It is used internally
5567 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5568 connection to the remote host has been authenticated.
5569 </para>
5570 </listitem></varlistentry>
5571 <varlistentry>
5572 <term><option>-MCP</option></term>
5573 <listitem>
5574 <para>
5575 <indexterm role="option">
5576 <primary><option>-MCP</option></primary>
5577 </indexterm>
5578 This option is not intended for use by external callers. It is used internally
5579 by Exim in conjunction with the <option>-MC</option> option. It signifies that the server to
5580 which Exim is connected supports pipelining.
5581 </para>
5582 </listitem></varlistentry>
5583 <varlistentry>
5584 <term><option>-MCQ</option>&nbsp;&lt;<emphasis>process&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>pipe&nbsp;fd</emphasis>&gt;</term>
5585 <listitem>
5586 <para>
5587 <indexterm role="option">
5588 <primary><option>-MCQ</option></primary>
5589 </indexterm>
5590 This option is not intended for use by external callers. It is used internally
5591 by Exim in conjunction with the <option>-MC</option> option when the original delivery was
5592 started by a queue runner. It passes on the process id of the queue runner,
5593 together with the file descriptor number of an open pipe. Closure of the pipe
5594 signals the final completion of the sequence of processes that are passing
5595 messages through the same SMTP connection.
5596 </para>
5597 </listitem></varlistentry>
5598 <varlistentry>
5599 <term><option>-MCS</option></term>
5600 <listitem>
5601 <para>
5602 <indexterm role="option">
5603 <primary><option>-MCS</option></primary>
5604 </indexterm>
5605 This option is not intended for use by external callers. It is used internally
5606 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5607 SMTP SIZE option should be used on messages delivered down the existing
5608 connection.
5609 </para>
5610 </listitem></varlistentry>
5611 <varlistentry>
5612 <term><option>-MCT</option></term>
5613 <listitem>
5614 <para>
5615 <indexterm role="option">
5616 <primary><option>-MCT</option></primary>
5617 </indexterm>
5618 This option is not intended for use by external callers. It is used internally
5619 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5620 host to which Exim is connected supports TLS encryption.
5621 </para>
5622 </listitem></varlistentry>
5623 <varlistentry>
5624 <term><option>-Mc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5625 <listitem>
5626 <para>
5627 <indexterm role="option">
5628 <primary><option>-Mc</option></primary>
5629 </indexterm>
5630 <indexterm role="concept">
5631 <primary>hints database</primary>
5632 <secondary>not overridden by <option>-Mc</option></secondary>
5633 </indexterm>
5634 <indexterm role="concept">
5635 <primary>delivery</primary>
5636 <secondary>manually started &ndash; not forced</secondary>
5637 </indexterm>
5638 This option requests Exim to run a delivery attempt on each message in turn,
5639 but unlike the <option>-M</option> option, it does check for retry hints, and respects any
5640 that are found. This option is not very useful to external callers. It is
5641 provided mainly for internal use by Exim when it needs to re-invoke itself in
5642 order to regain root privilege for a delivery (see chapter <xref linkend="CHAPsecurity"/>).
5643 However, <option>-Mc</option> can be useful when testing, in order to run a delivery that
5644 respects retry times and other options such as <option>hold_domains</option> that are
5645 overridden when <option>-M</option> is used. Such a delivery does not count as a queue run.
5646 If you want to run a specific delivery as if in a queue run, you should use
5647 <option>-q</option> with a message id argument. A distinction between queue run deliveries
5648 and other deliveries is made in one or two places.
5649 </para>
5650 </listitem></varlistentry>
5651 <varlistentry>
5652 <term><option>-Mes</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5653 <listitem>
5654 <para>
5655 <indexterm role="option">
5656 <primary><option>-Mes</option></primary>
5657 </indexterm>
5658 <indexterm role="concept">
5659 <primary>message</primary>
5660 <secondary>changing sender</secondary>
5661 </indexterm>
5662 <indexterm role="concept">
5663 <primary>sender</primary>
5664 <secondary>changing</secondary>
5665 </indexterm>
5666 This option requests Exim to change the sender address in the message to the
5667 given address, which must be a fully qualified address or <quote>&lt;&gt;</quote> (<quote>es</quote> for
5668 <quote>edit sender</quote>). There must be exactly two arguments. The first argument must
5669 be a message id, and the second one an email address. However, if the message
5670 is active (in the middle of a delivery attempt), its status is not altered.
5671 This option can be used only by an admin user.
5672 </para>
5673 </listitem></varlistentry>
5674 <varlistentry>
5675 <term><option>-Mf</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5676 <listitem>
5677 <para>
5678 <indexterm role="option">
5679 <primary><option>-Mf</option></primary>
5680 </indexterm>
5681 <indexterm role="concept">
5682 <primary>freezing messages</primary>
5683 </indexterm>
5684 <indexterm role="concept">
5685 <primary>message</primary>
5686 <secondary>manually freezing</secondary>
5687 </indexterm>
5688 This option requests Exim to mark each listed message as <quote>frozen</quote>. This
5689 prevents any delivery attempts taking place until the message is <quote>thawed</quote>,
5690 either manually or as a result of the <option>auto_thaw</option> configuration option.
5691 However, if any of the messages are active (in the middle of a delivery
5692 attempt), their status is not altered. This option can be used only by an admin
5693 user.
5694 </para>
5695 </listitem></varlistentry>
5696 <varlistentry>
5697 <term><option>-Mg</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5698 <listitem>
5699 <para>
5700 <indexterm role="option">
5701 <primary><option>-Mg</option></primary>
5702 </indexterm>
5703 <indexterm role="concept">
5704 <primary>giving up on messages</primary>
5705 </indexterm>
5706 <indexterm role="concept">
5707 <primary>message</primary>
5708 <secondary>abandoning delivery attempts</secondary>
5709 </indexterm>
5710 <indexterm role="concept">
5711 <primary>delivery</primary>
5712 <secondary>abandoning further attempts</secondary>
5713 </indexterm>
5714 This option requests Exim to give up trying to deliver the listed messages,
5715 including any that are frozen. However, if any of the messages are active,
5716 their status is not altered. For non-bounce messages, a delivery error message
5717 is sent to the sender, containing the text <quote>cancelled by administrator</quote>.
5718 Bounce messages are just discarded. This option can be used only by an admin
5719 user.
5720 </para>
5721 </listitem></varlistentry>
5722 <varlistentry>
5723 <term><option>-Mmad</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5724 <listitem>
5725 <para>
5726 <indexterm role="option">
5727 <primary><option>-Mmad</option></primary>
5728 </indexterm>
5729 <indexterm role="concept">
5730 <primary>delivery</primary>
5731 <secondary>cancelling all</secondary>
5732 </indexterm>
5733 This option requests Exim to mark all the recipient addresses in the messages
5734 as already delivered (<quote>mad</quote> for <quote>mark all delivered</quote>). However, if any
5735 message is active (in the middle of a delivery attempt), its status is not
5736 altered. This option can be used only by an admin user.
5737 </para>
5738 </listitem></varlistentry>
5739 <varlistentry>
5740 <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>
5741 <listitem>
5742 <para>
5743 <indexterm role="option">
5744 <primary><option>-Mmd</option></primary>
5745 </indexterm>
5746 <indexterm role="concept">
5747 <primary>delivery</primary>
5748 <secondary>cancelling by address</secondary>
5749 </indexterm>
5750 <indexterm role="concept">
5751 <primary>recipient</primary>
5752 <secondary>removing</secondary>
5753 </indexterm>
5754 <indexterm role="concept">
5755 <primary>removing recipients</primary>
5756 </indexterm>
5757 This option requests Exim to mark the given addresses as already delivered
5758 (<quote>md</quote> for <quote>mark delivered</quote>). The first argument must be a message id, and
5759 the remaining ones must be email addresses. These are matched to recipient
5760 addresses in the message in a case-sensitive manner. If the message is active
5761 (in the middle of a delivery attempt), its status is not altered. This option
5762 can be used only by an admin user.
5763 </para>
5764 </listitem></varlistentry>
5765 <varlistentry>
5766 <term><option>-Mrm</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5767 <listitem>
5768 <para>
5769 <indexterm role="option">
5770 <primary><option>-Mrm</option></primary>
5771 </indexterm>
5772 <indexterm role="concept">
5773 <primary>removing messages</primary>
5774 </indexterm>
5775 <indexterm role="concept">
5776 <primary>abandoning mail</primary>
5777 </indexterm>
5778 <indexterm role="concept">
5779 <primary>message</primary>
5780 <secondary>manually discarding</secondary>
5781 </indexterm>
5782 This option requests Exim to remove the given messages from the queue. No
5783 bounce messages are sent; each message is simply forgotten. However, if any of
5784 the messages are active, their status is not altered. This option can be used
5785 only by an admin user or by the user who originally caused the message to be
5786 placed on the queue.
5787 </para>
5788 </listitem></varlistentry>
5789 <varlistentry>
5790 <term><option>-Mset</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5791 <listitem>
5792 <para>
5793 <indexterm role="option">
5794 <primary><option>-Mset</option></primary>
5795 </indexterm>
5796 <indexterm role="concept">
5797 <primary>testing</primary>
5798 <secondary>string expansion</secondary>
5799 </indexterm>
5800 <indexterm role="concept">
5801 <primary>expansion</primary>
5802 <secondary>testing</secondary>
5803 </indexterm>
5804 This option is useful only in conjunction with <option>-be</option> (that is, when testing
5805 string expansions). Exim loads the given message from its spool before doing
5806 the test expansions, thus setting message-specific variables such as
5807 <varname>$message_size</varname> and the header variables. The <varname>$recipients</varname> variable is made
5808 available. This feature is provided to make it easier to test expansions that
5809 make use of these variables. However, this option can be used only by an admin
5810 user. See also <option>-bem</option>.
5811 </para>
5812 </listitem></varlistentry>
5813 <varlistentry>
5814 <term><option>-Mt</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5815 <listitem>
5816 <para>
5817 <indexterm role="option">
5818 <primary><option>-Mt</option></primary>
5819 </indexterm>
5820 <indexterm role="concept">
5821 <primary>thawing messages</primary>
5822 </indexterm>
5823 <indexterm role="concept">
5824 <primary>unfreezing messages</primary>
5825 </indexterm>
5826 <indexterm role="concept">
5827 <primary>frozen messages</primary>
5828 <secondary>thawing</secondary>
5829 </indexterm>
5830 <indexterm role="concept">
5831 <primary>message</primary>
5832 <secondary>thawing frozen</secondary>
5833 </indexterm>
5834 This option requests Exim to <quote>thaw</quote> any of the listed messages that are
5835 <quote>frozen</quote>, so that delivery attempts can resume. However, if any of the
5836 messages are active, their status is not altered. This option can be used only
5837 by an admin user.
5838 </para>
5839 </listitem></varlistentry>
5840 <varlistentry>
5841 <term><option>-Mvb</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5842 <listitem>
5843 <para>
5844 <indexterm role="option">
5845 <primary><option>-Mvb</option></primary>
5846 </indexterm>
5847 <indexterm role="concept">
5848 <primary>listing</primary>
5849 <secondary>message body</secondary>
5850 </indexterm>
5851 <indexterm role="concept">
5852 <primary>message</primary>
5853 <secondary>listing body of</secondary>
5854 </indexterm>
5855 This option causes the contents of the message body (-D) spool file to be
5856 written to the standard output. This option can be used only by an admin user.
5857 </para>
5858 </listitem></varlistentry>
5859 <varlistentry>
5860 <term><option>-Mvc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5861 <listitem>
5862 <para>
5863 <indexterm role="option">
5864 <primary><option>-Mvc</option></primary>
5865 </indexterm>
5866 <indexterm role="concept">
5867 <primary>message</primary>
5868 <secondary>listing in RFC 2822 format</secondary>
5869 </indexterm>
5870 <indexterm role="concept">
5871 <primary>listing</primary>
5872 <secondary>message in RFC 2822 format</secondary>
5873 </indexterm>
5874 This option causes a copy of the complete message (header lines plus body) to
5875 be written to the standard output in RFC 2822 format. This option can be used
5876 only by an admin user.
5877 </para>
5878 </listitem></varlistentry>
5879 <varlistentry>
5880 <term><option>-Mvh</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5881 <listitem>
5882 <para>
5883 <indexterm role="option">
5884 <primary><option>-Mvh</option></primary>
5885 </indexterm>
5886 <indexterm role="concept">
5887 <primary>listing</primary>
5888 <secondary>message headers</secondary>
5889 </indexterm>
5890 <indexterm role="concept">
5891 <primary>header lines</primary>
5892 <secondary>listing</secondary>
5893 </indexterm>
5894 <indexterm role="concept">
5895 <primary>message</primary>
5896 <secondary>listing header lines</secondary>
5897 </indexterm>
5898 This option causes the contents of the message headers (-H) spool file to be
5899 written to the standard output. This option can be used only by an admin user.
5900 </para>
5901 </listitem></varlistentry>
5902 <varlistentry>
5903 <term><option>-Mvl</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5904 <listitem>
5905 <para>
5906 <indexterm role="option">
5907 <primary><option>-Mvl</option></primary>
5908 </indexterm>
5909 <indexterm role="concept">
5910 <primary>listing</primary>
5911 <secondary>message log</secondary>
5912 </indexterm>
5913 <indexterm role="concept">
5914 <primary>message</primary>
5915 <secondary>listing message log</secondary>
5916 </indexterm>
5917 This option causes the contents of the message log spool file to be written to
5918 the standard output. This option can be used only by an admin user.
5919 </para>
5920 </listitem></varlistentry>
5921 <varlistentry>
5922 <term><option>-m</option></term>
5923 <listitem>
5924 <para>
5925 <indexterm role="option">
5926 <primary><option>-m</option></primary>
5927 </indexterm>
5928 This is apparently a synonym for <option>-om</option> that is accepted by Sendmail, so Exim
5929 treats it that way too.
5930 </para>
5931 </listitem></varlistentry>
5932 <varlistentry>
5933 <term><option>-N</option></term>
5934 <listitem>
5935 <para>
5936 <indexterm role="option">
5937 <primary><option>-N</option></primary>
5938 </indexterm>
5939 <indexterm role="concept">
5940 <primary>debugging</primary>
5941 <secondary><option>-N</option> option</secondary>
5942 </indexterm>
5943 <indexterm role="concept">
5944 <primary>debugging</primary>
5945 <secondary>suppressing delivery</secondary>
5946 </indexterm>
5947 This is a debugging option that inhibits delivery of a message at the transport
5948 level. It implies <option>-v</option>. Exim goes through many of the motions of delivery &ndash;
5949 it just doesn&#x2019;t actually transport the message, but instead behaves as if it
5950 had successfully done so. However, it does not make any updates to the retry
5951 database, and the log entries for deliveries are flagged with <quote>*&gt;</quote> rather
5952 than <quote>=&gt;</quote>.
5953 </para>
5954 <para>
5955 Because <option>-N</option> discards any message to which it applies, only root or the Exim
5956 user are allowed to use it with <option>-bd</option>, <option>-q</option>, <option>-R</option> or <option>-M</option>. In other
5957 words, an ordinary user can use it only when supplying an incoming message to
5958 which it will apply. Although transportation never fails when <option>-N</option> is set, an
5959 address may be deferred because of a configuration problem on a transport, or a
5960 routing problem. Once <option>-N</option> has been used for a delivery attempt, it sticks to
5961 the message, and applies to any subsequent delivery attempts that may happen
5962 for that message.
5963 </para>
5964 </listitem></varlistentry>
5965 <varlistentry>
5966 <term><option>-n</option></term>
5967 <listitem>
5968 <para>
5969 <indexterm role="option">
5970 <primary><option>-n</option></primary>
5971 </indexterm>
5972 This option is interpreted by Sendmail to mean <quote>no aliasing</quote>.
5973 For normal modes of operation, it is ignored by Exim.
5974 When combined with <option>-bP</option> it suppresses the name of an option from being output.
5975 </para>
5976 </listitem></varlistentry>
5977 <varlistentry>
5978 <term><option>-O</option>&nbsp;&lt;<emphasis>data</emphasis>&gt;</term>
5979 <listitem>
5980 <para>
5981 <indexterm role="option">
5982 <primary><option>-O</option></primary>
5983 </indexterm>
5984 This option is interpreted by Sendmail to mean <literal>set option</literal>. It is ignored by
5985 Exim.
5986 </para>
5987 </listitem></varlistentry>
5988 <varlistentry>
5989 <term><option>-oA</option>&nbsp;&lt;<emphasis>file&nbsp;name</emphasis>&gt;</term>
5990 <listitem>
5991 <para>
5992 <indexterm role="option">
5993 <primary><option>-oA</option></primary>
5994 </indexterm>
5995 <indexterm role="concept">
5996 <primary>Sendmail compatibility</primary>
5997 <secondary><option>-oA</option> option</secondary>
5998 </indexterm>
5999 This option is used by Sendmail in conjunction with <option>-bi</option> to specify an
6000 alternative alias file name. Exim handles <option>-bi</option> differently; see the
6001 description above.
6002 </para>
6003 </listitem></varlistentry>
6004 <varlistentry>
6005 <term><option>-oB</option>&nbsp;&lt;<emphasis>n</emphasis>&gt;</term>
6006 <listitem>
6007 <para>
6008 <indexterm role="option">
6009 <primary><option>-oB</option></primary>
6010 </indexterm>
6011 <indexterm role="concept">
6012 <primary>SMTP</primary>
6013 <secondary>passed connection</secondary>
6014 </indexterm>
6015 <indexterm role="concept">
6016 <primary>SMTP</primary>
6017 <secondary>multiple deliveries</secondary>
6018 </indexterm>
6019 <indexterm role="concept">
6020 <primary>multiple SMTP deliveries</primary>
6021 </indexterm>
6022 This is a debugging option which limits the maximum number of messages that can
6023 be delivered down one SMTP connection, overriding the value set in any <command>smtp</command>
6024 transport. If &lt;<emphasis>n</emphasis>&gt; is omitted, the limit is set to 1.
6025 </para>
6026 </listitem></varlistentry>
6027 <varlistentry>
6028 <term><option>-odb</option></term>
6029 <listitem>
6030 <para>
6031 <indexterm role="option">
6032 <primary><option>-odb</option></primary>
6033 </indexterm>
6034 <indexterm role="concept">
6035 <primary>background delivery</primary>
6036 </indexterm>
6037 <indexterm role="concept">
6038 <primary>delivery</primary>
6039 <secondary>in the background</secondary>
6040 </indexterm>
6041 This option applies to all modes in which Exim accepts incoming messages,
6042 including the listening daemon. It requests <quote>background</quote> delivery of such
6043 messages, which means that the accepting process automatically starts a
6044 delivery process for each message received, but does not wait for the delivery
6045 processes to finish.
6046 </para>
6047 <para>
6048 When all the messages have been received, the reception process exits,
6049 leaving the delivery processes to finish in their own time. The standard output
6050 and error streams are closed at the start of each delivery process.
6051 This is the default action if none of the <option>-od</option> options are present.
6052 </para>
6053 <para>
6054 If one of the queueing options in the configuration file
6055 (<option>queue_only</option> or <option>queue_only_file</option>, for example) is in effect, <option>-odb</option>
6056 overrides it if <option>queue_only_override</option> is set true, which is the default
6057 setting. If <option>queue_only_override</option> is set false, <option>-odb</option> has no effect.
6058 </para>
6059 </listitem></varlistentry>
6060 <varlistentry>
6061 <term><option>-odf</option></term>
6062 <listitem>
6063 <para>
6064 <indexterm role="option">
6065 <primary><option>-odf</option></primary>
6066 </indexterm>
6067 <indexterm role="concept">
6068 <primary>foreground delivery</primary>
6069 </indexterm>
6070 <indexterm role="concept">
6071 <primary>delivery</primary>
6072 <secondary>in the foreground</secondary>
6073 </indexterm>
6074 This option requests <quote>foreground</quote> (synchronous) delivery when Exim has
6075 accepted a locally-generated message. (For the daemon it is exactly the same as
6076 <option>-odb</option>.) A delivery process is automatically started to deliver the message,
6077 and Exim waits for it to complete before proceeding.
6078 </para>
6079 <para>
6080 The original Exim reception process does not finish until the delivery
6081 process for the final message has ended. The standard error stream is left open
6082 during deliveries.
6083 </para>
6084 <para>
6085 However, like <option>-odb</option>, this option has no effect if <option>queue_only_override</option> is
6086 false and one of the queueing options in the configuration file is in effect.
6087 </para>
6088 <para>
6089 If there is a temporary delivery error during foreground delivery, the
6090 message is left on the queue for later delivery, and the original reception
6091 process exits. See chapter <xref linkend="CHAPnonqueueing"/> for a way of setting up a
6092 restricted configuration that never queues messages.
6093 </para>
6094 </listitem></varlistentry>
6095 <varlistentry>
6096 <term><option>-odi</option></term>
6097 <listitem>
6098 <para>
6099 <indexterm role="option">
6100 <primary><option>-odi</option></primary>
6101 </indexterm>
6102 This option is synonymous with <option>-odf</option>. It is provided for compatibility with
6103 Sendmail.
6104 </para>
6105 </listitem></varlistentry>
6106 <varlistentry>
6107 <term><option>-odq</option></term>
6108 <listitem>
6109 <para>
6110 <indexterm role="option">
6111 <primary><option>-odq</option></primary>
6112 </indexterm>
6113 <indexterm role="concept">
6114 <primary>non-immediate delivery</primary>
6115 </indexterm>
6116 <indexterm role="concept">
6117 <primary>delivery</primary>
6118 <secondary>suppressing immediate</secondary>
6119 </indexterm>
6120 <indexterm role="concept">
6121 <primary>queueing incoming messages</primary>
6122 </indexterm>
6123 This option applies to all modes in which Exim accepts incoming messages,
6124 including the listening daemon. It specifies that the accepting process should
6125 not automatically start a delivery process for each message received. Messages
6126 are placed on the queue, and remain there until a subsequent queue runner
6127 process encounters them. There are several configuration options (such as
6128 <option>queue_only</option>) that can be used to queue incoming messages under certain
6129 conditions. This option overrides all of them and also <option>-odqs</option>. It always
6130 forces queueing.
6131 </para>
6132 </listitem></varlistentry>
6133 <varlistentry>
6134 <term><option>-odqs</option></term>
6135 <listitem>
6136 <para>
6137 <indexterm role="option">
6138 <primary><option>-odqs</option></primary>
6139 </indexterm>
6140 <indexterm role="concept">
6141 <primary>SMTP</primary>
6142 <secondary>delaying delivery</secondary>
6143 </indexterm>
6144 This option is a hybrid between <option>-odb</option>/<option>-odi</option> and <option>-odq</option>.
6145 However, like <option>-odb</option> and <option>-odi</option>, this option has no effect if
6146 <option>queue_only_override</option> is false and one of the queueing options in the
6147 configuration file is in effect.
6148 </para>
6149 <para>
6150 When <option>-odqs</option> does operate, a delivery process is started for each incoming
6151 message, in the background by default, but in the foreground if <option>-odi</option> is
6152 also present. The recipient addresses are routed, and local deliveries are done
6153 in the normal way. However, if any SMTP deliveries are required, they are not
6154 done at this time, so the message remains on the queue until a subsequent queue
6155 runner process encounters it. Because routing was done, Exim knows which
6156 messages are waiting for which hosts, and so a number of messages for the same
6157 host can be sent in a single SMTP connection. The <option>queue_smtp_domains</option>
6158 configuration option has the same effect for specific domains. See also the
6159 <option>-qq</option> option.
6160 </para>
6161 </listitem></varlistentry>
6162 <varlistentry>
6163 <term><option>-oee</option></term>
6164 <listitem>
6165 <para>
6166 <indexterm role="option">
6167 <primary><option>-oee</option></primary>
6168 </indexterm>
6169 <indexterm role="concept">
6170 <primary>error</primary>
6171 <secondary>reporting</secondary>
6172 </indexterm>
6173 If an error is detected while a non-SMTP message is being received (for
6174 example, a malformed address), the error is reported to the sender in a mail
6175 message.
6176 </para>
6177 <para>
6178 <indexterm role="concept">
6179 <primary>return code</primary>
6180 <secondary>for <option>-oee</option></secondary>
6181 </indexterm>
6182 Provided
6183 this error message is successfully sent, the Exim receiving process
6184 exits with a return code of zero. If not, the return code is 2 if the problem
6185 is that the original message has no recipients, or 1 for any other error.
6186 This is the default <option>-oe</option><emphasis>x</emphasis> option if Exim is called as <emphasis>rmail</emphasis>.
6187 </para>
6188 </listitem></varlistentry>
6189 <varlistentry>
6190 <term><option>-oem</option></term>
6191 <listitem>
6192 <para>
6193 <indexterm role="option">
6194 <primary><option>-oem</option></primary>
6195 </indexterm>
6196 <indexterm role="concept">
6197 <primary>error</primary>
6198 <secondary>reporting</secondary>
6199 </indexterm>
6200 <indexterm role="concept">
6201 <primary>return code</primary>
6202 <secondary>for <option>-oem</option></secondary>
6203 </indexterm>
6204 This is the same as <option>-oee</option>, except that Exim always exits with a non-zero
6205 return code, whether or not the error message was successfully sent.
6206 This is the default <option>-oe</option><emphasis>x</emphasis> option, unless Exim is called as <emphasis>rmail</emphasis>.
6207 </para>
6208 </listitem></varlistentry>
6209 <varlistentry>
6210 <term><option>-oep</option></term>
6211 <listitem>
6212 <para>
6213 <indexterm role="option">
6214 <primary><option>-oep</option></primary>
6215 </indexterm>
6216 <indexterm role="concept">
6217 <primary>error</primary>
6218 <secondary>reporting</secondary>
6219 </indexterm>
6220 If an error is detected while a non-SMTP message is being received, the
6221 error is reported by writing a message to the standard error file (stderr).
6222 <indexterm role="concept">
6223 <primary>return code</primary>
6224 <secondary>for <option>-oep</option></secondary>
6225 </indexterm>
6226 The return code is 1 for all errors.
6227 </para>
6228 </listitem></varlistentry>
6229 <varlistentry>
6230 <term><option>-oeq</option></term>
6231 <listitem>
6232 <para>
6233 <indexterm role="option">
6234 <primary><option>-oeq</option></primary>
6235 </indexterm>
6236 <indexterm role="concept">
6237 <primary>error</primary>
6238 <secondary>reporting</secondary>
6239 </indexterm>
6240 This option is supported for compatibility with Sendmail, but has the same
6241 effect as <option>-oep</option>.
6242 </para>
6243 </listitem></varlistentry>
6244 <varlistentry>
6245 <term><option>-oew</option></term>
6246 <listitem>
6247 <para>
6248 <indexterm role="option">
6249 <primary><option>-oew</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>-oem</option>.
6257 </para>
6258 </listitem></varlistentry>
6259 <varlistentry>
6260 <term><option>-oi</option></term>
6261 <listitem>
6262 <para>
6263 <indexterm role="option">
6264 <primary><option>-oi</option></primary>
6265 </indexterm>
6266 <indexterm role="concept">
6267 <primary>dot</primary>
6268 <secondary>in incoming non-SMTP message</secondary>
6269 </indexterm>
6270 This option, which has the same effect as <option>-i</option>, specifies that a dot on a
6271 line by itself should not terminate an incoming, non-SMTP message. Otherwise, a
6272 single dot does terminate, though Exim does no special processing for other
6273 lines that start with a dot. This option is set by default if Exim is called as
6274 <emphasis>rmail</emphasis>. See also <option>-ti</option>.
6275 </para>
6276 </listitem></varlistentry>
6277 <varlistentry>
6278 <term><option>-oitrue</option></term>
6279 <listitem>
6280 <para>
6281 <indexterm role="option">
6282 <primary><option>-oitrue</option></primary>
6283 </indexterm>
6284 This option is treated as synonymous with <option>-oi</option>.
6285 </para>
6286 </listitem></varlistentry>
6287 <varlistentry>
6288 <term><option>-oMa</option>&nbsp;&lt;<emphasis>host&nbsp;address</emphasis>&gt;</term>
6289 <listitem>
6290 <para>
6291 <indexterm role="option">
6292 <primary><option>-oMa</option></primary>
6293 </indexterm>
6294 <indexterm role="concept">
6295 <primary>sender</primary>
6296 <secondary>host address, specifying for local message</secondary>
6297 </indexterm>
6298 A number of options starting with <option>-oM</option> can be used to set values associated
6299 with remote hosts on locally-submitted messages (that is, messages not received
6300 over TCP/IP). These options can be used by any caller in conjunction with the
6301 <option>-bh</option>, <option>-be</option>, <option>-bf</option>, <option>-bF</option>, <option>-bt</option>, or <option>-bv</option> testing options. In
6302 other circumstances, they are ignored unless the caller is trusted.
6303 </para>
6304 <para>
6305 The <option>-oMa</option> option sets the sender host address. This may include a port
6306 number at the end, after a full stop (period). For example:
6307 </para>
6308 <literallayout class="monospaced">
6309 exim -bs -oMa 10.9.8.7.1234
6310 </literallayout>
6311 <para>
6312 An alternative syntax is to enclose the IP address in square brackets,
6313 followed by a colon and the port number:
6314 </para>
6315 <literallayout class="monospaced">
6316 exim -bs -oMa [10.9.8.7]:1234
6317 </literallayout>
6318 <para>
6319 The IP address is placed in the <varname>$sender_host_address</varname> variable, and the
6320 port, if present, in <varname>$sender_host_port</varname>. If both <option>-oMa</option> and <option>-bh</option>
6321 are present on the command line, the sender host IP address is taken from
6322 whichever one is last.
6323 </para>
6324 </listitem></varlistentry>
6325 <varlistentry>
6326 <term><option>-oMaa</option>&nbsp;&lt;<emphasis>name</emphasis>&gt;</term>
6327 <listitem>
6328 <para>
6329 <indexterm role="option">
6330 <primary><option>-oMaa</option></primary>
6331 </indexterm>
6332 <indexterm role="concept">
6333 <primary>authentication</primary>
6334 <secondary>name, specifying for local message</secondary>
6335 </indexterm>
6336 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMaa</option>
6337 option sets the value of <varname>$sender_host_authenticated</varname> (the authenticator
6338 name). See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of SMTP authentication.
6339 This option can be used with <option>-bh</option> and <option>-bs</option> to set up an
6340 authenticated SMTP session without actually using the SMTP AUTH command.
6341 </para>
6342 </listitem></varlistentry>
6343 <varlistentry>
6344 <term><option>-oMai</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6345 <listitem>
6346 <para>
6347 <indexterm role="option">
6348 <primary><option>-oMai</option></primary>
6349 </indexterm>
6350 <indexterm role="concept">
6351 <primary>authentication</primary>
6352 <secondary>id, specifying for local message</secondary>
6353 </indexterm>
6354 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMai</option>
6355 option sets the value of <varname>$authenticated_id</varname> (the id that was authenticated).
6356 This overrides the default value (the caller&#x2019;s login id, except with <option>-bh</option>,
6357 where there is no default) for messages from local sources. See chapter
6358 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated ids.
6359 </para>
6360 </listitem></varlistentry>
6361 <varlistentry>
6362 <term><option>-oMas</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
6363 <listitem>
6364 <para>
6365 <indexterm role="option">
6366 <primary><option>-oMas</option></primary>
6367 </indexterm>
6368 <indexterm role="concept">
6369 <primary>authentication</primary>
6370 <secondary>sender, specifying for local message</secondary>
6371 </indexterm>
6372 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMas</option>
6373 option sets the authenticated sender value in <varname>$authenticated_sender</varname>. It
6374 overrides the sender address that is created from the caller&#x2019;s login id for
6375 messages from local sources, except when <option>-bh</option> is used, when there is no
6376 default. For both <option>-bh</option> and <option>-bs</option>, an authenticated sender that is
6377 specified on a MAIL command overrides this value. See chapter
6378 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated senders.
6379 </para>
6380 </listitem></varlistentry>
6381 <varlistentry>
6382 <term><option>-oMi</option>&nbsp;&lt;<emphasis>interface&nbsp;address</emphasis>&gt;</term>
6383 <listitem>
6384 <para>
6385 <indexterm role="option">
6386 <primary><option>-oMi</option></primary>
6387 </indexterm>
6388 <indexterm role="concept">
6389 <primary>interface</primary>
6390 <secondary>address, specifying for local message</secondary>
6391 </indexterm>
6392 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMi</option>
6393 option sets the IP interface address value. A port number may be included,
6394 using the same syntax as for <option>-oMa</option>. The interface address is placed in
6395 <varname>$received_ip_address</varname> and the port number, if present, in <varname>$received_port</varname>.
6396 </para>
6397 </listitem></varlistentry>
6398 <varlistentry>
6399 <term><option>-oMm</option>&nbsp;&lt;<emphasis>message&nbsp;reference</emphasis>&gt;</term>
6400 <listitem>
6401 <para>
6402 <indexterm role="option">
6403 <primary><option>-oMm</option></primary>
6404 </indexterm>
6405 <indexterm role="concept">
6406 <primary>message reference</primary>
6407 <secondary>message reference, specifying for local message</secondary>
6408 </indexterm>
6409 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMm</option>
6410 option sets the message reference, e.g. message-id, and is logged during
6411 delivery. This is useful when some kind of audit trail is required to tie
6412 messages together. The format of the message reference is checked and will
6413 abort if the format is invalid. The option will only be accepted if exim is
6414 running in trusted mode, not as any regular user.
6415 </para>
6416 <para>
6417 The best example of a message reference is when Exim sends a bounce message.
6418 The message reference is the message-id of the original message for which Exim
6419 is sending the bounce.
6420 </para>
6421 </listitem></varlistentry>
6422 <varlistentry>
6423 <term><option>-oMr</option>&nbsp;&lt;<emphasis>protocol&nbsp;name</emphasis>&gt;</term>
6424 <listitem>
6425 <para>
6426 <indexterm role="option">
6427 <primary><option>-oMr</option></primary>
6428 </indexterm>
6429 <indexterm role="concept">
6430 <primary>protocol, specifying for local message</primary>
6431 </indexterm>
6432 <indexterm role="variable">
6433 <primary><varname>$received_protocol</varname></primary>
6434 </indexterm>
6435 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMr</option>
6436 option sets the received protocol value that is stored in
6437 <varname>$received_protocol</varname>. However, it does not apply (and is ignored) when <option>-bh</option>
6438 or <option>-bs</option> is used. For <option>-bh</option>, the protocol is forced to one of the standard
6439 SMTP protocol names (see the description of <varname>$received_protocol</varname> in section
6440 <xref linkend="SECTexpvar"/>). For <option>-bs</option>, the protocol is always <quote>local-</quote> followed by
6441 one of those same names. For <option>-bS</option> (batched SMTP) however, the protocol can
6442 be set by <option>-oMr</option>.
6443 </para>
6444 </listitem></varlistentry>
6445 <varlistentry>
6446 <term><option>-oMs</option>&nbsp;&lt;<emphasis>host&nbsp;name</emphasis>&gt;</term>
6447 <listitem>
6448 <para>
6449 <indexterm role="option">
6450 <primary><option>-oMs</option></primary>
6451 </indexterm>
6452 <indexterm role="concept">
6453 <primary>sender</primary>
6454 <secondary>host name, specifying for local message</secondary>
6455 </indexterm>
6456 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMs</option>
6457 option sets the sender host name in <varname>$sender_host_name</varname>. When this option is
6458 present, Exim does not attempt to look up a host name from an IP address; it
6459 uses the name it is given.
6460 </para>
6461 </listitem></varlistentry>
6462 <varlistentry>
6463 <term><option>-oMt</option>&nbsp;&lt;<emphasis>ident&nbsp;string</emphasis>&gt;</term>
6464 <listitem>
6465 <para>
6466 <indexterm role="option">
6467 <primary><option>-oMt</option></primary>
6468 </indexterm>
6469 <indexterm role="concept">
6470 <primary>sender</primary>
6471 <secondary>ident string, specifying for local message</secondary>
6472 </indexterm>
6473 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMt</option>
6474 option sets the sender ident value in <varname>$sender_ident</varname>. The default setting for
6475 local callers is the login id of the calling process, except when <option>-bh</option> is
6476 used, when there is no default.
6477 </para>
6478 </listitem></varlistentry>
6479 <varlistentry>
6480 <term><option>-om</option></term>
6481 <listitem>
6482 <para>
6483 <indexterm role="option">
6484 <primary><option>-om</option></primary>
6485 </indexterm>
6486 <indexterm role="concept">
6487 <primary>Sendmail compatibility</primary>
6488 <secondary><option>-om</option> option ignored</secondary>
6489 </indexterm>
6490 In Sendmail, this option means <quote>me too</quote>, indicating that the sender of a
6491 message should receive a copy of the message if the sender appears in an alias
6492 expansion. Exim always does this, so the option does nothing.
6493 </para>
6494 </listitem></varlistentry>
6495 <varlistentry>
6496 <term><option>-oo</option></term>
6497 <listitem>
6498 <para>
6499 <indexterm role="option">
6500 <primary><option>-oo</option></primary>
6501 </indexterm>
6502 <indexterm role="concept">
6503 <primary>Sendmail compatibility</primary>
6504 <secondary><option>-oo</option> option ignored</secondary>
6505 </indexterm>
6506 This option is ignored. In Sendmail it specifies <quote>old style headers</quote>,
6507 whatever that means.
6508 </para>
6509 </listitem></varlistentry>
6510 <varlistentry>
6511 <term><option>-oP</option>&nbsp;&lt;<emphasis>path</emphasis>&gt;</term>
6512 <listitem>
6513 <para>
6514 <indexterm role="option">
6515 <primary><option>-oP</option></primary>
6516 </indexterm>
6517 <indexterm role="concept">
6518 <primary>pid (process id)</primary>
6519 <secondary>of daemon</secondary>
6520 </indexterm>
6521 <indexterm role="concept">
6522 <primary>daemon</primary>
6523 <secondary>process id (pid)</secondary>
6524 </indexterm>
6525 This option is useful only in conjunction with <option>-bd</option> or <option>-q</option> with a time
6526 value. The option specifies the file to which the process id of the daemon is
6527 written. When <option>-oX</option> is used with <option>-bd</option>, or when <option>-q</option> with a time is used
6528 without <option>-bd</option>, this is the only way of causing Exim to write a pid file,
6529 because in those cases, the normal pid file is not used.
6530 </para>
6531 </listitem></varlistentry>
6532 <varlistentry>
6533 <term><option>-or</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6534 <listitem>
6535 <para>
6536 <indexterm role="option">
6537 <primary><option>-or</option></primary>
6538 </indexterm>
6539 <indexterm role="concept">
6540 <primary>timeout</primary>
6541 <secondary>for non-SMTP input</secondary>
6542 </indexterm>
6543 This option sets a timeout value for incoming non-SMTP messages. If it is not
6544 set, Exim will wait forever for the standard input. The value can also be set
6545 by the <option>receive_timeout</option> option. The format used for specifying times is
6546 described in section <xref linkend="SECTtimeformat"/>.
6547 </para>
6548 </listitem></varlistentry>
6549 <varlistentry>
6550 <term><option>-os</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6551 <listitem>
6552 <para>
6553 <indexterm role="option">
6554 <primary><option>-os</option></primary>
6555 </indexterm>
6556 <indexterm role="concept">
6557 <primary>timeout</primary>
6558 <secondary>for SMTP input</secondary>
6559 </indexterm>
6560 <indexterm role="concept">
6561 <primary>SMTP</primary>
6562 <secondary>input timeout</secondary>
6563 </indexterm>
6564 This option sets a timeout value for incoming SMTP messages. The timeout
6565 applies to each SMTP command and block of data. The value can also be set by
6566 the <option>smtp_receive_timeout</option> option; it defaults to 5 minutes. The format used
6567 for specifying times is described in section <xref linkend="SECTtimeformat"/>.
6568 </para>
6569 </listitem></varlistentry>
6570 <varlistentry>
6571 <term><option>-ov</option></term>
6572 <listitem>
6573 <para>
6574 <indexterm role="option">
6575 <primary><option>-ov</option></primary>
6576 </indexterm>
6577 This option has exactly the same effect as <option>-v</option>.
6578 </para>
6579 </listitem></varlistentry>
6580 <varlistentry>
6581 <term><option>-oX</option>&nbsp;&lt;<emphasis>number&nbsp;or&nbsp;string</emphasis>&gt;</term>
6582 <listitem>
6583 <para>
6584 <indexterm role="option">
6585 <primary><option>-oX</option></primary>
6586 </indexterm>
6587 <indexterm role="concept">
6588 <primary>TCP/IP</primary>
6589 <secondary>setting listening ports</secondary>
6590 </indexterm>
6591 <indexterm role="concept">
6592 <primary>TCP/IP</primary>
6593 <secondary>setting listening interfaces</secondary>
6594 </indexterm>
6595 <indexterm role="concept">
6596 <primary>port</primary>
6597 <secondary>receiving TCP/IP</secondary>
6598 </indexterm>
6599 This option is relevant only when the <option>-bd</option> (start listening daemon) option
6600 is also given. It controls which ports and interfaces the daemon uses. Details
6601 of the syntax, and how it interacts with configuration file options, are given
6602 in chapter <xref linkend="CHAPinterfaces"/>. When <option>-oX</option> is used to start a daemon, no pid
6603 file is written unless <option>-oP</option> is also present to specify a pid file name.
6604 </para>
6605 </listitem></varlistentry>
6606 <varlistentry>
6607 <term><option>-pd</option></term>
6608 <listitem>
6609 <para>
6610 <indexterm role="option">
6611 <primary><option>-pd</option></primary>
6612 </indexterm>
6613 <indexterm role="concept">
6614 <primary>Perl</primary>
6615 <secondary>starting the interpreter</secondary>
6616 </indexterm>
6617 This option applies when an embedded Perl interpreter is linked with Exim (see
6618 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6619 option, forcing the starting of the interpreter to be delayed until it is
6620 needed.
6621 </para>
6622 </listitem></varlistentry>
6623 <varlistentry>
6624 <term><option>-ps</option></term>
6625 <listitem>
6626 <para>
6627 <indexterm role="option">
6628 <primary><option>-ps</option></primary>
6629 </indexterm>
6630 <indexterm role="concept">
6631 <primary>Perl</primary>
6632 <secondary>starting the interpreter</secondary>
6633 </indexterm>
6634 This option applies when an embedded Perl interpreter is linked with Exim (see
6635 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6636 option, forcing the starting of the interpreter to occur as soon as Exim is
6637 started.
6638 </para>
6639 </listitem></varlistentry>
6640 <varlistentry>
6641 <term><option>-p</option>&lt;<emphasis>rval</emphasis>&gt;:&lt;<emphasis>sval</emphasis>&gt;</term>
6642 <listitem>
6643 <para>
6644 <indexterm role="option">
6645 <primary><option>-p</option></primary>
6646 </indexterm>
6647 For compatibility with Sendmail, this option is equivalent to
6648 </para>
6649 <literallayout>
6650 <literal>-oMr</literal> &lt;<emphasis>rval</emphasis>&gt; <literal>-oMs</literal> &lt;<emphasis>sval</emphasis>&gt;
6651 </literallayout>
6652 <para>
6653 It sets the incoming protocol and host name (for trusted callers). The
6654 host name and its colon can be omitted when only the protocol is to be set.
6655 Note the Exim already has two private options, <option>-pd</option> and <option>-ps</option>, that refer
6656 to embedded Perl. It is therefore impossible to set a protocol value of <literal>d</literal>
6657 or <literal>s</literal> using this option (but that does not seem a real limitation).
6658 </para>
6659 </listitem></varlistentry>
6660 <varlistentry>
6661 <term><option>-q</option></term>
6662 <listitem>
6663 <para>
6664 <indexterm role="option">
6665 <primary><option>-q</option></primary>
6666 </indexterm>
6667 <indexterm role="concept">
6668 <primary>queue runner</primary>
6669 <secondary>starting manually</secondary>
6670 </indexterm>
6671 This option is normally restricted to admin users. However, there is a
6672 configuration option called <option>prod_requires_admin</option> which can be set false to
6673 relax this restriction (and also the same requirement for the <option>-M</option>, <option>-R</option>,
6674 and <option>-S</option> options).
6675 </para>
6676 <para>
6677 <indexterm role="concept">
6678 <primary>queue runner</primary>
6679 <secondary>description of operation</secondary>
6680 </indexterm>
6681 The <option>-q</option> option starts one queue runner process. This scans the queue of
6682 waiting messages, and runs a delivery process for each one in turn. It waits
6683 for each delivery process to finish before starting the next one. A delivery
6684 process may not actually do any deliveries if the retry times for the addresses
6685 have not been reached. Use <option>-qf</option> (see below) if you want to override this.
6686 </para>
6687 <para>
6688 If
6689 <indexterm role="concept">
6690 <primary>SMTP</primary>
6691 <secondary>passed connection</secondary>
6692 </indexterm>
6693 <indexterm role="concept">
6694 <primary>SMTP</primary>
6695 <secondary>multiple deliveries</secondary>
6696 </indexterm>
6697 <indexterm role="concept">
6698 <primary>multiple SMTP deliveries</primary>
6699 </indexterm>
6700 the delivery process spawns other processes to deliver other messages down
6701 passed SMTP connections, the queue runner waits for these to finish before
6702 proceeding.
6703 </para>
6704 <para>
6705 When all the queued messages have been considered, the original queue runner
6706 process terminates. In other words, a single pass is made over the waiting
6707 mail, one message at a time. Use <option>-q</option> with a time (see below) if you want
6708 this to be repeated periodically.
6709 </para>
6710 <para>
6711 Exim processes the waiting messages in an unpredictable order. It isn&#x2019;t very
6712 random, but it is likely to be different each time, which is all that matters.
6713 If one particular message screws up a remote MTA, other messages to the same
6714 MTA have a chance of getting through if they get tried first.
6715 </para>
6716 <para>
6717 It is possible to cause the messages to be processed in lexical message id
6718 order, which is essentially the order in which they arrived, by setting the
6719 <option>queue_run_in_order</option> option, but this is not recommended for normal use.
6720 </para>
6721 </listitem></varlistentry>
6722 <varlistentry>
6723 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;</term>
6724 <listitem>
6725 <para>
6726 The <option>-q</option> option may be followed by one or more flag letters that change its
6727 behaviour. They are all optional, but if more than one is present, they must
6728 appear in the correct order. Each flag is described in a separate item below.
6729 </para>
6730 </listitem></varlistentry>
6731 <varlistentry>
6732 <term><option>-qq...</option></term>
6733 <listitem>
6734 <para>
6735 <indexterm role="option">
6736 <primary><option>-qq</option></primary>
6737 </indexterm>
6738 <indexterm role="concept">
6739 <primary>queue</primary>
6740 <secondary>double scanning</secondary>
6741 </indexterm>
6742 <indexterm role="concept">
6743 <primary>queue</primary>
6744 <secondary>routing</secondary>
6745 </indexterm>
6746 <indexterm role="concept">
6747 <primary>routing</primary>
6748 <secondary>whole queue before delivery</secondary>
6749 </indexterm>
6750 An option starting with <option>-qq</option> requests a two-stage queue run. In the first
6751 stage, the queue is scanned as if the <option>queue_smtp_domains</option> option matched
6752 every domain. Addresses are routed, local deliveries happen, but no remote
6753 transports are run.
6754 </para>
6755 <para>
6756 <indexterm role="concept">
6757 <primary>hints database</primary>
6758 <secondary>remembering routing</secondary>
6759 </indexterm>
6760 The hints database that remembers which messages are waiting for specific hosts
6761 is updated, as if delivery to those hosts had been deferred. After this is
6762 complete, a second, normal queue scan happens, with routing and delivery taking
6763 place as normal. Messages that are routed to the same host should mostly be
6764 delivered down a single SMTP
6765 <indexterm role="concept">
6766 <primary>SMTP</primary>
6767 <secondary>passed connection</secondary>
6768 </indexterm>
6769 <indexterm role="concept">
6770 <primary>SMTP</primary>
6771 <secondary>multiple deliveries</secondary>
6772 </indexterm>
6773 <indexterm role="concept">
6774 <primary>multiple SMTP deliveries</primary>
6775 </indexterm>
6776 connection because of the hints that were set up during the first queue scan.
6777 This option may be useful for hosts that are connected to the Internet
6778 intermittently.
6779 </para>
6780 </listitem></varlistentry>
6781 <varlistentry>
6782 <term><option>-q[q]i...</option></term>
6783 <listitem>
6784 <para>
6785 <indexterm role="option">
6786 <primary><option>-qi</option></primary>
6787 </indexterm>
6788 <indexterm role="concept">
6789 <primary>queue</primary>
6790 <secondary>initial delivery</secondary>
6791 </indexterm>
6792 If the <emphasis>i</emphasis> flag is present, the queue runner runs delivery processes only for
6793 those messages that haven&#x2019;t previously been tried. (<emphasis>i</emphasis> stands for <quote>initial
6794 delivery</quote>.) This can be helpful if you are putting messages on the queue using
6795 <option>-odq</option> and want a queue runner just to process the new messages.
6796 </para>
6797 </listitem></varlistentry>
6798 <varlistentry>
6799 <term><option>-q[q][i]f...</option></term>
6800 <listitem>
6801 <para>
6802 <indexterm role="option">
6803 <primary><option>-qf</option></primary>
6804 </indexterm>
6805 <indexterm role="concept">
6806 <primary>queue</primary>
6807 <secondary>forcing delivery</secondary>
6808 </indexterm>
6809 <indexterm role="concept">
6810 <primary>delivery</primary>
6811 <secondary>forcing in queue run</secondary>
6812 </indexterm>
6813 If one <emphasis>f</emphasis> flag is present, a delivery attempt is forced for each non-frozen
6814 message, whereas without <emphasis>f</emphasis> only those non-frozen addresses that have passed
6815 their retry times are tried.
6816 </para>
6817 </listitem></varlistentry>
6818 <varlistentry>
6819 <term><option>-q[q][i]ff...</option></term>
6820 <listitem>
6821 <para>
6822 <indexterm role="option">
6823 <primary><option>-qff</option></primary>
6824 </indexterm>
6825 <indexterm role="concept">
6826 <primary>frozen messages</primary>
6827 <secondary>forcing delivery</secondary>
6828 </indexterm>
6829 If <emphasis>ff</emphasis> is present, a delivery attempt is forced for every message, whether
6830 frozen or not.
6831 </para>
6832 </listitem></varlistentry>
6833 <varlistentry>
6834 <term><option>-q[q][i][f[f]]l</option></term>
6835 <listitem>
6836 <para>
6837 <indexterm role="option">
6838 <primary><option>-ql</option></primary>
6839 </indexterm>
6840 <indexterm role="concept">
6841 <primary>queue</primary>
6842 <secondary>local deliveries only</secondary>
6843 </indexterm>
6844 The <emphasis>l</emphasis> (the letter <quote>ell</quote>) flag specifies that only local deliveries are to
6845 be done. If a message requires any remote deliveries, it remains on the queue
6846 for later delivery.
6847 </para>
6848 </listitem></varlistentry>
6849 <varlistentry>
6850 <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>
6851 <listitem>
6852 <para>
6853 <indexterm role="concept">
6854 <primary>queue</primary>
6855 <secondary>delivering specific messages</secondary>
6856 </indexterm>
6857 When scanning the queue, Exim can be made to skip over messages whose ids are
6858 lexically less than a given value by following the <option>-q</option> option with a
6859 starting message id. For example:
6860 </para>
6861 <literallayout class="monospaced">
6862 exim -q 0t5C6f-0000c8-00
6863 </literallayout>
6864 <para>
6865 Messages that arrived earlier than <literal>0t5C6f-0000c8-00</literal> are not inspected. If a
6866 second message id is given, messages whose ids are lexically greater than it
6867 are also skipped. If the same id is given twice, for example,
6868 </para>
6869 <literallayout class="monospaced">
6870 exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00
6871 </literallayout>
6872 <para>
6873 just one delivery process is started, for that message. This differs from
6874 <option>-M</option> in that retry data is respected, and it also differs from <option>-Mc</option> in
6875 that it counts as a delivery from a queue run. Note that the selection
6876 mechanism does not affect the order in which the messages are scanned. There
6877 are also other ways of selecting specific sets of messages for delivery in a
6878 queue run &ndash; see <option>-R</option> and <option>-S</option>.
6879 </para>
6880 </listitem></varlistentry>
6881 <varlistentry>
6882 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;&lt;<emphasis>time</emphasis>&gt;</term>
6883 <listitem>
6884 <para>
6885 <indexterm role="concept">
6886 <primary>queue runner</primary>
6887 <secondary>starting periodically</secondary>
6888 </indexterm>
6889 <indexterm role="concept">
6890 <primary>periodic queue running</primary>
6891 </indexterm>
6892 When a time value is present, the <option>-q</option> option causes Exim to run as a daemon,
6893 starting a queue runner process at intervals specified by the given time value
6894 (whose format is described in section <xref linkend="SECTtimeformat"/>). This form of the
6895 <option>-q</option> option is commonly combined with the <option>-bd</option> option, in which case a
6896 single daemon process handles both functions. A common way of starting up a
6897 combined daemon at system boot time is to use a command such as
6898 </para>
6899 <literallayout class="monospaced">
6900 /usr/exim/bin/exim -bd -q30m
6901 </literallayout>
6902 <para>
6903 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
6904 process every 30 minutes.
6905 </para>
6906 <para>
6907 When a daemon is started by <option>-q</option> with a time value, but without <option>-bd</option>, no
6908 pid file is written unless one is explicitly requested by the <option>-oP</option> option.
6909 </para>
6910 </listitem></varlistentry>
6911 <varlistentry>
6912 <term><option>-qR</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6913 <listitem>
6914 <para>
6915 <indexterm role="option">
6916 <primary><option>-qR</option></primary>
6917 </indexterm>
6918 This option is synonymous with <option>-R</option>. It is provided for Sendmail
6919 compatibility.
6920 </para>
6921 </listitem></varlistentry>
6922 <varlistentry>
6923 <term><option>-qS</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6924 <listitem>
6925 <para>
6926 <indexterm role="option">
6927 <primary><option>-qS</option></primary>
6928 </indexterm>
6929 This option is synonymous with <option>-S</option>.
6930 </para>
6931 </listitem></varlistentry>
6932 <varlistentry>
6933 <term><option>-R</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6934 <listitem>
6935 <para>
6936 <indexterm role="option">
6937 <primary><option>-R</option></primary>
6938 </indexterm>
6939 <indexterm role="concept">
6940 <primary>queue runner</primary>
6941 <secondary>for specific recipients</secondary>
6942 </indexterm>
6943 <indexterm role="concept">
6944 <primary>delivery</primary>
6945 <secondary>to given domain</secondary>
6946 </indexterm>
6947 <indexterm role="concept">
6948 <primary>domain</primary>
6949 <secondary>delivery to</secondary>
6950 </indexterm>
6951 The &lt;<emphasis>rsflags</emphasis>&gt; may be empty, in which case the white space before the string
6952 is optional, unless the string is <emphasis>f</emphasis>, <emphasis>ff</emphasis>, <emphasis>r</emphasis>, <emphasis>rf</emphasis>, or <emphasis>rff</emphasis>,
6953 which are the possible values for &lt;<emphasis>rsflags</emphasis>&gt;. White space is required if
6954 &lt;<emphasis>rsflags</emphasis>&gt; is not empty.
6955 </para>
6956 <para>
6957 This option is similar to <option>-q</option> with no time value, that is, it causes Exim to
6958 perform a single queue run, except that, when scanning the messages on the
6959 queue, Exim processes only those that have at least one undelivered recipient
6960 address containing the given string, which is checked in a case-independent
6961 way. If the &lt;<emphasis>rsflags</emphasis>&gt; start with <emphasis>r</emphasis>, &lt;<emphasis>string</emphasis>&gt; is interpreted as a
6962 regular expression; otherwise it is a literal string.
6963 </para>
6964 <para>
6965 If you want to do periodic queue runs for messages with specific recipients,
6966 you can combine <option>-R</option> with <option>-q</option> and a time value. For example:
6967 </para>
6968 <literallayout class="monospaced">
6969 exim -q25m -R @special.domain.example
6970 </literallayout>
6971 <para>
6972 This example does a queue run for messages with recipients in the given domain
6973 every 25 minutes. Any additional flags that are specified with <option>-q</option> are
6974 applied to each queue run.
6975 </para>
6976 <para>
6977 Once a message is selected for delivery by this mechanism, all its addresses
6978 are processed. For the first selected message, Exim overrides any retry
6979 information and forces a delivery attempt for each undelivered address. This
6980 means that if delivery of any address in the first message is successful, any
6981 existing retry information is deleted, and so delivery attempts for that
6982 address in subsequently selected messages (which are processed without forcing)
6983 will run. However, if delivery of any address does not succeed, the retry
6984 information is updated, and in subsequently selected messages, the failing
6985 address will be skipped.
6986 </para>
6987 <para>
6988 <indexterm role="concept">
6989 <primary>frozen messages</primary>
6990 <secondary>forcing delivery</secondary>
6991 </indexterm>
6992 If the &lt;<emphasis>rsflags</emphasis>&gt; contain <emphasis>f</emphasis> or <emphasis>ff</emphasis>, the delivery forcing applies to
6993 all selected messages, not just the first; frozen messages are included when
6994 <emphasis>ff</emphasis> is present.
6995 </para>
6996 <para>
6997 The <option>-R</option> option makes it straightforward to initiate delivery of all messages
6998 to a given domain after a host has been down for some time. When the SMTP
6999 command ETRN is accepted by its ACL (see chapter <xref linkend="CHAPACL"/>), its default
7000 effect is to run Exim with the <option>-R</option> option, but it can be configured to run
7001 an arbitrary command instead.
7002 </para>
7003 </listitem></varlistentry>
7004 <varlistentry>
7005 <term><option>-r</option></term>
7006 <listitem>
7007 <para>
7008 <indexterm role="option">
7009 <primary><option>-r</option></primary>
7010 </indexterm>
7011 This is a documented (for Sendmail) obsolete alternative name for <option>-f</option>.
7012 </para>
7013 </listitem></varlistentry>
7014 <varlistentry>
7015 <term><option>-S</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7016 <listitem>
7017 <para>
7018 <indexterm role="option">
7019 <primary><option>-S</option></primary>
7020 </indexterm>
7021 <indexterm role="concept">
7022 <primary>delivery</primary>
7023 <secondary>from given sender</secondary>
7024 </indexterm>
7025 <indexterm role="concept">
7026 <primary>queue runner</primary>
7027 <secondary>for specific senders</secondary>
7028 </indexterm>
7029 This option acts like <option>-R</option> except that it checks the string against each
7030 message&#x2019;s sender instead of against the recipients. If <option>-R</option> is also set, both
7031 conditions must be met for a message to be selected. If either of the options
7032 has <emphasis>f</emphasis> or <emphasis>ff</emphasis> in its flags, the associated action is taken.
7033 </para>
7034 </listitem></varlistentry>
7035 <varlistentry>
7036 <term><option>-Tqt</option>&nbsp;&lt;<emphasis>times</emphasis>&gt;</term>
7037 <listitem>
7038 <para>
7039 <indexterm role="option">
7040 <primary><option>-Tqt</option></primary>
7041 </indexterm>
7042 This is an option that is exclusively for use by the Exim testing suite. It is not
7043 recognized when Exim is run normally. It allows for the setting up of explicit
7044 <quote>queue times</quote> so that various warning/retry features can be tested.
7045 </para>
7046 </listitem></varlistentry>
7047 <varlistentry>
7048 <term><option>-t</option></term>
7049 <listitem>
7050 <para>
7051 <indexterm role="option">
7052 <primary><option>-t</option></primary>
7053 </indexterm>
7054 <indexterm role="concept">
7055 <primary>recipient</primary>
7056 <secondary>extracting from header lines</secondary>
7057 </indexterm>
7058 <indexterm role="concept">
7059 <primary><emphasis>Bcc:</emphasis> header line</primary>
7060 </indexterm>
7061 <indexterm role="concept">
7062 <primary><emphasis>Cc:</emphasis> header line</primary>
7063 </indexterm>
7064 <indexterm role="concept">
7065 <primary><emphasis>To:</emphasis> header line</primary>
7066 </indexterm>
7067 When Exim is receiving a locally-generated, non-SMTP message on its standard
7068 input, the <option>-t</option> option causes the recipients of the message to be obtained
7069 from the <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis> header lines in the message instead of
7070 from the command arguments. The addresses are extracted before any rewriting
7071 takes place and the <emphasis>Bcc:</emphasis> header line, if present, is then removed.
7072 </para>
7073 <para>
7074 <indexterm role="concept">
7075 <primary>Sendmail compatibility</primary>
7076 <secondary><option>-t</option> option</secondary>
7077 </indexterm>
7078 If the command has any arguments, they specify addresses to which the message
7079 is <emphasis>not</emphasis> to be delivered. That is, the argument addresses are removed from
7080 the recipients list obtained from the headers. This is compatible with Smail 3
7081 and in accordance with the documented behaviour of several versions of
7082 Sendmail, as described in man pages on a number of operating systems (e.g.
7083 Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail <emphasis>add</emphasis>
7084 argument addresses to those obtained from the headers, and the O&#x2019;Reilly
7085 Sendmail book documents it that way. Exim can be made to add argument addresses
7086 instead of subtracting them by setting the option
7087 <option>extract_addresses_remove_arguments</option> false.
7088 </para>
7089 <para>
7090 <indexterm role="concept">
7091 <primary><option>Resent-</option> header lines</primary>
7092 <secondary>with <option>-t</option></secondary>
7093 </indexterm>
7094 If there are any <option>Resent-</option> header lines in the message, Exim extracts
7095 recipients from all <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>, and <emphasis>Resent-Bcc:</emphasis> header
7096 lines instead of from <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis>. This is for compatibility
7097 with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if
7098 <option>-t</option> was used in conjunction with <option>Resent-</option> header lines.)
7099 </para>
7100 <para>
7101 RFC 2822 talks about different sets of <option>Resent-</option> header lines (for when a
7102 message is resent several times). The RFC also specifies that they should be
7103 added at the front of the message, and separated by <emphasis>Received:</emphasis> lines. It is
7104 not at all clear how <option>-t</option> should operate in the present of multiple sets,
7105 nor indeed exactly what constitutes a <quote>set</quote>.
7106 In practice, it seems that MUAs do not follow the RFC. The <option>Resent-</option> lines
7107 are often added at the end of the header, and if a message is resent more than
7108 once, it is common for the original set of <option>Resent-</option> headers to be renamed as
7109 <option>X-Resent-</option> when a new set is added. This removes any possible ambiguity.
7110 </para>
7111 </listitem></varlistentry>
7112 <varlistentry>
7113 <term><option>-ti</option></term>
7114 <listitem>
7115 <para>
7116 <indexterm role="option">
7117 <primary><option>-ti</option></primary>
7118 </indexterm>
7119 This option is exactly equivalent to <option>-t</option> <option>-i</option>. It is provided for
7120 compatibility with Sendmail.
7121 </para>
7122 </listitem></varlistentry>
7123 <varlistentry>
7124 <term><option>-tls-on-connect</option></term>
7125 <listitem>
7126 <para>
7127 <indexterm role="option">
7128 <primary><option>-tls-on-connect</option></primary>
7129 </indexterm>
7130 <indexterm role="concept">
7131 <primary>TLS</primary>
7132 <secondary>use without STARTTLS</secondary>
7133 </indexterm>
7134 <indexterm role="concept">
7135 <primary>TLS</primary>
7136 <secondary>automatic start</secondary>
7137 </indexterm>
7138 This option is available when Exim is compiled with TLS support. It forces all
7139 incoming SMTP connections to behave as if the incoming port is listed in the
7140 <option>tls_on_connect_ports</option> option. See section <xref linkend="SECTsupobssmt"/> and chapter
7141 <xref linkend="CHAPTLS"/> for further details.
7142 </para>
7143 </listitem></varlistentry>
7144 <varlistentry>
7145 <term><option>-U</option></term>
7146 <listitem>
7147 <para>
7148 <indexterm role="option">
7149 <primary><option>-U</option></primary>
7150 </indexterm>
7151 <indexterm role="concept">
7152 <primary>Sendmail compatibility</primary>
7153 <secondary><option>-U</option> option ignored</secondary>
7154 </indexterm>
7155 Sendmail uses this option for <quote>initial message submission</quote>, and its
7156 documentation states that in future releases, it may complain about
7157 syntactically invalid messages rather than fixing them when this flag is not
7158 set. Exim ignores this option.
7159 </para>
7160 </listitem></varlistentry>
7161 <varlistentry>
7162 <term><option>-v</option></term>
7163 <listitem>
7164 <para>
7165 <indexterm role="option">
7166 <primary><option>-v</option></primary>
7167 </indexterm>
7168 This option causes Exim to write information to the standard error stream,
7169 describing what it is doing. In particular, it shows the log lines for
7170 receiving and delivering a message, and if an SMTP connection is made, the SMTP
7171 dialogue is shown. Some of the log lines shown may not actually be written to
7172 the log if the setting of <option>log_selector</option> discards them. Any relevant
7173 selectors are shown with each log line. If none are shown, the logging is
7174 unconditional.
7175 </para>
7176 </listitem></varlistentry>
7177 <varlistentry>
7178 <term><option>-x</option></term>
7179 <listitem>
7180 <para>
7181 <indexterm role="option">
7182 <primary><option>-x</option></primary>
7183 </indexterm>
7184 AIX uses <option>-x</option> for a private purpose (<quote>mail from a local mail program has
7185 National Language Support extended characters in the body of the mail item</quote>).
7186 It sets <option>-x</option> when calling the MTA from its <option>mail</option> command. Exim ignores
7187 this option.
7188 </para>
7189 </listitem></varlistentry>
7190 <varlistentry>
7191 <term><option>-X</option>&nbsp;&lt;<emphasis>logfile</emphasis>&gt;</term>
7192 <listitem>
7193 <para>
7194 <indexterm role="option">
7195 <primary><option>-X</option></primary>
7196 </indexterm>
7197 This option is interpreted by Sendmail to cause debug information to be sent
7198 to the named file.  It is ignored by Exim.
7199 </para>
7200 </listitem></varlistentry>
7201 </variablelist>
7202 <para>
7203 <indexterm role="concept" startref="IIDclo1" class="endofrange"/>
7204 <indexterm role="concept" startref="IIDclo2" class="endofrange"/>
7205 </para>
7206 <!-- === End of command line options === -->
7207 </section>
7208 </chapter>
7209
7210 <chapter id="CHAPconf">
7211 <title>The Exim run time configuration file</title>
7212 <titleabbrev>The runtime configuration file</titleabbrev>
7213 <para>
7214 <indexterm role="concept">
7215 <primary>run time configuration</primary>
7216 </indexterm>
7217 <indexterm role="concept">
7218 <primary>configuration file</primary>
7219 <secondary>general description</secondary>
7220 </indexterm>
7221 <indexterm role="concept">
7222 <primary>CONFIGURE_FILE</primary>
7223 </indexterm>
7224 <indexterm role="concept">
7225 <primary>configuration file</primary>
7226 <secondary>errors in</secondary>
7227 </indexterm>
7228 <indexterm role="concept">
7229 <primary>error</primary>
7230 <secondary>in configuration file</secondary>
7231 </indexterm>
7232 <indexterm role="concept">
7233 <primary>return code</primary>
7234 <secondary>for bad configuration</secondary>
7235 </indexterm>
7236 Exim uses a single run time configuration file that is read whenever an Exim
7237 binary is executed. Note that in normal operation, this happens frequently,
7238 because Exim is designed to operate in a distributed manner, without central
7239 control.
7240 </para>
7241 <para>
7242 If a syntax error is detected while reading the configuration file, Exim
7243 writes a message on the standard error, and exits with a non-zero return code.
7244 The message is also written to the panic log. <emphasis role="bold">Note</emphasis>: Only simple syntax
7245 errors can be detected at this time. The values of any expanded options are
7246 not checked until the expansion happens, even when the expansion does not
7247 actually alter the string.
7248 </para>
7249 <para>
7250 The name of the configuration file is compiled into the binary for security
7251 reasons, and is specified by the CONFIGURE_FILE compilation option. In
7252 most configurations, this specifies a single file. However, it is permitted to
7253 give a colon-separated list of file names, in which case Exim uses the first
7254 existing file in the list.
7255 </para>
7256 <para>
7257 <indexterm role="concept">
7258 <primary>EXIM_USER</primary>
7259 </indexterm>
7260 <indexterm role="concept">
7261 <primary>EXIM_GROUP</primary>
7262 </indexterm>
7263 <indexterm role="concept">
7264 <primary>CONFIGURE_OWNER</primary>
7265 </indexterm>
7266 <indexterm role="concept">
7267 <primary>CONFIGURE_GROUP</primary>
7268 </indexterm>
7269 <indexterm role="concept">
7270 <primary>configuration file</primary>
7271 <secondary>ownership</secondary>
7272 </indexterm>
7273 <indexterm role="concept">
7274 <primary>ownership</primary>
7275 <secondary>configuration file</secondary>
7276 </indexterm>
7277 The run time configuration file must be owned by root or by the user that is
7278 specified at compile time by the CONFIGURE_OWNER option (if set). The
7279 configuration file must not be world-writeable, or group-writeable unless its
7280 group is the root group or the one specified at compile time by the
7281 CONFIGURE_GROUP option.
7282 </para>
7283 <para>
7284 <emphasis role="bold">Warning</emphasis>: In a conventional configuration, where the Exim binary is setuid
7285 to root, anybody who is able to edit the run time configuration file has an
7286 easy way to run commands as root. If you specify a user or group in the
7287 CONFIGURE_OWNER or CONFIGURE_GROUP options, then that user and/or any users
7288 who are members of that group will trivially be able to obtain root privileges.
7289 </para>
7290 <para>
7291 Up to Exim version 4.72, the run time configuration file was also permitted to
7292 be writeable by the Exim user and/or group. That has been changed in Exim 4.73
7293 since it offered a simple privilege escalation for any attacker who managed to
7294 compromise the Exim user account.
7295 </para>
7296 <para>
7297 A default configuration file, which will work correctly in simple situations,
7298 is provided in the file <filename>src/configure.default</filename>. If CONFIGURE_FILE
7299 defines just one file name, the installation process copies the default
7300 configuration to a new file of that name if it did not previously exist. If
7301 CONFIGURE_FILE is a list, no default is automatically installed. Chapter
7302 <xref linkend="CHAPdefconfil"/> is a <quote>walk-through</quote> discussion of the default
7303 configuration.
7304 </para>
7305 <section id="SECID40">
7306 <title>Using a different configuration file</title>
7307 <para>
7308 <indexterm role="concept">
7309 <primary>configuration file</primary>
7310 <secondary>alternate</secondary>
7311 </indexterm>
7312 A one-off alternate configuration can be specified by the <option>-C</option> command line
7313 option, which may specify a single file or a list of files. However, when
7314 <option>-C</option> is used, Exim gives up its root privilege, unless called by root (or
7315 unless the argument for <option>-C</option> is identical to the built-in value from
7316 CONFIGURE_FILE), or is listed in the TRUSTED_CONFIG_LIST file and the caller
7317 is the Exim user or the user specified in the CONFIGURE_OWNER setting. <option>-C</option>
7318 is useful mainly for checking the syntax of configuration files before
7319 installing them. No owner or group checks are done on a configuration file
7320 specified by <option>-C</option>, if root privilege has been dropped.
7321 </para>
7322 <para>
7323 Even the Exim user is not trusted to specify an arbitrary configuration file
7324 with the <option>-C</option> option to be used with root privileges, unless that file is
7325 listed in the TRUSTED_CONFIG_LIST file. This locks out the possibility of
7326 testing a configuration using <option>-C</option> right through message reception and
7327 delivery, even if the caller is root. The reception works, but by that time,
7328 Exim is running as the Exim user, so when it re-execs to regain privilege for
7329 the delivery, the use of <option>-C</option> causes privilege to be lost. However, root
7330 can test reception and delivery using two separate commands (one to put a
7331 message on the queue, using <option>-odq</option>, and another to do the delivery, using
7332 <option>-M</option>).
7333 </para>
7334 <para>
7335 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
7336 prefix string with which any file named in a <option>-C</option> command line option must
7337 start. In addition, the file name must not contain the sequence <quote><literal>/../</literal></quote>.
7338 There is no default setting for ALT_CONFIG_PREFIX; when it is unset, any file
7339 name can be used with <option>-C</option>.
7340 </para>
7341 <para>
7342 One-off changes to a configuration can be specified by the <option>-D</option> command line
7343 option, which defines and overrides values for macros used inside the
7344 configuration file. However, like <option>-C</option>, the use of this option by a
7345 non-privileged user causes Exim to discard its root privilege.
7346 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
7347 completely disabled, and its use causes an immediate error exit.
7348 </para>
7349 <para>
7350 The WHITELIST_D_MACROS option in <filename>Local/Makefile</filename> permits the binary builder
7351 to declare certain macro names trusted, such that root privilege will not
7352 necessarily be discarded.
7353 WHITELIST_D_MACROS defines a colon-separated list of macros which are
7354 considered safe and, if <option>-D</option> only supplies macros from this list, and the
7355 values are acceptable, then Exim will not give up root privilege if the caller
7356 is root, the Exim run-time user, or the CONFIGURE_OWNER, if set.  This is a
7357 transition mechanism and is expected to be removed in the future.  Acceptable
7358 values for the macros satisfy the regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
7359 </para>
7360 <para>
7361 Some sites may wish to use the same Exim binary on different machines that
7362 share a file system, but to use different configuration files on each machine.
7363 If CONFIGURE_FILE_USE_NODE is defined in <filename>Local/Makefile</filename>, Exim first
7364 looks for a file whose name is the configuration file name followed by a dot
7365 and the machine&#x2019;s node name, as obtained from the <function>uname()</function> function. If this
7366 file does not exist, the standard name is tried. This processing occurs for
7367 each file name in the list given by CONFIGURE_FILE or <option>-C</option>.
7368 </para>
7369 <para>
7370 In some esoteric situations different versions of Exim may be run under
7371 different effective uids and the CONFIGURE_FILE_USE_EUID is defined to
7372 help with this. See the comments in <filename>src/EDITME</filename> for details.
7373 </para>
7374 </section>
7375 <section id="SECTconffilfor">
7376 <title>Configuration file format</title>
7377 <para>
7378 <indexterm role="concept">
7379 <primary>configuration file</primary>
7380 <secondary>format of</secondary>
7381 </indexterm>
7382 <indexterm role="concept">
7383 <primary>format</primary>
7384 <secondary>configuration file</secondary>
7385 </indexterm>
7386 Exim&#x2019;s configuration file is divided into a number of different parts. General
7387 option settings must always appear at the start of the file. The other parts
7388 are all optional, and may appear in any order. Each part other than the first
7389 is introduced by the word <quote>begin</quote> followed by the name of the part. The
7390 optional parts are:
7391 </para>
7392 <itemizedlist>
7393 <listitem>
7394 <para>
7395 <emphasis>ACL</emphasis>: Access control lists for controlling incoming SMTP mail (see chapter
7396 <xref linkend="CHAPACL"/>).
7397 </para>
7398 </listitem>
7399 <listitem>
7400 <para>
7401 <indexterm role="concept">
7402 <primary>AUTH</primary>
7403 <secondary>configuration</secondary>
7404 </indexterm>
7405 <emphasis>authenticators</emphasis>: Configuration settings for the authenticator drivers. These
7406 are concerned with the SMTP AUTH command (see chapter <xref linkend="CHAPSMTPAUTH"/>).
7407 </para>
7408 </listitem>
7409 <listitem>
7410 <para>
7411 <emphasis>routers</emphasis>: Configuration settings for the router drivers. Routers process
7412 addresses and determine how the message is to be delivered (see chapters
7413 <xref linkend="CHAProutergeneric"/>&ndash;<xref linkend="CHAPredirect"/>).
7414 </para>
7415 </listitem>
7416 <listitem>
7417 <para>
7418 <emphasis>transports</emphasis>: Configuration settings for the transport drivers. Transports
7419 define mechanisms for copying messages to destinations (see chapters
7420 <xref linkend="CHAPtransportgeneric"/>&ndash;<xref linkend="CHAPsmtptrans"/>).
7421 </para>
7422 </listitem>
7423 <listitem>
7424 <para>
7425 <emphasis>retry</emphasis>: Retry rules, for use when a message cannot be delivered immediately.
7426 If there is no retry section, or if it is empty (that is, no retry rules are
7427 defined), Exim will not retry deliveries. In this situation, temporary errors
7428 are treated the same as permanent errors. Retry rules are discussed in chapter
7429 <xref linkend="CHAPretry"/>.
7430 </para>
7431 </listitem>
7432 <listitem>
7433 <para>
7434 <emphasis>rewrite</emphasis>: Global address rewriting rules, for use when a message arrives and
7435 when new addresses are generated during delivery. Rewriting is discussed in
7436 chapter <xref linkend="CHAPrewrite"/>.
7437 </para>
7438 </listitem>
7439 <listitem>
7440 <para>
7441 <emphasis>local_scan</emphasis>: Private options for the <function>local_scan()</function> function. If you
7442 want to use this feature, you must set
7443 </para>
7444 <literallayout class="monospaced">
7445 LOCAL_SCAN_HAS_OPTIONS=yes
7446 </literallayout>
7447 <para>
7448 in <filename>Local/Makefile</filename> before building Exim. Details of the <function>local_scan()</function>
7449 facility are given in chapter <xref linkend="CHAPlocalscan"/>.
7450 </para>
7451 </listitem>
7452 </itemizedlist>
7453 <para>
7454 <indexterm role="concept">
7455 <primary>configuration file</primary>
7456 <secondary>leading white space in</secondary>
7457 </indexterm>
7458 <indexterm role="concept">
7459 <primary>configuration file</primary>
7460 <secondary>trailing white space in</secondary>
7461 </indexterm>
7462 <indexterm role="concept">
7463 <primary>white space</primary>
7464 <secondary>in configuration file</secondary>
7465 </indexterm>
7466 Leading and trailing white space in configuration lines is always ignored.
7467 </para>
7468 <para>
7469 Blank lines in the file, and lines starting with a # character (ignoring
7470 leading white space) are treated as comments and are ignored. <emphasis role="bold">Note</emphasis>: A
7471 # character other than at the beginning of a line is not treated specially,
7472 and does not introduce a comment.
7473 </para>
7474 <para>
7475 Any non-comment line can be continued by ending it with a backslash. Note that
7476 the general rule for white space means that trailing white space after the
7477 backslash and leading white space at the start of continuation
7478 lines is ignored. Comment lines beginning with # (but not empty lines) may
7479 appear in the middle of a sequence of continuation lines.
7480 </para>
7481 <para>
7482 A convenient way to create a configuration file is to start from the
7483 default, which is supplied in <filename>src/configure.default</filename>, and add, delete, or
7484 change settings as required.
7485 </para>
7486 <para>
7487 The ACLs, retry rules, and rewriting rules have their own syntax which is
7488 described in chapters <xref linkend="CHAPACL"/>, <xref linkend="CHAPretry"/>, and <xref linkend="CHAPrewrite"/>,
7489 respectively. The other parts of the configuration file have some syntactic
7490 items in common, and these are described below, from section <xref linkend="SECTcos"/>
7491 onwards. Before that, the inclusion, macro, and conditional facilities are
7492 described.
7493 </para>
7494 </section>
7495 <section id="SECID41">
7496 <title>File inclusions in the configuration file</title>
7497 <para>
7498 <indexterm role="concept">
7499 <primary>inclusions in configuration file</primary>
7500 </indexterm>
7501 <indexterm role="concept">
7502 <primary>configuration file</primary>
7503 <secondary>including other files</secondary>
7504 </indexterm>
7505 <indexterm role="concept">
7506 <primary><literal>.include</literal> in configuration file</primary>
7507 </indexterm>
7508 <indexterm role="concept">
7509 <primary><literal>.include_if_exists</literal> in configuration file</primary>
7510 </indexterm>
7511 You can include other files inside Exim&#x2019;s run time configuration file by
7512 using this syntax:
7513 </para>
7514 <literallayout>
7515 <literal>.include</literal> &lt;<emphasis>file name</emphasis>&gt;
7516 <literal>.include_if_exists</literal> &lt;<emphasis>file name</emphasis>&gt;
7517 </literallayout>
7518 <para>
7519 on a line by itself. Double quotes round the file name are optional. If you use
7520 the first form, a configuration error occurs if the file does not exist; the
7521 second form does nothing for non-existent files. In all cases, an absolute file
7522 name is required.
7523 </para>
7524 <para>
7525 Includes may be nested to any depth, but remember that Exim reads its
7526 configuration file often, so it is a good idea to keep them to a minimum.
7527 If you change the contents of an included file, you must HUP the daemon,
7528 because an included file is read only when the configuration itself is read.
7529 </para>
7530 <para>
7531 The processing of inclusions happens early, at a physical line level, so, like
7532 comment lines, an inclusion can be used in the middle of an option setting,
7533 for example:
7534 </para>
7535 <literallayout class="monospaced">
7536 hosts_lookup = a.b.c \
7537                .include /some/file
7538 </literallayout>
7539 <para>
7540 Include processing happens after macro processing (see below). Its effect is to
7541 process the lines of the included file as if they occurred inline where the
7542 inclusion appears.
7543 </para>
7544 </section>
7545 <section id="SECTmacrodefs">
7546 <title>Macros in the configuration file</title>
7547 <para>
7548 <indexterm role="concept">
7549 <primary>macro</primary>
7550 <secondary>description of</secondary>
7551 </indexterm>
7552 <indexterm role="concept">
7553 <primary>configuration file</primary>
7554 <secondary>macros</secondary>
7555 </indexterm>
7556 If a line in the main part of the configuration (that is, before the first
7557 <quote>begin</quote> line) begins with an upper case letter, it is taken as a macro
7558 definition, and must be of the form
7559 </para>
7560 <literallayout>
7561 &lt;<emphasis>name</emphasis>&gt; = &lt;<emphasis>rest of line</emphasis>&gt;
7562 </literallayout>
7563 <para>
7564 The name must consist of letters, digits, and underscores, and need not all be
7565 in upper case, though that is recommended. The rest of the line, including any
7566 continuations, is the replacement text, and has leading and trailing white
7567 space removed. Quotes are not removed. The replacement text can never end with
7568 a backslash character, but this doesn&#x2019;t seem to be a serious limitation.
7569 </para>
7570 <para>
7571 Macros may also be defined between router, transport, authenticator, or ACL
7572 definitions. They may not, however, be defined within an individual driver or
7573 ACL, or in the <option>local_scan</option>, retry, or rewrite sections of the configuration.
7574 </para>
7575 </section>
7576 <section id="SECID42">
7577 <title>Macro substitution</title>
7578 <para>
7579 Once a macro is defined, all subsequent lines in the file (and any included
7580 files) are scanned for the macro name; if there are several macros, the line is
7581 scanned for each in turn, in the order in which the macros are defined. The
7582 replacement text is not re-scanned for the current macro, though it is scanned
7583 for subsequently defined macros. For this reason, a macro name may not contain
7584 the name of a previously defined macro as a substring. You could, for example,
7585 define
7586 </para>
7587 <literallayout>
7588 <literal>ABCD_XYZ = </literal>&lt;<emphasis>something</emphasis>&gt;
7589 <literal>ABCD = </literal>&lt;<emphasis>something else</emphasis>&gt;
7590 </literallayout>
7591 <para>
7592 but putting the definitions in the opposite order would provoke a configuration
7593 error. Macro expansion is applied to individual physical lines from the file,
7594 before checking for line continuation or file inclusion (see above). If a line
7595 consists solely of a macro name, and the expansion of the macro is empty, the
7596 line is ignored. A macro at the start of a line may turn the line into a
7597 comment line or a <literal>.include</literal> line.
7598 </para>
7599 </section>
7600 <section id="SECID43">
7601 <title>Redefining macros</title>
7602 <para>
7603 Once defined, the value of a macro can be redefined later in the configuration
7604 (or in an included file). Redefinition is specified by using <emphasis>==</emphasis> instead of
7605 <emphasis>=</emphasis>. For example:
7606 </para>
7607 <literallayout class="monospaced">
7608 MAC =  initial value
7609 ...
7610 MAC == updated value
7611 </literallayout>
7612 <para>
7613 Redefinition does not alter the order in which the macros are applied to the
7614 subsequent lines of the configuration file. It is still the same order in which
7615 the macros were originally defined. All that changes is the macro&#x2019;s value.
7616 Redefinition makes it possible to accumulate values. For example:
7617 </para>
7618 <literallayout class="monospaced">
7619 MAC =  initial value
7620 ...
7621 MAC == MAC and something added
7622 </literallayout>
7623 <para>
7624 This can be helpful in situations where the configuration file is built
7625 from a number of other files.
7626 </para>
7627 </section>
7628 <section id="SECID44">
7629 <title>Overriding macro values</title>
7630 <para>
7631 The values set for macros in the configuration file can be overridden by the
7632 <option>-D</option> command line option, but Exim gives up its root privilege when <option>-D</option> is
7633 used, unless called by root or the Exim user. A definition on the command line
7634 using the <option>-D</option> option causes all definitions and redefinitions within the
7635 file to be ignored.
7636 </para>
7637 </section>
7638 <section id="SECID45">
7639 <title>Example of macro usage</title>
7640 <para>
7641 As an example of macro usage, consider a configuration where aliases are looked
7642 up in a MySQL database. It helps to keep the file less cluttered if long
7643 strings such as SQL statements are defined separately as macros, for example:
7644 </para>
7645 <literallayout class="monospaced">
7646 ALIAS_QUERY = select mailbox from user where \
7647               login='${quote_mysql:$local_part}';
7648 </literallayout>
7649 <para>
7650 This can then be used in a <command>redirect</command> router setting like this:
7651 </para>
7652 <literallayout class="monospaced">
7653 data = ${lookup mysql{ALIAS_QUERY}}
7654 </literallayout>
7655 <para>
7656 In earlier versions of Exim macros were sometimes used for domain, host, or
7657 address lists. In Exim 4 these are handled better by named lists &ndash; see
7658 section <xref linkend="SECTnamedlists"/>.
7659 </para>
7660 </section>
7661 <section id="SECID46">
7662 <title>Conditional skips in the configuration file</title>
7663 <para>
7664 <indexterm role="concept">
7665 <primary>configuration file</primary>
7666 <secondary>conditional skips</secondary>
7667 </indexterm>
7668 <indexterm role="concept">
7669 <primary><literal>.ifdef</literal></primary>
7670 </indexterm>
7671 You can use the directives <literal>.ifdef</literal>, <literal>.ifndef</literal>, <literal>.elifdef</literal>,
7672 <literal>.elifndef</literal>, <literal>.else</literal>, and <literal>.endif</literal> to dynamically include or exclude
7673 portions of the configuration file. The processing happens whenever the file is
7674 read (that is, when an Exim binary starts to run).
7675 </para>
7676 <para>
7677 The implementation is very simple. Instances of the first four directives must
7678 be followed by text that includes the names of one or macros. The condition
7679 that is tested is whether or not any macro substitution has taken place in the
7680 line. Thus:
7681 </para>
7682 <literallayout class="monospaced">
7683 .ifdef AAA
7684 message_size_limit = 50M
7685 .else
7686 message_size_limit = 100M
7687 .endif
7688 </literallayout>
7689 <para>
7690 sets a message size limit of 50M if the macro <literal>AAA</literal> is defined, and 100M
7691 otherwise. If there is more than one macro named on the line, the condition
7692 is true if any of them are defined. That is, it is an <quote>or</quote> condition. To
7693 obtain an <quote>and</quote> condition, you need to use nested <literal>.ifdef</literal>s.
7694 </para>
7695 <para>
7696 Although you can use a macro expansion to generate one of these directives,
7697 it is not very useful, because the condition <quote>there was a macro substitution
7698 in this line</quote> will always be true.
7699 </para>
7700 <para>
7701 Text following <literal>.else</literal> and <literal>.endif</literal> is ignored, and can be used as comment
7702 to clarify complicated nestings.
7703 </para>
7704 </section>
7705 <section id="SECTcos">
7706 <title>Common option syntax</title>
7707 <para>
7708 <indexterm role="concept">
7709 <primary>common option syntax</primary>
7710 </indexterm>
7711 <indexterm role="concept">
7712 <primary>syntax of common options</primary>
7713 </indexterm>
7714 <indexterm role="concept">
7715 <primary>configuration file</primary>
7716 <secondary>common option syntax</secondary>
7717 </indexterm>
7718 For the main set of options, driver options, and <function>local_scan()</function> options,
7719 each setting is on a line by itself, and starts with a name consisting of
7720 lower-case letters and underscores. Many options require a data value, and in
7721 these cases the name must be followed by an equals sign (with optional white
7722 space) and then the value. For example:
7723 </para>
7724 <literallayout class="monospaced">
7725 qualify_domain = mydomain.example.com
7726 </literallayout>
7727 <para>
7728 <indexterm role="concept">
7729 <primary>hiding configuration option values</primary>
7730 </indexterm>
7731 <indexterm role="concept">
7732 <primary>configuration options</primary>
7733 <secondary>hiding value of</secondary>
7734 </indexterm>
7735 <indexterm role="concept">
7736 <primary>options</primary>
7737 <secondary>hiding value of</secondary>
7738 </indexterm>
7739 Some option settings may contain sensitive data, for example, passwords for
7740 accessing databases. To stop non-admin users from using the <option>-bP</option> command
7741 line option to read these values, you can precede the option settings with the
7742 word <quote>hide</quote>. For example:
7743 </para>
7744 <literallayout class="monospaced">
7745 hide mysql_servers = localhost/users/admin/secret-password
7746 </literallayout>
7747 <para>
7748 For non-admin users, such options are displayed like this:
7749 </para>
7750 <literallayout class="monospaced">
7751 mysql_servers = &lt;value not displayable&gt;
7752 </literallayout>
7753 <para>
7754 If <quote>hide</quote> is used on a driver option, it hides the value of that option on
7755 all instances of the same driver.
7756 </para>
7757 <para>
7758 The following sections describe the syntax used for the different data types
7759 that are found in option settings.
7760 </para>
7761 </section>
7762 <section id="SECID47">
7763 <title>Boolean options</title>
7764 <para>
7765 <indexterm role="concept">
7766 <primary>format</primary>
7767 <secondary>boolean</secondary>
7768 </indexterm>
7769 <indexterm role="concept">
7770 <primary>boolean configuration values</primary>
7771 </indexterm>
7772 <indexterm role="option">
7773 <primary><option>no_</option><emphasis>xxx</emphasis></primary>
7774 </indexterm>
7775 <indexterm role="option">
7776 <primary><option>not_</option><emphasis>xxx</emphasis></primary>
7777 </indexterm>
7778 Options whose type is given as boolean are on/off switches. There are two
7779 different ways of specifying such options: with and without a data value. If
7780 the option name is specified on its own without data, the switch is turned on;
7781 if it is preceded by <quote>no_</quote> or <quote>not_</quote> the switch is turned off. However,
7782 boolean options may be followed by an equals sign and one of the words
7783 <quote>true</quote>, <quote>false</quote>, <quote>yes</quote>, or <quote>no</quote>, as an alternative syntax. For example,
7784 the following two settings have exactly the same effect:
7785 </para>
7786 <literallayout class="monospaced">
7787 queue_only
7788 queue_only = true
7789 </literallayout>
7790 <para>
7791 The following two lines also have the same (opposite) effect:
7792 </para>
7793 <literallayout class="monospaced">
7794 no_queue_only
7795 queue_only = false
7796 </literallayout>
7797 <para>
7798 You can use whichever syntax you prefer.
7799 </para>
7800 </section>
7801 <section id="SECID48">
7802 <title>Integer values</title>
7803 <para>
7804 <indexterm role="concept">
7805 <primary>integer configuration values</primary>
7806 </indexterm>
7807 <indexterm role="concept">
7808 <primary>format</primary>
7809 <secondary>integer</secondary>
7810 </indexterm>
7811 If an option&#x2019;s type is given as <quote>integer</quote>, the value can be given in decimal,
7812 hexadecimal, or octal. If it starts with a digit greater than zero, a decimal
7813 number is assumed. Otherwise, it is treated as an octal number unless it starts
7814 with the characters <quote>0x</quote>, in which case the remainder is interpreted as a
7815 hexadecimal number.
7816 </para>
7817 <para>
7818 If an integer value is followed by the letter K, it is multiplied by 1024; if
7819 it is followed by the letter M, it is multiplied by 1024x1024. When the values
7820 of integer option settings are output, values which are an exact multiple of
7821 1024 or 1024x1024 are sometimes, but not always, printed using the letters K
7822 and M. The printing style is independent of the actual input format that was
7823 used.
7824 </para>
7825 </section>
7826 <section id="SECID49">
7827 <title>Octal integer values</title>
7828 <para>
7829 <indexterm role="concept">
7830 <primary>integer format</primary>
7831 </indexterm>
7832 <indexterm role="concept">
7833 <primary>format</primary>
7834 <secondary>octal integer</secondary>
7835 </indexterm>
7836 If an option&#x2019;s type is given as <quote>octal integer</quote>, its value is always
7837 interpreted as an octal number, whether or not it starts with the digit zero.
7838 Such options are always output in octal.
7839 </para>
7840 </section>
7841 <section id="SECID50">
7842 <title>Fixed point numbers</title>
7843 <para>
7844 <indexterm role="concept">
7845 <primary>fixed point configuration values</primary>
7846 </indexterm>
7847 <indexterm role="concept">
7848 <primary>format</primary>
7849 <secondary>fixed point</secondary>
7850 </indexterm>
7851 If an option&#x2019;s type is given as <quote>fixed-point</quote>, its value must be a decimal
7852 integer, optionally followed by a decimal point and up to three further digits.
7853 </para>
7854 </section>
7855 <section id="SECTtimeformat">
7856 <title>Time intervals</title>
7857 <para>
7858 <indexterm role="concept">
7859 <primary>time interval</primary>
7860 <secondary>specifying in configuration</secondary>
7861 </indexterm>
7862 <indexterm role="concept">
7863 <primary>format</primary>
7864 <secondary>time interval</secondary>
7865 </indexterm>
7866 A time interval is specified as a sequence of numbers, each followed by one of
7867 the following letters, with no intervening white space:
7868 </para>
7869 <informaltable frame="none">
7870 <tgroup cols="2" colsep="0" rowsep="0">
7871 <colspec colwidth="30pt" align="left"/>
7872 <colspec colwidth="254pt" align="left"/>
7873 <tbody>
7874 <row>
7875 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>s</option></entry>
7876 <entry>seconds</entry>
7877 </row>
7878 <row>
7879 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>m</option></entry>
7880 <entry>minutes</entry>
7881 </row>
7882 <row>
7883 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>h</option></entry>
7884 <entry>hours</entry>
7885 </row>
7886 <row>
7887 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>d</option></entry>
7888 <entry>days</entry>
7889 </row>
7890 <row>
7891 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>w</option></entry>
7892 <entry>weeks</entry>
7893 </row>
7894 </tbody>
7895 </tgroup>
7896 </informaltable>
7897 <para>
7898 For example, <quote>3h50m</quote> specifies 3 hours and 50 minutes. The values of time
7899 intervals are output in the same format. Exim does not restrict the values; it
7900 is perfectly acceptable, for example, to specify <quote>90m</quote> instead of <quote>1h30m</quote>.
7901 </para>
7902 </section>
7903 <section id="SECTstrings">
7904 <title>String values</title>
7905 <para>
7906 <indexterm role="concept">
7907 <primary>string</primary>
7908 <secondary>format of configuration values</secondary>
7909 </indexterm>
7910 <indexterm role="concept">
7911 <primary>format</primary>
7912 <secondary>string</secondary>
7913 </indexterm>
7914 If an option&#x2019;s type is specified as <quote>string</quote>, the value can be specified with
7915 or without double-quotes. If it does not start with a double-quote, the value
7916 consists of the remainder of the line plus any continuation lines, starting at
7917 the first character after any leading white space, with trailing white space
7918 removed, and with no interpretation of the characters in the string. Because
7919 Exim removes comment lines (those beginning with #) at an early stage, they can
7920 appear in the middle of a multi-line string. The following two settings are
7921 therefore equivalent:
7922 </para>
7923 <literallayout class="monospaced">
7924 trusted_users = uucp:mail
7925 trusted_users = uucp:\
7926                 # This comment line is ignored
7927                 mail
7928 </literallayout>
7929 <para>
7930 <indexterm role="concept">
7931 <primary>string</primary>
7932 <secondary>quoted</secondary>
7933 </indexterm>
7934 <indexterm role="concept">
7935 <primary>escape characters in quoted strings</primary>
7936 </indexterm>
7937 If a string does start with a double-quote, it must end with a closing
7938 double-quote, and any backslash characters other than those used for line
7939 continuation are interpreted as escape characters, as follows:
7940 </para>
7941 <informaltable frame="none">
7942 <tgroup cols="2" colsep="0" rowsep="0">
7943 <colspec colwidth="100pt" align="left"/>
7944 <colspec colwidth="254pt" align="left"/>
7945 <tbody>
7946 <row>
7947 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\\</literal></entry>
7948 <entry>single backslash</entry>
7949 </row>
7950 <row>
7951 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\n</literal></entry>
7952 <entry>newline</entry>
7953 </row>
7954 <row>
7955 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\r</literal></entry>
7956 <entry>carriage return</entry>
7957 </row>
7958 <row>
7959 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\t</literal></entry>
7960 <entry>tab</entry>
7961 </row>
7962 <row>
7963 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\</literal>&lt;<emphasis>octal digits</emphasis>&gt;</entry>
7964 <entry>up to 3 octal digits specify one character</entry>
7965 </row>
7966 <row>
7967 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\x</literal>&lt;<emphasis>hex digits</emphasis>&gt;</entry>
7968 <entry>up to 2 hexadecimal digits specify one character</entry>
7969 </row>
7970 </tbody>
7971 </tgroup>
7972 </informaltable>
7973 <para>
7974 If a backslash is followed by some other character, including a double-quote
7975 character, that character replaces the pair.
7976 </para>
7977 <para>
7978 Quoting is necessary only if you want to make use of the backslash escapes to
7979 insert special characters, or if you need to specify a value with leading or
7980 trailing spaces. These cases are rare, so quoting is almost never needed in
7981 current versions of Exim. In versions of Exim before 3.14, quoting was required
7982 in order to continue lines, so you may come across older configuration files
7983 and examples that apparently quote unnecessarily.
7984 </para>
7985 </section>
7986 <section id="SECID51">
7987 <title>Expanded strings</title>
7988 <para>
7989 <indexterm role="concept">
7990 <primary>expansion</primary>
7991 <secondary>definition of</secondary>
7992 </indexterm>
7993 Some strings in the configuration file are subjected to <emphasis>string expansion</emphasis>,
7994 by which means various parts of the string may be changed according to the
7995 circumstances (see chapter <xref linkend="CHAPexpand"/>). The input syntax for such strings
7996 is as just described; in particular, the handling of backslashes in quoted
7997 strings is done as part of the input process, before expansion takes place.
7998 However, backslash is also an escape character for the expander, so any
7999 backslashes that are required for that reason must be doubled if they are
8000 within a quoted configuration string.
8001 </para>
8002 </section>
8003 <section id="SECID52">
8004 <title>User and group names</title>
8005 <para>
8006 <indexterm role="concept">
8007 <primary>user name</primary>
8008 <secondary>format of</secondary>
8009 </indexterm>
8010 <indexterm role="concept">
8011 <primary>format</primary>
8012 <secondary>user name</secondary>
8013 </indexterm>
8014 <indexterm role="concept">
8015 <primary>groups</primary>
8016 <secondary>name format</secondary>
8017 </indexterm>
8018 <indexterm role="concept">
8019 <primary>format</primary>
8020 <secondary>group name</secondary>
8021 </indexterm>
8022 User and group names are specified as strings, using the syntax described
8023 above, but the strings are interpreted specially. A user or group name must
8024 either consist entirely of digits, or be a name that can be looked up using the
8025 <function>getpwnam()</function> or <function>getgrnam()</function> function, as appropriate.
8026 </para>
8027 </section>
8028 <section id="SECTlistconstruct">
8029 <title>List construction</title>
8030 <para>
8031 <indexterm role="concept">
8032 <primary>list</primary>
8033 <secondary>syntax of in configuration</secondary>
8034 </indexterm>
8035 <indexterm role="concept">
8036 <primary>format</primary>
8037 <secondary>list item in configuration</secondary>
8038 </indexterm>
8039 <indexterm role="concept">
8040 <primary>string</primary>
8041 <secondary>list, definition of</secondary>
8042 </indexterm>
8043 The data for some configuration options is a list of items, with colon as the
8044 default separator. Many of these options are shown with type <quote>string list</quote> in
8045 the descriptions later in this document. Others are listed as <quote>domain list</quote>,
8046 <quote>host list</quote>, <quote>address list</quote>, or <quote>local part list</quote>. Syntactically, they
8047 are all the same; however, those other than <quote>string list</quote> are subject to
8048 particular kinds of interpretation, as described in chapter
8049 <xref linkend="CHAPdomhosaddlists"/>.
8050 </para>
8051 <para>
8052 In all these cases, the entire list is treated as a single string as far as the
8053 input syntax is concerned. The <option>trusted_users</option> setting in section
8054 <xref linkend="SECTstrings"/> above is an example. If a colon is actually needed in an item
8055 in a list, it must be entered as two colons. Leading and trailing white space
8056 on each item in a list is ignored. This makes it possible to include items that
8057 start with a colon, and in particular, certain forms of IPv6 address. For
8058 example, the list
8059 </para>
8060 <literallayout class="monospaced">
8061 local_interfaces = 127.0.0.1 : ::::1
8062 </literallayout>
8063 <para>
8064 contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1.
8065 </para>
8066 <para>
8067 <emphasis role="bold">Note</emphasis>: Although leading and trailing white space is ignored in individual
8068 list items, it is not ignored when parsing the list. The space after the first
8069 colon in the example above is necessary. If it were not there, the list would
8070 be interpreted as the two items 127.0.0.1:: and 1.
8071 </para>
8072 </section>
8073 <section id="SECID53">
8074 <title>Changing list separators</title>
8075 <para>
8076 <indexterm role="concept">
8077 <primary>list separator</primary>
8078 <secondary>changing</secondary>
8079 </indexterm>
8080 <indexterm role="concept">
8081 <primary>IPv6</primary>
8082 <secondary>addresses in lists</secondary>
8083 </indexterm>
8084 Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was
8085 introduced to allow the separator character to be changed. If a list begins
8086 with a left angle bracket, followed by any punctuation character, that
8087 character is used instead of colon as the list separator. For example, the list
8088 above can be rewritten to use a semicolon separator like this:
8089 </para>
8090 <literallayout class="monospaced">
8091 local_interfaces = &lt;; 127.0.0.1 ; ::1
8092 </literallayout>
8093 <para>
8094 This facility applies to all lists, with the exception of the list in
8095 <option>log_file_path</option>. It is recommended that the use of non-colon separators be
8096 confined to circumstances where they really are needed.
8097 </para>
8098 <para>
8099 <indexterm role="concept">
8100 <primary>list separator</primary>
8101 <secondary>newline as</secondary>
8102 </indexterm>
8103 <indexterm role="concept">
8104 <primary>newline</primary>
8105 <secondary>as list separator</secondary>
8106 </indexterm>
8107 It is also possible to use newline and other control characters (those with
8108 code values less than 32, plus DEL) as separators in lists. Such separators
8109 must be provided literally at the time the list is processed. For options that
8110 are string-expanded, you can write the separator using a normal escape
8111 sequence. This will be processed by the expander before the string is
8112 interpreted as a list. For example, if a newline-separated list of domains is
8113 generated by a lookup, you can process it directly by a line such as this:
8114 </para>
8115 <literallayout class="monospaced">
8116 domains = &lt;\n ${lookup mysql{.....}}
8117 </literallayout>
8118 <para>
8119 This avoids having to change the list separator in such data. You are unlikely
8120 to want to use a control character as a separator in an option that is not
8121 expanded, because the value is literal text. However, it can be done by giving
8122 the value in quotes. For example:
8123 </para>
8124 <literallayout class="monospaced">
8125 local_interfaces = "&lt;\n 127.0.0.1 \n ::1"
8126 </literallayout>
8127 <para>
8128 Unlike printing character separators, which can be included in list items by
8129 doubling, it is not possible to include a control character as data when it is
8130 set as the separator. Two such characters in succession are interpreted as
8131 enclosing an empty list item.
8132 </para>
8133 </section>
8134 <section id="SECTempitelis">
8135 <title>Empty items in lists</title>
8136 <para>
8137 <indexterm role="concept">
8138 <primary>list</primary>
8139 <secondary>empty item in</secondary>
8140 </indexterm>
8141 An empty item at the end of a list is always ignored. In other words, trailing
8142 separator characters are ignored. Thus, the list in
8143 </para>
8144 <literallayout class="monospaced">
8145 senders = user@domain :
8146 </literallayout>
8147 <para>
8148 contains only a single item. If you want to include an empty string as one item
8149 in a list, it must not be the last item. For example, this list contains three
8150 items, the second of which is empty:
8151 </para>
8152 <literallayout class="monospaced">
8153 senders = user1@domain : : user2@domain
8154 </literallayout>
8155 <para>
8156 <emphasis role="bold">Note</emphasis>: There must be white space between the two colons, as otherwise they
8157 are interpreted as representing a single colon data character (and the list
8158 would then contain just one item). If you want to specify a list that contains
8159 just one, empty item, you can do it as in this example:
8160 </para>
8161 <literallayout class="monospaced">
8162 senders = :
8163 </literallayout>
8164 <para>
8165 In this case, the first item is empty, and the second is discarded because it
8166 is at the end of the list.
8167 </para>
8168 </section>
8169 <section id="SECTfordricon">
8170 <title>Format of driver configurations</title>
8171 <para>
8172 <indexterm role="concept">
8173 <primary>drivers</primary>
8174 <secondary>configuration format</secondary>
8175 </indexterm>
8176 There are separate parts in the configuration for defining routers, transports,
8177 and authenticators. In each part, you are defining a number of driver
8178 instances, each with its own set of options. Each driver instance is defined by
8179 a sequence of lines like this:
8180 </para>
8181 <literallayout>
8182 &lt;<emphasis>instance name</emphasis>&gt;:
8183   &lt;<emphasis>option</emphasis>&gt;
8184   ...
8185   &lt;<emphasis>option</emphasis>&gt;
8186 </literallayout>
8187 <para>
8188 In the following example, the instance name is <command>localuser</command>, and it is
8189 followed by three options settings:
8190 </para>
8191 <literallayout class="monospaced">
8192 localuser:
8193   driver = accept
8194   check_local_user
8195   transport = local_delivery
8196 </literallayout>
8197 <para>
8198 For each driver instance, you specify which Exim code module it uses &ndash; by the
8199 setting of the <option>driver</option> option &ndash; and (optionally) some configuration
8200 settings. For example, in the case of transports, if you want a transport to
8201 deliver with SMTP you would use the <command>smtp</command> driver; if you want to deliver to
8202 a local file you would use the <command>appendfile</command> driver. Each of the drivers is
8203 described in detail in its own separate chapter later in this manual.
8204 </para>
8205 <para>
8206 You can have several routers, transports, or authenticators that are based on
8207 the same underlying driver (each must have a different instance name).
8208 </para>
8209 <para>
8210 The order in which routers are defined is important, because addresses are
8211 passed to individual routers one by one, in order. The order in which
8212 transports are defined does not matter at all. The order in which
8213 authenticators are defined is used only when Exim, as a client, is searching
8214 them to find one that matches an authentication mechanism offered by the
8215 server.
8216 </para>
8217 <para>
8218 <indexterm role="concept">
8219 <primary>generic options</primary>
8220 </indexterm>
8221 <indexterm role="concept">
8222 <primary>options</primary>
8223 <secondary>generic &ndash; definition of</secondary>
8224 </indexterm>
8225 Within a driver instance definition, there are two kinds of option: <emphasis>generic</emphasis>
8226 and <emphasis>private</emphasis>. The generic options are those that apply to all drivers of the
8227 same type (that is, all routers, all transports or all authenticators). The
8228 <option>driver</option> option is a generic option that must appear in every definition.
8229 <indexterm role="concept">
8230 <primary>private options</primary>
8231 </indexterm>
8232 The private options are special for each driver, and none need appear, because
8233 they all have default values.
8234 </para>
8235 <para>
8236 The options may appear in any order, except that the <option>driver</option> option must
8237 precede any private options, since these depend on the particular driver. For
8238 this reason, it is recommended that <option>driver</option> always be the first option.
8239 </para>
8240 <para>
8241 Driver instance names, which are used for reference in log entries and
8242 elsewhere, can be any sequence of letters, digits, and underscores (starting
8243 with a letter) and must be unique among drivers of the same type. A router and
8244 a transport (for example) can each have the same name, but no two router
8245 instances can have the same name. The name of a driver instance should not be
8246 confused with the name of the underlying driver module. For example, the
8247 configuration lines:
8248 </para>
8249 <literallayout class="monospaced">
8250 remote_smtp:
8251   driver = smtp
8252 </literallayout>
8253 <para>
8254 create an instance of the <command>smtp</command> transport driver whose name is
8255 <command>remote_smtp</command>. The same driver code can be used more than once, with
8256 different instance names and different option settings each time. A second
8257 instance of the <command>smtp</command> transport, with different options, might be defined
8258 thus:
8259 </para>
8260 <literallayout class="monospaced">
8261 special_smtp:
8262   driver = smtp
8263   port = 1234
8264   command_timeout = 10s
8265 </literallayout>
8266 <para>
8267 The names <command>remote_smtp</command> and <command>special_smtp</command> would be used to reference
8268 these transport instances from routers, and these names would appear in log
8269 lines.
8270 </para>
8271 <para>
8272 Comment lines may be present in the middle of driver specifications. The full
8273 list of option settings for any particular driver instance, including all the
8274 defaulted values, can be extracted by making use of the <option>-bP</option> command line
8275 option.
8276 </para>
8277 </section>
8278 </chapter>
8279
8280 <chapter id="CHAPdefconfil">
8281 <title>The default configuration file</title>
8282 <para>
8283 <indexterm role="concept" id="IIDconfiwal" class="startofrange">
8284 <primary>configuration file</primary>
8285 <secondary>default <quote>walk through</quote></secondary>
8286 </indexterm>
8287 <indexterm role="concept">
8288 <primary>default</primary>
8289 <secondary>configuration file <quote>walk through</quote></secondary>
8290 </indexterm>
8291 The default configuration file supplied with Exim as <filename>src/configure.default</filename>
8292 is sufficient for a host with simple mail requirements. As an introduction to
8293 the way Exim is configured, this chapter <quote>walks through</quote> the default
8294 configuration, giving brief explanations of the settings. Detailed descriptions
8295 of the options are given in subsequent chapters. The default configuration file
8296 itself contains extensive comments about ways you might want to modify the
8297 initial settings. However, note that there are many options that are not
8298 mentioned at all in the default configuration.
8299 </para>
8300 <section id="SECTdefconfmain">
8301 <title>Main configuration settings</title>
8302 <para>
8303 The main (global) configuration option settings must always come first in the
8304 file. The first thing you&#x2019;ll see in the file, after some initial comments, is
8305 the line
8306 </para>
8307 <literallayout class="monospaced">
8308 # primary_hostname =
8309 </literallayout>
8310 <para>
8311 This is a commented-out setting of the <option>primary_hostname</option> option. Exim needs
8312 to know the official, fully qualified name of your host, and this is where you
8313 can specify it. However, in most cases you do not need to set this option. When
8314 it is unset, Exim uses the <function>uname()</function> system function to obtain the host name.
8315 </para>
8316 <para>
8317 The first three non-comment configuration lines are as follows:
8318 </para>
8319 <literallayout class="monospaced">
8320 domainlist local_domains    = @
8321 domainlist relay_to_domains =
8322 hostlist   relay_from_hosts = 127.0.0.1
8323 </literallayout>
8324 <para>
8325 These are not, in fact, option settings. They are definitions of two named
8326 domain lists and one named host list. Exim allows you to give names to lists of
8327 domains, hosts, and email addresses, in order to make it easier to manage the
8328 configuration file (see section <xref linkend="SECTnamedlists"/>).
8329 </para>
8330 <para>
8331 The first line defines a domain list called <emphasis>local_domains</emphasis>; this is used
8332 later in the configuration to identify domains that are to be delivered
8333 on the local host.
8334 </para>
8335 <para>
8336 <indexterm role="concept">
8337 <primary>@ in a domain list</primary>
8338 </indexterm>
8339 There is just one item in this list, the string <quote>@</quote>. This is a special form
8340 of entry which means <quote>the name of the local host</quote>. Thus, if the local host is
8341 called <emphasis>a.host.example</emphasis>, mail to <emphasis>any.user@a.host.example</emphasis> is expected to
8342 be delivered locally. Because the local host&#x2019;s name is referenced indirectly,
8343 the same configuration file can be used on different hosts.
8344 </para>
8345 <para>
8346 The second line defines a domain list called <emphasis>relay_to_domains</emphasis>, but the
8347 list itself is empty. Later in the configuration we will come to the part that
8348 controls mail relaying through the local host; it allows relaying to any
8349 domains in this list. By default, therefore, no relaying on the basis of a mail
8350 domain is permitted.
8351 </para>
8352 <para>
8353 The third line defines a host list called <emphasis>relay_from_hosts</emphasis>. This list is
8354 used later in the configuration to permit relaying from any host or IP address
8355 that matches the list. The default contains just the IP address of the IPv4
8356 loopback interface, which means that processes on the local host are able to
8357 submit mail for relaying by sending it over TCP/IP to that interface. No other
8358 hosts are permitted to submit messages for relaying.
8359 </para>
8360 <para>
8361 Just to be sure there&#x2019;s no misunderstanding: at this point in the configuration
8362 we aren&#x2019;t actually setting up any controls. We are just defining some domains
8363 and hosts that will be used in the controls that are specified later.
8364 </para>
8365 <para>
8366 The next two configuration lines are genuine option settings:
8367 </para>
8368 <literallayout class="monospaced">
8369 acl_smtp_rcpt = acl_check_rcpt
8370 acl_smtp_data = acl_check_data
8371 </literallayout>
8372 <para>
8373 These options specify <emphasis>Access Control Lists</emphasis> (ACLs) that are to be used
8374 during an incoming SMTP session for every recipient of a message (every RCPT
8375 command), and after the contents of the message have been received,
8376 respectively. The names of the lists are <emphasis>acl_check_rcpt</emphasis> and
8377 <emphasis>acl_check_data</emphasis>, and we will come to their definitions below, in the ACL
8378 section of the configuration. The RCPT ACL controls which recipients are
8379 accepted for an incoming message &ndash; if a configuration does not provide an ACL
8380 to check recipients, no SMTP mail can be accepted. The DATA ACL allows the
8381 contents of a message to be checked.
8382 </para>
8383 <para>
8384 Two commented-out option settings are next:
8385 </para>
8386 <literallayout class="monospaced">
8387 # av_scanner = clamd:/tmp/clamd
8388 # spamd_address = 127.0.0.1 783
8389 </literallayout>
8390 <para>
8391 These are example settings that can be used when Exim is compiled with the
8392 content-scanning extension. The first specifies the interface to the virus
8393 scanner, and the second specifies the interface to SpamAssassin. Further
8394 details are given in chapter <xref linkend="CHAPexiscan"/>.
8395 </para>
8396 <para>
8397 Three more commented-out option settings follow:
8398 </para>
8399 <literallayout class="monospaced">
8400 # tls_advertise_hosts = *
8401 # tls_certificate = /etc/ssl/exim.crt
8402 # tls_privatekey = /etc/ssl/exim.pem
8403 </literallayout>
8404 <para>
8405 These are example settings that can be used when Exim is compiled with
8406 support for TLS (aka SSL) as described in section <xref linkend="SECTinctlsssl"/>. The
8407 first one specifies the list of clients that are allowed to use TLS when
8408 connecting to this server; in this case the wildcard means all clients. The
8409 other options specify where Exim should find its TLS certificate and private
8410 key, which together prove the server&#x2019;s identity to any clients that connect.
8411 More details are given in chapter <xref linkend="CHAPTLS"/>.
8412 </para>
8413 <para>
8414 Another two commented-out option settings follow:
8415 </para>
8416 <literallayout class="monospaced">
8417 # daemon_smtp_ports = 25 : 465 : 587
8418 # tls_on_connect_ports = 465
8419 </literallayout>
8420 <para>
8421 <indexterm role="concept">
8422 <primary>port</primary>
8423 <secondary>465 and 587</secondary>
8424 </indexterm>
8425 <indexterm role="concept">
8426 <primary>port</primary>
8427 <secondary>for message submission</secondary>
8428 </indexterm>
8429 <indexterm role="concept">
8430 <primary>message</primary>
8431 <secondary>submission, ports for</secondary>
8432 </indexterm>
8433 <indexterm role="concept">
8434 <primary>ssmtp protocol</primary>
8435 </indexterm>
8436 <indexterm role="concept">
8437 <primary>smtps protocol</primary>
8438 </indexterm>
8439 <indexterm role="concept">
8440 <primary>SMTP</primary>
8441 <secondary>ssmtp protocol</secondary>
8442 </indexterm>
8443 <indexterm role="concept">
8444 <primary>SMTP</primary>
8445 <secondary>smtps protocol</secondary>
8446 </indexterm>
8447 These options provide better support for roaming users who wish to use this
8448 server for message submission. They are not much use unless you have turned on
8449 TLS (as described in the previous paragraph) and authentication (about which
8450 more in section <xref linkend="SECTdefconfauth"/>). The usual SMTP port 25 is often blocked
8451 on end-user networks, so RFC 4409 specifies that message submission should use
8452 port 587 instead. However some software (notably Microsoft Outlook) cannot be
8453 configured to use port 587 correctly, so these settings also enable the
8454 non-standard <quote>smtps</quote> (aka <quote>ssmtp</quote>) port 465 (see section
8455 <xref linkend="SECTsupobssmt"/>).
8456 </para>
8457 <para>
8458 Two more commented-out options settings follow:
8459 </para>
8460 <literallayout class="monospaced">
8461 # qualify_domain =
8462 # qualify_recipient =
8463 </literallayout>
8464 <para>
8465 The first of these specifies a domain that Exim uses when it constructs a
8466 complete email address from a local login name. This is often needed when Exim
8467 receives a message from a local process. If you do not set <option>qualify_domain</option>,
8468 the value of <option>primary_hostname</option> is used. If you set both of these options,
8469 you can have different qualification domains for sender and recipient
8470 addresses. If you set only the first one, its value is used in both cases.
8471 </para>
8472 <para>
8473 <indexterm role="concept">
8474 <primary>domain literal</primary>
8475 <secondary>recognizing format</secondary>
8476 </indexterm>
8477 The following line must be uncommented if you want Exim to recognize
8478 addresses of the form <emphasis>user@[10.11.12.13]</emphasis> that is, with a <quote>domain literal</quote>
8479 (an IP address within square brackets) instead of a named domain.
8480 </para>
8481 <literallayout class="monospaced">
8482 # allow_domain_literals
8483 </literallayout>
8484 <para>
8485 The RFCs still require this form, but many people think that in the modern
8486 Internet it makes little sense to permit mail to be sent to specific hosts by
8487 quoting their IP addresses. This ancient format has been used by people who
8488 try to abuse hosts by using them for unwanted relaying. However, some
8489 people believe there are circumstances (for example, messages addressed to
8490 <emphasis>postmaster</emphasis>) where domain literals are still useful.
8491 </para>
8492 <para>
8493 The next configuration line is a kind of trigger guard:
8494 </para>
8495 <literallayout class="monospaced">
8496 never_users = root
8497 </literallayout>
8498 <para>
8499 It specifies that no delivery must ever be run as the root user. The normal
8500 convention is to set up <emphasis>root</emphasis> as an alias for the system administrator. This
8501 setting is a guard against slips in the configuration.
8502 The list of users specified by <option>never_users</option> is not, however, the complete
8503 list; the build-time configuration in <filename>Local/Makefile</filename> has an option called
8504 FIXED_NEVER_USERS specifying a list that cannot be overridden. The
8505 contents of <option>never_users</option> are added to this list. By default
8506 FIXED_NEVER_USERS also specifies root.
8507 </para>
8508 <para>
8509 When a remote host connects to Exim in order to send mail, the only information
8510 Exim has about the host&#x2019;s identity is its IP address. The next configuration
8511 line,
8512 </para>
8513 <literallayout class="monospaced">
8514 host_lookup = *
8515 </literallayout>
8516 <para>
8517 specifies that Exim should do a reverse DNS lookup on all incoming connections,
8518 in order to get a host name. This improves the quality of the logging
8519 information, but if you feel it is too expensive, you can remove it entirely,
8520 or restrict the lookup to hosts on <quote>nearby</quote> networks.
8521 Note that it is not always possible to find a host name from an IP address,
8522 because not all DNS reverse zones are maintained, and sometimes DNS servers are
8523 unreachable.
8524 </para>
8525 <para>
8526 The next two lines are concerned with <emphasis>ident</emphasis> callbacks, as defined by RFC
8527 1413 (hence their names):
8528 </para>
8529 <literallayout class="monospaced">
8530 rfc1413_hosts = *
8531 rfc1413_query_timeout = 0s
8532 </literallayout>
8533 <para>
8534 These settings cause Exim to avoid ident callbacks for all incoming SMTP calls.
8535 Few hosts offer RFC1413 service these days; calls have to be
8536 terminated by a timeout and this needlessly delays the startup
8537 of an incoming SMTP connection.
8538 If you have hosts for which you trust RFC1413 and need this
8539 information, you can change this.
8540 </para>
8541 <para>
8542 This line enables an efficiency SMTP option.  It is negotiated by clients
8543 and not expected to cause problems but can be disabled if needed.
8544 </para>
8545 <literallayout class="monospaced">
8546 prdr_enable = true
8547 </literallayout>
8548 <para>
8549 When Exim receives messages over SMTP connections, it expects all addresses to
8550 be fully qualified with a domain, as required by the SMTP definition. However,
8551 if you are running a server to which simple clients submit messages, you may
8552 find that they send unqualified addresses. The two commented-out options:
8553 </para>
8554 <literallayout class="monospaced">
8555 # sender_unqualified_hosts =
8556 # recipient_unqualified_hosts =
8557 </literallayout>
8558 <para>
8559 show how you can specify hosts that are permitted to send unqualified sender
8560 and recipient addresses, respectively.
8561 </para>
8562 <para>
8563 The <option>percent_hack_domains</option> option is also commented out:
8564 </para>
8565 <literallayout class="monospaced">
8566 # percent_hack_domains =
8567 </literallayout>
8568 <para>
8569 It provides a list of domains for which the <quote>percent hack</quote> is to operate.
8570 This is an almost obsolete form of explicit email routing. If you do not know
8571 anything about it, you can safely ignore this topic.
8572 </para>
8573 <para>
8574 The last two settings in the main part of the default configuration are
8575 concerned with messages that have been <quote>frozen</quote> on Exim&#x2019;s queue. When a
8576 message is frozen, Exim no longer continues to try to deliver it. Freezing
8577 occurs when a bounce message encounters a permanent failure because the sender
8578 address of the original message that caused the bounce is invalid, so the
8579 bounce cannot be delivered. This is probably the most common case, but there
8580 are also other conditions that cause freezing, and frozen messages are not
8581 always bounce messages.
8582 </para>
8583 <literallayout class="monospaced">
8584 ignore_bounce_errors_after = 2d
8585 timeout_frozen_after = 7d
8586 </literallayout>
8587 <para>
8588 The first of these options specifies that failing bounce messages are to be
8589 discarded after 2 days on the queue. The second specifies that any frozen
8590 message (whether a bounce message or not) is to be timed out (and discarded)
8591 after a week. In this configuration, the first setting ensures that no failing
8592 bounce message ever lasts a week.
8593 </para>
8594 </section>
8595 <section id="SECID54">
8596 <title>ACL configuration</title>
8597 <para>
8598 <indexterm role="concept">
8599 <primary>default</primary>
8600 <secondary>ACLs</secondary>
8601 </indexterm>
8602 <indexterm role="concept">
8603 <primary>access control lists (ACLs)</primary>
8604 <secondary>default configuration</secondary>
8605 </indexterm>
8606 In the default configuration, the ACL section follows the main configuration.
8607 It starts with the line
8608 </para>
8609 <literallayout class="monospaced">
8610 begin acl
8611 </literallayout>
8612 <para>
8613 and it contains the definitions of two ACLs, called <emphasis>acl_check_rcpt</emphasis> and
8614 <emphasis>acl_check_data</emphasis>, that were referenced in the settings of <option>acl_smtp_rcpt</option>
8615 and <option>acl_smtp_data</option> above.
8616 </para>
8617 <para>
8618 <indexterm role="concept">
8619 <primary>RCPT</primary>
8620 <secondary>ACL for</secondary>
8621 </indexterm>
8622 The first ACL is used for every RCPT command in an incoming SMTP message. Each
8623 RCPT command specifies one of the message&#x2019;s recipients. The ACL statements
8624 are considered in order, until the recipient address is either accepted or
8625 rejected. The RCPT command is then accepted or rejected, according to the
8626 result of the ACL processing.
8627 </para>
8628 <literallayout class="monospaced">
8629 acl_check_rcpt:
8630 </literallayout>
8631 <para>
8632 This line, consisting of a name terminated by a colon, marks the start of the
8633 ACL, and names it.
8634 </para>
8635 <literallayout class="monospaced">
8636 accept  hosts = :
8637 </literallayout>
8638 <para>
8639 This ACL statement accepts the recipient if the sending host matches the list.
8640 But what does that strange list mean? It doesn&#x2019;t actually contain any host
8641 names or IP addresses. The presence of the colon puts an empty item in the
8642 list; Exim matches this only if the incoming message did not come from a remote
8643 host, because in that case, the remote hostname is empty. The colon is
8644 important. Without it, the list itself is empty, and can never match anything.
8645 </para>
8646 <para>
8647 What this statement is doing is to accept unconditionally all recipients in
8648 messages that are submitted by SMTP from local processes using the standard
8649 input and output (that is, not using TCP/IP). A number of MUAs operate in this
8650 manner.
8651 </para>
8652 <literallayout class="monospaced">
8653 deny    message       = Restricted characters in address
8654         domains       = +local_domains
8655         local_parts   = ^[.] : ^.*[@%!/|]
8656
8657 deny    message       = Restricted characters in address
8658         domains       = !+local_domains
8659         local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
8660 </literallayout>
8661 <para>
8662 These statements are concerned with local parts that contain any of the
8663 characters <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>, <quote>|</quote>, or dots in unusual places.
8664 Although these characters are entirely legal in local parts (in the case of
8665 <quote>@</quote> and leading dots, only if correctly quoted), they do not commonly occur
8666 in Internet mail addresses.
8667 </para>
8668 <para>
8669 The first three have in the past been associated with explicitly routed
8670 addresses (percent is still sometimes used &ndash; see the <option>percent_hack_domains</option>
8671 option). Addresses containing these characters are regularly tried by spammers
8672 in an attempt to bypass relaying restrictions, and also by open relay testing
8673 programs. Unless you really need them it is safest to reject these characters
8674 at this early stage. This configuration is heavy-handed in rejecting these
8675 characters for all messages it accepts from remote hosts. This is a deliberate
8676 policy of being as safe as possible.
8677 </para>
8678 <para>
8679 The first rule above is stricter, and is applied to messages that are addressed
8680 to one of the local domains handled by this host. This is implemented by the
8681 first condition, which restricts it to domains that are listed in the
8682 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8683 reference to a named list. In this configuration, there is just one domain in
8684 <emphasis>local_domains</emphasis>, but in general there may be many.
8685 </para>
8686 <para>
8687 The second condition on the first statement uses two regular expressions to
8688 block local parts that begin with a dot or contain <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>,
8689 or <quote>|</quote>. If you have local accounts that include these characters, you will
8690 have to modify this rule.
8691 </para>
8692 <para>
8693 Empty components (two dots in a row) are not valid in RFC 2822, but Exim
8694 allows them because they have been encountered in practice. (Consider the
8695 common convention of local parts constructed as
8696 <quote><emphasis>first-initial.second-initial.family-name</emphasis></quote> when applied to someone like
8697 the author of Exim, who has no second initial.) However, a local part starting
8698 with a dot or containing <quote>/../</quote> can cause trouble if it is used as part of a
8699 file name (for example, for a mailing list). This is also true for local parts
8700 that contain slashes. A pipe symbol can also be troublesome if the local part
8701 is incorporated unthinkingly into a shell command line.
8702 </para>
8703 <para>
8704 The second rule above applies to all other domains, and is less strict. This
8705 allows your own users to send outgoing messages to sites that use slashes
8706 and vertical bars in their local parts. It blocks local parts that begin
8707 with a dot, slash, or vertical bar, but allows these characters within the
8708 local part. However, the sequence <quote>/../</quote> is barred. The use of <quote>@</quote>, <quote>%</quote>,
8709 and <quote>!</quote> is blocked, as before. The motivation here is to prevent your users
8710 (or your users&#x2019; viruses) from mounting certain kinds of attack on remote sites.
8711 </para>
8712 <literallayout class="monospaced">
8713 accept  local_parts   = postmaster
8714         domains       = +local_domains
8715 </literallayout>
8716 <para>
8717 This statement, which has two conditions, accepts an incoming address if the
8718 local part is <emphasis>postmaster</emphasis> and the domain is one of those listed in the
8719 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8720 reference to a named list. In this configuration, there is just one domain in
8721 <emphasis>local_domains</emphasis>, but in general there may be many.
8722 </para>
8723 <para>
8724 The presence of this statement means that mail to postmaster is never blocked
8725 by any of the subsequent tests. This can be helpful while sorting out problems
8726 in cases where the subsequent tests are incorrectly denying access.
8727 </para>
8728 <literallayout class="monospaced">
8729 require verify        = sender
8730 </literallayout>
8731 <para>
8732 This statement requires the sender address to be verified before any subsequent
8733 ACL statement can be used. If verification fails, the incoming recipient
8734 address is refused. Verification consists of trying to route the address, to
8735 see if a bounce message could be delivered to it. In the case of remote
8736 addresses, basic verification checks only the domain, but <emphasis>callouts</emphasis> can be
8737 used for more verification if required. Section <xref linkend="SECTaddressverification"/>
8738 discusses the details of address verification.
8739 </para>
8740 <literallayout class="monospaced">
8741 accept  hosts         = +relay_from_hosts
8742         control       = submission
8743 </literallayout>
8744 <para>
8745 This statement accepts the address if the message is coming from one of the
8746 hosts that are defined as being allowed to relay through this host. Recipient
8747 verification is omitted here, because in many cases the clients are dumb MUAs
8748 that do not cope well with SMTP error responses. For the same reason, the
8749 second line specifies <quote>submission mode</quote> for messages that are accepted. This
8750 is described in detail in section <xref linkend="SECTsubmodnon"/>; it causes Exim to fix
8751 messages that are deficient in some way, for example, because they lack a
8752 <emphasis>Date:</emphasis> header line. If you are actually relaying out from MTAs, you should
8753 probably add recipient verification here, and disable submission mode.
8754 </para>
8755 <literallayout class="monospaced">
8756 accept  authenticated = *
8757         control       = submission
8758 </literallayout>
8759 <para>
8760 This statement accepts the address if the client host has authenticated itself.
8761 Submission mode is again specified, on the grounds that such messages are most
8762 likely to come from MUAs. The default configuration does not define any
8763 authenticators, though it does include some nearly complete commented-out
8764 examples described in <xref linkend="SECTdefconfauth"/>. This means that no client can in
8765 fact authenticate until you complete the authenticator definitions.
8766 </para>
8767 <literallayout class="monospaced">
8768 require message = relay not permitted
8769         domains = +local_domains : +relay_to_domains
8770 </literallayout>
8771 <para>
8772 This statement rejects the address if its domain is neither a local domain nor
8773 one of the domains for which this host is a relay.
8774 </para>
8775 <literallayout class="monospaced">
8776 require verify = recipient
8777 </literallayout>
8778 <para>
8779 This statement requires the recipient address to be verified; if verification
8780 fails, the address is rejected.
8781 </para>
8782 <literallayout class="monospaced">
8783 # deny    message     = rejected because $sender_host_address \
8784 #                       is in a black list at $dnslist_domain\n\
8785 #                       $dnslist_text
8786 #         dnslists    = black.list.example
8787 #
8788 # warn    dnslists    = black.list.example
8789 #         add_header  = X-Warning: $sender_host_address is in \
8790 #                       a black list at $dnslist_domain
8791 #         log_message = found in $dnslist_domain
8792 </literallayout>
8793 <para>
8794 These commented-out lines are examples of how you could configure Exim to check
8795 sending hosts against a DNS black list. The first statement rejects messages
8796 from blacklisted hosts, whereas the second just inserts a warning header
8797 line.
8798 </para>
8799 <literallayout class="monospaced">
8800 # require verify = csa
8801 </literallayout>
8802 <para>
8803 This commented-out line is an example of how you could turn on client SMTP
8804 authorization (CSA) checking. Such checks do DNS lookups for special SRV
8805 records.
8806 </para>
8807 <literallayout class="monospaced">
8808 accept
8809 </literallayout>
8810 <para>
8811 The final statement in the first ACL unconditionally accepts any recipient
8812 address that has successfully passed all the previous tests.
8813 </para>
8814 <literallayout class="monospaced">
8815 acl_check_data:
8816 </literallayout>
8817 <para>
8818 This line marks the start of the second ACL, and names it. Most of the contents
8819 of this ACL are commented out:
8820 </para>
8821 <literallayout class="monospaced">
8822 # deny    malware   = *
8823 #         message   = This message contains a virus \
8824 #                     ($malware_name).
8825 </literallayout>
8826 <para>
8827 These lines are examples of how to arrange for messages to be scanned for
8828 viruses when Exim has been compiled with the content-scanning extension, and a
8829 suitable virus scanner is installed. If the message is found to contain a
8830 virus, it is rejected with the given custom error message.
8831 </para>
8832 <literallayout class="monospaced">
8833 # warn    spam      = nobody
8834 #         message   = X-Spam_score: $spam_score\n\
8835 #                     X-Spam_score_int: $spam_score_int\n\
8836 #                     X-Spam_bar: $spam_bar\n\
8837 #                     X-Spam_report: $spam_report
8838 </literallayout>
8839 <para>
8840 These lines are an example of how to arrange for messages to be scanned by
8841 SpamAssassin when Exim has been compiled with the content-scanning extension,
8842 and SpamAssassin has been installed. The SpamAssassin check is run with
8843 <literal>nobody</literal> as its user parameter, and the results are added to the message as a
8844 series of extra header line. In this case, the message is not rejected,
8845 whatever the spam score.
8846 </para>
8847 <literallayout class="monospaced">
8848 accept
8849 </literallayout>
8850 <para>
8851 This final line in the DATA ACL accepts the message unconditionally.
8852 </para>
8853 </section>
8854 <section id="SECID55">
8855 <title>Router configuration</title>
8856 <para>
8857 <indexterm role="concept">
8858 <primary>default</primary>
8859 <secondary>routers</secondary>
8860 </indexterm>
8861 <indexterm role="concept">
8862 <primary>routers</primary>
8863 <secondary>default</secondary>
8864 </indexterm>
8865 The router configuration comes next in the default configuration, introduced
8866 by the line
8867 </para>
8868 <literallayout class="monospaced">
8869 begin routers
8870 </literallayout>
8871 <para>
8872 Routers are the modules in Exim that make decisions about where to send
8873 messages. An address is passed to each router in turn, until it is either
8874 accepted, or failed. This means that the order in which you define the routers
8875 matters. Each router is fully described in its own chapter later in this
8876 manual. Here we give only brief overviews.
8877 </para>
8878 <literallayout class="monospaced">
8879 # domain_literal:
8880 #   driver = ipliteral
8881 #   domains = !+local_domains
8882 #   transport = remote_smtp
8883 </literallayout>
8884 <para>
8885 <indexterm role="concept">
8886 <primary>domain literal</primary>
8887 <secondary>default router</secondary>
8888 </indexterm>
8889 This router is commented out because the majority of sites do not want to
8890 support domain literal addresses (those of the form <emphasis>user@[10.9.8.7]</emphasis>). If
8891 you uncomment this router, you also need to uncomment the setting of
8892 <option>allow_domain_literals</option> in the main part of the configuration.
8893 </para>
8894 <literallayout class="monospaced">
8895 dnslookup:
8896   driver = dnslookup
8897   domains = ! +local_domains
8898   transport = remote_smtp
8899   ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
8900   no_more
8901 </literallayout>
8902 <para>
8903 The first uncommented router handles addresses that do not involve any local
8904 domains. This is specified by the line
8905 </para>
8906 <literallayout class="monospaced">
8907 domains = ! +local_domains
8908 </literallayout>
8909 <para>
8910 The <option>domains</option> option lists the domains to which this router applies, but the
8911 exclamation mark is a negation sign, so the router is used only for domains
8912 that are not in the domain list called <emphasis>local_domains</emphasis> (which was defined at
8913 the start of the configuration). The plus sign before <emphasis>local_domains</emphasis>
8914 indicates that it is referring to a named list. Addresses in other domains are
8915 passed on to the following routers.
8916 </para>
8917 <para>
8918 The name of the router driver is <command>dnslookup</command>,
8919 and is specified by the <option>driver</option> option. Do not be confused by the fact that
8920 the name of this router instance is the same as the name of the driver. The
8921 instance name is arbitrary, but the name set in the <option>driver</option> option must be
8922 one of the driver modules that is in the Exim binary.
8923 </para>
8924 <para>
8925 The <command>dnslookup</command> router routes addresses by looking up their domains in the
8926 DNS in order to obtain a list of hosts to which the address is routed. If the
8927 router succeeds, the address is queued for the <command>remote_smtp</command> transport, as
8928 specified by the <option>transport</option> option. If the router does not find the domain
8929 in the DNS, no further routers are tried because of the <option>no_more</option> setting, so
8930 the address fails and is bounced.
8931 </para>
8932 <para>
8933 The <option>ignore_target_hosts</option> option specifies a list of IP addresses that are to
8934 be entirely ignored. This option is present because a number of cases have been
8935 encountered where MX records in the DNS point to host names
8936 whose IP addresses are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1).
8937 Completely ignoring these IP addresses causes Exim to fail to route the
8938 email address, so it bounces. Otherwise, Exim would log a routing problem, and
8939 continue to try to deliver the message periodically until the address timed
8940 out.
8941 </para>
8942 <literallayout class="monospaced">
8943 system_aliases:
8944   driver = redirect
8945   allow_fail
8946   allow_defer
8947   data = ${lookup{$local_part}lsearch{/etc/aliases}}
8948 # user = exim
8949   file_transport = address_file
8950   pipe_transport = address_pipe
8951 </literallayout>
8952 <para>
8953 Control reaches this and subsequent routers only for addresses in the local
8954 domains. This router checks to see whether the local part is defined as an
8955 alias in the <filename>/etc/aliases</filename> file, and if so, redirects it according to the
8956 data that it looks up from that file. If no data is found for the local part,
8957 the value of the <option>data</option> option is empty, causing the address to be passed to
8958 the next router.
8959 </para>
8960 <para>
8961 <filename>/etc/aliases</filename> is a conventional name for the system aliases file that is
8962 often used. That is why it is referenced by from the default configuration
8963 file. However, you can change this by setting SYSTEM_ALIASES_FILE in
8964 <filename>Local/Makefile</filename> before building Exim.
8965 </para>
8966 <literallayout class="monospaced">
8967 userforward:
8968   driver = redirect
8969   check_local_user
8970 # local_part_suffix = +* : -*
8971 # local_part_suffix_optional
8972   file = $home/.forward
8973 # allow_filter
8974   no_verify
8975   no_expn
8976   check_ancestor
8977   file_transport = address_file
8978   pipe_transport = address_pipe
8979   reply_transport = address_reply
8980 </literallayout>
8981 <para>
8982 This is the most complicated router in the default configuration. It is another
8983 redirection router, but this time it is looking for forwarding data set up by
8984 individual users. The <option>check_local_user</option> setting specifies a check that the
8985 local part of the address is the login name of a local user. If it is not, the
8986 router is skipped. The two commented options that follow <option>check_local_user</option>,
8987 namely:
8988 </para>
8989 <literallayout class="monospaced">
8990 # local_part_suffix = +* : -*
8991 # local_part_suffix_optional
8992 </literallayout>
8993 <para>
8994 <indexterm role="variable">
8995 <primary><varname>$local_part_suffix</varname></primary>
8996 </indexterm>
8997 show how you can specify the recognition of local part suffixes. If the first
8998 is uncommented, a suffix beginning with either a plus or a minus sign, followed
8999 by any sequence of characters, is removed from the local part and placed in the
9000 variable <varname>$local_part_suffix</varname>. The second suffix option specifies that the
9001 presence of a suffix in the local part is optional. When a suffix is present,
9002 the check for a local login uses the local part with the suffix removed.
9003 </para>
9004 <para>
9005 When a local user account is found, the file called <filename>.forward</filename> in the user&#x2019;s
9006 home directory is consulted. If it does not exist, or is empty, the router
9007 declines. Otherwise, the contents of <filename>.forward</filename> are interpreted as
9008 redirection data (see chapter <xref linkend="CHAPredirect"/> for more details).
9009 </para>
9010 <para>
9011 <indexterm role="concept">
9012 <primary>Sieve filter</primary>
9013 <secondary>enabling in default router</secondary>
9014 </indexterm>
9015 Traditional <filename>.forward</filename> files contain just a list of addresses, pipes, or
9016 files. Exim supports this by default. However, if <option>allow_filter</option> is set (it
9017 is commented out by default), the contents of the file are interpreted as a set
9018 of Exim or Sieve filtering instructions, provided the file begins with <quote>#Exim
9019 filter</quote> or <quote>#Sieve filter</quote>, respectively. User filtering is discussed in the
9020 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
9021 </para>
9022 <para>
9023 The <option>no_verify</option> and <option>no_expn</option> options mean that this router is skipped when
9024 verifying addresses, or when running as a consequence of an SMTP EXPN command.
9025 There are two reasons for doing this:
9026 </para>
9027 <orderedlist numeration="arabic">
9028 <listitem>
9029 <para>
9030 Whether or not a local user has a <filename>.forward</filename> file is not really relevant when
9031 checking an address for validity; it makes sense not to waste resources doing
9032 unnecessary work.
9033 </para>
9034 </listitem>
9035 <listitem>
9036 <para>
9037 More importantly, when Exim is verifying addresses or handling an EXPN
9038 command during an SMTP session, it is running as the Exim user, not as root.
9039 The group is the Exim group, and no additional groups are set up.
9040 It may therefore not be possible for Exim to read users&#x2019; <filename>.forward</filename> files at
9041 this time.
9042 </para>
9043 </listitem>
9044 </orderedlist>
9045 <para>
9046 The setting of <option>check_ancestor</option> prevents the router from generating a new
9047 address that is the same as any previous address that was redirected. (This
9048 works round a problem concerning a bad interaction between aliasing and
9049 forwarding &ndash; see section <xref linkend="SECTredlocmai"/>).
9050 </para>
9051 <para>
9052 The final three option settings specify the transports that are to be used when
9053 forwarding generates a direct delivery to a file, or to a pipe, or sets up an
9054 auto-reply, respectively. For example, if a <filename>.forward</filename> file contains
9055 </para>
9056 <literallayout class="monospaced">
9057 a.nother@elsewhere.example, /home/spqr/archive
9058 </literallayout>
9059 <para>
9060 the delivery to <filename>/home/spqr/archive</filename> is done by running the <option>address_file</option>
9061 transport.
9062 </para>
9063 <literallayout class="monospaced">
9064 localuser:
9065   driver = accept
9066   check_local_user
9067 # local_part_suffix = +* : -*
9068 # local_part_suffix_optional
9069   transport = local_delivery
9070 </literallayout>
9071 <para>
9072 The final router sets up delivery into local mailboxes, provided that the local
9073 part is the name of a local login, by accepting the address and assigning it to
9074 the <command>local_delivery</command> transport. Otherwise, we have reached the end of the
9075 routers, so the address is bounced. The commented suffix settings fulfil the
9076 same purpose as they do for the <command>userforward</command> router.
9077 </para>
9078 </section>
9079 <section id="SECID56">
9080 <title>Transport configuration</title>
9081 <para>
9082 <indexterm role="concept">
9083 <primary>default</primary>
9084 <secondary>transports</secondary>
9085 </indexterm>
9086 <indexterm role="concept">
9087 <primary>transports</primary>
9088 <secondary>default</secondary>
9089 </indexterm>
9090 Transports define mechanisms for actually delivering messages. They operate
9091 only when referenced from routers, so the order in which they are defined does
9092 not matter. The transports section of the configuration starts with
9093 </para>
9094 <literallayout class="monospaced">
9095 begin transports
9096 </literallayout>
9097 <para>
9098 One remote transport and four local transports are defined.
9099 </para>
9100 <literallayout class="monospaced">
9101 remote_smtp:
9102   driver = smtp
9103   hosts_try_prdr = *
9104 </literallayout>
9105 <para>
9106 This transport is used for delivering messages over SMTP connections.
9107 The list of remote hosts comes from the router.
9108 The <option>hosts_try_prdr</option> option enables an efficiency SMTP option.
9109 It is negotiated between client and server
9110 and not expected to cause problems but can be disabled if needed.
9111 All other options are defaulted.
9112 </para>
9113 <literallayout class="monospaced">
9114 local_delivery:
9115   driver = appendfile
9116   file = /var/mail/$local_part
9117   delivery_date_add
9118   envelope_to_add
9119   return_path_add
9120 # group = mail
9121 # mode = 0660
9122 </literallayout>
9123 <para>
9124 This <command>appendfile</command> transport is used for local delivery to user mailboxes in
9125 traditional BSD mailbox format. By default it runs under the uid and gid of the
9126 local user, which requires the sticky bit to be set on the <filename>/var/mail</filename>
9127 directory. Some systems use the alternative approach of running mail deliveries
9128 under a particular group instead of using the sticky bit. The commented options
9129 show how this can be done.
9130 </para>
9131 <para>
9132 Exim adds three headers to the message as it delivers it: <emphasis>Delivery-date:</emphasis>,
9133 <emphasis>Envelope-to:</emphasis> and <emphasis>Return-path:</emphasis>. This action is requested by the three
9134 similarly-named options above.
9135 </para>
9136 <literallayout class="monospaced">
9137 address_pipe:
9138   driver = pipe
9139   return_output
9140 </literallayout>
9141 <para>
9142 This transport is used for handling deliveries to pipes that are generated by
9143 redirection (aliasing or users&#x2019; <filename>.forward</filename> files). The <option>return_output</option>
9144 option specifies that any output generated by the pipe is to be returned to the
9145 sender.
9146 </para>
9147 <literallayout class="monospaced">
9148 address_file:
9149   driver = appendfile
9150   delivery_date_add
9151   envelope_to_add
9152   return_path_add
9153 </literallayout>
9154 <para>
9155 This transport is used for handling deliveries to files that are generated by
9156 redirection. The name of the file is not specified in this instance of
9157 <command>appendfile</command>, because it comes from the <command>redirect</command> router.
9158 </para>
9159 <literallayout class="monospaced">
9160 address_reply:
9161   driver = autoreply
9162 </literallayout>
9163 <para>
9164 This transport is used for handling automatic replies generated by users&#x2019;
9165 filter files.
9166 </para>
9167 </section>
9168 <section id="SECID57">
9169 <title>Default retry rule</title>
9170 <para>
9171 <indexterm role="concept">
9172 <primary>retry</primary>
9173 <secondary>default rule</secondary>
9174 </indexterm>
9175 <indexterm role="concept">
9176 <primary>default</primary>
9177 <secondary>retry rule</secondary>
9178 </indexterm>
9179 The retry section of the configuration file contains rules which affect the way
9180 Exim retries deliveries that cannot be completed at the first attempt. It is
9181 introduced by the line
9182 </para>
9183 <literallayout class="monospaced">
9184 begin retry
9185 </literallayout>
9186 <para>
9187 In the default configuration, there is just one rule, which applies to all
9188 errors:
9189 </para>
9190 <literallayout class="monospaced">
9191 *   *   F,2h,15m; G,16h,1h,1.5; F,4d,6h
9192 </literallayout>
9193 <para>
9194 This causes any temporarily failing address to be retried every 15 minutes for
9195 2 hours, then at intervals starting at one hour and increasing by a factor of
9196 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address
9197 is not delivered after 4 days of temporary failure, it is bounced.
9198 </para>
9199 <para>
9200 If the retry section is removed from the configuration, or is empty (that is,
9201 if no retry rules are defined), Exim will not retry deliveries. This turns
9202 temporary errors into permanent errors.
9203 </para>
9204 </section>
9205 <section id="SECID58">
9206 <title>Rewriting configuration</title>
9207 <para>
9208 The rewriting section of the configuration, introduced by
9209 </para>
9210 <literallayout class="monospaced">
9211 begin rewrite
9212 </literallayout>
9213 <para>
9214 contains rules for rewriting addresses in messages as they arrive. There are no
9215 rewriting rules in the default configuration file.
9216 </para>
9217 </section>
9218 <section id="SECTdefconfauth">
9219 <title>Authenticators configuration</title>
9220 <para>
9221 <indexterm role="concept">
9222 <primary>AUTH</primary>
9223 <secondary>configuration</secondary>
9224 </indexterm>
9225 The authenticators section of the configuration, introduced by
9226 </para>
9227 <literallayout class="monospaced">
9228 begin authenticators
9229 </literallayout>
9230 <para>
9231 defines mechanisms for the use of the SMTP AUTH command. The default
9232 configuration file contains two commented-out example authenticators
9233 which support plaintext username/password authentication using the
9234 standard PLAIN mechanism and the traditional but non-standard LOGIN
9235 mechanism, with Exim acting as the server. PLAIN and LOGIN are enough
9236 to support most MUA software.
9237 </para>
9238 <para>
9239 The example PLAIN authenticator looks like this:
9240 </para>
9241 <literallayout class="monospaced">
9242 #PLAIN:
9243 #  driver                  = plaintext
9244 #  server_set_id           = $auth2
9245 #  server_prompts          = :
9246 #  server_condition        = Authentication is not yet configured
9247 #  server_advertise_condition = ${if def:tls_in_cipher }
9248 </literallayout>
9249 <para>
9250 And the example LOGIN authenticator looks like this:
9251 </para>
9252 <literallayout class="monospaced">
9253 #LOGIN:
9254 #  driver                  = plaintext
9255 #  server_set_id           = $auth1
9256 #  server_prompts          = &lt;| Username: | Password:
9257 #  server_condition        = Authentication is not yet configured
9258 #  server_advertise_condition = ${if def:tls_in_cipher }
9259 </literallayout>
9260 <para>
9261 The <option>server_set_id</option> option makes Exim remember the authenticated username
9262 in <varname>$authenticated_id</varname>, which can be used later in ACLs or routers. The
9263 <option>server_prompts</option> option configures the <command>plaintext</command> authenticator so
9264 that it implements the details of the specific authentication mechanism,
9265 i.e. PLAIN or LOGIN. The <option>server_advertise_condition</option> setting controls
9266 when Exim offers authentication to clients; in the examples, this is only
9267 when TLS or SSL has been started, so to enable the authenticators you also
9268 need to add support for TLS as described in section <xref linkend="SECTdefconfmain"/>.
9269 </para>
9270 <para>
9271 The <option>server_condition</option> setting defines how to verify that the username and
9272 password are correct. In the examples it just produces an error message.
9273 To make the authenticators work, you can use a string expansion
9274 expression like one of the examples in chapter <xref linkend="CHAPplaintext"/>.
9275 </para>
9276 <para>
9277 Beware that the sequence of the parameters to PLAIN and LOGIN differ; the
9278 usercode and password are in different positions.
9279 Chapter <xref linkend="CHAPplaintext"/> covers both.
9280 </para>
9281 <para>
9282 <indexterm role="concept" startref="IIDconfiwal" class="endofrange"/>
9283 </para>
9284 </section>
9285 </chapter>
9286
9287 <chapter id="CHAPregexp">
9288 <title>Regular expressions</title>
9289 <para>
9290 <indexterm role="concept">
9291 <primary>regular expressions</primary>
9292 <secondary>library</secondary>
9293 </indexterm>
9294 <indexterm role="concept">
9295 <primary>PCRE</primary>
9296 </indexterm>
9297 Exim supports the use of regular expressions in many of its options. It
9298 uses the PCRE regular expression library; this provides regular expression
9299 matching that is compatible with Perl 5. The syntax and semantics of
9300 regular expressions is discussed in many Perl reference books, and also in
9301 Jeffrey Friedl&#x2019;s <emphasis>Mastering Regular Expressions</emphasis>, which is published by
9302 O&#x2019;Reilly (see <emphasis role="bold"><ulink url="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</ulink></emphasis>).
9303 </para>
9304 <para>
9305 The documentation for the syntax and semantics of the regular expressions that
9306 are supported by PCRE is included in the PCRE distribution, and no further
9307 description is included here. The PCRE functions are called from Exim using
9308 the default option settings (that is, with no PCRE options set), except that
9309 the PCRE_CASELESS option is set when the matching is required to be
9310 case-insensitive.
9311 </para>
9312 <para>
9313 In most cases, when a regular expression is required in an Exim configuration,
9314 it has to start with a circumflex, in order to distinguish it from plain text
9315 or an <quote>ends with</quote> wildcard. In this example of a configuration setting, the
9316 second item in the colon-separated list is a regular expression.
9317 </para>
9318 <literallayout class="monospaced">
9319 domains = a.b.c : ^\\d{3} : *.y.z : ...
9320 </literallayout>
9321 <para>
9322 The doubling of the backslash is required because of string expansion that
9323 precedes interpretation &ndash; see section <xref linkend="SECTlittext"/> for more discussion
9324 of this issue, and a way of avoiding the need for doubling backslashes. The
9325 regular expression that is eventually used in this example contains just one
9326 backslash. The circumflex is included in the regular expression, and has the
9327 normal effect of <quote>anchoring</quote> it to the start of the string that is being
9328 matched.
9329 </para>
9330 <para>
9331 There are, however, two cases where a circumflex is not required for the
9332 recognition of a regular expression: these are the <option>match</option> condition in a
9333 string expansion, and the <option>matches</option> condition in an Exim filter file. In
9334 these cases, the relevant string is always treated as a regular expression; if
9335 it does not start with a circumflex, the expression is not anchored, and can
9336 match anywhere in the subject string.
9337 </para>
9338 <para>
9339 In all cases, if you want a regular expression to match at the end of a string,
9340 you must code the $ metacharacter to indicate this. For example:
9341 </para>
9342 <literallayout class="monospaced">
9343 domains = ^\\d{3}\\.example
9344 </literallayout>
9345 <para>
9346 matches the domain <emphasis>123.example</emphasis>, but it also matches <emphasis>123.example.com</emphasis>.
9347 You need to use:
9348 </para>
9349 <literallayout class="monospaced">
9350 domains = ^\\d{3}\\.example\$
9351 </literallayout>
9352 <para>
9353 if you want <emphasis>example</emphasis> to be the top-level domain. The backslash before the
9354 $ is needed because string expansion also interprets dollar characters.
9355 </para>
9356 </chapter>
9357
9358 <chapter id="CHAPfdlookup">
9359 <title>File and database lookups</title>
9360 <para>
9361 <indexterm role="concept" id="IIDfidalo1" class="startofrange">
9362 <primary>file</primary>
9363 <secondary>lookups</secondary>
9364 </indexterm>
9365 <indexterm role="concept" id="IIDfidalo2" class="startofrange">
9366 <primary>database</primary>
9367 <secondary>lookups</secondary>
9368 </indexterm>
9369 <indexterm role="concept">
9370 <primary>lookup</primary>
9371 <secondary>description of</secondary>
9372 </indexterm>
9373 Exim can be configured to look up data in files or databases as it processes
9374 messages. Two different kinds of syntax are used:
9375 </para>
9376 <orderedlist numeration="arabic">
9377 <listitem>
9378 <para>
9379 A string that is to be expanded may contain explicit lookup requests. These
9380 cause parts of the string to be replaced by data that is obtained from the
9381 lookup. Lookups of this type are conditional expansion items. Different results
9382 can be defined for the cases of lookup success and failure. See chapter
9383 <xref linkend="CHAPexpand"/>, where string expansions are described in detail.
9384 </para>
9385 </listitem>
9386 <listitem>
9387 <para>
9388 Lists of domains, hosts, and email addresses can contain lookup requests as a
9389 way of avoiding excessively long linear lists. In this case, the data that is
9390 returned by the lookup is often (but not always) discarded; whether the lookup
9391 succeeds or fails is what really counts. These kinds of list are described in
9392 chapter <xref linkend="CHAPdomhosaddlists"/>.
9393 </para>
9394 </listitem>
9395 </orderedlist>
9396 <para>
9397 String expansions, lists, and lookups interact with each other in such a way
9398 that there is no order in which to describe any one of them that does not
9399 involve references to the others. Each of these three chapters makes more sense
9400 if you have read the other two first. If you are reading this for the first
9401 time, be aware that some of it will make a lot more sense after you have read
9402 chapters <xref linkend="CHAPdomhosaddlists"/> and <xref linkend="CHAPexpand"/>.
9403 </para>
9404 <section id="SECID60">
9405 <title>Examples of different lookup syntax</title>
9406 <para>
9407 It is easy to confuse the two different kinds of lookup, especially as the
9408 lists that may contain the second kind are always expanded before being
9409 processed as lists. Therefore, they may also contain lookups of the first kind.
9410 Be careful to distinguish between the following two examples:
9411 </para>
9412 <literallayout class="monospaced">
9413 domains = ${lookup{$sender_host_address}lsearch{/some/file}}
9414 domains = lsearch;/some/file
9415 </literallayout>
9416 <para>
9417 The first uses a string expansion, the result of which must be a domain list.
9418 No strings have been specified for a successful or a failing lookup; the
9419 defaults in this case are the looked-up data and an empty string, respectively.
9420 The expansion takes place before the string is processed as a list, and the
9421 file that is searched could contain lines like this:
9422 </para>
9423 <literallayout class="monospaced">
9424 192.168.3.4: domain1:domain2:...
9425 192.168.1.9: domain3:domain4:...
9426 </literallayout>
9427 <para>
9428 When the lookup succeeds, the result of the expansion is a list of domains (and
9429 possibly other types of item that are allowed in domain lists).
9430 </para>
9431 <para>
9432 In the second example, the lookup is a single item in a domain list. It causes
9433 Exim to use a lookup to see if the domain that is being processed can be found
9434 in the file. The file could contains lines like this:
9435 </para>
9436 <literallayout class="monospaced">
9437 domain1:
9438 domain2:
9439 </literallayout>
9440 <para>
9441 Any data that follows the keys is not relevant when checking that the domain
9442 matches the list item.
9443 </para>
9444 <para>
9445 It is possible, though no doubt confusing, to use both kinds of lookup at once.
9446 Consider a file containing lines like this:
9447 </para>
9448 <literallayout class="monospaced">
9449 192.168.5.6: lsearch;/another/file
9450 </literallayout>
9451 <para>
9452 If the value of <varname>$sender_host_address</varname> is 192.168.5.6, expansion of the
9453 first <option>domains</option> setting above generates the second setting, which therefore
9454 causes a second lookup to occur.
9455 </para>
9456 <para>
9457 The rest of this chapter describes the different lookup types that are
9458 available. Any of them can be used in any part of the configuration where a
9459 lookup is permitted.
9460 </para>
9461 </section>
9462 <section id="SECID61">
9463 <title>Lookup types</title>
9464 <para>
9465 <indexterm role="concept">
9466 <primary>lookup</primary>
9467 <secondary>types of</secondary>
9468 </indexterm>
9469 <indexterm role="concept">
9470 <primary>single-key lookup</primary>
9471 <secondary>definition of</secondary>
9472 </indexterm>
9473 Two different types of data lookup are implemented:
9474 </para>
9475 <itemizedlist>
9476 <listitem>
9477 <para>
9478 The <emphasis>single-key</emphasis> type requires the specification of a file in which to look,
9479 and a single key to search for. The key must be a non-empty string for the
9480 lookup to succeed. The lookup type determines how the file is searched.
9481 </para>
9482 </listitem>
9483 <listitem>
9484 <para>
9485 <indexterm role="concept">
9486 <primary>query-style lookup</primary>
9487 <secondary>definition of</secondary>
9488 </indexterm>
9489 The <emphasis>query-style</emphasis> type accepts a generalized database query. No particular
9490 key value is assumed by Exim for query-style lookups. You can use whichever
9491 Exim variables you need to construct the database query.
9492 </para>
9493 </listitem>
9494 </itemizedlist>
9495 <para>
9496 The code for each lookup type is in a separate source file that is included in
9497 the binary of Exim only if the corresponding compile-time option is set. The
9498 default settings in <filename>src/EDITME</filename> are:
9499 </para>
9500 <literallayout class="monospaced">
9501 LOOKUP_DBM=yes
9502 LOOKUP_LSEARCH=yes
9503 </literallayout>
9504 <para>
9505 which means that only linear searching and DBM lookups are included by default.
9506 For some types of lookup (e.g. SQL databases), you need to install appropriate
9507 libraries and header files before building Exim.
9508 </para>
9509 </section>
9510 <section id="SECTsinglekeylookups">
9511 <title>Single-key lookup types</title>
9512 <para>
9513 <indexterm role="concept">
9514 <primary>lookup</primary>
9515 <secondary>single-key types</secondary>
9516 </indexterm>
9517 <indexterm role="concept">
9518 <primary>single-key lookup</primary>
9519 <secondary>list of types</secondary>
9520 </indexterm>
9521 The following single-key lookup types are implemented:
9522 </para>
9523 <itemizedlist>
9524 <listitem>
9525 <para>
9526 <indexterm role="concept">
9527 <primary>cdb</primary>
9528 <secondary>description of</secondary>
9529 </indexterm>
9530 <indexterm role="concept">
9531 <primary>lookup</primary>
9532 <secondary>cdb</secondary>
9533 </indexterm>
9534 <indexterm role="concept">
9535 <primary>binary zero</primary>
9536 <secondary>in lookup key</secondary>
9537 </indexterm>
9538 <command>cdb</command>: The given file is searched as a Constant DataBase file, using the key
9539 string without a terminating binary zero. The cdb format is designed for
9540 indexed files that are read frequently and never updated, except by total
9541 re-creation. As such, it is particularly suitable for large files containing
9542 aliases or other indexed data referenced by an MTA. Information about cdb can
9543 be found in several places:
9544 </para>
9545 <literallayout>
9546 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>
9547 <emphasis role="bold"><ulink url="ftp://ftp.corpit.ru/pub/tinycdb/">ftp://ftp.corpit.ru/pub/tinycdb/</ulink></emphasis>
9548 <emphasis role="bold"><ulink url="http://packages.debian.org/stable/utils/freecdb.html">http://packages.debian.org/stable/utils/freecdb.html</ulink></emphasis>
9549 </literallayout>
9550 <para>
9551 A cdb distribution is not needed in order to build Exim with cdb support,
9552 because the code for reading cdb files is included directly in Exim itself.
9553 However, no means of building or testing cdb files is provided with Exim, so
9554 you need to obtain a cdb distribution in order to do this.
9555 </para>
9556 </listitem>
9557 <listitem>
9558 <para>
9559 <indexterm role="concept">
9560 <primary>DBM</primary>
9561 <secondary>lookup type</secondary>
9562 </indexterm>
9563 <indexterm role="concept">
9564 <primary>lookup</primary>
9565 <secondary>dbm</secondary>
9566 </indexterm>
9567 <indexterm role="concept">
9568 <primary>binary zero</primary>
9569 <secondary>in lookup key</secondary>
9570 </indexterm>
9571 <command>dbm</command>: Calls to DBM library functions are used to extract data from the given
9572 DBM file by looking up the record with the given key. A terminating binary
9573 zero is included in the key that is passed to the DBM library. See section
9574 <xref linkend="SECTdb"/> for a discussion of DBM libraries.
9575 </para>
9576 <para>
9577 <indexterm role="concept">
9578 <primary>Berkeley DB library</primary>
9579 <secondary>file format</secondary>
9580 </indexterm>
9581 For all versions of Berkeley DB, Exim uses the DB_HASH style of database
9582 when building DBM files using the <option>exim_dbmbuild</option> utility. However, when
9583 using Berkeley DB versions 3 or 4, it opens existing databases for reading with
9584 the DB_UNKNOWN option. This enables it to handle any of the types of database
9585 that the library supports, and can be useful for accessing DBM files created by
9586 other applications. (For earlier DB versions, DB_HASH is always used.)
9587 </para>
9588 </listitem>
9589 <listitem>
9590 <para>
9591 <indexterm role="concept">
9592 <primary>lookup</primary>
9593 <secondary>dbmjz</secondary>
9594 </indexterm>
9595 <indexterm role="concept">
9596 <primary>lookup</primary>
9597 <secondary>dbm &ndash; embedded NULs</secondary>
9598 </indexterm>
9599 <indexterm role="concept">
9600 <primary>sasldb2</primary>
9601 </indexterm>
9602 <indexterm role="concept">
9603 <primary>dbmjz lookup type</primary>
9604 </indexterm>
9605 <command>dbmjz</command>: This is the same as <command>dbm</command>, except that the lookup key is
9606 interpreted as an Exim list; the elements of the list are joined together with
9607 ASCII NUL characters to form the lookup key.  An example usage would be to
9608 authenticate incoming SMTP calls using the passwords from Cyrus SASL&#x2019;s
9609 <filename>/etc/sasldb2</filename> file with the <command>gsasl</command> authenticator or Exim&#x2019;s own
9610 <command>cram_md5</command> authenticator.
9611 </para>
9612 </listitem>
9613 <listitem>
9614 <para>
9615 <indexterm role="concept">
9616 <primary>lookup</primary>
9617 <secondary>dbmnz</secondary>
9618 </indexterm>
9619 <indexterm role="concept">
9620 <primary>lookup</primary>
9621 <secondary>dbm &ndash; terminating zero</secondary>
9622 </indexterm>
9623 <indexterm role="concept">
9624 <primary>binary zero</primary>
9625 <secondary>in lookup key</secondary>
9626 </indexterm>
9627 <indexterm role="concept">
9628 <primary>Courier</primary>
9629 </indexterm>
9630 <indexterm role="concept">
9631 <primary><filename>/etc/userdbshadow.dat</filename></primary>
9632 </indexterm>
9633 <indexterm role="concept">
9634 <primary>dbmnz lookup type</primary>
9635 </indexterm>
9636 <command>dbmnz</command>: This is the same as <command>dbm</command>, except that a terminating binary zero
9637 is not included in the key that is passed to the DBM library. You may need this
9638 if you want to look up data in files that are created by or shared with some
9639 other application that does not use terminating zeros. For example, you need to
9640 use <command>dbmnz</command> rather than <command>dbm</command> if you want to authenticate incoming SMTP
9641 calls using the passwords from Courier&#x2019;s <filename>/etc/userdbshadow.dat</filename> file. Exim&#x2019;s
9642 utility program for creating DBM files (<emphasis>exim_dbmbuild</emphasis>) includes the zeros
9643 by default, but has an option to omit them (see section <xref linkend="SECTdbmbuild"/>).
9644 </para>
9645 </listitem>
9646 <listitem>
9647 <para>
9648 <indexterm role="concept">
9649 <primary>lookup</primary>
9650 <secondary>dsearch</secondary>
9651 </indexterm>
9652 <indexterm role="concept">
9653 <primary>dsearch lookup type</primary>
9654 </indexterm>
9655 <command>dsearch</command>: The given file must be a directory; this is searched for an entry
9656 whose name is the key by calling the <function>lstat()</function> function. The key may not
9657 contain any forward slash characters. If <function>lstat()</function> succeeds, the result of
9658 the lookup is the name of the entry, which may be a file, directory,
9659 symbolic link, or any other kind of directory entry. An example of how this
9660 lookup can be used to support virtual domains is given in section
9661 <xref linkend="SECTvirtualdomains"/>.
9662 </para>
9663 </listitem>
9664 <listitem>
9665 <para>
9666 <indexterm role="concept">
9667 <primary>lookup</primary>
9668 <secondary>iplsearch</secondary>
9669 </indexterm>
9670 <indexterm role="concept">
9671 <primary>iplsearch lookup type</primary>
9672 </indexterm>
9673 <command>iplsearch</command>: The given file is a text file containing keys and data. A key is
9674 terminated by a colon or white space or the end of the line. The keys in the
9675 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
9676 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
9677 being interpreted as a key terminator. For example:
9678 </para>
9679 <literallayout class="monospaced">
9680 1.2.3.4:           data for 1.2.3.4
9681 192.168.0.0/16:    data for 192.168.0.0/16
9682 "abcd::cdab":      data for abcd::cdab
9683 "abcd:abcd::/32"   data for abcd:abcd::/32
9684 </literallayout>
9685 <para>
9686 The key for an <command>iplsearch</command> lookup must be an IP address (without a mask). The
9687 file is searched linearly, using the CIDR masks where present, until a matching
9688 key is found. The first key that matches is used; there is no attempt to find a
9689 <quote>best</quote> match. Apart from the way the keys are matched, the processing for
9690 <command>iplsearch</command> is the same as for <command>lsearch</command>.
9691 </para>
9692 <para>
9693 <emphasis role="bold">Warning 1</emphasis>: Unlike most other single-key lookup types, a file of data for
9694 <command>iplsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9695 lookup types support only literal keys.
9696 </para>
9697 <para>
9698 <emphasis role="bold">Warning 2</emphasis>: In a host list, you must always use <command>net-iplsearch</command> so that
9699 the implicit key is the host&#x2019;s IP address rather than its name (see section
9700 <xref linkend="SECThoslispatsikey"/>).
9701 </para>
9702 </listitem>
9703 <listitem>
9704 <para>
9705 <indexterm role="concept">
9706 <primary>linear search</primary>
9707 </indexterm>
9708 <indexterm role="concept">
9709 <primary>lookup</primary>
9710 <secondary>lsearch</secondary>
9711 </indexterm>
9712 <indexterm role="concept">
9713 <primary>lsearch lookup type</primary>
9714 </indexterm>
9715 <indexterm role="concept">
9716 <primary>case sensitivity</primary>
9717 <secondary>in lsearch lookup</secondary>
9718 </indexterm>
9719 <command>lsearch</command>: The given file is a text file that is searched linearly for a
9720 line beginning with the search key, terminated by a colon or white space or the
9721 end of the line. The search is case-insensitive; that is, upper and lower case
9722 letters are treated as the same. The first occurrence of the key that is found
9723 in the file is used.
9724 </para>
9725 <para>
9726 White space between the key and the colon is permitted. The remainder of the
9727 line, with leading and trailing white space removed, is the data. This can be
9728 continued onto subsequent lines by starting them with any amount of white
9729 space, but only a single space character is included in the data at such a
9730 junction. If the data begins with a colon, the key must be terminated by a
9731 colon, for example:
9732 </para>
9733 <literallayout class="monospaced">
9734 baduser:  :fail:
9735 </literallayout>
9736 <para>
9737 Empty lines and lines beginning with # are ignored, even if they occur in the
9738 middle of an item. This is the traditional textual format of alias files. Note
9739 that the keys in an <command>lsearch</command> file are literal strings. There is no
9740 wildcarding of any kind.
9741 </para>
9742 <para>
9743 <indexterm role="concept">
9744 <primary>lookup</primary>
9745 <secondary>lsearch &ndash; colons in keys</secondary>
9746 </indexterm>
9747 <indexterm role="concept">
9748 <primary>white space</primary>
9749 <secondary>in lsearch key</secondary>
9750 </indexterm>
9751 In most <command>lsearch</command> files, keys are not required to contain colons or #
9752 characters, or white space. However, if you need this feature, it is available.
9753 If a key begins with a doublequote character, it is terminated only by a
9754 matching quote (or end of line), and the normal escaping rules apply to its
9755 contents (see section <xref linkend="SECTstrings"/>). An optional colon is permitted after
9756 quoted keys (exactly as for unquoted keys). There is no special handling of
9757 quotes for the data part of an <command>lsearch</command> line.
9758 </para>
9759 </listitem>
9760 <listitem>
9761 <para>
9762 <indexterm role="concept">
9763 <primary>NIS lookup type</primary>
9764 </indexterm>
9765 <indexterm role="concept">
9766 <primary>lookup</primary>
9767 <secondary>NIS</secondary>
9768 </indexterm>
9769 <indexterm role="concept">
9770 <primary>binary zero</primary>
9771 <secondary>in lookup key</secondary>
9772 </indexterm>
9773 <command>nis</command>: The given file is the name of a NIS map, and a NIS lookup is done with
9774 the given key, without a terminating binary zero. There is a variant called
9775 <command>nis0</command> which does include the terminating binary zero in the key. This is
9776 reportedly needed for Sun-style alias files. Exim does not recognize NIS
9777 aliases; the full map names must be used.
9778 </para>
9779 </listitem>
9780 <listitem>
9781 <para>
9782 <indexterm role="concept">
9783 <primary>wildlsearch lookup type</primary>
9784 </indexterm>
9785 <indexterm role="concept">
9786 <primary>lookup</primary>
9787 <secondary>wildlsearch</secondary>
9788 </indexterm>
9789 <indexterm role="concept">
9790 <primary>nwildlsearch lookup type</primary>
9791 </indexterm>
9792 <indexterm role="concept">
9793 <primary>lookup</primary>
9794 <secondary>nwildlsearch</secondary>
9795 </indexterm>
9796 <command>wildlsearch</command> or <command>nwildlsearch</command>: These search a file linearly, like
9797 <command>lsearch</command>, but instead of being interpreted as a literal string, each key in
9798 the file may be wildcarded. The difference between these two lookup types is
9799 that for <command>wildlsearch</command>, each key in the file is string-expanded before being
9800 used, whereas for <command>nwildlsearch</command>, no expansion takes place.
9801 </para>
9802 <para>
9803 <indexterm role="concept">
9804 <primary>case sensitivity</primary>
9805 <secondary>in (n)wildlsearch lookup</secondary>
9806 </indexterm>
9807 Like <command>lsearch</command>, the testing is done case-insensitively. However, keys in the
9808 file that are regular expressions can be made case-sensitive by the use of
9809 <literal>(-i)</literal> within the pattern. The following forms of wildcard are recognized:
9810 </para>
9811 <orderedlist numeration="arabic">
9812 <listitem>
9813 <para>
9814 The string may begin with an asterisk to mean <quote>ends with</quote>. For example:
9815 </para>
9816 <literallayout class="monospaced">
9817     *.a.b.c       data for anything.a.b.c
9818     *fish         data for anythingfish
9819 </literallayout>
9820 </listitem>
9821 <listitem>
9822 <para>
9823 The string may begin with a circumflex to indicate a regular expression. For
9824 example, for <command>wildlsearch</command>:
9825 </para>
9826 <literallayout class="monospaced">
9827     ^\N\d+\.a\.b\N    data for &lt;digits&gt;.a.b
9828 </literallayout>
9829 <para>
9830 Note the use of <literal>\N</literal> to disable expansion of the contents of the regular
9831 expression. If you are using <command>nwildlsearch</command>, where the keys are not
9832 string-expanded, the equivalent entry is:
9833 </para>
9834 <literallayout class="monospaced">
9835     ^\d+\.a\.b        data for &lt;digits&gt;.a.b
9836 </literallayout>
9837 <para>
9838 The case-insensitive flag is set at the start of compiling the regular
9839 expression, but it can be turned off by using <literal>(-i)</literal> at an appropriate point.
9840 For example, to make the entire pattern case-sensitive:
9841 </para>
9842 <literallayout class="monospaced">
9843     ^(?-i)\d+\.a\.b        data for &lt;digits&gt;.a.b
9844 </literallayout>
9845 <para>
9846 If the regular expression contains white space or colon characters, you must
9847 either quote it (see <command>lsearch</command> above), or represent these characters in other
9848 ways. For example, <literal>\s</literal> can be used for white space and <literal>\x3A</literal> for a
9849 colon. This may be easier than quoting, because if you quote, you have to
9850 escape all the backslashes inside the quotes.
9851 </para>
9852 <para>
9853 <emphasis role="bold">Note</emphasis>: It is not possible to capture substrings in a regular expression
9854 match for later use, because the results of all lookups are cached. If a lookup
9855 is repeated, the result is taken from the cache, and no actual pattern matching
9856 takes place. The values of all the numeric variables are unset after a
9857 <command>(n)wildlsearch</command> match.
9858 </para>
9859 </listitem>
9860 <listitem>
9861 <para>
9862 Although I cannot see it being of much use, the general matching function that
9863 is used to implement <command>(n)wildlsearch</command> means that the string may begin with a
9864 lookup name terminated by a semicolon, and followed by lookup data. For
9865 example:
9866 </para>
9867 <literallayout class="monospaced">
9868     cdb;/some/file  data for keys that match the file
9869 </literallayout>
9870 <para>
9871 The data that is obtained from the nested lookup is discarded.
9872 </para>
9873 </listitem>
9874 </orderedlist>
9875 <para>
9876 Keys that do not match any of these patterns are interpreted literally. The
9877 continuation rules for the data are the same as for <command>lsearch</command>, and keys may
9878 be followed by optional colons.
9879 </para>
9880 <para>
9881 <emphasis role="bold">Warning</emphasis>: Unlike most other single-key lookup types, a file of data for
9882 <command>(n)wildlsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9883 lookup types support only literal keys.
9884 </para>
9885 </listitem>
9886 </itemizedlist>
9887 </section>
9888 <section id="SECID62">
9889 <title>Query-style lookup types</title>
9890 <para>
9891 <indexterm role="concept">
9892 <primary>lookup</primary>
9893 <secondary>query-style types</secondary>
9894 </indexterm>
9895 <indexterm role="concept">
9896 <primary>query-style lookup</primary>
9897 <secondary>list of types</secondary>
9898 </indexterm>
9899 The supported query-style lookup types are listed below. Further details about
9900 many of them are given in later sections.
9901 </para>
9902 <itemizedlist>
9903 <listitem>
9904 <para>
9905 <indexterm role="concept">
9906 <primary>DNS</primary>
9907 <secondary>as a lookup type</secondary>
9908 </indexterm>
9909 <indexterm role="concept">
9910 <primary>lookup</primary>
9911 <secondary>DNS</secondary>
9912 </indexterm>
9913 <command>dnsdb</command>: This does a DNS search for one or more records whose domain names
9914 are given in the supplied query. The resulting data is the contents of the
9915 records. See section <xref linkend="SECTdnsdb"/>.
9916 </para>
9917 </listitem>
9918 <listitem>
9919 <para>
9920 <indexterm role="concept">
9921 <primary>InterBase lookup type</primary>
9922 </indexterm>
9923 <indexterm role="concept">
9924 <primary>lookup</primary>
9925 <secondary>InterBase</secondary>
9926 </indexterm>
9927 <command>ibase</command>: This does a lookup in an InterBase database.
9928 </para>
9929 </listitem>
9930 <listitem>
9931 <para>
9932 <indexterm role="concept">
9933 <primary>LDAP</primary>
9934 <secondary>lookup type</secondary>
9935 </indexterm>
9936 <indexterm role="concept">
9937 <primary>lookup</primary>
9938 <secondary>LDAP</secondary>
9939 </indexterm>
9940 <command>ldap</command>: This does an LDAP lookup using a query in the form of a URL, and
9941 returns attributes from a single entry. There is a variant called <command>ldapm</command>
9942 that permits values from multiple entries to be returned. A third variant
9943 called <command>ldapdn</command> returns the Distinguished Name of a single entry instead of
9944 any attribute values. See section <xref linkend="SECTldap"/>.
9945 </para>
9946 </listitem>
9947 <listitem>
9948 <para>
9949 <indexterm role="concept">
9950 <primary>MySQL</primary>
9951 <secondary>lookup type</secondary>
9952 </indexterm>
9953 <indexterm role="concept">
9954 <primary>lookup</primary>
9955 <secondary>MySQL</secondary>
9956 </indexterm>
9957 <command>mysql</command>: The format of the query is an SQL statement that is passed to a
9958 MySQL database. See section <xref linkend="SECTsql"/>.
9959 </para>
9960 </listitem>
9961 <listitem>
9962 <para>
9963 <indexterm role="concept">
9964 <primary>NIS+ lookup type</primary>
9965 </indexterm>
9966 <indexterm role="concept">
9967 <primary>lookup</primary>
9968 <secondary>NIS+</secondary>
9969 </indexterm>
9970 <command>nisplus</command>: This does a NIS+ lookup using a query that can specify the name of
9971 the field to be returned. See section <xref linkend="SECTnisplus"/>.
9972 </para>
9973 </listitem>
9974 <listitem>
9975 <para>
9976 <indexterm role="concept">
9977 <primary>Oracle</primary>
9978 <secondary>lookup type</secondary>
9979 </indexterm>
9980 <indexterm role="concept">
9981 <primary>lookup</primary>
9982 <secondary>Oracle</secondary>
9983 </indexterm>
9984 <command>oracle</command>: The format of the query is an SQL statement that is passed to an
9985 Oracle database. See section <xref linkend="SECTsql"/>.
9986 </para>
9987 </listitem>
9988 <listitem>
9989 <para>
9990 <indexterm role="concept">
9991 <primary>lookup</primary>
9992 <secondary>passwd</secondary>
9993 </indexterm>
9994 <indexterm role="concept">
9995 <primary>passwd lookup type</primary>
9996 </indexterm>
9997 <indexterm role="concept">
9998 <primary><filename>/etc/passwd</filename></primary>
9999 </indexterm>
10000 <command>passwd</command> is a query-style lookup with queries that are just user names. The
10001 lookup calls <function>getpwnam()</function> to interrogate the system password data, and on
10002 success, the result string is the same as you would get from an <command>lsearch</command>
10003 lookup on a traditional <filename>/etc/passwd file</filename>, though with <literal>*</literal> for the
10004 password value. For example:
10005 </para>
10006 <literallayout class="monospaced">
10007 *:42:42:King Rat:/home/kr:/bin/bash
10008 </literallayout>
10009 </listitem>
10010 <listitem>
10011 <para>
10012 <indexterm role="concept">
10013 <primary>PostgreSQL lookup type</primary>
10014 </indexterm>
10015 <indexterm role="concept">
10016 <primary>lookup</primary>
10017 <secondary>PostgreSQL</secondary>
10018 </indexterm>
10019 <command>pgsql</command>: The format of the query is an SQL statement that is passed to a
10020 PostgreSQL database. See section <xref linkend="SECTsql"/>.
10021 </para>
10022 </listitem>
10023 <listitem>
10024 <para>
10025 <indexterm role="concept">
10026 <primary>sqlite lookup type</primary>
10027 </indexterm>
10028 <indexterm role="concept">
10029 <primary>lookup</primary>
10030 <secondary>sqlite</secondary>
10031 </indexterm>
10032 <command>sqlite</command>: The format of the query is a file name followed by an SQL statement
10033 that is passed to an SQLite database. See section <xref linkend="SECTsqlite"/>.
10034 </para>
10035 </listitem>
10036 <listitem>
10037 <para>
10038 <command>testdb</command>: This is a lookup type that is used for testing Exim. It is
10039 not likely to be useful in normal operation.
10040 </para>
10041 </listitem>
10042 <listitem>
10043 <para>
10044 <indexterm role="concept">
10045 <primary>whoson lookup type</primary>
10046 </indexterm>
10047 <indexterm role="concept">
10048 <primary>lookup</primary>
10049 <secondary>whoson</secondary>
10050 </indexterm>
10051 <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
10052 allows a server to check whether a particular (dynamically allocated) IP
10053 address is currently allocated to a known (trusted) user and, optionally, to
10054 obtain the identity of the said user. For SMTP servers, <emphasis>Whoson</emphasis> was popular
10055 at one time for <quote>POP before SMTP</quote> authentication, but that approach has been
10056 superseded by SMTP authentication. In Exim, <emphasis>Whoson</emphasis> can be used to implement
10057 <quote>POP before SMTP</quote> checking using ACL statements such as
10058 </para>
10059 <literallayout class="monospaced">
10060 require condition = \
10061   ${lookup whoson {$sender_host_address}{yes}{no}}
10062 </literallayout>
10063 <para>
10064 The query consists of a single IP address. The value returned is the name of
10065 the authenticated user, which is stored in the variable <varname>$value</varname>. However, in
10066 this example, the data in <varname>$value</varname> is not used; the result of the lookup is
10067 one of the fixed strings <quote>yes</quote> or <quote>no</quote>.
10068 </para>
10069 </listitem>
10070 </itemizedlist>
10071 </section>
10072 <section id="SECID63">
10073 <title>Temporary errors in lookups</title>
10074 <para>
10075 <indexterm role="concept">
10076 <primary>lookup</primary>
10077 <secondary>temporary error in</secondary>
10078 </indexterm>
10079 Lookup functions can return temporary error codes if the lookup cannot be
10080 completed. For example, an SQL or LDAP database might be unavailable. For this
10081 reason, it is not advisable to use a lookup that might do this for critical
10082 options such as a list of local domains.
10083 </para>
10084 <para>
10085 When a lookup cannot be completed in a router or transport, delivery
10086 of the message (to the relevant address) is deferred, as for any other
10087 temporary error. In other circumstances Exim may assume the lookup has failed,
10088 or may give up altogether.
10089 </para>
10090 </section>
10091 <section id="SECTdefaultvaluelookups">
10092 <title>Default values in single-key lookups</title>
10093 <para>
10094 <indexterm role="concept">
10095 <primary>wildcard lookups</primary>
10096 </indexterm>
10097 <indexterm role="concept">
10098 <primary>lookup</primary>
10099 <secondary>default values</secondary>
10100 </indexterm>
10101 <indexterm role="concept">
10102 <primary>lookup</primary>
10103 <secondary>wildcard</secondary>
10104 </indexterm>
10105 <indexterm role="concept">
10106 <primary>lookup</primary>
10107 <secondary>* added to type</secondary>
10108 </indexterm>
10109 <indexterm role="concept">
10110 <primary>default</primary>
10111 <secondary>in single-key lookups</secondary>
10112 </indexterm>
10113 In this context, a <quote>default value</quote> is a value specified by the administrator
10114 that is to be used if a lookup fails.
10115 </para>
10116 <para>
10117 <emphasis role="bold">Note:</emphasis> This section applies only to single-key lookups. For query-style
10118 lookups, the facilities of the query language must be used. An attempt to
10119 specify a default for a query-style lookup provokes an error.
10120 </para>
10121 <para>
10122 If <quote>*</quote> is added to a single-key lookup type (for example, <option>lsearch*</option>)
10123 and the initial lookup fails, the key <quote>*</quote> is looked up in the file to
10124 provide a default value. See also the section on partial matching below.
10125 </para>
10126 <para>
10127 <indexterm role="concept">
10128 <primary>*@ with single-key lookup</primary>
10129 </indexterm>
10130 <indexterm role="concept">
10131 <primary>lookup</primary>
10132 <secondary>*@ added to type</secondary>
10133 </indexterm>
10134 <indexterm role="concept">
10135 <primary>alias file</primary>
10136 <secondary>per-domain default</secondary>
10137 </indexterm>
10138 Alternatively, if <quote>*@</quote> is added to a single-key lookup type (for example
10139 <option>dbm*@</option>) then, if the initial lookup fails and the key contains an @
10140 character, a second lookup is done with everything before the last @ replaced
10141 by *. This makes it possible to provide per-domain defaults in alias files
10142 that include the domains in the keys. If the second lookup fails (or doesn&#x2019;t
10143 take place because there is no @ in the key), <quote>*</quote> is looked up.
10144 For example, a <command>redirect</command> router might contain:
10145 </para>
10146 <literallayout class="monospaced">
10147 data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}}
10148 </literallayout>
10149 <para>
10150 Suppose the address that is being processed is <emphasis>jane@eyre.example</emphasis>. Exim
10151 looks up these keys, in this order:
10152 </para>
10153 <literallayout class="monospaced">
10154 jane@eyre.example
10155 *@eyre.example
10156 *
10157 </literallayout>
10158 <para>
10159 The data is taken from whichever key it finds first. <emphasis role="bold">Note</emphasis>: In an
10160 <command>lsearch</command> file, this does not mean the first of these keys in the file. A
10161 complete scan is done for each key, and only if it is not found at all does
10162 Exim move on to try the next key.
10163 </para>
10164 </section>
10165 <section id="SECTpartiallookup">
10166 <title>Partial matching in single-key lookups</title>
10167 <para>
10168 <indexterm role="concept">
10169 <primary>partial matching</primary>
10170 </indexterm>
10171 <indexterm role="concept">
10172 <primary>wildcard lookups</primary>
10173 </indexterm>
10174 <indexterm role="concept">
10175 <primary>lookup</primary>
10176 <secondary>partial matching</secondary>
10177 </indexterm>
10178 <indexterm role="concept">
10179 <primary>lookup</primary>
10180 <secondary>wildcard</secondary>
10181 </indexterm>
10182 <indexterm role="concept">
10183 <primary>asterisk</primary>
10184 <secondary>in search type</secondary>
10185 </indexterm>
10186 The normal operation of a single-key lookup is to search the file for an exact
10187 match with the given key. However, in a number of situations where domains are
10188 being looked up, it is useful to be able to do partial matching. In this case,
10189 information in the file that has a key starting with <quote>*.</quote> is matched by any
10190 domain that ends with the components that follow the full stop. For example, if
10191 a key in a DBM file is
10192 </para>
10193 <literallayout class="monospaced">
10194 *.dates.fict.example
10195 </literallayout>
10196 <para>
10197 then when partial matching is enabled this is matched by (amongst others)
10198 <emphasis>2001.dates.fict.example</emphasis> and <emphasis>1984.dates.fict.example</emphasis>. It is also matched
10199 by <emphasis>dates.fict.example</emphasis>, if that does not appear as a separate key in the
10200 file.
10201 </para>
10202 <para>
10203 <emphasis role="bold">Note</emphasis>: Partial matching is not available for query-style lookups. It is
10204 also not available for any lookup items in address lists (see section
10205 <xref linkend="SECTaddresslist"/>).
10206 </para>
10207 <para>
10208 Partial matching is implemented by doing a series of separate lookups using
10209 keys constructed by modifying the original subject key. This means that it can
10210 be used with any of the single-key lookup types, provided that
10211 partial matching keys
10212 beginning with a special prefix (default <quote>*.</quote>) are included in the data file.
10213 Keys in the file that do not begin with the prefix are matched only by
10214 unmodified subject keys when partial matching is in use.
10215 </para>
10216 <para>
10217 Partial matching is requested by adding the string <quote>partial-</quote> to the front of
10218 the name of a single-key lookup type, for example, <option>partial-dbm</option>. When this
10219 is done, the subject key is first looked up unmodified; if that fails, <quote>*.</quote>
10220 is added at the start of the subject key, and it is looked up again. If that
10221 fails, further lookups are tried with dot-separated components removed from the
10222 start of the subject key, one-by-one, and <quote>*.</quote> added on the front of what
10223 remains.
10224 </para>
10225 <para>
10226 A minimum number of two non-* components are required. This can be adjusted
10227 by including a number before the hyphen in the search type. For example,
10228 <option>partial3-lsearch</option> specifies a minimum of three non-* components in the
10229 modified keys. Omitting the number is equivalent to <quote>partial2-</quote>. If the
10230 subject key is <emphasis>2250.dates.fict.example</emphasis> then the following keys are looked
10231 up when the minimum number of non-* components is two:
10232 </para>
10233 <literallayout class="monospaced">
10234 2250.dates.fict.example
10235 *.2250.dates.fict.example
10236 *.dates.fict.example
10237 *.fict.example
10238 </literallayout>
10239 <para>
10240 As soon as one key in the sequence is successfully looked up, the lookup
10241 finishes.
10242 </para>
10243 <para>
10244 <indexterm role="concept">
10245 <primary>lookup</primary>
10246 <secondary>partial matching &ndash; changing prefix</secondary>
10247 </indexterm>
10248 <indexterm role="concept">
10249 <primary>prefix</primary>
10250 <secondary>for partial matching</secondary>
10251 </indexterm>
10252 The use of <quote>*.</quote> as the partial matching prefix is a default that can be
10253 changed. The motivation for this feature is to allow Exim to operate with file
10254 formats that are used by other MTAs. A different prefix can be supplied in
10255 parentheses instead of the hyphen after <quote>partial</quote>. For example:
10256 </para>
10257 <literallayout class="monospaced">
10258 domains = partial(.)lsearch;/some/file
10259 </literallayout>
10260 <para>
10261 In this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
10262 <literal>a.b.c</literal>, <literal>.a.b.c</literal>, and <literal>.b.c</literal> (the default minimum of 2 non-wild
10263 components is unchanged). The prefix may consist of any punctuation characters
10264 other than a closing parenthesis. It may be empty, for example:
10265 </para>
10266 <literallayout class="monospaced">
10267 domains = partial1()cdb;/some/file
10268 </literallayout>
10269 <para>
10270 For this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
10271 <literal>a.b.c</literal>, <literal>b.c</literal>, and <literal>c</literal>.
10272 </para>
10273 <para>
10274 If <quote>partial0</quote> is specified, what happens at the end (when the lookup with
10275 just one non-wild component has failed, and the original key is shortened right
10276 down to the null string) depends on the prefix:
10277 </para>
10278 <itemizedlist>
10279 <listitem>
10280 <para>
10281 If the prefix has zero length, the whole lookup fails.
10282 </para>
10283 </listitem>
10284 <listitem>
10285 <para>
10286 If the prefix has length 1, a lookup for just the prefix is done. For
10287 example, the final lookup for <quote>partial0(.)</quote> is for <literal>.</literal> alone.
10288 </para>
10289 </listitem>
10290 <listitem>
10291 <para>
10292 Otherwise, if the prefix ends in a dot, the dot is removed, and the
10293 remainder is looked up. With the default prefix, therefore, the final lookup is
10294 for <quote>*</quote> on its own.
10295 </para>
10296 </listitem>
10297 <listitem>
10298 <para>
10299 Otherwise, the whole prefix is looked up.
10300 </para>
10301 </listitem>
10302 </itemizedlist>
10303 <para>
10304 If the search type ends in <quote>*</quote> or <quote>*@</quote> (see section
10305 <xref linkend="SECTdefaultvaluelookups"/> above), the search for an ultimate default that
10306 this implies happens after all partial lookups have failed. If <quote>partial0</quote> is
10307 specified, adding <quote>*</quote> to the search type has no effect with the default
10308 prefix, because the <quote>*</quote> key is already included in the sequence of partial
10309 lookups. However, there might be a use for lookup types such as
10310 <quote>partial0(.)lsearch*</quote>.
10311 </para>
10312 <para>
10313 The use of <quote>*</quote> in lookup partial matching differs from its use as a wildcard
10314 in domain lists and the like. Partial matching works only in terms of
10315 dot-separated components; a key such as <literal>*fict.example</literal>
10316 in a database file is useless, because the asterisk in a partial matching
10317 subject key is always followed by a dot.
10318 </para>
10319 </section>
10320 <section id="SECID64">
10321 <title>Lookup caching</title>
10322 <para>
10323 <indexterm role="concept">
10324 <primary>lookup</primary>
10325 <secondary>caching</secondary>
10326 </indexterm>
10327 <indexterm role="concept">
10328 <primary>caching</primary>
10329 <secondary>lookup data</secondary>
10330 </indexterm>
10331 Exim caches all lookup results in order to avoid needless repetition of
10332 lookups. However, because (apart from the daemon) Exim operates as a collection
10333 of independent, short-lived processes, this caching applies only within a
10334 single Exim process. There is no inter-process lookup caching facility.
10335 </para>
10336 <para>
10337 For single-key lookups, Exim keeps the relevant files open in case there is
10338 another lookup that needs them. In some types of configuration this can lead to
10339 many files being kept open for messages with many recipients. To avoid hitting
10340 the operating system limit on the number of simultaneously open files, Exim
10341 closes the least recently used file when it needs to open more files than its
10342 own internal limit, which can be changed via the <option>lookup_open_max</option> option.
10343 </para>
10344 <para>
10345 The single-key lookup files are closed and the lookup caches are flushed at
10346 strategic points during delivery &ndash; for example, after all routing is
10347 complete.
10348 </para>
10349 </section>
10350 <section id="SECID65">
10351 <title>Quoting lookup data</title>
10352 <para>
10353 <indexterm role="concept">
10354 <primary>lookup</primary>
10355 <secondary>quoting</secondary>
10356 </indexterm>
10357 <indexterm role="concept">
10358 <primary>quoting</primary>
10359 <secondary>in lookups</secondary>
10360 </indexterm>
10361 When data from an incoming message is included in a query-style lookup, there
10362 is the possibility of special characters in the data messing up the syntax of
10363 the query. For example, a NIS+ query that contains
10364 </para>
10365 <literallayout class="monospaced">
10366 [name=$local_part]
10367 </literallayout>
10368 <para>
10369 will be broken if the local part happens to contain a closing square bracket.
10370 For NIS+, data can be enclosed in double quotes like this:
10371 </para>
10372 <literallayout class="monospaced">
10373 [name="$local_part"]
10374 </literallayout>
10375 <para>
10376 but this still leaves the problem of a double quote in the data. The rule for
10377 NIS+ is that double quotes must be doubled. Other lookup types have different
10378 rules, and to cope with the differing requirements, an expansion operator
10379 of the following form is provided:
10380 </para>
10381 <literallayout class="monospaced">
10382 ${quote_&lt;lookup-type&gt;:&lt;string&gt;}
10383 </literallayout>
10384 <para>
10385 For example, the safest way to write the NIS+ query is
10386 </para>
10387 <literallayout class="monospaced">
10388 [name="${quote_nisplus:$local_part}"]
10389 </literallayout>
10390 <para>
10391 See chapter <xref linkend="CHAPexpand"/> for full coverage of string expansions. The quote
10392 operator can be used for all lookup types, but has no effect for single-key
10393 lookups, since no quoting is ever needed in their key strings.
10394 </para>
10395 </section>
10396 <section id="SECTdnsdb">
10397 <title>More about dnsdb</title>
10398 <para>
10399 <indexterm role="concept">
10400 <primary>dnsdb lookup</primary>
10401 </indexterm>
10402 <indexterm role="concept">
10403 <primary>lookup</primary>
10404 <secondary>dnsdb</secondary>
10405 </indexterm>
10406 <indexterm role="concept">
10407 <primary>DNS</primary>
10408 <secondary>as a lookup type</secondary>
10409 </indexterm>
10410 The <command>dnsdb</command> lookup type uses the DNS as its database. A simple query consists
10411 of a record type and a domain name, separated by an equals sign. For example,
10412 an expansion string could contain:
10413 </para>
10414 <literallayout class="monospaced">
10415 ${lookup dnsdb{mx=a.b.example}{$value}fail}
10416 </literallayout>
10417 <para>
10418 If the lookup succeeds, the result is placed in <varname>$value</varname>, which in this case
10419 is used on its own as the result. If the lookup does not succeed, the
10420 <literal>fail</literal> keyword causes a <emphasis>forced expansion failure</emphasis> &ndash; see section
10421 <xref linkend="SECTforexpfai"/> for an explanation of what this means.
10422 </para>
10423 <para>
10424 The supported DNS record types are A, CNAME, MX, NS, PTR, SPF, SRV, TLSA and TXT,
10425 and, when Exim is compiled with IPv6 support, AAAA (and A6 if that is also
10426 configured). If no type is given, TXT is assumed. When the type is PTR,
10427 the data can be an IP address, written as normal; inversion and the addition of
10428 <option>in-addr.arpa</option> or <option>ip6.arpa</option> happens automatically. For example:
10429 </para>
10430 <literallayout class="monospaced">
10431 ${lookup dnsdb{ptr=192.168.4.5}{$value}fail}
10432 </literallayout>
10433 <para>
10434 If the data for a PTR record is not a syntactically valid IP address, it is not
10435 altered and nothing is added.
10436 </para>
10437 <para>
10438 For any record type, if multiple records are found (or, for A6 lookups, if a
10439 single record leads to multiple addresses), the data is returned as a
10440 concatenation, with newline as the default separator. The order, of course,
10441 depends on the DNS resolver. You can specify a different separator character
10442 between multiple records by putting a right angle-bracket followed immediately
10443 by the new separator at the start of the query. For example:
10444 </para>
10445 <literallayout class="monospaced">
10446 ${lookup dnsdb{&gt;: a=host1.example}}
10447 </literallayout>
10448 <para>
10449 It is permitted to specify a space as the separator character. Further
10450 white space is ignored.
10451 </para>
10452 <para>
10453 <indexterm role="concept">
10454 <primary>MX record</primary>
10455 <secondary>in <command>dnsdb</command> lookup</secondary>
10456 </indexterm>
10457 <indexterm role="concept">
10458 <primary>SRV record</primary>
10459 <secondary>in <command>dnsdb</command> lookup</secondary>
10460 </indexterm>
10461 For an MX lookup, both the preference value and the host name are returned for
10462 each record, separated by a space. For an SRV lookup, the priority, weight,
10463 port, and host name are returned for each record, separated by spaces.
10464 </para>
10465 <para revisionflag="changed">
10466 An alternate field separator can be specified using a comma after the main
10467 separator character, followed immediately by the field separator.
10468 </para>
10469 <para>
10470 <indexterm role="concept">
10471 <primary>TXT record</primary>
10472 <secondary>in <command>dnsdb</command> lookup</secondary>
10473 </indexterm>
10474 <indexterm role="concept">
10475 <primary>SPF record</primary>
10476 <secondary>in <command>dnsdb</command> lookup</secondary>
10477 </indexterm>
10478 For TXT records with multiple items of data, only the first item is returned,
10479 unless a separator for them is specified using a comma after the separator
10480 character followed immediately by the TXT record item separator. To concatenate
10481 items without a separator, use a semicolon instead. For SPF records the
10482 default behaviour is to concatenate multiple items without using a separator.
10483 </para>
10484 <literallayout class="monospaced">
10485 ${lookup dnsdb{&gt;\n,: txt=a.b.example}}
10486 ${lookup dnsdb{&gt;\n; txt=a.b.example}}
10487 ${lookup dnsdb{spf=example.org}}
10488 </literallayout>
10489 <para>
10490 It is permitted to specify a space as the separator character. Further
10491 white space is ignored.
10492 </para>
10493 </section>
10494 <section id="SECTdnsdb_mod">
10495 <title>Dnsdb lookup modifiers</title>
10496 <para>
10497 <indexterm role="concept">
10498 <primary>dnsdb modifiers</primary>
10499 </indexterm>
10500 <indexterm role="concept">
10501 <primary>modifiers</primary>
10502 <secondary>dnsdb</secondary>
10503 </indexterm>
10504 <indexterm role="concept">
10505 <primary>options</primary>
10506 <secondary>dnsdb</secondary>
10507 </indexterm>
10508 Modifiers for <command>dnsdb</command> lookups are givien by optional keywords,
10509 each followed by a comma,
10510 that may appear before the record type.
10511 </para>
10512 <para>
10513 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
10514 temporary DNS error for any of them, the behaviour is controlled by
10515 a defer-option modifier.
10516 The possible keywords are
10517 <quote>defer_strict</quote>, <quote>defer_never</quote>, and <quote>defer_lax</quote>.
10518 With <quote>strict</quote> behaviour, any temporary DNS error causes the
10519 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
10520 ignored, and the behaviour is as if the DNS lookup failed to find anything.
10521 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
10522 error causes the whole lookup to defer only if none of the other lookups
10523 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
10524 </para>
10525 <literallayout class="monospaced">
10526 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
10527 ${lookup dnsdb{a=one.host.com:two.host.com}}
10528 </literallayout>
10529 <para>
10530 Thus, in the default case, as long as at least one of the DNS lookups
10531 yields some data, the lookup succeeds.
10532 </para>
10533 <para>
10534 <indexterm role="concept">
10535 <primary>DNSSEC</primary>
10536 <secondary>dns lookup</secondary>
10537 </indexterm>
10538 Use of <command>DNSSEC</command> is controlled by a dnssec modifier.
10539 The possible keywords are
10540 <quote>dnssec_strict</quote>, <quote>dnssec_lax</quote>, and <quote>dnssec_never</quote>.
10541 With <quote>strict</quote> or <quote>lax</quote> DNSSEC information is requested
10542 with the lookup.
10543 With <quote>strict</quote> a response from the DNS resolver that
10544 is not labelled as authenticated data
10545 is treated as equivalent to a temporary DNS error.
10546 The default is <quote>never</quote>.
10547 </para>
10548 <para>
10549 See also the <varname>$lookup_dnssec_authenticated</varname> variable.
10550 </para>
10551 </section>
10552 <section id="SECID66">
10553 <title>Pseudo dnsdb record types</title>
10554 <para>
10555 <indexterm role="concept">
10556 <primary>MX record</primary>
10557 <secondary>in <command>dnsdb</command> lookup</secondary>
10558 </indexterm>
10559 By default, both the preference value and the host name are returned for
10560 each MX record, separated by a space. If you want only host names, you can use
10561 the pseudo-type MXH:
10562 </para>
10563 <literallayout class="monospaced">
10564 ${lookup dnsdb{mxh=a.b.example}}
10565 </literallayout>
10566 <para>
10567 In this case, the preference values are omitted, and just the host names are
10568 returned.
10569 </para>
10570 <para>
10571 <indexterm role="concept">
10572 <primary>name server for enclosing domain</primary>
10573 </indexterm>
10574 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
10575 records on the given domain, but if none are found, it removes the first
10576 component of the domain name, and tries again. This process continues until NS
10577 records are found or there are no more components left (or there is a DNS
10578 error). In other words, it may return the name servers for a top-level domain,
10579 but it never returns the root name servers. If there are no NS records for the
10580 top-level domain, the lookup fails. Consider these examples:
10581 </para>
10582 <literallayout class="monospaced">
10583 ${lookup dnsdb{zns=xxx.quercite.com}}
10584 ${lookup dnsdb{zns=xxx.edu}}
10585 </literallayout>
10586 <para>
10587 Assuming that in each case there are no NS records for the full domain name,
10588 the first returns the name servers for <option>quercite.com</option>, and the second returns
10589 the name servers for <option>edu</option>.
10590 </para>
10591 <para>
10592 You should be careful about how you use this lookup because, unless the
10593 top-level domain does not exist, the lookup always returns some host names. The
10594 sort of use to which this might be put is for seeing if the name servers for a
10595 given domain are on a blacklist. You can probably assume that the name servers
10596 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
10597 such a list.
10598 </para>
10599 <para>
10600 <indexterm role="concept">
10601 <primary>CSA</primary>
10602 <secondary>in <command>dnsdb</command> lookup</secondary>
10603 </indexterm>
10604 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
10605 records according to the CSA rules, which are described in section
10606 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
10607 not sufficient because of the extra parent domain search behaviour of CSA. The
10608 result of a successful lookup such as:
10609 </para>
10610 <literallayout class="monospaced">
10611 ${lookup dnsdb {csa=$sender_helo_name}}
10612 </literallayout>
10613 <para>
10614 has two space-separated fields: an authorization code and a target host name.
10615 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
10616 authorization required but absent, or <quote>?</quote> for unknown.
10617 </para>
10618 <para>
10619 <indexterm role="concept">
10620 <primary>A+</primary>
10621 <secondary>in <command>dnsdb</command> lookup</secondary>
10622 </indexterm>
10623 The pseudo-type A+ performs an A6 lookup (if configured) followed by an AAAA
10624 and then an A lookup.  All results are returned; defer processing
10625 (see below) is handled separately for each lookup.  Example:
10626 </para>
10627 <literallayout class="monospaced">
10628 ${lookup dnsdb {&gt;; a+=$sender_helo_name}}
10629 </literallayout>
10630 </section>
10631 <section id="SECID67">
10632 <title>Multiple dnsdb lookups</title>
10633 <para>
10634 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
10635 However, you can specify a list of domains or IP addresses in a single
10636 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
10637 the default separator, but with the ability to change this. For example:
10638 </para>
10639 <literallayout class="monospaced">
10640 ${lookup dnsdb{one.domain.com:two.domain.com}}
10641 ${lookup dnsdb{a=one.host.com:two.host.com}}
10642 ${lookup dnsdb{ptr = &lt;; 1.2.3.4 ; 4.5.6.8}}
10643 </literallayout>
10644 <para>
10645 In order to retain backwards compatibility, there is one special case: if
10646 the lookup type is PTR and no change of separator is specified, Exim looks
10647 to see if the rest of the string is precisely one IPv6 address. In this
10648 case, it does not treat it as a list.
10649 </para>
10650 <para>
10651 The data from each lookup is concatenated, with newline separators by default,
10652 in the same way that multiple DNS records for a single item are handled. A
10653 different separator can be specified, as described above.
10654 </para>
10655 </section>
10656 <section id="SECTldap">
10657 <title>More about LDAP</title>
10658 <para>
10659 <indexterm role="concept">
10660 <primary>LDAP</primary>
10661 <secondary>lookup, more about</secondary>
10662 </indexterm>
10663 <indexterm role="concept">
10664 <primary>lookup</primary>
10665 <secondary>LDAP</secondary>
10666 </indexterm>
10667 <indexterm role="concept">
10668 <primary>Solaris</primary>
10669 <secondary>LDAP</secondary>
10670 </indexterm>
10671 The original LDAP implementation came from the University of Michigan; this has
10672 become <quote>Open LDAP</quote>, and there are now two different releases. Another
10673 implementation comes from Netscape, and Solaris 7 and subsequent releases
10674 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
10675 the lookup function level, their error handling is different. For this reason
10676 it is necessary to set a compile-time variable when building Exim with LDAP, to
10677 indicate which LDAP library is in use. One of the following should appear in
10678 your <filename>Local/Makefile</filename>:
10679 </para>
10680 <literallayout class="monospaced">
10681 LDAP_LIB_TYPE=UMICHIGAN
10682 LDAP_LIB_TYPE=OPENLDAP1
10683 LDAP_LIB_TYPE=OPENLDAP2
10684 LDAP_LIB_TYPE=NETSCAPE
10685 LDAP_LIB_TYPE=SOLARIS
10686 </literallayout>
10687 <para>
10688 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
10689 same interface as the University of Michigan version.
10690 </para>
10691 <para>
10692 There are three LDAP lookup types in Exim. These behave slightly differently in
10693 the way they handle the results of a query:
10694 </para>
10695 <itemizedlist>
10696 <listitem>
10697 <para>
10698 <command>ldap</command> requires the result to contain just one entry; if there are more, it
10699 gives an error.
10700 </para>
10701 </listitem>
10702 <listitem>
10703 <para>
10704 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
10705 Distinguished Name that is returned rather than any attribute values.
10706 </para>
10707 </listitem>
10708 <listitem>
10709 <para>
10710 <command>ldapm</command> permits the result to contain more than one entry; the attributes
10711 from all of them are returned.
10712 </para>
10713 </listitem>
10714 </itemizedlist>
10715 <para>
10716 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
10717 Exim behaves as if the entry did not exist, and the lookup fails. The format of
10718 the data returned by a successful lookup is described in the next section.
10719 First we explain how LDAP queries are coded.
10720 </para>
10721 </section>
10722 <section id="SECTforldaque">
10723 <title>Format of LDAP queries</title>
10724 <para>
10725 <indexterm role="concept">
10726 <primary>LDAP</primary>
10727 <secondary>query format</secondary>
10728 </indexterm>
10729 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
10730 the configuration of a <command>redirect</command> router one might have this setting:
10731 </para>
10732 <literallayout class="monospaced">
10733 data = ${lookup ldap \
10734   {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
10735   c=UK?mailbox?base?}}
10736 </literallayout>
10737 <para>
10738 <indexterm role="concept">
10739 <primary>LDAP</primary>
10740 <secondary>with TLS</secondary>
10741 </indexterm>
10742 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
10743 secure (encrypted) LDAP connections. The second of these ensures that an
10744 encrypted TLS connection is used.
10745 </para>
10746 <para>
10747 With sufficiently modern LDAP libraries, Exim supports forcing TLS over regular
10748 LDAP connections, rather than the SSL-on-connect <literal>ldaps</literal>.
10749 See the <option>ldap_start_tls</option> option.
10750 </para>
10751 <para>
10752 Starting with Exim 4.83, the initialization of LDAP with TLS is more tightly
10753 controlled. Every part of the TLS configuration can be configured by settings in
10754 <filename>exim.conf</filename>. Depending on the version of the client libraries installed on
10755 your system, some of the initialization may have required setting options in
10756 <filename>/etc/ldap.conf</filename> or <filename>~/.ldaprc</filename> to get TLS working with self-signed
10757 certificates. This revealed a nuance where the current UID that exim was
10758 running as could affect which config files it read. With Exim 4.83, these
10759 methods become optional, only taking effect if not specifically set in
10760 <filename>exim.conf</filename>.
10761 </para>
10762 </section>
10763 <section id="SECID68">
10764 <title>LDAP quoting</title>
10765 <para>
10766 <indexterm role="concept">
10767 <primary>LDAP</primary>
10768 <secondary>quoting</secondary>
10769 </indexterm>
10770 Two levels of quoting are required in LDAP queries, the first for LDAP itself
10771 and the second because the LDAP query is represented as a URL. Furthermore,
10772 within an LDAP query, two different kinds of quoting are required. For this
10773 reason, there are two different LDAP-specific quoting operators.
10774 </para>
10775 <para>
10776 The <option>quote_ldap</option> operator is designed for use on strings that are part of
10777 filter specifications. Conceptually, it first does the following conversions on
10778 the string:
10779 </para>
10780 <literallayout class="monospaced">
10781 *   =&gt;   \2A
10782 (   =&gt;   \28
10783 )   =&gt;   \29
10784 \   =&gt;   \5C
10785 </literallayout>
10786 <para>
10787 in accordance with RFC 2254. The resulting string is then quoted according
10788 to the rules for URLs, that is, all non-alphanumeric characters except
10789 </para>
10790 <literallayout class="monospaced">
10791 ! $ ' - . _ ( ) * +
10792 </literallayout>
10793 <para>
10794 are converted to their hex values, preceded by a percent sign. For example:
10795 </para>
10796 <literallayout class="monospaced">
10797 ${quote_ldap: a(bc)*, a&lt;yz&gt;; }
10798 </literallayout>
10799 <para>
10800 yields
10801 </para>
10802 <literallayout class="monospaced">
10803 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
10804 </literallayout>
10805 <para>
10806 Removing the URL quoting, this is (with a leading and a trailing space):
10807 </para>
10808 <literallayout class="monospaced">
10809 a\28bc\29\2A, a&lt;yz&gt;;
10810 </literallayout>
10811 <para>
10812 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
10813 base DN specifications in queries. Conceptually, it first converts the string
10814 by inserting a backslash in front of any of the following characters:
10815 </para>
10816 <literallayout class="monospaced">
10817 , + " \ &lt; &gt; ;
10818 </literallayout>
10819 <para>
10820 It also inserts a backslash before any leading spaces or # characters, and
10821 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
10822 is then quoted according to the rules for URLs. For example:
10823 </para>
10824 <literallayout class="monospaced">
10825 ${quote_ldap_dn: a(bc)*, a&lt;yz&gt;; }
10826 </literallayout>
10827 <para>
10828 yields
10829 </para>
10830 <literallayout class="monospaced">
10831 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
10832 </literallayout>
10833 <para>
10834 Removing the URL quoting, this is (with a trailing space):
10835 </para>
10836 <literallayout class="monospaced">
10837 \ a(bc)*\, a\&lt;yz\&gt;\;\
10838 </literallayout>
10839 <para>
10840 There are some further comments about quoting in the section on LDAP
10841 authentication below.
10842 </para>
10843 </section>
10844 <section id="SECID69">
10845 <title>LDAP connections</title>
10846 <para>
10847 <indexterm role="concept">
10848 <primary>LDAP</primary>
10849 <secondary>connections</secondary>
10850 </indexterm>
10851 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
10852 is in use, via a Unix domain socket. The example given above does not specify
10853 an LDAP server. A server that is reached by TCP/IP can be specified in a query
10854 by starting it with
10855 </para>
10856 <literallayout class="monospaced">
10857 ldap://&lt;hostname&gt;:&lt;port&gt;/...
10858 </literallayout>
10859 <para>
10860 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
10861 used. When no server is specified in a query, a list of default servers is
10862 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
10863 colon-separated list of servers which are tried in turn until one successfully
10864 handles a query, or there is a serious error. Successful handling either
10865 returns the requested data, or indicates that it does not exist. Serious errors
10866 are syntactical, or multiple values when only a single value is expected.
10867 Errors which cause the next server to be tried are connection failures, bind
10868 failures, and timeouts.
10869 </para>
10870 <para>
10871 For each server name in the list, a port number can be given. The standard way
10872 of specifying a host and port is to use a colon separator (RFC 1738). Because
10873 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
10874 doubled. For example
10875 </para>
10876 <literallayout class="monospaced">
10877 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
10878 </literallayout>
10879 <para>
10880 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
10881 to the LDAP library with no server name, and the library&#x2019;s default (normally
10882 the local host) is used.
10883 </para>
10884 <para>
10885 If you are using the OpenLDAP library, you can connect to an LDAP server using
10886 a Unix domain socket instead of a TCP/IP connection. This is specified by using
10887 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
10888 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
10889 not available.
10890 </para>
10891 <para>
10892 For this type of connection, instead of a host name for the server, a pathname
10893 for the socket is required, and the port number is not relevant. The pathname
10894 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
10895 the query. In the former case, you can have settings such as
10896 </para>
10897 <literallayout class="monospaced">
10898 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
10899 </literallayout>
10900 <para>
10901 When the pathname is given in the query, you have to escape the slashes as
10902 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
10903 </para>
10904 <literallayout class="monospaced">
10905 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
10906 </literallayout>
10907 <para>
10908 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
10909 a pathname, it uses the Unix domain socket code, even if the query actually
10910 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
10911 socket connection. This behaviour means that you can use a setting of
10912 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
10913 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
10914 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
10915 backup host.
10916 </para>
10917 <para>
10918 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
10919 specified, an error is diagnosed. However, if there are more items in
10920 <option>ldap_default_servers</option>, they are tried. In other words:
10921 </para>
10922 <itemizedlist>
10923 <listitem>
10924 <para>
10925 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
10926 interface.
10927 </para>
10928 </listitem>
10929 <listitem>
10930 <para>
10931 Using <literal>ldapi</literal> with a host name causes an error.
10932 </para>
10933 </listitem>
10934 </itemizedlist>
10935 <para>
10936 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
10937 <option>ldap_default_servers</option>, does whatever the library does by default.
10938 </para>
10939 </section>
10940 <section id="SECID70">
10941 <title>LDAP authentication and control information</title>
10942 <para>
10943 <indexterm role="concept">
10944 <primary>LDAP</primary>
10945 <secondary>authentication</secondary>
10946 </indexterm>
10947 The LDAP URL syntax provides no way of passing authentication and other control
10948 information to the server. To make this possible, the URL in an LDAP query may
10949 be preceded by any number of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; settings, separated by
10950 spaces. If a value contains spaces it must be enclosed in double quotes, and
10951 when double quotes are used, backslash is interpreted in the usual way inside
10952 them. The following names are recognized:
10953 </para>
10954 <literallayout>
10955 <literal>DEREFERENCE</literal>  set the dereferencing parameter
10956 <literal>NETTIME    </literal>  set a timeout for a network operation
10957 <literal>USER       </literal>  set the DN, for authenticating the LDAP bind
10958 <literal>PASS       </literal>  set the password, likewise
10959 <literal>REFERRALS  </literal>  set the referrals parameter
10960 <literal>SERVERS    </literal>  set alternate server list for this query only
10961 <literal>SIZE       </literal>  set the limit for the number of entries returned
10962 <literal>TIME       </literal>  set the maximum waiting time for a query
10963 </literallayout>
10964 <para>
10965 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
10966 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>. The value of the REFERRALS parameter
10967 must be <quote>follow</quote> (the default) or <quote>nofollow</quote>. The latter stops the LDAP
10968 library from trying to follow referrals issued by the LDAP server.
10969 </para>
10970 <para>
10971 The name CONNECT is an obsolete name for NETTIME, retained for
10972 backwards compatibility. This timeout (specified as a number of seconds) is
10973 enforced from the client end for operations that can be carried out over a
10974 network. Specifically, it applies to network connections and calls to the
10975 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
10976 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
10977 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
10978 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
10979 Netscape SDK; for OpenLDAP no action is taken.
10980 </para>
10981 <para>
10982 The TIME parameter (also a number of seconds) is passed to the server to
10983 set a server-side limit on the time taken to complete a search.
10984 </para>
10985 <para>
10986 The SERVERS parameter allows you to specify an alternate list of ldap servers
10987 to use for an individual lookup.  The global ldap_servers option provides a
10988 default list of ldap servers, and a single lookup can specify a single ldap
10989 server to use.  But when you need to do a lookup with a list of servers that is
10990 different than the default list (maybe different order, maybe a completely
10991 different set of servers), the SERVERS parameter allows you to specify this
10992 alternate list (colon-separated).
10993 </para>
10994 <para>
10995 Here is an example of an LDAP query in an Exim lookup that uses some of these
10996 values. This is a single line, folded to fit on the page:
10997 </para>
10998 <literallayout class="monospaced">
10999 ${lookup ldap
11000   {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
11001   ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
11002   {$value}fail}
11003 </literallayout>
11004 <para>
11005 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
11006 any of the auxiliary data. Exim configuration settings that include lookups
11007 which contain password information should be preceded by <quote>hide</quote> to prevent
11008 non-admin users from using the <option>-bP</option> option to see their values.
11009 </para>
11010 <para>
11011 The auxiliary data items may be given in any order. The default is no
11012 connection timeout (the system timeout is used), no user or password, no limit
11013 on the number of entries returned, and no time limit on queries.
11014 </para>
11015 <para>
11016 When a DN is quoted in the USER= setting for LDAP authentication, Exim
11017 removes any URL quoting that it may contain before passing it LDAP. Apparently
11018 some libraries do this for themselves, but some do not. Removing the URL
11019 quoting has two advantages:
11020 </para>
11021 <itemizedlist>
11022 <listitem>
11023 <para>
11024 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
11025 DNs as with DNs inside actual queries.
11026 </para>
11027 </listitem>
11028 <listitem>
11029 <para>
11030 It permits spaces inside USER= DNs.
11031 </para>
11032 </listitem>
11033 </itemizedlist>
11034 <para>
11035 For example, a setting such as
11036 </para>
11037 <literallayout class="monospaced">
11038 USER=cn=${quote_ldap_dn:$1}
11039 </literallayout>
11040 <para>
11041 should work even if <varname>$1</varname> contains spaces.
11042 </para>
11043 <para>
11044 Expanded data for the PASS= value should be quoted using the <option>quote</option>
11045 expansion operator, rather than the LDAP quote operators. The only reason this
11046 field needs quoting is to ensure that it conforms to the Exim syntax, which
11047 does not allow unquoted spaces. For example:
11048 </para>
11049 <literallayout class="monospaced">
11050 PASS=${quote:$3}
11051 </literallayout>
11052 <para>
11053 The LDAP authentication mechanism can be used to check passwords as part of
11054 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
11055 <xref linkend="CHAPexpand"/>.
11056 </para>
11057 </section>
11058 <section id="SECID71">
11059 <title>Format of data returned by LDAP</title>
11060 <para>
11061 <indexterm role="concept">
11062 <primary>LDAP</primary>
11063 <secondary>returned data formats</secondary>
11064 </indexterm>
11065 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
11066 as a sequence of values, for example
11067 </para>
11068 <literallayout class="monospaced">
11069 cn=manager, o=University of Cambridge, c=UK
11070 </literallayout>
11071 <para>
11072 The <command>ldap</command> lookup type generates an error if more than one entry matches the
11073 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
11074 the result between the data from different entries. It is possible for multiple
11075 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
11076 you know that whatever values are returned all came from a single entry in the
11077 directory.
11078 </para>
11079 <para>
11080 In the common case where you specify a single attribute in your LDAP query, the
11081 result is not quoted, and does not contain the attribute name. If the attribute
11082 has multiple values, they are separated by commas.
11083 </para>
11084 <para>
11085 If you specify multiple attributes, the result contains space-separated, quoted
11086 strings, each preceded by the attribute name and an equals sign. Within the
11087 quotes, the quote character, backslash, and newline are escaped with
11088 backslashes, and commas are used to separate multiple values for the attribute.
11089 </para>
11090 <para revisionflag="changed">
11091 Any commas in attribute values are doubled
11092 (permitting treatment of the values as a comma-separated list).
11093 </para>
11094 <para>
11095 Apart from the escaping, the string within quotes takes the same form as the
11096 output when a single attribute is requested. Specifying no attributes is the
11097 same as specifying all of an entry&#x2019;s attributes.
11098 </para>
11099 <para revisionflag="changed">
11100 Here are some examples of the output format. The first line of each pair is an
11101 LDAP query, and the second is the data that is returned. The attribute called
11102 <option>attr1</option> has two values, one of them with an embedded comma, whereas
11103 <option>attr2</option> has only one value:
11104 </para>
11105 <literallayout class="monospaced" revisionflag="changed">
11106 ldap:///o=base?attr1?sub?(uid=fred)
11107 value1.1,value1,,2
11108
11109 ldap:///o=base?attr2?sub?(uid=fred)
11110 value two
11111
11112 ldap:///o=base?attr1,attr2?sub?(uid=fred)
11113 attr1="value1.1,value1,,2" attr2="value two"
11114
11115 ldap:///o=base??sub?(uid=fred)
11116 objectClass="top" attr1="value1.1,value1,,2" attr2="value two"
11117 </literallayout>
11118 <para>
11119 You can
11120 make use of Exim&#x2019;s <option>-be</option> option to run expansion tests and thereby check the
11121 results of LDAP lookups.
11122 The <option>extract</option> operator in string expansions can be used to pick out
11123 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs.
11124 </para>
11125 <para revisionflag="changed">
11126 The <option>listextract</option> operator should be used to pick out individual values
11127 of attributes, even when only a single value is expected.
11128 The doubling of embedded commas allows you to use the returned data as a
11129 comma separated list (using the "&lt;," syntax for changing the input list separator).
11130 </para>
11131 </section>
11132 <section id="SECTnisplus">
11133 <title>More about NIS+</title>
11134 <para>
11135 <indexterm role="concept">
11136 <primary>NIS+ lookup type</primary>
11137 </indexterm>
11138 <indexterm role="concept">
11139 <primary>lookup</primary>
11140 <secondary>NIS+</secondary>
11141 </indexterm>
11142 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
11143 and field name. If this is given, the result of a successful query is the
11144 contents of the named field; otherwise the result consists of a concatenation
11145 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
11146 values containing spaces are quoted. For example, the query
11147 </para>
11148 <literallayout class="monospaced">
11149 [name=mg1456],passwd.org_dir
11150 </literallayout>
11151 <para>
11152 might return the string
11153 </para>
11154 <literallayout class="monospaced">
11155 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
11156 home=/home/mg1456 shell=/bin/bash shadow=""
11157 </literallayout>
11158 <para>
11159 (split over two lines here to fit on the page), whereas
11160 </para>
11161 <literallayout class="monospaced">
11162 [name=mg1456],passwd.org_dir:gcos
11163 </literallayout>
11164 <para>
11165 would just return
11166 </para>
11167 <literallayout class="monospaced">
11168 Martin Guerre
11169 </literallayout>
11170 <para>
11171 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
11172 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
11173 operator is to double any quote characters within the text.
11174 </para>
11175 </section>
11176 <section id="SECTsql">
11177 <title>SQL lookups</title>
11178 <para>
11179 <indexterm role="concept">
11180 <primary>SQL lookup types</primary>
11181 </indexterm>
11182 <indexterm role="concept">
11183 <primary>MySQL</primary>
11184 <secondary>lookup type</secondary>
11185 </indexterm>
11186 <indexterm role="concept">
11187 <primary>PostgreSQL lookup type</primary>
11188 </indexterm>
11189 <indexterm role="concept">
11190 <primary>lookup</primary>
11191 <secondary>MySQL</secondary>
11192 </indexterm>
11193 <indexterm role="concept">
11194 <primary>lookup</primary>
11195 <secondary>PostgreSQL</secondary>
11196 </indexterm>
11197 <indexterm role="concept">
11198 <primary>Oracle</primary>
11199 <secondary>lookup type</secondary>
11200 </indexterm>
11201 <indexterm role="concept">
11202 <primary>lookup</primary>
11203 <secondary>Oracle</secondary>
11204 </indexterm>
11205 <indexterm role="concept">
11206 <primary>InterBase lookup type</primary>
11207 </indexterm>
11208 <indexterm role="concept">
11209 <primary>lookup</primary>
11210 <secondary>InterBase</secondary>
11211 </indexterm>
11212 Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, and SQLite
11213 databases. Queries for these databases contain SQL statements, so an example
11214 might be
11215 </para>
11216 <literallayout class="monospaced">
11217 ${lookup mysql{select mailbox from users where id='userx'}\
11218   {$value}fail}
11219 </literallayout>
11220 <para>
11221 If the result of the query contains more than one field, the data for each
11222 field in the row is returned, preceded by its name, so the result of
11223 </para>
11224 <literallayout class="monospaced">
11225 ${lookup pgsql{select home,name from users where id='userx'}\
11226   {$value}}
11227 </literallayout>
11228 <para>
11229 might be
11230 </para>
11231 <literallayout class="monospaced">
11232 home=/home/userx name="Mister X"
11233 </literallayout>
11234 <para>
11235 Empty values and values containing spaces are double quoted, with embedded
11236 quotes escaped by a backslash. If the result of the query contains just one
11237 field, the value is passed back verbatim, without a field name, for example:
11238 </para>
11239 <literallayout class="monospaced">
11240 Mister X
11241 </literallayout>
11242 <para>
11243 If the result of the query yields more than one row, it is all concatenated,
11244 with a newline between the data for each row.
11245 </para>
11246 </section>
11247 <section id="SECID72">
11248 <title>More about MySQL, PostgreSQL, Oracle, and InterBase</title>
11249 <para>
11250 <indexterm role="concept">
11251 <primary>MySQL</primary>
11252 <secondary>lookup type</secondary>
11253 </indexterm>
11254 <indexterm role="concept">
11255 <primary>PostgreSQL lookup type</primary>
11256 </indexterm>
11257 <indexterm role="concept">
11258 <primary>lookup</primary>
11259 <secondary>MySQL</secondary>
11260 </indexterm>
11261 <indexterm role="concept">
11262 <primary>lookup</primary>
11263 <secondary>PostgreSQL</secondary>
11264 </indexterm>
11265 <indexterm role="concept">
11266 <primary>Oracle</primary>
11267 <secondary>lookup type</secondary>
11268 </indexterm>
11269 <indexterm role="concept">
11270 <primary>lookup</primary>
11271 <secondary>Oracle</secondary>
11272 </indexterm>
11273 <indexterm role="concept">
11274 <primary>InterBase lookup type</primary>
11275 </indexterm>
11276 <indexterm role="concept">
11277 <primary>lookup</primary>
11278 <secondary>InterBase</secondary>
11279 </indexterm>
11280 If any MySQL, PostgreSQL, Oracle, or InterBase lookups are used, the
11281 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, or <option>ibase_servers</option>
11282 option (as appropriate) must be set to a colon-separated list of server
11283 information.
11284 (For MySQL and PostgreSQL only, the global option need not be set if all
11285 queries contain their own server information &ndash; see section
11286 <xref linkend="SECTspeserque"/>.) Each item in the list is a slash-separated list of four
11287 items: host name, database name, user name, and password. In the case of
11288 Oracle, the host name field is used for the <quote>service name</quote>, and the database
11289 name field is not used and should be empty. For example:
11290 </para>
11291 <literallayout class="monospaced">
11292 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
11293 </literallayout>
11294 <para>
11295 Because password data is sensitive, you should always precede the setting with
11296 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
11297 option. Here is an example where two MySQL servers are listed:
11298 </para>
11299 <literallayout class="monospaced">
11300 hide mysql_servers = localhost/users/root/secret:\
11301                      otherhost/users/root/othersecret
11302 </literallayout>
11303 <para>
11304 For MySQL and PostgreSQL, a host may be specified as &lt;<emphasis>name</emphasis>&gt;:&lt;<emphasis>port</emphasis>&gt; but
11305 because this is a colon-separated list, the colon has to be doubled. For each
11306 query, these parameter groups are tried in order until a connection is made and
11307 a query is successfully processed. The result of a query may be that no data is
11308 found, but that is still a successful query. In other words, the list of
11309 servers provides a backup facility, not a list of different places to look.
11310 </para>
11311 <para>
11312 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
11313 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
11314 respectively, and the characters single-quote, double-quote, and backslash
11315 itself are escaped with backslashes. The <option>quote_pgsql</option> expansion operator, in
11316 addition, escapes the percent and underscore characters. This cannot be done
11317 for MySQL because these escapes are not recognized in contexts where these
11318 characters are not special.
11319 </para>
11320 </section>
11321 <section id="SECTspeserque">
11322 <title>Specifying the server in the query</title>
11323 <para>
11324 For MySQL and PostgreSQL lookups (but not currently for Oracle and InterBase),
11325 it is possible to specify a list of servers with an individual query. This is
11326 done by starting the query with
11327 </para>
11328 <literallayout>
11329 <literal>servers=</literal><emphasis>server1:server2:server3:...</emphasis><literal>;</literal>
11330 </literallayout>
11331 <para>
11332 Each item in the list may take one of two forms:
11333 </para>
11334 <orderedlist numeration="arabic">
11335 <listitem>
11336 <para>
11337 If it contains no slashes it is assumed to be just a host name. The appropriate
11338 global option (<option>mysql_servers</option> or <option>pgsql_servers</option>) is searched for a host
11339 of the same name, and the remaining parameters (database, user, password) are
11340 taken from there.
11341 </para>
11342 </listitem>
11343 <listitem>
11344 <para>
11345 If it contains any slashes, it is taken as a complete parameter set.
11346 </para>
11347 </listitem>
11348 </orderedlist>
11349 <para>
11350 The list of servers is used in exactly the same way as the global list.
11351 Once a connection to a server has happened and a query has been
11352 successfully executed, processing of the lookup ceases.
11353 </para>
11354 <para>
11355 This feature is intended for use in master/slave situations where updates
11356 are occurring and you want to update the master rather than a slave. If the
11357 master is in the list as a backup for reading, you might have a global setting
11358 like this:
11359 </para>
11360 <literallayout class="monospaced">
11361 mysql_servers = slave1/db/name/pw:\
11362                 slave2/db/name/pw:\
11363                 master/db/name/pw
11364 </literallayout>
11365 <para>
11366 In an updating lookup, you could then write:
11367 </para>
11368 <literallayout class="monospaced">
11369 ${lookup mysql{servers=master; UPDATE ...} }
11370 </literallayout>
11371 <para>
11372 That query would then be sent only to the master server. If, on the other hand,
11373 the master is not to be used for reading, and so is not present in the global
11374 option, you can still update it by a query of this form:
11375 </para>
11376 <literallayout class="monospaced">
11377 ${lookup pgsql{servers=master/db/name/pw; UPDATE ...} }
11378 </literallayout>
11379 </section>
11380 <section id="SECID73">
11381 <title>Special MySQL features</title>
11382 <para>
11383 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
11384 causes a connection to the server on the local host by means of a Unix domain
11385 socket. An alternate socket can be specified in parentheses. The full syntax of
11386 each item in <option>mysql_servers</option> is:
11387 </para>
11388 <literallayout>
11389 &lt;<emphasis>hostname</emphasis>&gt;::&lt;<emphasis>port</emphasis>&gt;(&lt;<emphasis>socket name</emphasis>&gt;)/&lt;<emphasis>database</emphasis>&gt;/&lt;<emphasis>user</emphasis>&gt;/&lt;<emphasis>password</emphasis>&gt;
11390 </literallayout>
11391 <para>
11392 Any of the three sub-parts of the first field can be omitted. For normal use on
11393 the local host it can be left blank or set to just <quote>localhost</quote>.
11394 </para>
11395 <para>
11396 No database need be supplied &ndash; but if it is absent here, it must be given in
11397 the queries.
11398 </para>
11399 <para>
11400 If a MySQL query is issued that does not request any data (an insert, update,
11401 or delete command), the result of the lookup is the number of rows affected.
11402 </para>
11403 <para>
11404 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
11405 anything (for example, setting a field to the value it already has), the result
11406 is zero because no rows are affected.
11407 </para>
11408 </section>
11409 <section id="SECID74">
11410 <title>Special PostgreSQL features</title>
11411 <para>
11412 PostgreSQL lookups can also use Unix domain socket connections to the database.
11413 This is usually faster and costs less CPU time than a TCP/IP connection.
11414 However it can be used only if the mail server runs on the same machine as the
11415 database server. A configuration line for PostgreSQL via Unix domain sockets
11416 looks like this:
11417 </para>
11418 <literallayout class="monospaced">
11419 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
11420 </literallayout>
11421 <para>
11422 In other words, instead of supplying a host name, a path to the socket is
11423 given. The path name is enclosed in parentheses so that its slashes aren&#x2019;t
11424 visually confused with the delimiters for the other server parameters.
11425 </para>
11426 <para>
11427 If a PostgreSQL query is issued that does not request any data (an insert,
11428 update, or delete command), the result of the lookup is the number of rows
11429 affected.
11430 </para>
11431 </section>
11432 <section id="SECTsqlite">
11433 <title>More about SQLite</title>
11434 <para>
11435 <indexterm role="concept">
11436 <primary>lookup</primary>
11437 <secondary>SQLite</secondary>
11438 </indexterm>
11439 <indexterm role="concept">
11440 <primary>sqlite lookup type</primary>
11441 </indexterm>
11442 SQLite is different to the other SQL lookups because a file name is required in
11443 addition to the SQL query. An SQLite database is a single file, and there is no
11444 daemon as in the other SQL databases. The interface to Exim requires the name
11445 of the file, as an absolute path, to be given at the start of the query. It is
11446 separated from the query by white space. This means that the path name cannot
11447 contain white space. Here is a lookup expansion example:
11448 </para>
11449 <literallayout class="monospaced">
11450 ${lookup sqlite {/some/thing/sqlitedb \
11451   select name from aliases where id='userx';}}
11452 </literallayout>
11453 <para>
11454 In a list, the syntax is similar. For example:
11455 </para>
11456 <literallayout class="monospaced">
11457 domainlist relay_to_domains = sqlite;/some/thing/sqlitedb \
11458    select * from relays where ip='$sender_host_address';
11459 </literallayout>
11460 <para>
11461 The only character affected by the <option>quote_sqlite</option> operator is a single
11462 quote, which it doubles.
11463 </para>
11464 <para>
11465 The SQLite library handles multiple simultaneous accesses to the database
11466 internally. Multiple readers are permitted, but only one process can
11467 update at once. Attempts to access the database while it is being updated
11468 are rejected after a timeout period, during which the SQLite library
11469 waits for the lock to be released. In Exim, the default timeout is set
11470 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
11471 option.
11472 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
11473 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
11474 </para>
11475 </section>
11476 </chapter>
11477
11478 <chapter id="CHAPdomhosaddlists">
11479 <title>Domain, host, address, and local part lists</title>
11480 <titleabbrev>Domain, host, and address lists</titleabbrev>
11481 <para>
11482 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
11483 <primary>lists of domains; hosts; etc.</primary>
11484 </indexterm>
11485 A number of Exim configuration options contain lists of domains, hosts,
11486 email addresses, or local parts. For example, the <option>hold_domains</option> option
11487 contains a list of domains whose delivery is currently suspended. These lists
11488 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
11489 arguments to expansion conditions such as <option>match_domain</option>.
11490 </para>
11491 <para>
11492 Each item in one of these lists is a pattern to be matched against a domain,
11493 host, email address, or local part, respectively. In the sections below, the
11494 different types of pattern for each case are described, but first we cover some
11495 general facilities that apply to all four kinds of list.
11496 </para>
11497 <section id="SECTlistexpand">
11498 <title>Expansion of lists</title>
11499 <para>
11500 <indexterm role="concept">
11501 <primary>expansion</primary>
11502 <secondary>of lists</secondary>
11503 </indexterm>
11504 Each list is expanded as a single string before it is used. The result of
11505 expansion must be a list, possibly containing empty items, which is split up
11506 into separate items for matching. By default, colon is the separator character,
11507 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
11508 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
11509 discusses the way to specify empty list items.
11510 </para>
11511 <para>
11512 If the string expansion is forced to fail, Exim behaves as if the item it is
11513 testing (domain, host, address, or local part) is not in the list. Other
11514 expansion failures cause temporary errors.
11515 </para>
11516 <para>
11517 If an item in a list is a regular expression, backslashes, dollars and possibly
11518 other special characters in the expression must be protected against
11519 misinterpretation by the string expander. The easiest way to do this is to use
11520 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
11521 expression should not be expanded. For example, in an ACL you might have:
11522 </para>
11523 <literallayout class="monospaced">
11524 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
11525                ${lookup{$domain}lsearch{/badsenders/bydomain}}
11526 </literallayout>
11527 <para>
11528 The first item is a regular expression that is protected from expansion by
11529 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
11530 senders based on the receiving domain.
11531 </para>
11532 </section>
11533 <section id="SECID76">
11534 <title>Negated items in lists</title>
11535 <para>
11536 <indexterm role="concept">
11537 <primary>list</primary>
11538 <secondary>negation</secondary>
11539 </indexterm>
11540 <indexterm role="concept">
11541 <primary>negation</primary>
11542 <secondary>in lists</secondary>
11543 </indexterm>
11544 Items in a list may be positive or negative. Negative items are indicated by a
11545 leading exclamation mark, which may be followed by optional white space. A list
11546 defines a set of items (domains, etc). When Exim processes one of these lists,
11547 it is trying to find out whether a domain, host, address, or local part
11548 (respectively) is in the set that is defined by the list. It works like this:
11549 </para>
11550 <para>
11551 The list is scanned from left to right. If a positive item is matched, the
11552 subject that is being checked is in the set; if a negative item is matched, the
11553 subject is not in the set. If the end of the list is reached without the
11554 subject having matched any of the patterns, it is in the set if the last item
11555 was a negative one, but not if it was a positive one. For example, the list in
11556 </para>
11557 <literallayout class="monospaced">
11558 domainlist relay_to_domains = !a.b.c : *.b.c
11559 </literallayout>
11560 <para>
11561 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
11562 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
11563 list is positive. However, if the setting were
11564 </para>
11565 <literallayout class="monospaced">
11566 domainlist relay_to_domains = !a.b.c
11567 </literallayout>
11568 <para>
11569 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
11570 list is negative. In other words, a list that ends with a negative item behaves
11571 as if it had an extra item <literal>:*</literal> on the end.
11572 </para>
11573 <para>
11574 Another way of thinking about positive and negative items in lists is to read
11575 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
11576 item.
11577 </para>
11578 </section>
11579 <section id="SECTfilnamlis">
11580 <title>File names in lists</title>
11581 <para>
11582 <indexterm role="concept">
11583 <primary>list</primary>
11584 <secondary>file name in</secondary>
11585 </indexterm>
11586 If an item in a domain, host, address, or local part list is an absolute file
11587 name (beginning with a slash character), each line of the file is read and
11588 processed as if it were an independent item in the list, except that further
11589 file names are not allowed,
11590 and no expansion of the data from the file takes place.
11591 Empty lines in the file are ignored, and the file may also contain comment
11592 lines:
11593 </para>
11594 <itemizedlist>
11595 <listitem>
11596 <para>
11597 For domain and host lists, if a # character appears anywhere in a line of the
11598 file, it and all following characters are ignored.
11599 </para>
11600 </listitem>
11601 <listitem>
11602 <para>
11603 Because local parts may legitimately contain # characters, a comment in an
11604 address list or local part list file is recognized only if # is preceded by
11605 white space or the start of the line. For example:
11606 </para>
11607 <literallayout class="monospaced">
11608 not#comment@x.y.z   # but this is a comment
11609 </literallayout>
11610 </listitem>
11611 </itemizedlist>
11612 <para>
11613 Putting a file name in a list has the same effect as inserting each line of the
11614 file as an item in the list (blank lines and comments excepted). However, there
11615 is one important difference: the file is read each time the list is processed,
11616 so if its contents vary over time, Exim&#x2019;s behaviour changes.
11617 </para>
11618 <para>
11619 If a file name is preceded by an exclamation mark, the sense of any match
11620 within the file is inverted. For example, if
11621 </para>
11622 <literallayout class="monospaced">
11623 hold_domains = !/etc/nohold-domains
11624 </literallayout>
11625 <para>
11626 and the file contains the lines
11627 </para>
11628 <literallayout class="monospaced">
11629 !a.b.c
11630 *.b.c
11631 </literallayout>
11632 <para>
11633 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
11634 any domain matching <literal>*.b.c</literal> is not.
11635 </para>
11636 </section>
11637 <section id="SECID77">
11638 <title>An lsearch file is not an out-of-line list</title>
11639 <para>
11640 As will be described in the sections that follow, lookups can be used in lists
11641 to provide indexed methods of checking list membership. There has been some
11642 confusion about the way <command>lsearch</command> lookups work in lists. Because
11643 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
11644 sometimes thought that it is allowed to contain wild cards and other kinds of
11645 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
11646 always fixed strings, just as for any other single-key lookup type.
11647 </para>
11648 <para>
11649 If you want to use a file to contain wild-card patterns that form part of a
11650 list, just give the file name on its own, without a search type, as described
11651 in the previous section. You could also use the <command>wildlsearch</command> or
11652 <command>nwildlsearch</command>, but there is no advantage in doing this.
11653 </para>
11654 </section>
11655 <section id="SECTnamedlists">
11656 <title>Named lists</title>
11657 <para>
11658 <indexterm role="concept">
11659 <primary>named lists</primary>
11660 </indexterm>
11661 <indexterm role="concept">
11662 <primary>list</primary>
11663 <secondary>named</secondary>
11664 </indexterm>
11665 A list of domains, hosts, email addresses, or local parts can be given a name
11666 which is then used to refer to the list elsewhere in the configuration. This is
11667 particularly convenient if the same list is required in several different
11668 places. It also allows lists to be given meaningful names, which can improve
11669 the readability of the configuration. For example, it is conventional to define
11670 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
11671 locally on a host, using a configuration line such as
11672 </para>
11673 <literallayout class="monospaced">
11674 domainlist local_domains = localhost:my.dom.example
11675 </literallayout>
11676 <para>
11677 Named lists are referenced by giving their name preceded by a plus sign, so,
11678 for example, a router that is intended to handle local domains would be
11679 configured with the line
11680 </para>
11681 <literallayout class="monospaced">
11682 domains = +local_domains
11683 </literallayout>
11684 <para>
11685 The first router in a configuration is often one that handles all domains
11686 except the local ones, using a configuration with a negated item like this:
11687 </para>
11688 <literallayout class="monospaced">
11689 dnslookup:
11690   driver = dnslookup
11691   domains = ! +local_domains
11692   transport = remote_smtp
11693   no_more
11694 </literallayout>
11695 <para>
11696 The four kinds of named list are created by configuration lines starting with
11697 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
11698 respectively. Then there follows the name that you are defining, followed by an
11699 equals sign and the list itself. For example:
11700 </para>
11701 <literallayout class="monospaced">
11702 hostlist    relay_from_hosts = 192.168.23.0/24 : my.friend.example
11703 addresslist bad_senders = cdb;/etc/badsenders
11704 </literallayout>
11705 <para>
11706 A named list may refer to other named lists:
11707 </para>
11708 <literallayout class="monospaced">
11709 domainlist  dom1 = first.example : second.example
11710 domainlist  dom2 = +dom1 : third.example
11711 domainlist  dom3 = fourth.example : +dom2 : fifth.example
11712 </literallayout>
11713 <para>
11714 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
11715 effect may not be what you intended, because the negation does not propagate
11716 out to the higher level. For example, consider:
11717 </para>
11718 <literallayout class="monospaced">
11719 domainlist  dom1 = !a.b
11720 domainlist  dom2 = +dom1 : *.b
11721 </literallayout>
11722 <para>
11723 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
11724 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
11725 means it matches the second list as well. The effect is not the same as
11726 </para>
11727 <literallayout class="monospaced">
11728 domainlist  dom2 = !a.b : *.b
11729 </literallayout>
11730 <para>
11731 where <emphasis>x.y</emphasis> does not match. It&#x2019;s best to avoid negation altogether in
11732 referenced lists if you can.
11733 </para>
11734 <para>
11735 Named lists may have a performance advantage. When Exim is routing an
11736 address or checking an incoming message, it caches the result of tests on named
11737 lists. So, if you have a setting such as
11738 </para>
11739 <literallayout class="monospaced">
11740 domains = +local_domains
11741 </literallayout>
11742 <para>
11743 on several of your routers
11744 or in several ACL statements,
11745 the actual test is done only for the first one. However, the caching works only
11746 if there are no expansions within the list itself or any sublists that it
11747 references. In other words, caching happens only for lists that are known to be
11748 the same each time they are referenced.
11749 </para>
11750 <para>
11751 By default, there may be up to 16 named lists of each type. This limit can be
11752 extended by changing a compile-time variable. The use of domain and host lists
11753 is recommended for concepts such as local domains, relay domains, and relay
11754 hosts. The default configuration is set up like this.
11755 </para>
11756 </section>
11757 <section id="SECID78">
11758 <title>Named lists compared with macros</title>
11759 <para>
11760 <indexterm role="concept">
11761 <primary>list</primary>
11762 <secondary>named compared with macro</secondary>
11763 </indexterm>
11764 <indexterm role="concept">
11765 <primary>macro</primary>
11766 <secondary>compared with named list</secondary>
11767 </indexterm>
11768 At first sight, named lists might seem to be no different from macros in the
11769 configuration file. However, macros are just textual substitutions. If you
11770 write
11771 </para>
11772 <literallayout class="monospaced">
11773 ALIST = host1 : host2
11774 auth_advertise_hosts = !ALIST
11775 </literallayout>
11776 <para>
11777 it probably won&#x2019;t do what you want, because that is exactly the same as
11778 </para>
11779 <literallayout class="monospaced">
11780 auth_advertise_hosts = !host1 : host2
11781 </literallayout>
11782 <para>
11783 Notice that the second host name is not negated. However, if you use a host
11784 list, and write
11785 </para>
11786 <literallayout class="monospaced">
11787 hostlist alist = host1 : host2
11788 auth_advertise_hosts = ! +alist
11789 </literallayout>
11790 <para>
11791 the negation applies to the whole list, and so that is equivalent to
11792 </para>
11793 <literallayout class="monospaced">
11794 auth_advertise_hosts = !host1 : !host2
11795 </literallayout>
11796 </section>
11797 <section id="SECID79">
11798 <title>Named list caching</title>
11799 <para>
11800 <indexterm role="concept">
11801 <primary>list</primary>
11802 <secondary>caching of named</secondary>
11803 </indexterm>
11804 <indexterm role="concept">
11805 <primary>caching</primary>
11806 <secondary>named lists</secondary>
11807 </indexterm>
11808 While processing a message, Exim caches the result of checking a named list if
11809 it is sure that the list is the same each time. In practice, this means that
11810 the cache operates only if the list contains no $ characters, which guarantees
11811 that it will not change when it is expanded. Sometimes, however, you may have
11812 an expanded list that you know will be the same each time within a given
11813 message. For example:
11814 </para>
11815 <literallayout class="monospaced">
11816 domainlist special_domains = \
11817            ${lookup{$sender_host_address}cdb{/some/file}}
11818 </literallayout>
11819 <para>
11820 This provides a list of domains that depends only on the sending host&#x2019;s IP
11821 address. If this domain list is referenced a number of times (for example,
11822 in several ACL lines, or in several routers) the result of the check is not
11823 cached by default, because Exim does not know that it is going to be the
11824 same list each time.
11825 </para>
11826 <para>
11827 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
11828 cache the result anyway. For example:
11829 </para>
11830 <literallayout class="monospaced">
11831 domainlist_cache special_domains = ${lookup{...
11832 </literallayout>
11833 <para>
11834 If you do this, you should be absolutely sure that caching is going to do
11835 the right thing in all cases. When in doubt, leave it out.
11836 </para>
11837 </section>
11838 <section id="SECTdomainlist">
11839 <title>Domain lists</title>
11840 <para>
11841 <indexterm role="concept">
11842 <primary>domain list</primary>
11843 <secondary>patterns for</secondary>
11844 </indexterm>
11845 <indexterm role="concept">
11846 <primary>list</primary>
11847 <secondary>domain list</secondary>
11848 </indexterm>
11849 Domain lists contain patterns that are to be matched against a mail domain.
11850 The following types of item may appear in domain lists:
11851 </para>
11852 <itemizedlist>
11853 <listitem>
11854 <para>
11855 <indexterm role="concept">
11856 <primary>primary host name</primary>
11857 </indexterm>
11858 <indexterm role="concept">
11859 <primary>host name</primary>
11860 <secondary>matched in domain list</secondary>
11861 </indexterm>
11862 <indexterm role="option">
11863 <primary><option>primary_hostname</option></primary>
11864 </indexterm>
11865 <indexterm role="concept">
11866 <primary>domain list</primary>
11867 <secondary>matching primary host name</secondary>
11868 </indexterm>
11869 <indexterm role="concept">
11870 <primary>@ in a domain list</primary>
11871 </indexterm>
11872 If a pattern consists of a single @ character, it matches the local host name,
11873 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
11874 possible to use the same configuration file on several different hosts that
11875 differ only in their names.
11876 </para>
11877 </listitem>
11878 <listitem>
11879 <para>
11880 <indexterm role="concept">
11881 <primary>@[] in a domain list</primary>
11882 </indexterm>
11883 <indexterm role="concept">
11884 <primary>domain list</primary>
11885 <secondary>matching local IP interfaces</secondary>
11886 </indexterm>
11887 <indexterm role="concept">
11888 <primary>domain literal</primary>
11889 </indexterm>
11890 If a pattern consists of the string <literal>@[]</literal> it matches an IP address enclosed
11891 in square brackets (as in an email address that contains a domain literal), but
11892 only if that IP address is recognized as local for email routing purposes. The
11893 <option>local_interfaces</option> and <option>extra_local_interfaces</option> options can be used to
11894 control which of a host&#x2019;s several IP addresses are treated as local.
11895 In today&#x2019;s Internet, the use of domain literals is controversial.
11896 </para>
11897 </listitem>
11898 <listitem>
11899 <para>
11900 <indexterm role="concept">
11901 <primary>@mx_any</primary>
11902 </indexterm>
11903 <indexterm role="concept">
11904 <primary>@mx_primary</primary>
11905 </indexterm>
11906 <indexterm role="concept">
11907 <primary>@mx_secondary</primary>
11908 </indexterm>
11909 <indexterm role="concept">
11910 <primary>domain list</primary>
11911 <secondary>matching MX pointers to local host</secondary>
11912 </indexterm>
11913 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
11914 has an MX record pointing to the local host or to any host that is listed in
11915 <indexterm role="option">
11916 <primary><option>hosts_treat_as_local</option></primary>
11917 </indexterm>
11918 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
11919 are similar, except that the first matches only when a primary MX target is the
11920 local host, and the second only when no primary MX target is the local host,
11921 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
11922 preference value &ndash; there may of course be more than one of them.
11923 </para>
11924 <para>
11925 The MX lookup that takes place when matching a pattern of this type is
11926 performed with the resolver options for widening names turned off. Thus, for
11927 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
11928 resolver&#x2019;s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
11929 options of the <command>dnslookup</command> router for a discussion of domain widening.
11930 </para>
11931 <para>
11932 Sometimes you may want to ignore certain IP addresses when using one of these
11933 patterns. You can specify this by following the pattern with <literal>/ignore=</literal>&lt;<emphasis>ip
11934 list</emphasis>&gt;, where &lt;<emphasis>ip list</emphasis>&gt; is a list of IP addresses. These addresses are
11935 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
11936 on a router). For example:
11937 </para>
11938 <literallayout class="monospaced">
11939 domains = @mx_any/ignore=127.0.0.1
11940 </literallayout>
11941 <para>
11942 This example matches any domain that has an MX record pointing to one of
11943 the local host&#x2019;s IP addresses other than 127.0.0.1.
11944 </para>
11945 <para>
11946 The list of IP addresses is in fact processed by the same code that processes
11947 host lists, so it may contain CIDR-coded network specifications and it may also
11948 contain negative items.
11949 </para>
11950 <para>
11951 Because the list of IP addresses is a sublist within a domain list, you have to
11952 be careful about delimiters if there is more than one address. Like any other
11953 list, the default delimiter can be changed. Thus, you might have:
11954 </para>
11955 <literallayout class="monospaced">
11956 domains = @mx_any/ignore=&lt;;127.0.0.1;0.0.0.0 : \
11957           an.other.domain : ...
11958 </literallayout>
11959 <para>
11960 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
11961 involved, it is easiest to change the delimiter for the main list as well:
11962 </para>
11963 <literallayout class="monospaced">
11964 domains = &lt;? @mx_any/ignore=&lt;;127.0.0.1;::1 ? \
11965           an.other.domain ? ...
11966 </literallayout>
11967 </listitem>
11968 <listitem>
11969 <para>
11970 <indexterm role="concept">
11971 <primary>asterisk</primary>
11972 <secondary>in domain list</secondary>
11973 </indexterm>
11974 <indexterm role="concept">
11975 <primary>domain list</primary>
11976 <secondary>asterisk in</secondary>
11977 </indexterm>
11978 <indexterm role="concept">
11979 <primary>domain list</primary>
11980 <secondary>matching <quote>ends with</quote></secondary>
11981 </indexterm>
11982 If a pattern starts with an asterisk, the remaining characters of the pattern
11983 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
11984 domain lists differs from its use in partial matching lookups. In a domain
11985 list, the character following the asterisk need not be a dot, whereas partial
11986 matching works only in terms of dot-separated components. For example, a domain
11987 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
11988 <emphasis>cipher.key.ex</emphasis>.
11989 </para>
11990 </listitem>
11991 <listitem>
11992 <para>
11993 <indexterm role="concept">
11994 <primary>regular expressions</primary>
11995 <secondary>in domain list</secondary>
11996 </indexterm>
11997 <indexterm role="concept">
11998 <primary>domain list</primary>
11999 <secondary>matching regular expression</secondary>
12000 </indexterm>
12001 If a pattern starts with a circumflex character, it is treated as a regular
12002 expression, and matched against the domain using a regular expression matching
12003 function. The circumflex is treated as part of the regular expression.
12004 Email domains are case-independent, so this regular expression match is by
12005 default case-independent, but you can make it case-dependent by starting it
12006 with <literal>(?-i)</literal>. References to descriptions of the syntax of regular expressions
12007 are given in chapter <xref linkend="CHAPregexp"/>.
12008 </para>
12009 <para>
12010 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
12011 must escape any backslash and dollar characters in the regular expression, or
12012 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
12013 it is not to be expanded (unless you really do want to build a regular
12014 expression by expansion, of course).
12015 </para>
12016 </listitem>
12017 <listitem>
12018 <para>
12019 <indexterm role="concept">
12020 <primary>lookup</primary>
12021 <secondary>in domain list</secondary>
12022 </indexterm>
12023 <indexterm role="concept">
12024 <primary>domain list</primary>
12025 <secondary>matching by lookup</secondary>
12026 </indexterm>
12027 If a pattern starts with the name of a single-key lookup type followed by a
12028 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
12029 must be a file name in a suitable format for the lookup type. For example, for
12030 <quote>cdb;</quote> it must be an absolute path:
12031 </para>
12032 <literallayout class="monospaced">
12033 domains = cdb;/etc/mail/local_domains.cdb
12034 </literallayout>
12035 <para>
12036 The appropriate type of lookup is done on the file using the domain name as the
12037 key. In most cases, the data that is looked up is not used; Exim is interested
12038 only in whether or not the key is present in the file. However, when a lookup
12039 is used for the <option>domains</option> option on a router
12040 or a <option>domains</option> condition in an ACL statement, the data is preserved in the
12041 <varname>$domain_data</varname> variable and can be referred to in other router options or
12042 other statements in the same ACL.
12043 </para>
12044 </listitem>
12045 <listitem>
12046 <para>
12047 Any of the single-key lookup type names may be preceded by
12048 <literal>partial</literal>&lt;<emphasis>n</emphasis>&gt;<literal>-</literal>, where the &lt;<emphasis>n</emphasis>&gt; is optional, for example,
12049 </para>
12050 <literallayout class="monospaced">
12051 domains = partial-dbm;/partial/domains
12052 </literallayout>
12053 <para>
12054 This causes partial matching logic to be invoked; a description of how this
12055 works is given in section <xref linkend="SECTpartiallookup"/>.
12056 </para>
12057 </listitem>
12058 <listitem>
12059 <para>
12060 <indexterm role="concept">
12061 <primary>asterisk</primary>
12062 <secondary>in lookup type</secondary>
12063 </indexterm>
12064 Any of the single-key lookup types may be followed by an asterisk. This causes
12065 a default lookup for a key consisting of a single asterisk to be done if the
12066 original lookup fails. This is not a useful feature when using a domain list to
12067 select particular domains (because any domain would match), but it might have
12068 value if the result of the lookup is being used via the <varname>$domain_data</varname>
12069 expansion variable.
12070 </para>
12071 </listitem>
12072 <listitem>
12073 <para>
12074 If the pattern starts with the name of a query-style lookup type followed by a
12075 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
12076 pattern must be an appropriate query for the lookup type, as described in
12077 chapter <xref linkend="CHAPfdlookup"/>. For example:
12078 </para>
12079 <literallayout class="monospaced">
12080 hold_domains = mysql;select domain from holdlist \
12081   where domain = '${quote_mysql:$domain}';
12082 </literallayout>
12083 <para>
12084 In most cases, the data that is looked up is not used (so for an SQL query, for
12085 example, it doesn&#x2019;t matter what field you select). Exim is interested only in
12086 whether or not the query succeeds. However, when a lookup is used for the
12087 <option>domains</option> option on a router, the data is preserved in the <varname>$domain_data</varname>
12088 variable and can be referred to in other options.
12089 </para>
12090 </listitem>
12091 <listitem>
12092 <para>
12093 <indexterm role="concept">
12094 <primary>domain list</primary>
12095 <secondary>matching literal domain name</secondary>
12096 </indexterm>
12097 If none of the above cases apply, a caseless textual comparison is made
12098 between the pattern and the domain.
12099 </para>
12100 </listitem>
12101 </itemizedlist>
12102 <para>
12103 Here is an example that uses several different kinds of pattern:
12104 </para>
12105 <literallayout class="monospaced">
12106 domainlist funny_domains = \
12107   @ : \
12108   lib.unseen.edu : \
12109   *.foundation.fict.example : \
12110   \N^[1-2]\d{3}\.fict\.example$\N : \
12111   partial-dbm;/opt/data/penguin/book : \
12112   nis;domains.byname : \
12113   nisplus;[name=$domain,status=local],domains.org_dir
12114 </literallayout>
12115 <para>
12116 There are obvious processing trade-offs among the various matching modes. Using
12117 an asterisk is faster than a regular expression, and listing a few names
12118 explicitly probably is too. The use of a file or database lookup is expensive,
12119 but may be the only option if hundreds of names are required. Because the
12120 patterns are tested in order, it makes sense to put the most commonly matched
12121 patterns earlier.
12122 </para>
12123 </section>
12124 <section id="SECThostlist">
12125 <title>Host lists</title>
12126 <para>
12127 <indexterm role="concept">
12128 <primary>host list</primary>
12129 <secondary>patterns in</secondary>
12130 </indexterm>
12131 <indexterm role="concept">
12132 <primary>list</primary>
12133 <secondary>host list</secondary>
12134 </indexterm>
12135 Host lists are used to control what remote hosts are allowed to do. For
12136 example, some hosts may be allowed to use the local host as a relay, and some
12137 may be permitted to use the SMTP ETRN command. Hosts can be identified in
12138 two different ways, by name or by IP address. In a host list, some types of
12139 pattern are matched to a host name, and some are matched to an IP address.
12140 You need to be particularly careful with this when single-key lookups are
12141 involved, to ensure that the right value is being used as the key.
12142 </para>
12143 </section>
12144 <section id="SECID80">
12145 <title>Special host list patterns</title>
12146 <para>
12147 <indexterm role="concept">
12148 <primary>empty item in hosts list</primary>
12149 </indexterm>
12150 <indexterm role="concept">
12151 <primary>host list</primary>
12152 <secondary>empty string in</secondary>
12153 </indexterm>
12154 If a host list item is the empty string, it matches only when no remote host is
12155 involved. This is the case when a message is being received from a local
12156 process using SMTP on the standard input, that is, when a TCP/IP connection is
12157 not used.
12158 </para>
12159 <para>
12160 <indexterm role="concept">
12161 <primary>asterisk</primary>
12162 <secondary>in host list</secondary>
12163 </indexterm>
12164 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
12165 the IP address nor the name is actually inspected.
12166 </para>
12167 </section>
12168 <section id="SECThoslispatip">
12169 <title>Host list patterns that match by IP address</title>
12170 <para>
12171 <indexterm role="concept">
12172 <primary>host list</primary>
12173 <secondary>matching IP addresses</secondary>
12174 </indexterm>
12175 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
12176 the incoming address actually appears in the IPv6 host as
12177 <literal>::ffff:</literal>&lt;<emphasis>v4address</emphasis>&gt;. When such an address is tested against a host
12178 list, it is converted into a traditional IPv4 address first. (Not all operating
12179 systems accept IPv4 calls on IPv6 sockets, as there have been some security
12180 concerns.)
12181 </para>
12182 <para>
12183 The following types of pattern in a host list check the remote host by
12184 inspecting its IP address:
12185 </para>
12186 <itemizedlist>
12187 <listitem>
12188 <para>
12189 If the pattern is a plain domain name (not a regular expression, not starting
12190 with *, not a lookup of any kind), Exim calls the operating system function
12191 to find the associated IP address(es). Exim uses the newer
12192 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
12193 This typically causes a forward DNS lookup of the name. The result is compared
12194 with the IP address of the subject host.
12195 </para>
12196 <para>
12197 If there is a temporary problem (such as a DNS timeout) with the host name
12198 lookup, a temporary error occurs. For example, if the list is being used in an
12199 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
12200 temporary SMTP error code. If no IP address can be found for the host name,
12201 what happens is described in section <xref linkend="SECTbehipnot"/> below.
12202 </para>
12203 </listitem>
12204 <listitem>
12205 <para>
12206 <indexterm role="concept">
12207 <primary>@ in a host list</primary>
12208 </indexterm>
12209 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
12210 domain name, as just described.
12211 </para>
12212 </listitem>
12213 <listitem>
12214 <para>
12215 If the pattern is an IP address, it is matched against the IP address of the
12216 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
12217 IPv6 addresses can be given in colon-separated format, but the colons have to
12218 be doubled so as not to be taken as item separators when the default list
12219 separator is used. IPv6 addresses are recognized even when Exim is compiled
12220 without IPv6 support. This means that if they appear in a host list on an
12221 IPv4-only host, Exim will not treat them as host names. They are just addresses
12222 that can never match a client host.
12223 </para>
12224 </listitem>
12225 <listitem>
12226 <para>
12227 <indexterm role="concept">
12228 <primary>@[] in a host list</primary>
12229 </indexterm>
12230 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
12231 the local host. For example, if the local host is an IPv4 host with one
12232 interface address 10.45.23.56, these two ACL statements have the same effect:
12233 </para>
12234 <literallayout class="monospaced">
12235 accept hosts = 127.0.0.1 : 10.45.23.56
12236 accept hosts = @[]
12237 </literallayout>
12238 </listitem>
12239 <listitem>
12240 <para>
12241 <indexterm role="concept">
12242 <primary>CIDR notation</primary>
12243 </indexterm>
12244 If the pattern is an IP address followed by a slash and a mask length (for
12245 example 10.11.42.0/24), it is matched against the IP address of the subject
12246 host under the given mask. This allows, an entire network of hosts to be
12247 included (or excluded) by a single item. The mask uses CIDR notation; it
12248 specifies the number of address bits that must match, starting from the most
12249 significant end of the address.
12250 </para>
12251 <para>
12252 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
12253 of a range of addresses. It is the number of bits in the network portion of the
12254 address. The above example specifies a 24-bit netmask, so it matches all 256
12255 addresses in the 10.11.42.0 network. An item such as
12256 </para>
12257 <literallayout class="monospaced">
12258 192.168.23.236/31
12259 </literallayout>
12260 <para>
12261 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
12262 32 for an IPv4 address is the same as no mask at all; just a single address
12263 matches.
12264 </para>
12265 <para>
12266 Here is another example which shows an IPv4 and an IPv6 network:
12267 </para>
12268 <literallayout class="monospaced">
12269 recipient_unqualified_hosts = 192.168.0.0/16: \
12270                               3ffe::ffff::836f::::/48
12271 </literallayout>
12272 <para>
12273 The doubling of list separator characters applies only when these items
12274 appear inline in a host list. It is not required when indirecting via a file.
12275 For example:
12276 </para>
12277 <literallayout class="monospaced">
12278 recipient_unqualified_hosts = /opt/exim/unqualnets
12279 </literallayout>
12280 <para>
12281 could make use of a file containing
12282 </para>
12283 <literallayout class="monospaced">
12284 172.16.0.0/12
12285 3ffe:ffff:836f::/48
12286 </literallayout>
12287 <para>
12288 to have exactly the same effect as the previous example. When listing IPv6
12289 addresses inline, it is usually more convenient to use the facility for
12290 changing separator characters. This list contains the same two networks:
12291 </para>
12292 <literallayout class="monospaced">
12293 recipient_unqualified_hosts = &lt;; 172.16.0.0/12; \
12294                                  3ffe:ffff:836f::/48
12295 </literallayout>
12296 <para>
12297 The separator is changed to semicolon by the leading <quote>&lt;;</quote> at the start of the
12298 list.
12299 </para>
12300 </listitem>
12301 </itemizedlist>
12302 </section>
12303 <section id="SECThoslispatsikey">
12304 <title>Host list patterns for single-key lookups by host address</title>
12305 <para>
12306 <indexterm role="concept">
12307 <primary>host list</primary>
12308 <secondary>lookup of IP address</secondary>
12309 </indexterm>
12310 When a host is to be identified by a single-key lookup of its complete IP
12311 address, the pattern takes this form:
12312 </para>
12313 <literallayout>
12314 <literal>net-&lt;</literal><emphasis>single-key-search-type</emphasis><literal>&gt;;&lt;</literal><emphasis>search-data</emphasis><literal>&gt;</literal>
12315 </literallayout>
12316 <para>
12317 For example:
12318 </para>
12319 <literallayout class="monospaced">
12320 hosts_lookup = net-cdb;/hosts-by-ip.db
12321 </literallayout>
12322 <para>
12323 The text form of the IP address of the subject host is used as the lookup key.
12324 IPv6 addresses are converted to an unabbreviated form, using lower case
12325 letters, with dots as separators because colon is the key terminator in
12326 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
12327 quoting the keys, but this is a facility that was added later.] The data
12328 returned by the lookup is not used.
12329 </para>
12330 <para>
12331 <indexterm role="concept">
12332 <primary>IP address</primary>
12333 <secondary>masking</secondary>
12334 </indexterm>
12335 <indexterm role="concept">
12336 <primary>host list</primary>
12337 <secondary>masked IP address</secondary>
12338 </indexterm>
12339 Single-key lookups can also be performed using masked IP addresses, using
12340 patterns of this form:
12341 </para>
12342 <literallayout>
12343 <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>
12344 </literallayout>
12345 <para>
12346 For example:
12347 </para>
12348 <literallayout class="monospaced">
12349 net24-dbm;/networks.db
12350 </literallayout>
12351 <para>
12352 The IP address of the subject host is masked using &lt;<emphasis>number</emphasis>&gt; as the mask
12353 length. A textual string is constructed from the masked value, followed by the
12354 mask, and this is used as the lookup key. For example, if the host&#x2019;s IP address
12355 is 192.168.34.6, the key that is looked up for the above example is
12356 <quote>192.168.34.0/24</quote>.
12357 </para>
12358 <para>
12359 When an IPv6 address is converted to a string, dots are normally used instead
12360 of colons, so that keys in <command>lsearch</command> files need not contain colons (which
12361 terminate <command>lsearch</command> keys). This was implemented some time before the ability
12362 to quote keys was made available in <command>lsearch</command> files. However, the more
12363 recently implemented <command>iplsearch</command> files do require colons in IPv6 keys
12364 (notated using the quoting facility) so as to distinguish them from IPv4 keys.
12365 For this reason, when the lookup type is <command>iplsearch</command>, IPv6 addresses are
12366 converted using colons and not dots. In all cases, full, unabbreviated IPv6
12367 addresses are always used.
12368 </para>
12369 <para>
12370 Ideally, it would be nice to tidy up this anomalous situation by changing to
12371 colons in all cases, given that quoting is now available for <command>lsearch</command>.
12372 However, this would be an incompatible change that might break some existing
12373 configurations.
12374 </para>
12375 <para>
12376 <emphasis role="bold">Warning</emphasis>: Specifying <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
12377 IPv6 address) is not the same as specifying just <option>net-</option> without a number. In
12378 the former case the key strings include the mask value, whereas in the latter
12379 case the IP address is used on its own.
12380 </para>
12381 </section>
12382 <section id="SECThoslispatnam">
12383 <title>Host list patterns that match by host name</title>
12384 <para>
12385 <indexterm role="concept">
12386 <primary>host</primary>
12387 <secondary>lookup failures</secondary>
12388 </indexterm>
12389 <indexterm role="concept">
12390 <primary>unknown host name</primary>
12391 </indexterm>
12392 <indexterm role="concept">
12393 <primary>host list</primary>
12394 <secondary>matching host name</secondary>
12395 </indexterm>
12396 There are several types of pattern that require Exim to know the name of the
12397 remote host. These are either wildcard patterns or lookups by name. (If a
12398 complete hostname is given without any wildcarding, it is used to find an IP
12399 address to match against, as described in section <xref linkend="SECThoslispatip"/>
12400 above.)
12401 </para>
12402 <para>
12403 If the remote host name is not already known when Exim encounters one of these
12404 patterns, it has to be found from the IP address.
12405 Although many sites on the Internet are conscientious about maintaining reverse
12406 DNS data for their hosts, there are also many that do not do this.
12407 Consequently, a name cannot always be found, and this may lead to unwanted
12408 effects. Take care when configuring host lists with wildcarded name patterns.
12409 Consider what will happen if a name cannot be found.
12410 </para>
12411 <para>
12412 Because of the problems of determining host names from IP addresses, matching
12413 against host names is not as common as matching against IP addresses.
12414 </para>
12415 <para>
12416 By default, in order to find a host name, Exim first does a reverse DNS lookup;
12417 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
12418 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
12419 are done can be changed by setting the <option>host_lookup_order</option> option. For
12420 security, once Exim has found one or more names, it looks up the IP addresses
12421 for these names and compares them with the IP address that it started with.
12422 Only those names whose IP addresses match are accepted. Any other names are
12423 discarded. If no names are left, Exim behaves as if the host name cannot be
12424 found. In the most common case there is only one name and one IP address.
12425 </para>
12426 <para>
12427 There are some options that control what happens if a host name cannot be
12428 found. These are described in section <xref linkend="SECTbehipnot"/> below.
12429 </para>
12430 <para>
12431 <indexterm role="concept">
12432 <primary>host</primary>
12433 <secondary>alias for</secondary>
12434 </indexterm>
12435 <indexterm role="concept">
12436 <primary>alias for host</primary>
12437 </indexterm>
12438 As a result of aliasing, hosts may have more than one name. When processing any
12439 of the following types of pattern, all the host&#x2019;s names are checked:
12440 </para>
12441 <itemizedlist>
12442 <listitem>
12443 <para>
12444 <indexterm role="concept">
12445 <primary>asterisk</primary>
12446 <secondary>in host list</secondary>
12447 </indexterm>
12448 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
12449 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
12450 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
12451 requirement. Other kinds of wildcarding require the use of a regular
12452 expression.
12453 </para>
12454 </listitem>
12455 <listitem>
12456 <para>
12457 <indexterm role="concept">
12458 <primary>regular expressions</primary>
12459 <secondary>in host list</secondary>
12460 </indexterm>
12461 <indexterm role="concept">
12462 <primary>host list</primary>
12463 <secondary>regular expression in</secondary>
12464 </indexterm>
12465 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
12466 matched against the host name. Host names are case-independent, so this regular
12467 expression match is by default case-independent, but you can make it
12468 case-dependent by starting it with <literal>(?-i)</literal>. References to descriptions of the
12469 syntax of regular expressions are given in chapter <xref linkend="CHAPregexp"/>. For
12470 example,
12471 </para>
12472 <literallayout class="monospaced">
12473 ^(a|b)\.c\.d$
12474 </literallayout>
12475 <para>
12476 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
12477 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
12478 that backslash and dollar characters are not misinterpreted as part of the
12479 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
12480 part of the string as non-expandable. For example:
12481 </para>
12482 <literallayout class="monospaced">
12483 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
12484 </literallayout>
12485 <para>
12486 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
12487 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
12488 example. Without it, a match at the start of the host name is all that is
12489 required.
12490 </para>
12491 </listitem>
12492 </itemizedlist>
12493 </section>
12494 <section id="SECTbehipnot">
12495 <title>Behaviour when an IP address or name cannot be found</title>
12496 <para>
12497 <indexterm role="concept">
12498 <primary>host</primary>
12499 <secondary>lookup failures, permanent</secondary>
12500 </indexterm>
12501 While processing a host list, Exim may need to look up an IP address from a
12502 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
12503 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
12504 behaviour when it fails to find the information it is seeking is the same.
12505 </para>
12506 <para>
12507 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
12508 apply to temporary DNS errors, whose handling is described in the next section.
12509 </para>
12510 <para>
12511 <indexterm role="concept">
12512 <primary><literal>+include_unknown</literal></primary>
12513 </indexterm>
12514 <indexterm role="concept">
12515 <primary><literal>+ignore_unknown</literal></primary>
12516 </indexterm>
12517 Exim parses a host list from left to right. If it encounters a permanent
12518 lookup failure in any item in the host list before it has found a match,
12519 Exim treats it as a failure and the default behavior is as if the host
12520 does not match the list. This may not always be what you want to happen.
12521 To change Exim&#x2019;s behaviour, the special items <literal>+include_unknown</literal> or
12522 <literal>+ignore_unknown</literal> may appear in the list (at top level &ndash; they are
12523 not recognized in an indirected file).
12524 </para>
12525 <itemizedlist>
12526 <listitem>
12527 <para>
12528 If any item that follows <literal>+include_unknown</literal> requires information that
12529 cannot found, Exim behaves as if the host does match the list. For example,
12530 </para>
12531 <literallayout class="monospaced">
12532 host_reject_connection = +include_unknown:*.enemy.ex
12533 </literallayout>
12534 <para>
12535 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
12536 any hosts whose name it cannot find.
12537 </para>
12538 </listitem>
12539 <listitem>
12540 <para>
12541 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
12542 be found, Exim ignores that item and proceeds to the rest of the list. For
12543 example:
12544 </para>
12545 <literallayout class="monospaced">
12546 accept hosts = +ignore_unknown : friend.example : \
12547                192.168.4.5
12548 </literallayout>
12549 <para>
12550 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
12551 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
12552 name can be found for 192.168.4.5, it is rejected.
12553 </para>
12554 </listitem>
12555 </itemizedlist>
12556 <para>
12557 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
12558 list. The effect of each one lasts until the next, or until the end of the
12559 list.
12560 </para>
12561 </section>
12562 <section id="SECTmixwilhos">
12563 <title>Mixing wildcarded host names and addresses in host lists</title>
12564 <para>
12565 <indexterm role="concept">
12566 <primary>host list</primary>
12567 <secondary>mixing names and addresses in</secondary>
12568 </indexterm>
12569 </para>
12570 <para>
12571 This section explains the host/ip processing logic with the same concepts
12572 as the previous section, but specifically addresses what happens when a
12573 wildcarded hostname is one of the items in the hostlist.
12574 </para>
12575 <itemizedlist>
12576 <listitem>
12577 <para>
12578 If you have name lookups or wildcarded host names and
12579 IP addresses in the same host list, you should normally put the IP
12580 addresses first. For example, in an ACL you could have:
12581 </para>
12582 <literallayout class="monospaced">
12583 accept hosts = 10.9.8.7 : *.friend.example
12584 </literallayout>
12585 <para>
12586 The reason you normally would order it this way lies in the
12587 left-to-right way that Exim processes lists.  It can test IP addresses
12588 without doing any DNS lookups, but when it reaches an item that requires
12589 a host name, it fails if it cannot find a host name to compare with the
12590 pattern. If the above list is given in the opposite order, the
12591 <option>accept</option> statement fails for a host whose name cannot be found, even
12592 if its IP address is 10.9.8.7.
12593 </para>
12594 </listitem>
12595 <listitem>
12596 <para>
12597 If you really do want to do the name check first, and still recognize the IP
12598 address, you can rewrite the ACL like this:
12599 </para>
12600 <literallayout class="monospaced">
12601 accept hosts = *.friend.example
12602 accept hosts = 10.9.8.7
12603 </literallayout>
12604 <para>
12605 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
12606 <xref linkend="CHAPACL"/> for details of ACLs. Alternatively, you can use
12607 <literal>+ignore_unknown</literal>, which was discussed in depth in the first example in
12608 this section.
12609 </para>
12610 </listitem>
12611 </itemizedlist>
12612 </section>
12613 <section id="SECTtemdnserr">
12614 <title>Temporary DNS errors when looking up host information</title>
12615 <para>
12616 <indexterm role="concept">
12617 <primary>host</primary>
12618 <secondary>lookup failures, temporary</secondary>
12619 </indexterm>
12620 <indexterm role="concept">
12621 <primary><literal>+include_defer</literal></primary>
12622 </indexterm>
12623 <indexterm role="concept">
12624 <primary><literal>+ignore_defer</literal></primary>
12625 </indexterm>
12626 A temporary DNS lookup failure normally causes a defer action (except when
12627 <option>dns_again_means_nonexist</option> converts it into a permanent error). However,
12628 host lists can include <literal>+ignore_defer</literal> and <literal>+include_defer</literal>, analagous to
12629 <literal>+ignore_unknown</literal> and <literal>+include_unknown</literal>, as described in the previous
12630 section. These options should be used with care, probably only in non-critical
12631 host lists such as whitelists.
12632 </para>
12633 </section>
12634 <section id="SECThoslispatnamsk">
12635 <title>Host list patterns for single-key lookups by host name</title>
12636 <para>
12637 <indexterm role="concept">
12638 <primary>unknown host name</primary>
12639 </indexterm>
12640 <indexterm role="concept">
12641 <primary>host list</primary>
12642 <secondary>matching host name</secondary>
12643 </indexterm>
12644 If a pattern is of the form
12645 </para>
12646 <literallayout>
12647 &lt;<emphasis>single-key-search-type</emphasis>&gt;;&lt;<emphasis>search-data</emphasis>&gt;
12648 </literallayout>
12649 <para>
12650 for example
12651 </para>
12652 <literallayout class="monospaced">
12653 dbm;/host/accept/list
12654 </literallayout>
12655 <para>
12656 a single-key lookup is performed, using the host name as its key. If the
12657 lookup succeeds, the host matches the item. The actual data that is looked up
12658 is not used.
12659 </para>
12660 <para>
12661 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
12662 keys in the file, not IP addresses. If you want to do lookups based on IP
12663 addresses, you must precede the search type with <quote>net-</quote> (see section
12664 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
12665 two items in the same list, one doing an address lookup and one doing a name
12666 lookup, both using the same file.
12667 </para>
12668 </section>
12669 <section id="SECID81">
12670 <title>Host list patterns for query-style lookups</title>
12671 <para>
12672 If a pattern is of the form
12673 </para>
12674 <literallayout>
12675 &lt;<emphasis>query-style-search-type</emphasis>&gt;;&lt;<emphasis>query</emphasis>&gt;
12676 </literallayout>
12677 <para>
12678 the query is obeyed, and if it succeeds, the host matches the item. The actual
12679 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
12680 <varname>$sender_host_name</varname> can be used in the query. For example:
12681 </para>
12682 <literallayout class="monospaced">
12683 hosts_lookup = pgsql;\
12684   select ip from hostlist where ip='$sender_host_address'
12685 </literallayout>
12686 <para>
12687 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
12688 can use the <option>sg</option> expansion item to change this if you need to. If you want to
12689 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
12690 operator.
12691 </para>
12692 <para>
12693 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
12694 looks up the host name if it has not already done so. (See section
12695 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
12696 </para>
12697 <para>
12698 Historical note: prior to release 4.30, Exim would always attempt to find a
12699 host name before running the query, unless the search type was preceded by
12700 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
12701 still recognized for query-style lookups, but its presence or absence has no
12702 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
12703 See section <xref linkend="SECThoslispatsikey"/>.)
12704 </para>
12705 </section>
12706 <section id="SECTaddresslist">
12707 <title>Address lists</title>
12708 <para>
12709 <indexterm role="concept">
12710 <primary>list</primary>
12711 <secondary>address list</secondary>
12712 </indexterm>
12713 <indexterm role="concept">
12714 <primary>address list</primary>
12715 <secondary>empty item</secondary>
12716 </indexterm>
12717 <indexterm role="concept">
12718 <primary>address list</primary>
12719 <secondary>patterns</secondary>
12720 </indexterm>
12721 Address lists contain patterns that are matched against mail addresses. There
12722 is one special case to be considered: the sender address of a bounce message is
12723 always empty. You can test for this by providing an empty item in an address
12724 list. For example, you can set up a router to process bounce messages by
12725 using this option setting:
12726 </para>
12727 <literallayout class="monospaced">
12728 senders = :
12729 </literallayout>
12730 <para>
12731 The presence of the colon creates an empty item. If you do not provide any
12732 data, the list is empty and matches nothing. The empty sender can also be
12733 detected by a regular expression that matches an empty string,
12734 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
12735 </para>
12736 <para>
12737 Non-empty items in an address list can be straightforward email addresses. For
12738 example:
12739 </para>
12740 <literallayout class="monospaced">
12741 senders = jbc@askone.example : hs@anacreon.example
12742 </literallayout>
12743 <para>
12744 A certain amount of wildcarding is permitted. If a pattern contains an @
12745 character, but is not a regular expression and does not begin with a
12746 semicolon-terminated lookup type (described below), the local part of the
12747 subject address is compared with the local part of the pattern, which may start
12748 with an asterisk. If the local parts match, the domain is checked in exactly
12749 the same way as for a pattern in a domain list. For example, the domain can be
12750 wildcarded, refer to a named list, or be a lookup:
12751 </para>
12752 <literallayout class="monospaced">
12753 deny senders = *@*.spamming.site:\
12754                *@+hostile_domains:\
12755                bozo@partial-lsearch;/list/of/dodgy/sites:\
12756                *@dbm;/bad/domains.db
12757 </literallayout>
12758 <para>
12759 <indexterm role="concept">
12760 <primary>local part</primary>
12761 <secondary>starting with !</secondary>
12762 </indexterm>
12763 <indexterm role="concept">
12764 <primary>address list</primary>
12765 <secondary>local part starting with !</secondary>
12766 </indexterm>
12767 If a local part that begins with an exclamation mark is required, it has to be
12768 specified using a regular expression, because otherwise the exclamation mark is
12769 treated as a sign of negation, as is standard in lists.
12770 </para>
12771 <para>
12772 If a non-empty pattern that is not a regular expression or a lookup does not
12773 contain an @ character, it is matched against the domain part of the subject
12774 address. The only two formats that are recognized this way are a literal
12775 domain, or a domain pattern that starts with *. In both these cases, the effect
12776 is the same as if <literal>*@</literal> preceded the pattern. For example:
12777 </para>
12778 <literallayout class="monospaced">
12779 deny senders = enemy.domain : *.enemy.domain
12780 </literallayout>
12781 <para>
12782 The following kinds of more complicated address list pattern can match any
12783 address, including the empty address that is characteristic of bounce message
12784 senders:
12785 </para>
12786 <itemizedlist>
12787 <listitem>
12788 <para>
12789 <indexterm role="concept">
12790 <primary>regular expressions</primary>
12791 <secondary>in address list</secondary>
12792 </indexterm>
12793 <indexterm role="concept">
12794 <primary>address list</primary>
12795 <secondary>regular expression in</secondary>
12796 </indexterm>
12797 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
12798 done against the complete address, with the pattern as the regular expression.
12799 You must take care that backslash and dollar characters are not misinterpreted
12800 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
12801 to mark that part of the string as non-expandable. For example:
12802 </para>
12803 <literallayout class="monospaced">
12804 deny senders = \N^.*this.*@example\.com$\N : \
12805                \N^\d{8}.+@spamhaus.example$\N : ...
12806 </literallayout>
12807 <para>
12808 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
12809 start with <quote>^</quote> by the time they are being interpreted as address patterns.
12810 </para>
12811 </listitem>
12812 <listitem>
12813 <para>
12814 <indexterm role="concept">
12815 <primary>address list</primary>
12816 <secondary>lookup for complete address</secondary>
12817 </indexterm>
12818 Complete addresses can be looked up by using a pattern that starts with a
12819 lookup type terminated by a semicolon, followed by the data for the lookup. For
12820 example:
12821 </para>
12822 <literallayout class="monospaced">
12823 deny senders = cdb;/etc/blocked.senders : \
12824   mysql;select address from blocked where \
12825   address='${quote_mysql:$sender_address}'
12826 </literallayout>
12827 <para>
12828 Both query-style and single-key lookup types can be used. For a single-key
12829 lookup type, Exim uses the complete address as the key. However, empty keys are
12830 not supported for single-key lookups, so a match against the empty address
12831 always fails. This restriction does not apply to query-style lookups.
12832 </para>
12833 <para>
12834 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
12835 cannot be used, and is ignored if specified, with an entry being written to the
12836 panic log.
12837 <indexterm role="concept">
12838 <primary>*@ with single-key lookup</primary>
12839 </indexterm>
12840 However, you can configure lookup defaults, as described in section
12841 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
12842 default. For example, with this lookup:
12843 </para>
12844 <literallayout class="monospaced">
12845 accept senders = lsearch*@;/some/file
12846 </literallayout>
12847 <para>
12848 the file could contains lines like this:
12849 </para>
12850 <literallayout class="monospaced">
12851 user1@domain1.example
12852 *@domain2.example
12853 </literallayout>
12854 <para>
12855 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
12856 that are tried is:
12857 </para>
12858 <literallayout class="monospaced">
12859 nimrod@jaeger.example
12860 *@jaeger.example
12861 *
12862 </literallayout>
12863 <para>
12864 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
12865 would mean that every address matches, thus rendering the test useless.
12866 </para>
12867 <para>
12868 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
12869 </para>
12870 <literallayout class="monospaced">
12871 deny recipients = dbm*@;/some/file
12872 deny recipients = *@dbm;/some/file
12873 </literallayout>
12874 <para>
12875 The first does a whole address lookup, with defaulting, as just described,
12876 because it starts with a lookup type. The second matches the local part and
12877 domain independently, as described in a bullet point below.
12878 </para>
12879 </listitem>
12880 </itemizedlist>
12881 <para>
12882 The following kinds of address list pattern can match only non-empty addresses.
12883 If the subject address is empty, a match against any of these pattern types
12884 always fails.
12885 </para>
12886 <itemizedlist>
12887 <listitem>
12888 <para>
12889 <indexterm role="concept">
12890 <primary>@@ with single-key lookup</primary>
12891 </indexterm>
12892 <indexterm role="concept">
12893 <primary>address list</primary>
12894 <secondary>@@ lookup type</secondary>
12895 </indexterm>
12896 <indexterm role="concept">
12897 <primary>address list</primary>
12898 <secondary>split local part and domain</secondary>
12899 </indexterm>
12900 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
12901 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
12902 split into a local part and a domain. The domain is looked up in the file. If
12903 it is not found, there is no match. If it is found, the data that is looked up
12904 from the file is treated as a colon-separated list of local part patterns, each
12905 of which is matched against the subject local part in turn.
12906 </para>
12907 <para>
12908 <indexterm role="concept">
12909 <primary>asterisk</primary>
12910 <secondary>in address list</secondary>
12911 </indexterm>
12912 The lookup may be a partial one, and/or one involving a search for a default
12913 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
12914 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
12915 even be further lookups. They may also be independently negated. For example,
12916 with
12917 </para>
12918 <literallayout class="monospaced">
12919 deny senders = @@dbm;/etc/reject-by-domain
12920 </literallayout>
12921 <para>
12922 the data from which the DBM file is built could contain lines like
12923 </para>
12924 <literallayout class="monospaced">
12925 baddomain.com:  !postmaster : *
12926 </literallayout>
12927 <para>
12928 to reject all senders except <option>postmaster</option> from that domain.
12929 </para>
12930 <para>
12931 <indexterm role="concept">
12932 <primary>local part</primary>
12933 <secondary>starting with !</secondary>
12934 </indexterm>
12935 If a local part that actually begins with an exclamation mark is required, it
12936 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
12937 may be split over several lines by indenting the second and subsequent lines,
12938 but the separating colon must still be included at line breaks. White space
12939 surrounding the colons is ignored. For example:
12940 </para>
12941 <literallayout class="monospaced">
12942 aol.com:  spammer1 : spammer2 : ^[0-9]+$ :
12943   spammer3 : spammer4
12944 </literallayout>
12945 <para>
12946 As in all colon-separated lists in Exim, a colon can be included in an item by
12947 doubling.
12948 </para>
12949 <para>
12950 If the last item in the list starts with a right angle-bracket, the remainder
12951 of the item is taken as a new key to look up in order to obtain a continuation
12952 list of local parts. The new key can be any sequence of characters. Thus one
12953 might have entries like
12954 </para>
12955 <literallayout class="monospaced">
12956 aol.com: spammer1 : spammer 2 : &gt;*
12957 xyz.com: spammer3 : &gt;*
12958 *:       ^\d{8}$
12959 </literallayout>
12960 <para>
12961 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
12962 local parts for all domains, in addition to the specific local parts listed for
12963 each domain. Of course, using this feature costs another lookup each time a
12964 chain is followed, but the effort needed to maintain the data is reduced.
12965 </para>
12966 <para>
12967 <indexterm role="concept">
12968 <primary>loop</primary>
12969 <secondary>in lookups</secondary>
12970 </indexterm>
12971 It is possible to construct loops using this facility, and in order to catch
12972 them, the chains may be no more than fifty items long.
12973 </para>
12974 </listitem>
12975 <listitem>
12976 <para>
12977 The @@&lt;<emphasis>lookup</emphasis>&gt; style of item can also be used with a query-style
12978 lookup, but in this case, the chaining facility is not available. The lookup
12979 can only return a single list of local parts.
12980 </para>
12981 </listitem>
12982 </itemizedlist>
12983 <para>
12984 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
12985 in these two examples:
12986 </para>
12987 <literallayout class="monospaced">
12988 senders = +my_list
12989 senders = *@+my_list
12990 </literallayout>
12991 <para>
12992 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
12993 example it is a named domain list.
12994 </para>
12995 </section>
12996 <section id="SECTcasletadd">
12997 <title>Case of letters in address lists</title>
12998 <para>
12999 <indexterm role="concept">
13000 <primary>case of local parts</primary>
13001 </indexterm>
13002 <indexterm role="concept">
13003 <primary>address list</primary>
13004 <secondary>case forcing</secondary>
13005 </indexterm>
13006 <indexterm role="concept">
13007 <primary>case forcing in address lists</primary>
13008 </indexterm>
13009 Domains in email addresses are always handled caselessly, but for local parts
13010 case may be significant on some systems (see <option>caseful_local_part</option> for how
13011 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
13012 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
13013 blocking lists should be done in a case-independent manner. Since most address
13014 lists in Exim are used for this kind of control, Exim attempts to do this by
13015 default.
13016 </para>
13017 <para>
13018 The domain portion of an address is always lowercased before matching it to an
13019 address list. The local part is lowercased by default, and any string
13020 comparisons that take place are done caselessly. This means that the data in
13021 the address list itself, in files included as plain file names, and in any file
13022 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
13023 keys in files that are looked up by a search type other than <command>lsearch</command> (which
13024 works caselessly) must be in lower case, because these lookups are not
13025 case-independent.
13026 </para>
13027 <para>
13028 <indexterm role="concept">
13029 <primary><literal>+caseful</literal></primary>
13030 </indexterm>
13031 To allow for the possibility of caseful address list matching, if an item in
13032 an address list is the string <quote>+caseful</quote>, the original case of the local
13033 part is restored for any comparisons that follow, and string comparisons are no
13034 longer case-independent. This does not affect the domain, which remains in
13035 lower case. However, although independent matches on the domain alone are still
13036 performed caselessly, regular expressions that match against an entire address
13037 become case-sensitive after <quote>+caseful</quote> has been seen.
13038 </para>
13039 </section>
13040 <section id="SECTlocparlis">
13041 <title>Local part lists</title>
13042 <para>
13043 <indexterm role="concept">
13044 <primary>list</primary>
13045 <secondary>local part list</secondary>
13046 </indexterm>
13047 <indexterm role="concept">
13048 <primary>local part</primary>
13049 <secondary>list</secondary>
13050 </indexterm>
13051 Case-sensitivity in local part lists is handled in the same way as for address
13052 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
13053 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
13054 set false, the subject is lowercased and the matching is initially
13055 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
13056 matching in the local part list, but not elsewhere in the router. If
13057 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
13058 option is case-sensitive from the start.
13059 </para>
13060 <para>
13061 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
13062 comments are handled in the same way as address lists &ndash; they are recognized
13063 only if the # is preceded by white space or the start of the line.
13064 Otherwise, local part lists are matched in the same way as domain lists, except
13065 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
13066 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
13067 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
13068 types.
13069 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
13070 </para>
13071 </section>
13072 </chapter>
13073
13074 <chapter id="CHAPexpand">
13075 <title>String expansions</title>
13076 <para>
13077 <indexterm role="concept" id="IIDstrexp" class="startofrange">
13078 <primary>expansion</primary>
13079 <secondary>of strings</secondary>
13080 </indexterm>
13081 Many strings in Exim&#x2019;s run time configuration are expanded before use. Some of
13082 them are expanded every time they are used; others are expanded only once.
13083 </para>
13084 <para>
13085 When a string is being expanded it is copied verbatim from left to right except
13086 when a dollar or backslash character is encountered. A dollar specifies the
13087 start of a portion of the string that is interpreted and replaced as described
13088 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
13089 escape character, as described in the following section.
13090 </para>
13091 <para>
13092 Whether a string is expanded depends upon the context.  Usually this is solely
13093 dependent upon the option for which a value is sought; in this documentation,
13094 options for which string expansion is performed are marked with &dagger; after
13095 the data type.  ACL rules always expand strings.  A couple of expansion
13096 conditions do not expand some of the brace-delimited branches, for security
13097 reasons.
13098 </para>
13099 <section id="SECTlittext">
13100 <title>Literal text in expanded strings</title>
13101 <para>
13102 <indexterm role="concept">
13103 <primary>expansion</primary>
13104 <secondary>including literal text</secondary>
13105 </indexterm>
13106 An uninterpreted dollar can be included in an expanded string by putting a
13107 backslash in front of it. A backslash can be used to prevent any special
13108 character being treated specially in an expansion, including backslash itself.
13109 If the string appears in quotes in the configuration file, two backslashes are
13110 required because the quotes themselves cause interpretation of backslashes when
13111 the string is read in (see section <xref linkend="SECTstrings"/>).
13112 </para>
13113 <para>
13114 <indexterm role="concept">
13115 <primary>expansion</primary>
13116 <secondary>non-expandable substrings</secondary>
13117 </indexterm>
13118 A portion of the string can specified as non-expandable by placing it between
13119 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
13120 expressions, which often contain backslashes and dollar signs. For example:
13121 </para>
13122 <literallayout class="monospaced">
13123 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
13124 </literallayout>
13125 <para>
13126 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
13127 without interpretation until it reaches the next <literal>\N</literal> or the end of the
13128 string.
13129 </para>
13130 </section>
13131 <section id="SECID82">
13132 <title>Character escape sequences in expanded strings</title>
13133 <para>
13134 <indexterm role="concept">
13135 <primary>expansion</primary>
13136 <secondary>escape sequences</secondary>
13137 </indexterm>
13138 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
13139 expanded string is recognized as an escape sequence for the character newline,
13140 carriage return, or tab, respectively. A backslash followed by up to three
13141 octal digits is recognized as an octal encoding for a single character, and a
13142 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
13143 encoding.
13144 </para>
13145 <para>
13146 These escape sequences are also recognized in quoted strings when they are read
13147 in. Their interpretation in expansions as well is useful for unquoted strings,
13148 and for other cases such as looked-up strings that are then expanded.
13149 </para>
13150 </section>
13151 <section id="SECID83">
13152 <title>Testing string expansions</title>
13153 <para>
13154 <indexterm role="concept">
13155 <primary>expansion</primary>
13156 <secondary>testing</secondary>
13157 </indexterm>
13158 <indexterm role="concept">
13159 <primary>testing</primary>
13160 <secondary>string expansion</secondary>
13161 </indexterm>
13162 <indexterm role="option">
13163 <primary><option>-be</option></primary>
13164 </indexterm>
13165 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
13166 takes the command arguments, or lines from the standard input if there are no
13167 arguments, runs them through the string expansion code, and writes the results
13168 to the standard output. Variables based on configuration values are set up, but
13169 since no message is being processed, variables such as <varname>$local_part</varname> have no
13170 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
13171 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
13172 and <option>nhash</option>.
13173 </para>
13174 <para>
13175 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
13176 instead runs under the uid and gid it was called with, to prevent users from
13177 using <option>-be</option> for reading files to which they do not have access.
13178 </para>
13179 <para>
13180 <indexterm role="option">
13181 <primary><option>-bem</option></primary>
13182 </indexterm>
13183 If you want to test expansions that include variables whose values are taken
13184 from a message, there are two other options that can be used. The <option>-bem</option>
13185 option is like <option>-be</option> except that it is followed by a file name. The file is
13186 read as a message before doing the test expansions. For example:
13187 </para>
13188 <literallayout class="monospaced">
13189 exim -bem /tmp/test.message '$h_subject:'
13190 </literallayout>
13191 <para>
13192 The <option>-Mset</option> option is used in conjunction with <option>-be</option> and is followed by an
13193 Exim message identifier. For example:
13194 </para>
13195 <literallayout class="monospaced">
13196 exim -be -Mset 1GrA8W-0004WS-LQ '$recipients'
13197 </literallayout>
13198 <para>
13199 This loads the message from Exim&#x2019;s spool before doing the test expansions, and
13200 is therefore restricted to admin users.
13201 </para>
13202 </section>
13203 <section id="SECTforexpfai">
13204 <title>Forced expansion failure</title>
13205 <para>
13206 <indexterm role="concept">
13207 <primary>expansion</primary>
13208 <secondary>forced failure</secondary>
13209 </indexterm>
13210 A number of expansions that are described in the following section have
13211 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
13212 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
13213 used depends on some condition that is evaluated as part of the expansion. If,
13214 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
13215 the entire string expansion fails in a way that can be detected by the code
13216 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
13217 its consequences depend on the circumstances. In some cases it is no different
13218 from any other expansion failure, but in others a different action may be
13219 taken. Such variations are mentioned in the documentation of the option that is
13220 being expanded.
13221 </para>
13222 </section>
13223 <section id="SECTexpansionitems">
13224 <title>Expansion items</title>
13225 <para>
13226 The following items are recognized in expanded strings. White space may be used
13227 between sub-items that are keywords or substrings enclosed in braces inside an
13228 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
13229 white space is significant.
13230 </para>
13231 <variablelist>
13232 <varlistentry>
13233 <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>
13234 <listitem>
13235 <para>
13236 <indexterm role="concept">
13237 <primary>expansion</primary>
13238 <secondary>variables</secondary>
13239 </indexterm>
13240 Substitute the contents of the named variable, for example:
13241 </para>
13242 <literallayout class="monospaced">
13243 $local_part
13244 ${domain}
13245 </literallayout>
13246 <para>
13247 The second form can be used to separate the name from subsequent alphanumeric
13248 characters. This form (using braces) is available only for variables; it does
13249 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
13250 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
13251 given, the expansion fails.
13252 </para>
13253 </listitem></varlistentry>
13254 <varlistentry>
13255 <term><emphasis role="bold">${</emphasis>&lt;<emphasis>op</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13256 <listitem>
13257 <para>
13258 <indexterm role="concept">
13259 <primary>expansion</primary>
13260 <secondary>operators</secondary>
13261 </indexterm>
13262 The string is first itself expanded, and then the operation specified by
13263 &lt;<emphasis>op</emphasis>&gt; is applied to it. For example:
13264 </para>
13265 <literallayout class="monospaced">
13266 ${lc:$local_part}
13267 </literallayout>
13268 <para>
13269 The string starts with the first character after the colon, which may be
13270 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
13271 below. The operator notation is used for simple expansion items that have just
13272 one argument, because it reduces the number of braces and therefore makes the
13273 string easier to understand.
13274 </para>
13275 </listitem></varlistentry>
13276 <varlistentry>
13277 <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>
13278 <listitem>
13279 <para>
13280 This item inserts <quote>basic</quote> header lines. It is described with the <option>header</option>
13281 expansion item below.
13282 </para>
13283 </listitem></varlistentry>
13284 <varlistentry>
13285 <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>
13286 <listitem>
13287 <para>
13288 <indexterm role="concept">
13289 <primary>expansion</primary>
13290 <secondary>calling an acl</secondary>
13291 </indexterm>
13292 <indexterm role="concept">
13293 <primary><option>acl</option></primary>
13294 <secondary>call from expansion</secondary>
13295 </indexterm>
13296 The name and zero to nine argument strings are first expanded separately.  The expanded
13297 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
13298 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
13299 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
13300 and may use the variables; if another acl expansion is used the values
13301 are restored after it returns.  If the ACL sets
13302 a value using a "message =" modifier and returns accept or deny, the value becomes
13303 the result of the expansion.
13304 If no message is set and the ACL returns accept or deny
13305 the expansion result is an empty string.
13306 If the ACL returns defer the result is a forced-fail.  Otherwise the expansion fails.
13307 </para>
13308 </listitem></varlistentry>
13309 <varlistentry>
13310 <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>
13311 <listitem>
13312 <para>
13313 <indexterm role="concept">
13314 <primary>expansion</primary>
13315 <secondary>extracting cerificate fields</secondary>
13316 </indexterm>
13317 <indexterm role="concept">
13318 <primary><option>certextract</option></primary>
13319 <secondary>certificate fields</secondary>
13320 </indexterm>
13321 <indexterm role="concept">
13322 <primary>certificate</primary>
13323 <secondary>extracting fields</secondary>
13324 </indexterm>
13325 The &lt;<emphasis>certificate</emphasis>&gt; must be a variable of type certificate.
13326 The field name is expanded and used to retrive the relevant field from
13327 the certificate.  Supported fields are:
13328 </para>
13329 <literallayout>
13330 <literal>version        </literal>
13331 <literal>serial_number  </literal>
13332 <literal>subject        </literal> RFC4514 DN
13333 <literal>issuer         </literal> RFC4514 DN
13334 <literal>notbefore      </literal> time
13335 <literal>notafter       </literal> time
13336 <literal>sig_algorithm  </literal>
13337 <literal>signature      </literal>
13338 <literal>subj_altname   </literal> tagged list
13339 <literal>ocsp_uri       </literal> list
13340 <literal>crl_uri        </literal> list
13341 </literallayout>
13342 <para>
13343 If the field is found,
13344 &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
13345 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
13346 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
13347 is restored to any previous value it might have had.
13348 </para>
13349 <para>
13350 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
13351 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
13352 extracted is used.
13353 </para>
13354 <para>
13355 Some field names take optional modifiers, appended and separated by commas.
13356 </para>
13357 <para>
13358 The field selectors marked as "RFC4514" above
13359 output a Distinguished Name string which is
13360 not quite
13361 parseable by Exim as a comma-separated tagged list
13362 (the exceptions being elements containin commas).
13363 RDN elements of a single type may be selected by
13364 a modifier of the type label; if so the expansion
13365 result is a list (newline-separated by default).
13366 The separator may be changed by another modifer of
13367 a right angle-bracket followed immediately by the new separator.
13368 Recognised RDN type labels include "CN", "O", "OU" and "DC".
13369 </para>
13370 <para>
13371 The field selectors marked as "time" above
13372 take an optional modifier of "int"
13373 for which the result is the number of seconds since epoch.
13374 Otherwise the result is a human-readable string
13375 in the timezone selected by the main "timezone" option.
13376 </para>
13377 <para>
13378 The field selectors marked as "list" above return a list,
13379 newline-separated by default,
13380 (embedded separator characters in elements are doubled).
13381 The separator may be changed by a modifier of
13382 a right angle-bracket followed immediately by the new separator.
13383 </para>
13384 <para>
13385 The field selectors marked as "tagged" above
13386 prefix each list element with a type string and an equals sign.
13387 Elements of only one type may be selected by a modifier
13388 which is one of "dns", "uri" or "mail";
13389 if so the elenment tags are omitted.
13390 </para>
13391 <para>
13392 If not otherwise noted field values are presented in human-readable form.
13393 </para>
13394 </listitem></varlistentry>
13395 <varlistentry>
13396 <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>
13397 <listitem>
13398 <para>
13399 <indexterm role="concept">
13400 <primary><option>dlfunc</option></primary>
13401 </indexterm>
13402 This expansion dynamically loads and then calls a locally-written C function.
13403 This functionality is available only if Exim is compiled with
13404 </para>
13405 <literallayout class="monospaced">
13406 EXPAND_DLFUNC=yes
13407 </literallayout>
13408 <para>
13409 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
13410 object so that it doesn&#x2019;t reload the same object file in the same Exim process
13411 (but of course Exim does start new processes frequently).
13412 </para>
13413 <para>
13414 There may be from zero to eight arguments to the function. When compiling
13415 a local function that is to be called in this way, <filename>local_scan.h</filename> should be
13416 included. The Exim variables and functions that are defined by that API
13417 are also available for dynamically loaded functions. The function itself
13418 must have the following type:
13419 </para>
13420 <literallayout class="monospaced">
13421 int dlfunction(uschar **yield, int argc, uschar *argv[])
13422 </literallayout>
13423 <para>
13424 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
13425 function should return one of the following values:
13426 </para>
13427 <para>
13428 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
13429 into the expanded string that is being built.
13430 </para>
13431 <para>
13432 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
13433 from <emphasis>yield</emphasis>, if it is set.
13434 </para>
13435 <para>
13436 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
13437 taken from <emphasis>yield</emphasis> if it is set.
13438 </para>
13439 <para>
13440 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
13441 </para>
13442 <para>
13443 When compiling a function that is to be used in this way with gcc,
13444 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
13445 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
13446 </para>
13447 </listitem></varlistentry>
13448 <varlistentry>
13449 <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>
13450 <listitem>
13451 <para>
13452 <indexterm role="concept">
13453 <primary>expansion</primary>
13454 <secondary>extracting substrings by key</secondary>
13455 </indexterm>
13456 <indexterm role="concept">
13457 <primary><option>extract</option></primary>
13458 <secondary>substrings by key</secondary>
13459 </indexterm>
13460 The key and &lt;<emphasis>string1</emphasis>&gt; are first expanded separately. Leading and trailing
13461 white space is removed from the key (but not from any of the strings). The key
13462 must not consist entirely of digits. The expanded &lt;<emphasis>string1</emphasis>&gt; must be of the
13463 form:
13464 </para>
13465 <literallayout>
13466 &lt;<emphasis>key1</emphasis>&gt; = &lt;<emphasis>value1</emphasis>&gt;  &lt;<emphasis>key2</emphasis>&gt; = &lt;<emphasis>value2</emphasis>&gt; ...
13467 </literallayout>
13468 <para>
13469 <indexterm role="variable">
13470 <primary><varname>$value</varname></primary>
13471 </indexterm>
13472 where the equals signs and spaces (but not both) are optional. If any of the
13473 values contain white space, they must be enclosed in double quotes, and any
13474 values that are enclosed in double quotes are subject to escape processing as
13475 described in section <xref linkend="SECTstrings"/>. The expanded &lt;<emphasis>string1</emphasis>&gt; is searched
13476 for the value that corresponds to the key. The search is case-insensitive. If
13477 the key is found, &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
13478 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
13479 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
13480 is restored to any previous value it might have had.
13481 </para>
13482 <para>
13483 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
13484 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
13485 extracted is used. Thus, for example, these two expansions are identical, and
13486 yield <quote>2001</quote>:
13487 </para>
13488 <literallayout class="monospaced">
13489 ${extract{gid}{uid=1984 gid=2001}}
13490 ${extract{gid}{uid=1984 gid=2001}{$value}}
13491 </literallayout>
13492 <para>
13493 Instead of {&lt;<emphasis>string3</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
13494 appear, for example:
13495 </para>
13496 <literallayout class="monospaced">
13497 ${extract{Z}{A=... B=...}{$value} fail }
13498 </literallayout>
13499 <para>
13500 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
13501 {&lt;<emphasis>string2</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
13502 </para>
13503 </listitem></varlistentry>
13504 <varlistentry>
13505 <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>
13506 <listitem>
13507 <para>
13508 <indexterm role="concept">
13509 <primary>expansion</primary>
13510 <secondary>extracting substrings by number</secondary>
13511 </indexterm>
13512 <indexterm role="concept">
13513 <primary><option>extract</option></primary>
13514 <secondary>substrings by number</secondary>
13515 </indexterm>
13516 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
13517 apart from leading and trailing white space, which is ignored.
13518 This is what distinguishes this form of <option>extract</option> from the previous kind. It
13519 behaves in the same way, except that, instead of extracting a named field, it
13520 extracts from &lt;<emphasis>string1</emphasis>&gt; the field whose number is given as the first
13521 argument. You can use <varname>$value</varname> in &lt;<emphasis>string2</emphasis>&gt; or <literal>fail</literal> instead of
13522 &lt;<emphasis>string3</emphasis>&gt; as before.
13523 </para>
13524 <para>
13525 The fields in the string are separated by any one of the characters in the
13526 separator string. These may include space or tab characters.
13527 The first field is numbered one. If the number is negative, the fields are
13528 counted from the end of the string, with the rightmost one numbered -1. If the
13529 number given is zero, the entire string is returned. If the modulus of the
13530 number is greater than the number of fields in the string, the result is the
13531 expansion of &lt;<emphasis>string3</emphasis>&gt;, or the empty string if &lt;<emphasis>string3</emphasis>&gt; is not
13532 provided. For example:
13533 </para>
13534 <literallayout class="monospaced">
13535 ${extract{2}{:}{x:42:99:&amp; Mailer::/bin/bash}}
13536 </literallayout>
13537 <para>
13538 yields <quote>42</quote>, and
13539 </para>
13540 <literallayout class="monospaced">
13541 ${extract{-4}{:}{x:42:99:&amp; Mailer::/bin/bash}}
13542 </literallayout>
13543 <para>
13544 yields <quote>99</quote>. Two successive separators mean that the field between them is
13545 empty (for example, the fifth field above).
13546 </para>
13547 </listitem></varlistentry>
13548 <varlistentry>
13549 <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>
13550 <listitem>
13551 <para>
13552 <indexterm role="concept">
13553 <primary>list</primary>
13554 <secondary>selecting by condition</secondary>
13555 </indexterm>
13556 <indexterm role="concept">
13557 <primary>expansion</primary>
13558 <secondary>selecting from list by condition</secondary>
13559 </indexterm>
13560 <indexterm role="variable">
13561 <primary><varname>$item</varname></primary>
13562 </indexterm>
13563 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
13564 default, but the separator can be changed in the usual way. For each item
13565 in this list, its value is place in <varname>$item</varname>, and then the condition is
13566 evaluated. If the condition is true, <varname>$item</varname> is added to the output as an
13567 item in a new list; if the condition is false, the item is discarded. The
13568 separator used for the output list is the same as the one used for the
13569 input, but a separator setting is not included in the output. For example:
13570 </para>
13571 <literallayout class="monospaced">
13572 ${filter{a:b:c}{!eq{$item}{b}}
13573 </literallayout>
13574 <para>
13575 yields <literal>a:c</literal>. At the end of the expansion, the value of <varname>$item</varname> is restored
13576 to what it was before. See also the <emphasis role="bold">map</emphasis> and <emphasis role="bold">reduce</emphasis> expansion items.
13577 </para>
13578 </listitem></varlistentry>
13579 <varlistentry>
13580 <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>
13581 <listitem>
13582 <para>
13583 <indexterm role="concept">
13584 <primary>hash function</primary>
13585 <secondary>textual</secondary>
13586 </indexterm>
13587 <indexterm role="concept">
13588 <primary>expansion</primary>
13589 <secondary>textual hash</secondary>
13590 </indexterm>
13591 This is a textual hashing function, and was the first to be implemented in
13592 early versions of Exim. In current releases, there are other hashing functions
13593 (numeric, MD5, and SHA-1), which are described below.
13594 </para>
13595 <para>
13596 The first two strings, after expansion, must be numbers. Call them &lt;<emphasis>m</emphasis>&gt; and
13597 &lt;<emphasis>n</emphasis>&gt;. If you are using fixed values for these numbers, that is, if
13598 &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you can
13599 use the simpler operator notation that avoids some of the braces:
13600 </para>
13601 <literallayout class="monospaced">
13602 ${hash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
13603 </literallayout>
13604 <para>
13605 The second number is optional (in both notations). If &lt;<emphasis>n</emphasis>&gt; is greater than
13606 or equal to the length of the string, the expansion item returns the string.
13607 Otherwise it computes a new string of length &lt;<emphasis>n</emphasis>&gt; by applying a hashing
13608 function to the string. The new string consists of characters taken from the
13609 first &lt;<emphasis>m</emphasis>&gt; characters of the string
13610 </para>
13611 <literallayout class="monospaced">
13612 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
13613 </literallayout>
13614 <para>
13615 If &lt;<emphasis>m</emphasis>&gt; is not present the value 26 is used, so that only lower case
13616 letters appear. For example:
13617 </para>
13618 <literallayout>
13619 <literal>$hash{3}{monty}}           </literal>   yields  <literal>jmg</literal>
13620 <literal>$hash{5}{monty}}           </literal>   yields  <literal>monty</literal>
13621 <literal>$hash{4}{62}{monty python}}</literal>   yields  <literal>fbWx</literal>
13622 </literallayout>
13623 </listitem></varlistentry>
13624 <varlistentry>
13625 <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>
13626 <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>
13627 <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>
13628 <listitem>
13629 <para>
13630 <indexterm role="concept">
13631 <primary>expansion</primary>
13632 <secondary>header insertion</secondary>
13633 </indexterm>
13634 <indexterm role="variable">
13635 <primary><varname>$header_</varname></primary>
13636 </indexterm>
13637 <indexterm role="variable">
13638 <primary><varname>$bheader_</varname></primary>
13639 </indexterm>
13640 <indexterm role="variable">
13641 <primary><varname>$rheader_</varname></primary>
13642 </indexterm>
13643 <indexterm role="concept">
13644 <primary>header lines</primary>
13645 <secondary>in expansion strings</secondary>
13646 </indexterm>
13647 <indexterm role="concept">
13648 <primary>header lines</primary>
13649 <secondary>character sets</secondary>
13650 </indexterm>
13651 <indexterm role="concept">
13652 <primary>header lines</primary>
13653 <secondary>decoding</secondary>
13654 </indexterm>
13655 Substitute the contents of the named message header line, for example
13656 </para>
13657 <literallayout class="monospaced">
13658 $header_reply-to:
13659 </literallayout>
13660 <para>
13661 The newline that terminates a header line is not included in the expansion, but
13662 internal newlines (caused by splitting the header line over several physical
13663 lines) may be present.
13664 </para>
13665 <para>
13666 The difference between <option>rheader</option>, <option>bheader</option>, and <option>header</option> is in the way
13667 the data in the header line is interpreted.
13668 </para>
13669 <itemizedlist>
13670 <listitem>
13671 <para>
13672 <indexterm role="concept">
13673 <primary>white space</primary>
13674 <secondary>in header lines</secondary>
13675 </indexterm>
13676 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
13677 processing at all, and without the removal of leading and trailing white space.
13678 </para>
13679 </listitem>
13680 <listitem>
13681 <para>
13682 <indexterm role="concept">
13683 <primary>base64 encoding</primary>
13684 <secondary>in header lines</secondary>
13685 </indexterm>
13686 <option>bheader</option> removes leading and trailing white space, and then decodes base64
13687 or quoted-printable MIME <quote>words</quote> within the header text, but does no
13688 character set translation. If decoding of what looks superficially like a MIME
13689 <quote>word</quote> fails, the raw string is returned. If decoding
13690 <indexterm role="concept">
13691 <primary>binary zero</primary>
13692 <secondary>in header line</secondary>
13693 </indexterm>
13694 produces a binary zero character, it is replaced by a question mark &ndash; this is
13695 what Exim does for binary zeros that are actually received in header lines.
13696 </para>
13697 </listitem>
13698 <listitem>
13699 <para>
13700 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
13701 standard character set. This is an attempt to produce the same string as would
13702 be displayed on a user&#x2019;s MUA. If translation fails, the <option>bheader</option> string is
13703 returned. Translation is attempted only on operating systems that support the
13704 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
13705 a system Makefile or in <filename>Local/Makefile</filename>.
13706 </para>
13707 </listitem>
13708 </itemizedlist>
13709 <para>
13710 In a filter file, the target character set for <option>header</option> can be specified by a
13711 command of the following form:
13712 </para>
13713 <literallayout class="monospaced">
13714 headers charset "UTF-8"
13715 </literallayout>
13716 <para>
13717 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
13718 subsequently obeyed filter commands. In the absence of this command, the target
13719 character set in a filter is taken from the setting of the <option>headers_charset</option>
13720 option in the runtime configuration. The value of this option defaults to the
13721 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
13722 ISO-8859-1.
13723 </para>
13724 <para>
13725 Header names follow the syntax of RFC 2822, which states that they may contain
13726 any printing characters except space and colon. Consequently, curly brackets
13727 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
13728 if they were variables. Attempting to do so causes a syntax error.
13729 </para>
13730 <para>
13731 Only header lines that are common to all copies of a message are visible to
13732 this mechanism. These are the original header lines that are received with the
13733 message, and any that are added by an ACL statement or by a system
13734 filter. Header lines that are added to a particular copy of a message by a
13735 router or transport are not accessible.
13736 </para>
13737 <para>
13738 For incoming SMTP messages, no header lines are visible in ACLs that are obeyed
13739 before the DATA ACL, because the header structure is not set up until the
13740 message is received. Header lines that are added in a RCPT ACL (for example)
13741 are saved until the message&#x2019;s incoming header lines are available, at which
13742 point they are added. When a DATA ACL is running, however, header lines added
13743 by earlier ACLs are visible.
13744 </para>
13745 <para>
13746 Upper case and lower case letters are synonymous in header names. If the
13747 following character is white space, the terminating colon may be omitted, but
13748 this is not recommended, because you may then forget it when it is needed. When
13749 white space terminates the header name, it is included in the expanded string.
13750 If the message does not contain the given header, the expansion item is
13751 replaced by an empty string. (See the <option>def</option> condition in section
13752 <xref linkend="SECTexpcond"/> for a means of testing for the existence of a header.)
13753 </para>
13754 <para>
13755 If there is more than one header with the same name, they are all concatenated
13756 to form the substitution string, up to a maximum length of 64K. Unless
13757 <option>rheader</option> is being used, leading and trailing white space is removed from
13758 each header before concatenation, and a completely empty header is ignored. A
13759 newline character is then inserted between non-empty headers, but there is no
13760 newline at the very end. For the <option>header</option> and <option>bheader</option> expansion, for
13761 those headers that contain lists of addresses, a comma is also inserted at the
13762 junctions between headers. This does not happen for the <option>rheader</option> expansion.
13763 </para>
13764 </listitem></varlistentry>
13765 <varlistentry>
13766 <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>
13767 <listitem>
13768 <para>
13769 <indexterm role="concept">
13770 <primary>expansion</primary>
13771 <secondary>hmac hashing</secondary>
13772 </indexterm>
13773 <indexterm role="concept">
13774 <primary><option>hmac</option></primary>
13775 </indexterm>
13776 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
13777 shared secret and some text into a message authentication code, as specified in
13778 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
13779 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
13780 cryptographic hash, allowing for authentication that is not possible with MD5
13781 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
13782 present. For example:
13783 </para>
13784 <literallayout class="monospaced">
13785 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
13786 </literallayout>
13787 <para>
13788 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
13789 produces:
13790 </para>
13791 <literallayout class="monospaced">
13792 dd97e3ba5d1a61b5006108f8c8252953
13793 </literallayout>
13794 <para>
13795 As an example of how this might be used, you might put in the main part of
13796 an Exim configuration:
13797 </para>
13798 <literallayout class="monospaced">
13799 SPAMSCAN_SECRET=cohgheeLei2thahw
13800 </literallayout>
13801 <para>
13802 In a router or a transport you could then have:
13803 </para>
13804 <literallayout class="monospaced">
13805 headers_add = \
13806   X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
13807   ${hmac{md5}{SPAMSCAN_SECRET}\
13808   {${primary_hostname},${message_exim_id},$h_message-id:}}
13809 </literallayout>
13810 <para>
13811 Then given a message, you can check where it was scanned by looking at the
13812 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
13813 this header line is authentic by recomputing the authentication code from the
13814 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
13815 using Exim&#x2019;s <option>-be</option> option, or by other means, for example by using the
13816 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
13817 </para>
13818 </listitem></varlistentry>
13819 <varlistentry>
13820 <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>
13821 <listitem>
13822 <para>
13823 <indexterm role="concept">
13824 <primary>expansion</primary>
13825 <secondary>conditional</secondary>
13826 </indexterm>
13827 <indexterm role="concept">
13828 <primary><option>if</option>, expansion item</primary>
13829 </indexterm>
13830 If &lt;<emphasis>condition</emphasis>&gt; is true, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the whole
13831 item; otherwise &lt;<emphasis>string2</emphasis>&gt; is used. The available conditions are described
13832 in section <xref linkend="SECTexpcond"/> below. For example:
13833 </para>
13834 <literallayout class="monospaced">
13835 ${if eq {$local_part}{postmaster} {yes}{no} }
13836 </literallayout>
13837 <para>
13838 The second string need not be present; if it is not and the condition is not
13839 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
13840 be present instead of the second string (without any curly brackets). In this
13841 case, the expansion is forced to fail if the condition is not true (see section
13842 <xref linkend="SECTforexpfai"/>).
13843 </para>
13844 <para>
13845 If both strings are omitted, the result is the string <literal>true</literal> if the condition
13846 is true, and the empty string if the condition is false. This makes it less
13847 cumbersome to write custom ACL and router conditions. For example, instead of
13848 </para>
13849 <literallayout class="monospaced">
13850 condition = ${if &gt;{$acl_m4}{3}{true}{false}}
13851 </literallayout>
13852 <para>
13853 you can use
13854 </para>
13855 <literallayout class="monospaced">
13856 condition = ${if &gt;{$acl_m4}{3}}
13857 </literallayout>
13858 </listitem></varlistentry>
13859 <varlistentry>
13860 <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>
13861 <listitem>
13862 <para>
13863 <indexterm role="concept">
13864 <primary>expansion</primary>
13865 <secondary>string truncation</secondary>
13866 </indexterm>
13867 <indexterm role="concept">
13868 <primary><option>length</option> expansion item</primary>
13869 </indexterm>
13870 The <option>length</option> item is used to extract the initial portion of a string. Both
13871 strings are expanded, and the first one must yield a number, &lt;<emphasis>n</emphasis>&gt;, say. If
13872 you are using a fixed value for the number, that is, if &lt;<emphasis>string1</emphasis>&gt; does not
13873 change when expanded, you can use the simpler operator notation that avoids
13874 some of the braces:
13875 </para>
13876 <literallayout class="monospaced">
13877 ${length_&lt;n&gt;:&lt;string&gt;}
13878 </literallayout>
13879 <para>
13880 The result of this item is either the first &lt;<emphasis>n</emphasis>&gt; characters or the whole
13881 of &lt;<emphasis>string2</emphasis>&gt;, whichever is the shorter. Do not confuse <option>length</option> with
13882 <option>strlen</option>, which gives the length of a string.
13883 </para>
13884 </listitem></varlistentry>
13885 <varlistentry>
13886 <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>
13887 <listitem>
13888 <para>
13889 <indexterm role="concept">
13890 <primary>expansion</primary>
13891 <secondary>extracting list elements by number</secondary>
13892 </indexterm>
13893 <indexterm role="concept">
13894 <primary><option>listextract</option></primary>
13895 <secondary>extract list elements by number</secondary>
13896 </indexterm>
13897 <indexterm role="concept">
13898 <primary>list</primary>
13899 <secondary>extracting elements by number</secondary>
13900 </indexterm>
13901 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
13902 apart from an optional leading minus,
13903 and leading and trailing white space (which is ignored).
13904 </para>
13905 <para>
13906 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
13907 default, but the separator can be changed in the usual way.
13908 </para>
13909 <para>
13910 The first field of the list is numbered one.
13911 If the number is negative, the fields are
13912 counted from the end of the list, with the rightmost one numbered -1.
13913 The numbered element of the list is extracted and placed in <varname>$value</varname>,
13914 then &lt;<emphasis>string2</emphasis>&gt; is expanded as the result.
13915 </para>
13916 <para>
13917 If the modulus of the
13918 number is zero or greater than the number of fields in the string,
13919 the result is the expansion of &lt;<emphasis>string3</emphasis>&gt;.
13920 </para>
13921 <para>
13922 For example:
13923 </para>
13924 <literallayout class="monospaced">
13925 ${listextract{2}{x:42:99}}
13926 </literallayout>
13927 <para>
13928 yields <quote>42</quote>, and
13929 </para>
13930 <literallayout class="monospaced">
13931 ${listextract{-3}{&lt;, x,42,99,&amp; Mailer,,/bin/bash}{result: $value}}
13932 </literallayout>
13933 <para>
13934 yields <quote>result: 99</quote>.
13935 </para>
13936 <para>
13937 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, an empty string is used for string3.
13938 If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
13939 extracted is used.
13940 You can use <literal>fail</literal> instead of {&lt;<emphasis>string3</emphasis>&gt;} as in a string extract.
13941 </para>
13942 </listitem></varlistentry>
13943 <varlistentry>
13944 <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>
13945 <listitem>
13946 <para>
13947 This is the first of one of two different types of lookup item, which are both
13948 described in the next item.
13949 </para>
13950 </listitem></varlistentry>
13951 <varlistentry>
13952 <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>
13953 <listitem>
13954 <para>
13955 <indexterm role="concept">
13956 <primary>expansion</primary>
13957 <secondary>lookup in</secondary>
13958 </indexterm>
13959 <indexterm role="concept">
13960 <primary>file</primary>
13961 <secondary>lookups</secondary>
13962 </indexterm>
13963 <indexterm role="concept">
13964 <primary>lookup</primary>
13965 <secondary>in expanded string</secondary>
13966 </indexterm>
13967 The two forms of lookup item specify data lookups in files and databases, as
13968 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
13969 lookups, and the second is used for query-style lookups. The &lt;<emphasis>key</emphasis>&gt;,
13970 &lt;<emphasis>file</emphasis>&gt;, and &lt;<emphasis>query</emphasis>&gt; strings are expanded before use.
13971 </para>
13972 <para>
13973 If there is any white space in a lookup item which is part of a filter command,
13974 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
13975 other place where white space is significant, the lookup item must be enclosed
13976 in double quotes. The use of data lookups in users&#x2019; filter files may be locked
13977 out by the system administrator.
13978 </para>
13979 <para>
13980 <indexterm role="variable">
13981 <primary><varname>$value</varname></primary>
13982 </indexterm>
13983 If the lookup succeeds, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the entire item.
13984 During its expansion, the variable <varname>$value</varname> contains the data returned by the
13985 lookup. Afterwards it reverts to the value it had previously (at the outer
13986 level it is empty). If the lookup fails, &lt;<emphasis>string2</emphasis>&gt; is expanded and replaces
13987 the entire item. If {&lt;<emphasis>string2</emphasis>&gt;} is omitted, the replacement is the empty
13988 string on failure. If &lt;<emphasis>string2</emphasis>&gt; is provided, it can itself be a nested
13989 lookup, thus providing a mechanism for looking up a default value when the
13990 original lookup fails.
13991 </para>
13992 <para>
13993 If a nested lookup is used as part of &lt;<emphasis>string1</emphasis>&gt;, <varname>$value</varname> contains the
13994 data for the outer lookup while the parameters of the second lookup are
13995 expanded, and also while &lt;<emphasis>string2</emphasis>&gt; of the second lookup is expanded, should
13996 the second lookup fail. Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> can
13997 appear, and in this case, if the lookup fails, the entire expansion is forced
13998 to fail (see section <xref linkend="SECTforexpfai"/>). If both {&lt;<emphasis>string1</emphasis>&gt;} and
13999 {&lt;<emphasis>string2</emphasis>&gt;} are omitted, the result is the looked up value in the case of a
14000 successful lookup, and nothing in the case of failure.
14001 </para>
14002 <para>
14003 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
14004 search type in order to do partial matching, and * or *@ may follow a search
14005 type to request default lookups if the key does not match (see sections
14006 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
14007 </para>
14008 <para>
14009 <indexterm role="concept">
14010 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
14011 <secondary>in lookup expansion</secondary>
14012 </indexterm>
14013 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
14014 and non-wild parts of the key during the expansion of the replacement text.
14015 They return to their previous values at the end of the lookup item.
14016 </para>
14017 <para>
14018 This example looks up the postmaster alias in the conventional alias file:
14019 </para>
14020 <literallayout class="monospaced">
14021 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
14022 </literallayout>
14023 <para>
14024 This example uses NIS+ to look up the full name of the user corresponding to
14025 the local part of an address, forcing the expansion to fail if it is not found:
14026 </para>
14027 <literallayout class="monospaced">
14028 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
14029   {$value}fail}
14030 </literallayout>
14031 </listitem></varlistentry>
14032 <varlistentry>
14033 <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>
14034 <listitem>
14035 <para>
14036 <indexterm role="concept">
14037 <primary>expansion</primary>
14038 <secondary>list creation</secondary>
14039 </indexterm>
14040 <indexterm role="variable">
14041 <primary><varname>$item</varname></primary>
14042 </indexterm>
14043 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
14044 default, but the separator can be changed in the usual way. For each item
14045 in this list, its value is place in <varname>$item</varname>, and then &lt;<emphasis>string2</emphasis>&gt; is
14046 expanded and added to the output as an item in a new list. The separator used
14047 for the output list is the same as the one used for the input, but a separator
14048 setting is not included in the output. For example:
14049 </para>
14050 <literallayout class="monospaced">
14051 ${map{a:b:c}{[$item]}} ${map{&lt;- x-y-z}{($item)}}
14052 </literallayout>
14053 <para>
14054 expands to <literal>[a]:[b]:[c] (x)-(y)-(z)</literal>. At the end of the expansion, the
14055 value of <varname>$item</varname> is restored to what it was before. See also the <emphasis role="bold">filter</emphasis>
14056 and <emphasis role="bold">reduce</emphasis> expansion items.
14057 </para>
14058 </listitem></varlistentry>
14059 <varlistentry>
14060 <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>
14061 <listitem>
14062 <para>
14063 <indexterm role="concept">
14064 <primary>expansion</primary>
14065 <secondary>numeric hash</secondary>
14066 </indexterm>
14067 <indexterm role="concept">
14068 <primary>hash function</primary>
14069 <secondary>numeric</secondary>
14070 </indexterm>
14071 The three strings are expanded; the first two must yield numbers. Call them
14072 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
14073 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
14074 can use the simpler operator notation that avoids some of the braces:
14075 </para>
14076 <literallayout class="monospaced">
14077 ${nhash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
14078 </literallayout>
14079 <para>
14080 The second number is optional (in both notations). If there is only one number,
14081 the result is a number in the range 0&ndash;&lt;<emphasis>n</emphasis>&gt;-1. Otherwise, the string is
14082 processed by a div/mod hash function that returns two numbers, separated by a
14083 slash, in the ranges 0 to &lt;<emphasis>n</emphasis>&gt;-1 and 0 to &lt;<emphasis>m</emphasis>&gt;-1, respectively. For
14084 example,
14085 </para>
14086 <literallayout class="monospaced">
14087 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
14088 </literallayout>
14089 <para>
14090 returns the string <quote>6/33</quote>.
14091 </para>
14092 </listitem></varlistentry>
14093 <varlistentry>
14094 <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>
14095 <listitem>
14096 <para>
14097 <indexterm role="concept">
14098 <primary>Perl</primary>
14099 <secondary>use in expanded string</secondary>
14100 </indexterm>
14101 <indexterm role="concept">
14102 <primary>expansion</primary>
14103 <secondary>calling Perl from</secondary>
14104 </indexterm>
14105 This item is available only if Exim has been built to include an embedded Perl
14106 interpreter. The subroutine name and the arguments are first separately
14107 expanded, and then the Perl subroutine is called with those arguments. No
14108 additional arguments need be given; the maximum number permitted, including the
14109 name of the subroutine, is nine.
14110 </para>
14111 <para>
14112 The return value of the subroutine is inserted into the expanded string, unless
14113 the return value is <option>undef</option>. In that case, the expansion fails in the same
14114 way as an explicit <quote>fail</quote> on a lookup item. The return value is a scalar.
14115 Whatever you return is evaluated in a scalar context. For example, if you
14116 return the name of a Perl vector, the return value is the size of the vector,
14117 not its contents.
14118 </para>
14119 <para>
14120 If the subroutine exits by calling Perl&#x2019;s <option>die</option> function, the expansion fails
14121 with the error message that was passed to <option>die</option>. More details of the embedded
14122 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
14123 </para>
14124 <para>
14125 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
14126 out the use of this expansion item in filter files.
14127 </para>
14128 </listitem></varlistentry>
14129 <varlistentry>
14130 <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>
14131 <listitem>
14132 <para>
14133 <indexterm role="concept">
14134 <primary><option>prvs</option> expansion item</primary>
14135 </indexterm>
14136 The first argument is a complete email address and the second is secret
14137 keystring. The third argument, specifying a key number, is optional. If absent,
14138 it defaults to 0. The result of the expansion is a prvs-signed email address,
14139 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
14140 as part of a bounce address tag validation (BATV) scheme. For more discussion
14141 and an example, see section <xref linkend="SECTverifyPRVS"/>.
14142 </para>
14143 </listitem></varlistentry>
14144 <varlistentry>
14145 <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>
14146 <listitem>
14147 <para>
14148 <indexterm role="concept">
14149 <primary><option>prvscheck</option> expansion item</primary>
14150 </indexterm>
14151 This expansion item is the complement of the <option>prvs</option> item. It is used for
14152 checking prvs-signed addresses. If the expansion of the first argument does not
14153 yield a syntactically valid prvs-signed address, the whole item expands to the
14154 empty string. When the first argument does expand to a syntactically valid
14155 prvs-signed address, the second argument is expanded, with the prvs-decoded
14156 version of the address and the key number extracted from the address in the
14157 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
14158 </para>
14159 <para>
14160 These two variables can be used in the expansion of the second argument to
14161 retrieve the secret. The validity of the prvs-signed address is then checked
14162 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
14163 which is empty for failure or <quote>1</quote> for success.
14164 </para>
14165 <para>
14166 The third argument is optional; if it is missing, it defaults to an empty
14167 string. This argument is now expanded. If the result is an empty string, the
14168 result of the expansion is the decoded version of the address. This is the case
14169 whether or not the signature was valid. Otherwise, the result of the expansion
14170 is the expansion of the third argument.
14171 </para>
14172 <para>
14173 All three variables can be used in the expansion of the third argument.
14174 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
14175 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
14176 </para>
14177 </listitem></varlistentry>
14178 <varlistentry>
14179 <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>
14180 <listitem>
14181 <para>
14182 <indexterm role="concept">
14183 <primary>expansion</primary>
14184 <secondary>inserting an entire file</secondary>
14185 </indexterm>
14186 <indexterm role="concept">
14187 <primary>file</primary>
14188 <secondary>inserting into expansion</secondary>
14189 </indexterm>
14190 <indexterm role="concept">
14191 <primary><option>readfile</option> expansion item</primary>
14192 </indexterm>
14193 The file name and end-of-line string are first expanded separately. The file is
14194 then read, and its contents replace the entire item. All newline characters in
14195 the file are replaced by the end-of-line string if it is present. Otherwise,
14196 newlines are left in the string.
14197 String expansion is not applied to the contents of the file. If you want this,
14198 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
14199 the string expansion fails.
14200 </para>
14201 <para>
14202 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
14203 locks out the use of this expansion item in filter files.
14204 </para>
14205 </listitem></varlistentry>
14206 <varlistentry>
14207 <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>
14208 <listitem>
14209 <para>
14210 <indexterm role="concept">
14211 <primary>expansion</primary>
14212 <secondary>inserting from a socket</secondary>
14213 </indexterm>
14214 <indexterm role="concept">
14215 <primary>socket, use of in expansion</primary>
14216 </indexterm>
14217 <indexterm role="concept">
14218 <primary><option>readsocket</option> expansion item</primary>
14219 </indexterm>
14220 This item inserts data from a Unix domain or TCP socket into the expanded
14221 string. The minimal way of using it uses just two arguments, as in these
14222 examples:
14223 </para>
14224 <literallayout class="monospaced">
14225 ${readsocket{/socket/name}{request string}}
14226 ${readsocket{inet:some.host:1234}{request string}}
14227 </literallayout>
14228 <para>
14229 For a Unix domain socket, the first substring must be the path to the socket.
14230 For an Internet socket, the first substring must contain <literal>inet:</literal> followed by
14231 a host name or IP address, followed by a colon and a port, which can be a
14232 number or the name of a TCP port in <filename>/etc/services</filename>. An IP address may
14233 optionally be enclosed in square brackets. This is best for IPv6 addresses. For
14234 example:
14235 </para>
14236 <literallayout class="monospaced">
14237 ${readsocket{inet:[::1]:1234}{request string}}
14238 </literallayout>
14239 <para>
14240 Only a single host name may be given, but if looking it up yields more than
14241 one IP address, they are each tried in turn until a connection is made. For
14242 both kinds of socket, Exim makes a connection, writes the request string
14243 (unless it is an empty string) and reads from the socket until an end-of-file
14244 is read. A timeout of 5 seconds is applied. Additional, optional arguments
14245 extend what can be done. Firstly, you can vary the timeout. For example:
14246 </para>
14247 <literallayout class="monospaced">
14248 ${readsocket{/socket/name}{request string}{3s}}
14249 </literallayout>
14250 <para>
14251 A fourth argument allows you to change any newlines that are in the data
14252 that is read, in the same way as for <option>readfile</option> (see above). This example
14253 turns them into spaces:
14254 </para>
14255 <literallayout class="monospaced">
14256 ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }}
14257 </literallayout>
14258 <para>
14259 As with all expansions, the substrings are expanded before the processing
14260 happens. Errors in these sub-expansions cause the expansion to fail. In
14261 addition, the following errors can occur:
14262 </para>
14263 <itemizedlist>
14264 <listitem>
14265 <para>
14266 Failure to create a socket file descriptor;
14267 </para>
14268 </listitem>
14269 <listitem>
14270 <para>
14271 Failure to connect the socket;
14272 </para>
14273 </listitem>
14274 <listitem>
14275 <para>
14276 Failure to write the request string;
14277 </para>
14278 </listitem>
14279 <listitem>
14280 <para>
14281 Timeout on reading from the socket.
14282 </para>
14283 </listitem>
14284 </itemizedlist>
14285 <para>
14286 By default, any of these errors causes the expansion to fail. However, if
14287 you supply a fifth substring, it is expanded and used when any of the above
14288 errors occurs. For example:
14289 </para>
14290 <literallayout class="monospaced">
14291 ${readsocket{/socket/name}{request string}{3s}{\n}\
14292   {socket failure}}
14293 </literallayout>
14294 <para>
14295 You can test for the existence of a Unix domain socket by wrapping this
14296 expansion in <literal>${if exists</literal>, but there is a race condition between that test
14297 and the actual opening of the socket, so it is safer to use the fifth argument
14298 if you want to be absolutely sure of avoiding an expansion error for a
14299 non-existent Unix domain socket, or a failure to connect to an Internet socket.
14300 </para>
14301 <para>
14302 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
14303 locks out the use of this expansion item in filter files.
14304 </para>
14305 </listitem></varlistentry>
14306 <varlistentry>
14307 <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>
14308 <listitem>
14309 <para>
14310 <indexterm role="concept">
14311 <primary>expansion</primary>
14312 <secondary>reducing a list to a scalar</secondary>
14313 </indexterm>
14314 <indexterm role="concept">
14315 <primary>list</primary>
14316 <secondary>reducing to a scalar</secondary>
14317 </indexterm>
14318 <indexterm role="variable">
14319 <primary><varname>$value</varname></primary>
14320 </indexterm>
14321 <indexterm role="variable">
14322 <primary><varname>$item</varname></primary>
14323 </indexterm>
14324 This operation reduces a list to a single, scalar string. After expansion,
14325 &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by default, but the
14326 separator can be changed in the usual way. Then &lt;<emphasis>string2</emphasis>&gt; is expanded and
14327 assigned to the <varname>$value</varname> variable. After this, each item in the &lt;<emphasis>string1</emphasis>&gt;
14328 list is assigned to <varname>$item</varname> in turn, and &lt;<emphasis>string3</emphasis>&gt; is expanded for each of
14329 them. The result of that expansion is assigned to <varname>$value</varname> before the next
14330 iteration. When the end of the list is reached, the final value of <varname>$value</varname> is
14331 added to the expansion output. The <emphasis role="bold">reduce</emphasis> expansion item can be used in a
14332 number of ways. For example, to add up a list of numbers:
14333 </para>
14334 <literallayout class="monospaced">
14335 ${reduce {&lt;, 1,2,3}{0}{${eval:$value+$item}}}
14336 </literallayout>
14337 <para>
14338 The result of that expansion would be <literal>6</literal>. The maximum of a list of numbers
14339 can be found:
14340 </para>
14341 <literallayout class="monospaced">
14342 ${reduce {3:0:9:4:6}{0}{${if &gt;{$item}{$value}{$item}{$value}}}}
14343 </literallayout>
14344 <para>
14345 At the end of a <emphasis role="bold">reduce</emphasis> expansion, the values of <varname>$item</varname> and <varname>$value</varname> are
14346 restored to what they were before. See also the <emphasis role="bold">filter</emphasis> and <emphasis role="bold">map</emphasis>
14347 expansion items.
14348 </para>
14349 </listitem></varlistentry>
14350 <varlistentry>
14351 <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>
14352 <listitem>
14353 <para>
14354 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
14355 expansion item above.
14356 </para>
14357 </listitem></varlistentry>
14358 <varlistentry>
14359 <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>
14360 <listitem>
14361 <para>
14362 <indexterm role="concept">
14363 <primary>expansion</primary>
14364 <secondary>running a command</secondary>
14365 </indexterm>
14366 <indexterm role="concept">
14367 <primary><option>run</option> expansion item</primary>
14368 </indexterm>
14369 The command and its arguments are first expanded as one string. The string is
14370 split apart into individual arguments by spaces, and then the command is run
14371 in a separate process, but under the same uid and gid.  As in other command
14372 executions from Exim, a shell is not used by default. If the command requires
14373 a shell, you must explicitly code it.
14374 </para>
14375 <para>
14376 Since the arguments are split by spaces, when there is a variable expansion
14377 which has an empty result, it will cause the situation that the argument will
14378 simply be omitted when the program is actually executed by Exim. If the
14379 script/program requires a specific number of arguments and the expanded
14380 variable could possibly result in this empty expansion, the variable must be
14381 quoted. This is more difficult if the expanded variable itself could result
14382 in a string containing quotes, because it would interfere with the quotes
14383 around the command arguments. A possible guard against this is to wrap the
14384 variable in the <option>sg</option> operator to change any quote marks to some other
14385 character.
14386 </para>
14387 <para>
14388 The standard input for the command exists, but is empty. The standard output
14389 and standard error are set to the same file descriptor.
14390 <indexterm role="concept">
14391 <primary>return code</primary>
14392 <secondary>from <option>run</option> expansion</secondary>
14393 </indexterm>
14394 <indexterm role="variable">
14395 <primary><varname>$value</varname></primary>
14396 </indexterm>
14397 If the command succeeds (gives a zero return code) &lt;<emphasis>string1</emphasis>&gt; is expanded
14398 and replaces the entire item; during this expansion, the standard output/error
14399 from the command is in the variable <varname>$value</varname>. If the command fails,
14400 &lt;<emphasis>string2</emphasis>&gt;, if present, is expanded and used. Once again, during the
14401 expansion, the standard output/error from the command is in the variable
14402 <varname>$value</varname>.
14403 </para>
14404 <para>
14405 If &lt;<emphasis>string2</emphasis>&gt; is absent, the result is empty. Alternatively, &lt;<emphasis>string2</emphasis>&gt;
14406 can be the word <quote>fail</quote> (not in braces) to force expansion failure if the
14407 command does not succeed. If both strings are omitted, the result is contents
14408 of the standard output/error on success, and nothing on failure.
14409 </para>
14410 <para>
14411 <indexterm role="variable">
14412 <primary><varname>$run_in_acl</varname></primary>
14413 </indexterm>
14414 The standard output/error of the command is put in the variable <varname>$value</varname>.
14415 In this ACL example, the output of a command is logged for the admin to
14416 troubleshoot:
14417 </para>
14418 <literallayout class="monospaced">
14419 warn  condition    = ${run{/usr/bin/id}{yes}{no}}
14420       log_message  = Output of id: $value
14421 </literallayout>
14422 <para>
14423 If the command requires shell idioms, such as the &gt; redirect operator, the
14424 shell must be invoked directly, such as with:
14425 </para>
14426 <literallayout class="monospaced">
14427 ${run{/bin/bash -c "/usr/bin/id &gt;/tmp/id"}{yes}{yes}}
14428 </literallayout>
14429 <para>
14430 <indexterm role="variable">
14431 <primary><varname>$runrc</varname></primary>
14432 </indexterm>
14433 The return code from the command is put in the variable <varname>$runrc</varname>, and this
14434 remains set afterwards, so in a filter file you can do things like this:
14435 </para>
14436 <literallayout class="monospaced">
14437 if "${run{x y z}{}}$runrc" is 1 then ...
14438   elif $runrc is 2 then ...
14439   ...
14440 endif
14441 </literallayout>
14442 <para>
14443 If execution of the command fails (for example, the command does not exist),
14444 the return code is 127 &ndash; the same code that shells use for non-existent
14445 commands.
14446 </para>
14447 <para>
14448 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
14449 option values are expanded, except for those preconditions whose order of
14450 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
14451 by the expansion of one option, and use it in another.
14452 </para>
14453 <para>
14454 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
14455 out the use of this expansion item in filter files.
14456 </para>
14457 </listitem></varlistentry>
14458 <varlistentry>
14459 <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>
14460 <listitem>
14461 <para>
14462 <indexterm role="concept">
14463 <primary>expansion</primary>
14464 <secondary>string substitution</secondary>
14465 </indexterm>
14466 <indexterm role="concept">
14467 <primary><option>sg</option> expansion item</primary>
14468 </indexterm>
14469 This item works like Perl&#x2019;s substitution operator (s) with the global (/g)
14470 option; hence its name. However, unlike the Perl equivalent, Exim does not
14471 modify the subject string; instead it returns the modified string for insertion
14472 into the overall expansion. The item takes three arguments: the subject string,
14473 a regular expression, and a substitution string. For example:
14474 </para>
14475 <literallayout class="monospaced">
14476 ${sg{abcdefabcdef}{abc}{xyz}}
14477 </literallayout>
14478 <para>
14479 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
14480 if any $ or \ characters are required in the regular expression or in the
14481 substitution string, they have to be escaped. For example:
14482 </para>
14483 <literallayout class="monospaced">
14484 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
14485 </literallayout>
14486 <para>
14487 yields <quote>defabc</quote>, and
14488 </para>
14489 <literallayout class="monospaced">
14490 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
14491 </literallayout>
14492 <para>
14493 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
14494 the regular expression from string expansion.
14495 </para>
14496 </listitem></varlistentry>
14497 <varlistentry revisionflag="changed">
14498 <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>
14499 <listitem>
14500 <para revisionflag="changed">
14501 <indexterm role="concept">
14502 <primary>sorting</primary>
14503 <secondary>a</secondary>
14504 </indexterm>
14505 <indexterm role="concept">
14506 <primary>list</primary>
14507 <secondary>sorting</secondary>
14508 </indexterm>
14509 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
14510 default, but the separator can be changed in the usual way.
14511 The &lt;<emphasis>comparator</emphasis>&gt; argument is interpreted as the operator
14512 of a two-argument expansion condition.
14513 The numeric operators plus ge, gt, le, lt (and ~i variants) are supported.
14514 The comparison should return true when applied to two values
14515 if the first value should sort before the second value.
14516 The &lt;<emphasis>extractor</emphasis>&gt; expansion is applied repeatedly to elements of the list,
14517 the element being placed in <varname>$item</varname>,
14518 to give values for comparison.
14519 </para>
14520 <para revisionflag="changed">
14521 The item result is a sorted list,
14522 with the original list separator,
14523 of the list elements (in full) of the original.
14524 </para>
14525 <para revisionflag="changed">
14526 Examples:
14527 </para>
14528 <literallayout class="monospaced" revisionflag="changed">
14529 ${sort{3:2:1:4}{&lt;}{$item}}
14530 </literallayout>
14531 <para revisionflag="changed">
14532 sorts a list of numbers, and
14533 </para>
14534 <literallayout class="monospaced" revisionflag="changed">
14535 ${sort {$lookup dnsdb{&gt;:,,mx=example.com}} {&lt;} {${listextract{1}{&lt;,$item}}}}
14536 </literallayout>
14537 <para revisionflag="changed">
14538 will sort an MX lookup into priority order.
14539 </para>
14540 </listitem></varlistentry>
14541 <varlistentry>
14542 <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>
14543 <listitem>
14544 <para>
14545 <indexterm role="concept">
14546 <primary><option>substr</option> expansion item</primary>
14547 </indexterm>
14548 <indexterm role="concept">
14549 <primary>substring extraction</primary>
14550 </indexterm>
14551 <indexterm role="concept">
14552 <primary>expansion</primary>
14553 <secondary>substring extraction</secondary>
14554 </indexterm>
14555 The three strings are expanded; the first two must yield numbers. Call them
14556 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
14557 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
14558 can use the simpler operator notation that avoids some of the braces:
14559 </para>
14560 <literallayout class="monospaced">
14561 ${substr_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
14562 </literallayout>
14563 <para>
14564 The second number is optional (in both notations).
14565 If it is absent in the simpler format, the preceding underscore must also be
14566 omitted.
14567 </para>
14568 <para>
14569 The <option>substr</option> item can be used to extract more general substrings than
14570 <option>length</option>. The first number, &lt;<emphasis>n</emphasis>&gt;, is a starting offset, and &lt;<emphasis>m</emphasis>&gt; is the
14571 length required. For example
14572 </para>
14573 <literallayout class="monospaced">
14574 ${substr{3}{2}{$local_part}}
14575 </literallayout>
14576 <para>
14577 If the starting offset is greater than the string length the result is the
14578 null string; if the length plus starting offset is greater than the string
14579 length, the result is the right-hand part of the string, starting from the
14580 given offset. The first character in the string has offset zero.
14581 </para>
14582 <para>
14583 The <option>substr</option> expansion item can take negative offset values to count
14584 from the right-hand end of its operand. The last character is offset -1, the
14585 second-last is offset -2, and so on. Thus, for example,
14586 </para>
14587 <literallayout class="monospaced">
14588 ${substr{-5}{2}{1234567}}
14589 </literallayout>
14590 <para>
14591 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
14592 length of the string, the substring starts at the beginning of the string, and
14593 the length is reduced by the amount of overshoot. Thus, for example,
14594 </para>
14595 <literallayout class="monospaced">
14596 ${substr{-5}{2}{12}}
14597 </literallayout>
14598 <para>
14599 yields an empty string, but
14600 </para>
14601 <literallayout class="monospaced">
14602 ${substr{-3}{2}{12}}
14603 </literallayout>
14604 <para>
14605 yields <quote>1</quote>.
14606 </para>
14607 <para>
14608 When the second number is omitted from <option>substr</option>, the remainder of the string
14609 is taken if the offset is positive. If it is negative, all characters in the
14610 string preceding the offset point are taken. For example, an offset of -1 and
14611 no length, as in these semantically identical examples:
14612 </para>
14613 <literallayout class="monospaced">
14614 ${substr_-1:abcde}
14615 ${substr{-1}{abcde}}
14616 </literallayout>
14617 <para>
14618 yields all but the last character of the string, that is, <quote>abcd</quote>.
14619 </para>
14620 </listitem></varlistentry>
14621 <varlistentry>
14622 <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>
14623 <listitem>
14624 <para>
14625 <indexterm role="concept">
14626 <primary>expansion</primary>
14627 <secondary>character translation</secondary>
14628 </indexterm>
14629 <indexterm role="concept">
14630 <primary><option>tr</option> expansion item</primary>
14631 </indexterm>
14632 This item does single-character translation on its subject string. The second
14633 argument is a list of characters to be translated in the subject string. Each
14634 matching character is replaced by the corresponding character from the
14635 replacement list. For example
14636 </para>
14637 <literallayout class="monospaced">
14638 ${tr{abcdea}{ac}{13}}
14639 </literallayout>
14640 <para>
14641 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
14642 last occurrence is used. If the third string is shorter than the second, its
14643 last character is replicated. However, if it is empty, no translation takes
14644 place.
14645 </para>
14646 </listitem></varlistentry>
14647 </variablelist>
14648 </section>
14649 <section id="SECTexpop">
14650 <title>Expansion operators</title>
14651 <para>
14652 <indexterm role="concept">
14653 <primary>expansion</primary>
14654 <secondary>operators</secondary>
14655 </indexterm>
14656 For expansion items that perform transformations on a single argument string,
14657 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
14658 The substring is first expanded before the operation is applied to it. The
14659 following operations can be performed:
14660 </para>
14661 <variablelist>
14662 <varlistentry>
14663 <term><emphasis role="bold">${address:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14664 <listitem>
14665 <para>
14666 <indexterm role="concept">
14667 <primary>expansion</primary>
14668 <secondary>RFC 2822 address handling</secondary>
14669 </indexterm>
14670 <indexterm role="concept">
14671 <primary><option>address</option> expansion item</primary>
14672 </indexterm>
14673 The string is interpreted as an RFC 2822 address, as it might appear in a
14674 header line, and the effective address is extracted from it. If the string does
14675 not parse successfully, the result is empty.
14676 </para>
14677 </listitem></varlistentry>
14678 <varlistentry>
14679 <term><emphasis role="bold">${addresses:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14680 <listitem>
14681 <para>
14682 <indexterm role="concept">
14683 <primary>expansion</primary>
14684 <secondary>RFC 2822 address handling</secondary>
14685 </indexterm>
14686 <indexterm role="concept">
14687 <primary><option>addresses</option> expansion item</primary>
14688 </indexterm>
14689 The string (after expansion) is interpreted as a list of addresses in RFC
14690 2822 format, such as can be found in a <emphasis>To:</emphasis> or <emphasis>Cc:</emphasis> header line. The
14691 operative address (<emphasis>local-part@domain</emphasis>) is extracted from each item, and the
14692 result of the expansion is a colon-separated list, with appropriate
14693 doubling of colons should any happen to be present in the email addresses.
14694 Syntactically invalid RFC2822 address items are omitted from the output.
14695 </para>
14696 <para>
14697 It is possible to specify a character other than colon for the output
14698 separator by starting the string with &gt; followed by the new separator
14699 character. For example:
14700 </para>
14701 <literallayout class="monospaced">
14702 ${addresses:&gt;&amp; Chief &lt;ceo@up.stairs&gt;, sec@base.ment (dogsbody)}
14703 </literallayout>
14704 <para>
14705 expands to <literal>ceo@up.stairs&amp;sec@base.ment</literal>. Compare the <emphasis role="bold">address</emphasis> (singular)
14706 expansion item, which extracts the working address from a single RFC2822
14707 address. See the <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and <emphasis role="bold">reduce</emphasis> items for ways of
14708 processing lists.
14709 </para>
14710 <para>
14711 To clarify "list of addresses in RFC 2822 format" mentioned above, Exim follows
14712 a strict interpretation of header line formatting.  Exim parses the bare,
14713 unquoted portion of an email address and if it finds a comma, treats it as an
14714 email address seperator. For the example header line:
14715 </para>
14716 <literallayout class="monospaced">
14717 From: =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;
14718 </literallayout>
14719 <para>
14720 The first example below demonstrates that Q-encoded email addresses are parsed
14721 properly if it is given the raw header (in this example, <literal>$rheader_from:</literal>).
14722 It does not see the comma because it&#x2019;s still encoded as "=2C".  The second
14723 example below is passed the contents of <literal>$header_from:</literal>, meaning it gets
14724 de-mimed. Exim sees the decoded "," so it treats it as <emphasis role="bold">two</emphasis> email addresses.
14725 The third example shows that the presence of a comma is skipped when it is
14726 quoted.
14727 </para>
14728 <literallayout class="monospaced">
14729 # exim -be '${addresses:From: \
14730 =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;}'
14731 user@example.com
14732 # exim -be '${addresses:From: Last, First &lt;user@example.com&gt;}'
14733 Last:user@example.com
14734 # exim -be '${addresses:From: "Last, First" &lt;user@example.com&gt;}'
14735 user@example.com
14736 </literallayout>
14737 </listitem></varlistentry>
14738 <varlistentry>
14739 <term><emphasis role="bold">${base62:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14740 <listitem>
14741 <para>
14742 <indexterm role="concept">
14743 <primary><option>base62</option> expansion item</primary>
14744 </indexterm>
14745 <indexterm role="concept">
14746 <primary>expansion</primary>
14747 <secondary>conversion to base 62</secondary>
14748 </indexterm>
14749 The string must consist entirely of decimal digits. The number is converted to
14750 base 62 and output as a string of six characters, including leading zeros. In
14751 the few operating environments where Exim uses base 36 instead of base 62 for
14752 its message identifiers (because those systems do not have case-sensitive file
14753 names), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just to
14754 be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
14755 </para>
14756 </listitem></varlistentry>
14757 <varlistentry>
14758 <term><emphasis role="bold">${base62d:</emphasis>&lt;<emphasis>base-62&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14759 <listitem>
14760 <para>
14761 <indexterm role="concept">
14762 <primary><option>base62d</option> expansion item</primary>
14763 </indexterm>
14764 <indexterm role="concept">
14765 <primary>expansion</primary>
14766 <secondary>conversion to base 62</secondary>
14767 </indexterm>
14768 The string must consist entirely of base-62 digits, or, in operating
14769 environments where Exim uses base 36 instead of base 62 for its message
14770 identifiers, base-36 digits. The number is converted to decimal and output as a
14771 string.
14772 </para>
14773 </listitem></varlistentry>
14774 <varlistentry>
14775 <term><emphasis role="bold">${domain:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14776 <listitem>
14777 <para>
14778 <indexterm role="concept">
14779 <primary>domain</primary>
14780 <secondary>extraction</secondary>
14781 </indexterm>
14782 <indexterm role="concept">
14783 <primary>expansion</primary>
14784 <secondary>domain extraction</secondary>
14785 </indexterm>
14786 The string is interpreted as an RFC 2822 address and the domain is extracted
14787 from it. If the string does not parse successfully, the result is empty.
14788 </para>
14789 </listitem></varlistentry>
14790 <varlistentry>
14791 <term><emphasis role="bold">${escape:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14792 <listitem>
14793 <para>
14794 <indexterm role="concept">
14795 <primary>expansion</primary>
14796 <secondary>escaping non-printing characters</secondary>
14797 </indexterm>
14798 <indexterm role="concept">
14799 <primary><option>escape</option> expansion item</primary>
14800 </indexterm>
14801 If the string contains any non-printing characters, they are converted to
14802 escape sequences starting with a backslash. Whether characters with the most
14803 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
14804 is controlled by the <option>print_topbitchars</option> option.
14805 </para>
14806 </listitem></varlistentry>
14807 <varlistentry>
14808 <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>
14809 <listitem>
14810 <para>
14811 <indexterm role="concept">
14812 <primary>expansion</primary>
14813 <secondary>expression evaluation</secondary>
14814 </indexterm>
14815 <indexterm role="concept">
14816 <primary>expansion</primary>
14817 <secondary>arithmetic expression</secondary>
14818 </indexterm>
14819 <indexterm role="concept">
14820 <primary><option>eval</option> expansion item</primary>
14821 </indexterm>
14822 These items supports simple arithmetic and bitwise logical operations in
14823 expansion strings. The string (after expansion) must be a conventional
14824 arithmetic expression, but it is limited to basic arithmetic operators, bitwise
14825 logical operators, and parentheses. All operations are carried out using
14826 integer arithmetic. The operator priorities are as follows (the same as in the
14827 C programming language):
14828 </para>
14829 <informaltable frame="none">
14830 <tgroup cols="2" colsep="0" rowsep="0">
14831 <colspec colwidth="70pt" align="left"/>
14832 <colspec colwidth="300pt" align="left"/>
14833 <tbody>
14834 <row>
14835 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>highest:</emphasis></entry>
14836 <entry>not (~), negate (-)</entry>
14837 </row>
14838 <row>
14839 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14840 <entry>multiply (*), divide (/), remainder (%)</entry>
14841 </row>
14842 <row>
14843 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14844 <entry>plus (+), minus (-)</entry>
14845 </row>
14846 <row>
14847 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14848 <entry>shift-left (&lt;&lt;), shift-right (&gt;&gt;)</entry>
14849 </row>
14850 <row>
14851 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14852 <entry>and (&amp;)</entry>
14853 </row>
14854 <row>
14855 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14856 <entry>xor (^)</entry>
14857 </row>
14858 <row>
14859 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>lowest:</emphasis></entry>
14860 <entry>or (|)</entry>
14861 </row>
14862 </tbody>
14863 </tgroup>
14864 </informaltable>
14865 <para>
14866 Binary operators with the same priority are evaluated from left to right. White
14867 space is permitted before or after operators.
14868 </para>
14869 <para>
14870 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
14871 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
14872 decimal, even if they start with a leading zero; hexadecimal numbers are not
14873 permitted. This can be useful when processing numbers extracted from dates or
14874 times, which often do have leading zeros.
14875 </para>
14876 <para>
14877 A number may be followed by <quote>K</quote>, <quote>M</quote> or <quote>G</quote> to multiply it by 1024, 1024*1024
14878 or 1024*1024*1024,
14879 respectively. Negative numbers are supported. The result of the computation is
14880 a decimal representation of the answer (without <quote>K</quote>, <quote>M</quote> or <quote>G</quote>). For example:
14881 </para>
14882 <literallayout>
14883 <literal>${eval:1+1}            </literal>  yields 2
14884 <literal>${eval:1+2*3}          </literal>  yields 7
14885 <literal>${eval:(1+2)*3}        </literal>  yields 9
14886 <literal>${eval:2+42%5}         </literal>  yields 4
14887 <literal>${eval:0xc&amp;5}          </literal>  yields 4
14888 <literal>${eval:0xc|5}          </literal>  yields 13
14889 <literal>${eval:0xc^5}          </literal>  yields 9
14890 <literal>${eval:0xc&gt;&gt;1}         </literal>  yields 6
14891 <literal>${eval:0xc&lt;&lt;1}         </literal>  yields 24
14892 <literal>${eval:~255&amp;0x1234}    </literal>  yields 4608
14893 <literal>${eval:-(~255&amp;0x1234)} </literal>  yields -4608
14894 </literallayout>
14895 <para>
14896 As a more realistic example, in an ACL you might have
14897 </para>
14898 <literallayout class="monospaced">
14899 deny   message = Too many bad recipients
14900        condition =                    \
14901          ${if and {                   \
14902            {&gt;{$rcpt_count}{10}}       \
14903            {                          \
14904            &lt;                          \
14905              {$recipients_count}      \
14906              {${eval:$rcpt_count/2}}  \
14907            }                          \
14908          }{yes}{no}}
14909 </literallayout>
14910 <para>
14911 The condition is true if there have been more than 10 RCPT commands and
14912 fewer than half of them have resulted in a valid recipient.
14913 </para>
14914 </listitem></varlistentry>
14915 <varlistentry>
14916 <term><emphasis role="bold">${expand:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14917 <listitem>
14918 <para>
14919 <indexterm role="concept">
14920 <primary>expansion</primary>
14921 <secondary>re-expansion of substring</secondary>
14922 </indexterm>
14923 The <option>expand</option> operator causes a string to be expanded for a second time. For
14924 example,
14925 </para>
14926 <literallayout class="monospaced">
14927 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
14928 </literallayout>
14929 <para>
14930 first looks up a string in a file while expanding the operand for <option>expand</option>,
14931 and then re-expands what it has found.
14932 </para>
14933 </listitem></varlistentry>
14934 <varlistentry>
14935 <term><emphasis role="bold">${from_utf8:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14936 <listitem>
14937 <para>
14938 <indexterm role="concept">
14939 <primary>Unicode</primary>
14940 </indexterm>
14941 <indexterm role="concept">
14942 <primary>UTF-8</primary>
14943 <secondary>conversion from</secondary>
14944 </indexterm>
14945 <indexterm role="concept">
14946 <primary>expansion</primary>
14947 <secondary>UTF-8 conversion</secondary>
14948 </indexterm>
14949 <indexterm role="concept">
14950 <primary><option>from_utf8</option> expansion item</primary>
14951 </indexterm>
14952 The world is slowly moving towards Unicode, although there are no standards for
14953 email yet. However, other applications (including some databases) are starting
14954 to store data in Unicode, using UTF-8 encoding. This operator converts from a
14955 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
14956 converted to underscores. The input must be a valid UTF-8 string. If it is not,
14957 the result is an undefined sequence of bytes.
14958 </para>
14959 <para>
14960 Unicode code points with values less than 256 are compatible with ASCII and
14961 ISO-8859-1 (also known as Latin-1).
14962 For example, character 169 is the copyright symbol in both cases, though the
14963 way it is encoded is different. In UTF-8, more than one byte is needed for
14964 characters with code values greater than 127, whereas ISO-8859-1 is a
14965 single-byte encoding (but thereby limited to 256 characters). This makes
14966 translation from UTF-8 to ISO-8859-1 straightforward.
14967 </para>
14968 </listitem></varlistentry>
14969 <varlistentry>
14970 <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>
14971 <listitem>
14972 <para>
14973 <indexterm role="concept">
14974 <primary>hash function</primary>
14975 <secondary>textual</secondary>
14976 </indexterm>
14977 <indexterm role="concept">
14978 <primary>expansion</primary>
14979 <secondary>textual hash</secondary>
14980 </indexterm>
14981 The <option>hash</option> operator is a simpler interface to the hashing function that can
14982 be used when the two parameters are fixed numbers (as opposed to strings that
14983 change when expanded). The effect is the same as
14984 </para>
14985 <literallayout class="monospaced">
14986 ${hash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
14987 </literallayout>
14988 <para>
14989 See the description of the general <option>hash</option> item above for details. The
14990 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
14991 </para>
14992 </listitem></varlistentry>
14993 <varlistentry>
14994 <term><emphasis role="bold">${hex2b64:</emphasis>&lt;<emphasis>hexstring</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14995 <listitem>
14996 <para>
14997 <indexterm role="concept">
14998 <primary>base64 encoding</primary>
14999 <secondary>conversion from hex</secondary>
15000 </indexterm>
15001 <indexterm role="concept">
15002 <primary>expansion</primary>
15003 <secondary>hex to base64</secondary>
15004 </indexterm>
15005 <indexterm role="concept">
15006 <primary><option>hex2b64</option> expansion item</primary>
15007 </indexterm>
15008 This operator converts a hex string into one that is base64 encoded. This can
15009 be useful for processing the output of the MD5 and SHA-1 hashing functions.
15010 </para>
15011 </listitem></varlistentry>
15012 <varlistentry>
15013 <term><emphasis role="bold">${hexquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15014 <listitem>
15015 <para>
15016 <indexterm role="concept">
15017 <primary>quoting</primary>
15018 <secondary>hex-encoded unprintable characters</secondary>
15019 </indexterm>
15020 <indexterm role="concept">
15021 <primary><option>hexquote</option> expansion item</primary>
15022 </indexterm>
15023 This operator converts non-printable characters in a string into a hex
15024 escape form. Byte values between 33 (!) and 126 (~) inclusive are left
15025 as is, and other byte values are converted to <literal>\xNN</literal>, for example a
15026 byte value 127 is converted to <literal>\x7f</literal>.
15027 </para>
15028 </listitem></varlistentry>
15029 <varlistentry>
15030 <term><emphasis role="bold">${lc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15031 <listitem>
15032 <para>
15033 <indexterm role="concept">
15034 <primary>case forcing in strings</primary>
15035 </indexterm>
15036 <indexterm role="concept">
15037 <primary>string</primary>
15038 <secondary>case forcing</secondary>
15039 </indexterm>
15040 <indexterm role="concept">
15041 <primary>lower casing</primary>
15042 </indexterm>
15043 <indexterm role="concept">
15044 <primary>expansion</primary>
15045 <secondary>case forcing</secondary>
15046 </indexterm>
15047 <indexterm role="concept">
15048 <primary><option>lc</option> expansion item</primary>
15049 </indexterm>
15050 This forces the letters in the string into lower-case, for example:
15051 </para>
15052 <literallayout class="monospaced">
15053 ${lc:$local_part}
15054 </literallayout>
15055 </listitem></varlistentry>
15056 <varlistentry>
15057 <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>
15058 <listitem>
15059 <para>
15060 <indexterm role="concept">
15061 <primary>expansion</primary>
15062 <secondary>string truncation</secondary>
15063 </indexterm>
15064 <indexterm role="concept">
15065 <primary><option>length</option> expansion item</primary>
15066 </indexterm>
15067 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
15068 can be used when the parameter is a fixed number (as opposed to a string that
15069 changes when expanded). The effect is the same as
15070 </para>
15071 <literallayout class="monospaced">
15072 ${length{&lt;number&gt;}{&lt;string&gt;}}
15073 </literallayout>
15074 <para>
15075 See the description of the general <option>length</option> item above for details. Note that
15076 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
15077 when <option>length</option> is used as an operator.
15078 </para>
15079 </listitem></varlistentry>
15080 <varlistentry>
15081 <term><emphasis role="bold">${listcount:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15082 <listitem>
15083 <para>
15084 <indexterm role="concept">
15085 <primary>expansion</primary>
15086 <secondary>list item count</secondary>
15087 </indexterm>
15088 <indexterm role="concept">
15089 <primary>list</primary>
15090 <secondary>item count</secondary>
15091 </indexterm>
15092 <indexterm role="concept">
15093 <primary>list</primary>
15094 <secondary>count of items</secondary>
15095 </indexterm>
15096 <indexterm role="concept">
15097 <primary><option>listcount</option> expansion item</primary>
15098 </indexterm>
15099 The string is interpreted as a list and the number of items is returned.
15100 </para>
15101 </listitem></varlistentry>
15102 <varlistentry>
15103 <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>
15104 <listitem>
15105 <para>
15106 <indexterm role="concept">
15107 <primary>expansion</primary>
15108 <secondary>named list</secondary>
15109 </indexterm>
15110 <indexterm role="concept">
15111 <primary><option>listnamed</option> expansion item</primary>
15112 </indexterm>
15113 The name is interpreted as a named list and the content of the list is returned,
15114 expanding any referenced lists, re-quoting as needed for colon-separation.
15115 If the optional type is given it must be one of "a", "d", "h" or "l"
15116 and selects address-, domain-, host- or localpart- lists to search among respectively.
15117 Otherwise all types are searched in an undefined order and the first
15118 matching list is returned.
15119 </para>
15120 </listitem></varlistentry>
15121 <varlistentry>
15122 <term><emphasis role="bold">${local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15123 <listitem>
15124 <para>
15125 <indexterm role="concept">
15126 <primary>expansion</primary>
15127 <secondary>local part extraction</secondary>
15128 </indexterm>
15129 <indexterm role="concept">
15130 <primary><option>local_part</option> expansion item</primary>
15131 </indexterm>
15132 The string is interpreted as an RFC 2822 address and the local part is
15133 extracted from it. If the string does not parse successfully, the result is
15134 empty.
15135 </para>
15136 </listitem></varlistentry>
15137 <varlistentry>
15138 <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>
15139 <listitem>
15140 <para>
15141 <indexterm role="concept">
15142 <primary>masked IP address</primary>
15143 </indexterm>
15144 <indexterm role="concept">
15145 <primary>IP address</primary>
15146 <secondary>masking</secondary>
15147 </indexterm>
15148 <indexterm role="concept">
15149 <primary>CIDR notation</primary>
15150 </indexterm>
15151 <indexterm role="concept">
15152 <primary>expansion</primary>
15153 <secondary>IP address masking</secondary>
15154 </indexterm>
15155 <indexterm role="concept">
15156 <primary><option>mask</option> expansion item</primary>
15157 </indexterm>
15158 If the form of the string to be operated on is not an IP address followed by a
15159 slash and an integer (that is, a network address in CIDR notation), the
15160 expansion fails. Otherwise, this operator converts the IP address to binary,
15161 masks off the least significant bits according to the bit count, and converts
15162 the result back to text, with mask appended. For example,
15163 </para>
15164 <literallayout class="monospaced">
15165 ${mask:10.111.131.206/28}
15166 </literallayout>
15167 <para>
15168 returns the string <quote>10.111.131.192/28</quote>. Since this operation is expected to
15169 be mostly used for looking up masked addresses in files, the result for an IPv6
15170 address uses dots to separate components instead of colons, because colon
15171 terminates a key string in lsearch files. So, for example,
15172 </para>
15173 <literallayout class="monospaced">
15174 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
15175 </literallayout>
15176 <para>
15177 returns the string
15178 </para>
15179 <literallayout class="monospaced">
15180 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
15181 </literallayout>
15182 <para>
15183 Letters in IPv6 addresses are always output in lower case.
15184 </para>
15185 </listitem></varlistentry>
15186 <varlistentry>
15187 <term><emphasis role="bold">${md5:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15188 <listitem>
15189 <para>
15190 <indexterm role="concept">
15191 <primary>MD5 hash</primary>
15192 </indexterm>
15193 <indexterm role="concept">
15194 <primary>expansion</primary>
15195 <secondary>MD5 hash</secondary>
15196 </indexterm>
15197 <indexterm role="concept">
15198 <primary>certificate fingerprint</primary>
15199 </indexterm>
15200 <indexterm role="concept">
15201 <primary><option>md5</option> expansion item</primary>
15202 </indexterm>
15203 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
15204 as a 32-digit hexadecimal number, in which any letters are in lower case.
15205 </para>
15206 </listitem></varlistentry>
15207 <varlistentry>
15208 <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>
15209 <listitem>
15210 <para>
15211 <indexterm role="concept">
15212 <primary>expansion</primary>
15213 <secondary>numeric hash</secondary>
15214 </indexterm>
15215 <indexterm role="concept">
15216 <primary>hash function</primary>
15217 <secondary>numeric</secondary>
15218 </indexterm>
15219 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
15220 that can be used when the two parameters are fixed numbers (as opposed to
15221 strings that change when expanded). The effect is the same as
15222 </para>
15223 <literallayout class="monospaced">
15224 ${nhash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
15225 </literallayout>
15226 <para>
15227 See the description of the general <option>nhash</option> item above for details.
15228 </para>
15229 </listitem></varlistentry>
15230 <varlistentry>
15231 <term><emphasis role="bold">${quote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15232 <listitem>
15233 <para>
15234 <indexterm role="concept">
15235 <primary>quoting</primary>
15236 <secondary>in string expansions</secondary>
15237 </indexterm>
15238 <indexterm role="concept">
15239 <primary>expansion</primary>
15240 <secondary>quoting</secondary>
15241 </indexterm>
15242 <indexterm role="concept">
15243 <primary><option>quote</option> expansion item</primary>
15244 </indexterm>
15245 The <option>quote</option> operator puts its argument into double quotes if it
15246 is an empty string or
15247 contains anything other than letters, digits, underscores, dots, and hyphens.
15248 Any occurrences of double quotes and backslashes are escaped with a backslash.
15249 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
15250 respectively For example,
15251 </para>
15252 <literallayout class="monospaced">
15253 ${quote:ab"*"cd}
15254 </literallayout>
15255 <para>
15256 becomes
15257 </para>
15258 <literallayout class="monospaced">
15259 "ab\"*\"cd"
15260 </literallayout>
15261 <para>
15262 The place where this is useful is when the argument is a substitution from a
15263 variable or a message header.
15264 </para>
15265 </listitem></varlistentry>
15266 <varlistentry>
15267 <term><emphasis role="bold">${quote_local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15268 <listitem>
15269 <para>
15270 <indexterm role="concept">
15271 <primary><option>quote_local_part</option> expansion item</primary>
15272 </indexterm>
15273 This operator is like <option>quote</option>, except that it quotes the string only if
15274 required to do so by the rules of RFC 2822 for quoting local parts. For
15275 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
15276 If you are creating a new email address from the contents of <varname>$local_part</varname>
15277 (or any other unknown data), you should always use this operator.
15278 </para>
15279 </listitem></varlistentry>
15280 <varlistentry>
15281 <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>
15282 <listitem>
15283 <para>
15284 <indexterm role="concept">
15285 <primary>quoting</primary>
15286 <secondary>lookup-specific</secondary>
15287 </indexterm>
15288 This operator applies lookup-specific quoting rules to the string. Each
15289 query-style lookup type has its own quoting rules which are described with
15290 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
15291 </para>
15292 <literallayout class="monospaced">
15293 ${quote_ldap:two * two}
15294 </literallayout>
15295 <para>
15296 returns
15297 </para>
15298 <literallayout class="monospaced">
15299 two%20%5C2A%20two
15300 </literallayout>
15301 <para>
15302 For single-key lookup types, no quoting is ever necessary and this operator
15303 yields an unchanged string.
15304 </para>
15305 </listitem></varlistentry>
15306 <varlistentry>
15307 <term><emphasis role="bold">${randint:</emphasis>&lt;<emphasis>n</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15308 <listitem>
15309 <para>
15310 <indexterm role="concept">
15311 <primary>random number</primary>
15312 </indexterm>
15313 This operator returns a somewhat random number which is less than the
15314 supplied number and is at least 0.  The quality of this randomness depends
15315 on how Exim was built; the values are not suitable for keying material.
15316 If Exim is linked against OpenSSL then RAND_pseudo_bytes() is used.
15317 If Exim is linked against GnuTLS then gnutls_rnd(GNUTLS_RND_NONCE) is used,
15318 for versions of GnuTLS with that function.
15319 Otherwise, the implementation may be arc4random(), random() seeded by
15320 srandomdev() or srandom(), or a custom implementation even weaker than
15321 random().
15322 </para>
15323 </listitem></varlistentry>
15324 <varlistentry>
15325 <term><emphasis role="bold">${reverse_ip:</emphasis>&lt;<emphasis>ipaddr</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15326 <listitem>
15327 <para>
15328 <indexterm role="concept">
15329 <primary>expansion</primary>
15330 <secondary>IP address</secondary>
15331 </indexterm>
15332 This operator reverses an IP address; for IPv4 addresses, the result is in
15333 dotted-quad decimal form, while for IPv6 addreses the result is in
15334 dotted-nibble hexadecimal form.  In both cases, this is the "natural" form
15335 for DNS.  For example,
15336 </para>
15337 <literallayout class="monospaced">
15338 ${reverse_ip:192.0.2.4}
15339 ${reverse_ip:2001:0db8:c42:9:1:abcd:192.0.2.127}
15340 </literallayout>
15341 <para>
15342 returns
15343 </para>
15344 <literallayout class="monospaced">
15345 4.2.0.192
15346 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
15347 </literallayout>
15348 </listitem></varlistentry>
15349 <varlistentry>
15350 <term><emphasis role="bold">${rfc2047:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15351 <listitem>
15352 <para>
15353 <indexterm role="concept">
15354 <primary>expansion</primary>
15355 <secondary>RFC 2047</secondary>
15356 </indexterm>
15357 <indexterm role="concept">
15358 <primary>RFC 2047</primary>
15359 <secondary>expansion operator</secondary>
15360 </indexterm>
15361 <indexterm role="concept">
15362 <primary><option>rfc2047</option> expansion item</primary>
15363 </indexterm>
15364 This operator encodes text according to the rules of RFC 2047. This is an
15365 encoding that is used in header lines to encode non-ASCII characters. It is
15366 assumed that the input string is in the encoding specified by the
15367 <option>headers_charset</option> option, which defaults to ISO-8859-1. If the string
15368 contains only characters in the range 33&ndash;126, and no instances of the
15369 characters
15370 </para>
15371 <literallayout class="monospaced">
15372 ? = ( ) &lt; &gt; @ , ; : \ " . [ ] _
15373 </literallayout>
15374 <para>
15375 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
15376 string, using as many <quote>encoded words</quote> as necessary to encode all the
15377 characters.
15378 </para>
15379 </listitem></varlistentry>
15380 <varlistentry>
15381 <term><emphasis role="bold">${rfc2047d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15382 <listitem>
15383 <para>
15384 <indexterm role="concept">
15385 <primary>expansion</primary>
15386 <secondary>RFC 2047</secondary>
15387 </indexterm>
15388 <indexterm role="concept">
15389 <primary>RFC 2047</primary>
15390 <secondary>decoding</secondary>
15391 </indexterm>
15392 <indexterm role="concept">
15393 <primary><option>rfc2047d</option> expansion item</primary>
15394 </indexterm>
15395 This operator decodes strings that are encoded as per RFC 2047. Binary zero
15396 bytes are replaced by question marks. Characters are converted into the
15397 character set defined by <option>headers_charset</option>. Overlong RFC 2047 <quote>words</quote> are
15398 not recognized unless <option>check_rfc2047_length</option> is set false.
15399 </para>
15400 <para>
15401 <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
15402 access a header line, RFC 2047 decoding is done automatically. You do not need
15403 to use this operator as well.
15404 </para>
15405 </listitem></varlistentry>
15406 <varlistentry>
15407 <term><emphasis role="bold">${rxquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15408 <listitem>
15409 <para>
15410 <indexterm role="concept">
15411 <primary>quoting</primary>
15412 <secondary>in regular expressions</secondary>
15413 </indexterm>
15414 <indexterm role="concept">
15415 <primary>regular expressions</primary>
15416 <secondary>quoting</secondary>
15417 </indexterm>
15418 <indexterm role="concept">
15419 <primary><option>rxquote</option> expansion item</primary>
15420 </indexterm>
15421 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
15422 characters in its argument. This is useful when substituting the values of
15423 variables or headers inside regular expressions.
15424 </para>
15425 </listitem></varlistentry>
15426 <varlistentry>
15427 <term><emphasis role="bold">${sha1:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15428 <listitem>
15429 <para>
15430 <indexterm role="concept">
15431 <primary>SHA-1 hash</primary>
15432 </indexterm>
15433 <indexterm role="concept">
15434 <primary>expansion</primary>
15435 <secondary>SHA-1 hashing</secondary>
15436 </indexterm>
15437 <indexterm role="concept">
15438 <primary>certificate fingerprint</primary>
15439 </indexterm>
15440 <indexterm role="concept">
15441 <primary><option>sha2</option> expansion item</primary>
15442 </indexterm>
15443 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
15444 it as a 40-digit hexadecimal number, in which any letters are in upper case.
15445 </para>
15446 </listitem></varlistentry>
15447 <varlistentry>
15448 <term><emphasis role="bold">${sha256:</emphasis>&lt;<emphasis>certificate</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15449 <listitem>
15450 <para>
15451 <indexterm role="concept">
15452 <primary>SHA-256 hash</primary>
15453 </indexterm>
15454 <indexterm role="concept">
15455 <primary>certificate fingerprint</primary>
15456 </indexterm>
15457 <indexterm role="concept">
15458 <primary>expansion</primary>
15459 <secondary>SHA-256 hashing</secondary>
15460 </indexterm>
15461 <indexterm role="concept">
15462 <primary><option>sha256</option> expansion item</primary>
15463 </indexterm>
15464 The <option>sha256</option> operator computes the SHA-256 hash fingerprint of the
15465 certificate,
15466 and returns
15467 it as a 64-digit hexadecimal number, in which any letters are in upper case.
15468 Only arguments which are a single variable of certificate type are supported.
15469 </para>
15470 </listitem></varlistentry>
15471 <varlistentry>
15472 <term><emphasis role="bold">${stat:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15473 <listitem>
15474 <para>
15475 <indexterm role="concept">
15476 <primary>expansion</primary>
15477 <secondary>statting a file</secondary>
15478 </indexterm>
15479 <indexterm role="concept">
15480 <primary>file</primary>
15481 <secondary>extracting characteristics</secondary>
15482 </indexterm>
15483 <indexterm role="concept">
15484 <primary><option>stat</option> expansion item</primary>
15485 </indexterm>
15486 The string, after expansion, must be a file path. A call to the <function>stat()</function>
15487 function is made for this path. If <function>stat()</function> fails, an error occurs and the
15488 expansion fails. If it succeeds, the data from the stat replaces the item, as a
15489 series of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; pairs, where the values are all numerical,
15490 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
15491 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
15492 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
15493 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
15494 can extract individual fields using the <option>extract</option> expansion item.
15495 </para>
15496 <para>
15497 The use of the <option>stat</option> expansion in users&#x2019; filter files can be locked out by
15498 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
15499 systems for files larger than 2GB.
15500 </para>
15501 </listitem></varlistentry>
15502 <varlistentry>
15503 <term><emphasis role="bold">${str2b64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15504 <listitem>
15505 <para>
15506 <indexterm role="concept">
15507 <primary>expansion</primary>
15508 <secondary>base64 encoding</secondary>
15509 </indexterm>
15510 <indexterm role="concept">
15511 <primary>base64 encoding</primary>
15512 <secondary>in string expansion</secondary>
15513 </indexterm>
15514 <indexterm role="concept">
15515 <primary><option>str2b64</option> expansion item</primary>
15516 </indexterm>
15517 This operator converts a string into one that is base64 encoded.
15518 </para>
15519 </listitem></varlistentry>
15520 <varlistentry>
15521 <term><emphasis role="bold">${strlen:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15522 <listitem>
15523 <para>
15524 <indexterm role="concept">
15525 <primary>expansion</primary>
15526 <secondary>string length</secondary>
15527 </indexterm>
15528 <indexterm role="concept">
15529 <primary>string</primary>
15530 <secondary>length in expansion</secondary>
15531 </indexterm>
15532 <indexterm role="concept">
15533 <primary><option>strlen</option> expansion item</primary>
15534 </indexterm>
15535 The item is replace by the length of the expanded string, expressed as a
15536 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
15537 </para>
15538 </listitem></varlistentry>
15539 <varlistentry>
15540 <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>
15541 <listitem>
15542 <para>
15543 <indexterm role="concept">
15544 <primary><option>substr</option> expansion item</primary>
15545 </indexterm>
15546 <indexterm role="concept">
15547 <primary>substring extraction</primary>
15548 </indexterm>
15549 <indexterm role="concept">
15550 <primary>expansion</primary>
15551 <secondary>substring expansion</secondary>
15552 </indexterm>
15553 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
15554 can be used when the two parameters are fixed numbers (as opposed to strings
15555 that change when expanded). The effect is the same as
15556 </para>
15557 <literallayout class="monospaced">
15558 ${substr{&lt;start&gt;}{&lt;length&gt;}{&lt;string&gt;}}
15559 </literallayout>
15560 <para>
15561 See the description of the general <option>substr</option> item above for details. The
15562 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
15563 </para>
15564 </listitem></varlistentry>
15565 <varlistentry>
15566 <term><emphasis role="bold">${time_eval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15567 <listitem>
15568 <para>
15569 <indexterm role="concept">
15570 <primary><option>time_eval</option> expansion item</primary>
15571 </indexterm>
15572 <indexterm role="concept">
15573 <primary>time interval</primary>
15574 <secondary>decoding</secondary>
15575 </indexterm>
15576 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
15577 seconds.
15578 </para>
15579 </listitem></varlistentry>
15580 <varlistentry>
15581 <term><emphasis role="bold">${time_interval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15582 <listitem>
15583 <para>
15584 <indexterm role="concept">
15585 <primary><option>time_interval</option> expansion item</primary>
15586 </indexterm>
15587 <indexterm role="concept">
15588 <primary>time interval</primary>
15589 <secondary>formatting</secondary>
15590 </indexterm>
15591 The argument (after sub-expansion) must be a sequence of decimal digits that
15592 represents an interval of time as a number of seconds. It is converted into a
15593 number of larger units and output in Exim&#x2019;s normal time format, for example,
15594 <literal>1w3d4h2m6s</literal>.
15595 </para>
15596 </listitem></varlistentry>
15597 <varlistentry>
15598 <term><emphasis role="bold">${uc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15599 <listitem>
15600 <para>
15601 <indexterm role="concept">
15602 <primary>case forcing in strings</primary>
15603 </indexterm>
15604 <indexterm role="concept">
15605 <primary>string</primary>
15606 <secondary>case forcing</secondary>
15607 </indexterm>
15608 <indexterm role="concept">
15609 <primary>upper casing</primary>
15610 </indexterm>
15611 <indexterm role="concept">
15612 <primary>expansion</primary>
15613 <secondary>case forcing</secondary>
15614 </indexterm>
15615 <indexterm role="concept">
15616 <primary><option>uc</option> expansion item</primary>
15617 </indexterm>
15618 This forces the letters in the string into upper-case.
15619 </para>
15620 </listitem></varlistentry>
15621 <varlistentry>
15622 <term><emphasis role="bold">${utf8clean:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15623 <listitem>
15624 <para>
15625 <indexterm role="concept">
15626 <primary>correction of invalid utf-8 sequences in strings</primary>
15627 </indexterm>
15628 <indexterm role="concept">
15629 <primary>utf-8</primary>
15630 <secondary>utf-8 sequences</secondary>
15631 </indexterm>
15632 <indexterm role="concept">
15633 <primary>incorrect utf-8</primary>
15634 </indexterm>
15635 <indexterm role="concept">
15636 <primary>expansion</primary>
15637 <secondary>utf-8 forcing</secondary>
15638 </indexterm>
15639 <indexterm role="concept">
15640 <primary><option>utf8clean</option> expansion item</primary>
15641 </indexterm>
15642 This replaces any invalid utf-8 sequence in the string by the character <literal>?</literal>.
15643 </para>
15644 </listitem></varlistentry>
15645 </variablelist>
15646 </section>
15647 <section id="SECTexpcond">
15648 <title>Expansion conditions</title>
15649 <para>
15650 <indexterm role="concept" id="IIDexpcond" class="startofrange">
15651 <primary>expansion</primary>
15652 <secondary>conditions</secondary>
15653 </indexterm>
15654 The following conditions are available for testing by the <option>${if</option> construct
15655 while expanding strings:
15656 </para>
15657 <variablelist>
15658 <varlistentry>
15659 <term><emphasis role="bold">!</emphasis>&lt;<emphasis>condition</emphasis>&gt;</term>
15660 <listitem>
15661 <para>
15662 <indexterm role="concept">
15663 <primary>expansion</primary>
15664 <secondary>negating a condition</secondary>
15665 </indexterm>
15666 <indexterm role="concept">
15667 <primary>negation</primary>
15668 <secondary>in expansion condition</secondary>
15669 </indexterm>
15670 Preceding any condition with an exclamation mark negates the result of the
15671 condition.
15672 </para>
15673 </listitem></varlistentry>
15674 <varlistentry>
15675 <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>
15676 <listitem>
15677 <para>
15678 <indexterm role="concept">
15679 <primary>numeric comparison</primary>
15680 </indexterm>
15681 <indexterm role="concept">
15682 <primary>expansion</primary>
15683 <secondary>numeric comparison</secondary>
15684 </indexterm>
15685 There are a number of symbolic operators for doing numeric comparisons. They
15686 are:
15687 </para>
15688 <literallayout>
15689 <literal>=   </literal>   equal
15690 <literal>==  </literal>   equal
15691 <literal>&gt;   </literal>   greater
15692 <literal>&gt;=  </literal>   greater or equal
15693 <literal>&lt;   </literal>   less
15694 <literal>&lt;=  </literal>   less or equal
15695 </literallayout>
15696 <para>
15697 For example:
15698 </para>
15699 <literallayout class="monospaced">
15700 ${if &gt;{$message_size}{10M} ...
15701 </literallayout>
15702 <para>
15703 Note that the general negation operator provides for inequality testing. The
15704 two strings must take the form of optionally signed decimal integers,
15705 optionally followed by one of the letters <quote>K</quote>, <quote>M</quote> or <quote>G</quote> (in either upper or
15706 lower case), signifying multiplication by 1024, 1024*1024 or 1024*1024*1024, respectively.
15707 As a special case, the numerical value of an empty string is taken as
15708 zero.
15709 </para>
15710 <para>
15711 In all cases, a relative comparator OP is testing if &lt;<emphasis>string1</emphasis>&gt; OP
15712 &lt;<emphasis>string2</emphasis>&gt;; the above example is checking if <varname>$message_size</varname> is larger than
15713 10M, not if 10M is larger than <varname>$message_size</varname>.
15714 </para>
15715 </listitem></varlistentry>
15716 <varlistentry>
15717 <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>
15718 <listitem>
15719 <para>
15720 <indexterm role="concept">
15721 <primary>expansion</primary>
15722 <secondary>calling an acl</secondary>
15723 </indexterm>
15724 <indexterm role="concept">
15725 <primary><option>acl</option></primary>
15726 <secondary>expansion condition</secondary>
15727 </indexterm>
15728 The name and zero to nine argument strings are first expanded separately.  The expanded
15729 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
15730 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
15731 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
15732 and may use the variables; if another acl expansion is used the values
15733 are restored after it returns.  If the ACL sets
15734 a value using a "message =" modifier the variable $value becomes
15735 the result of the expansion, otherwise it is empty.
15736 If the ACL returns accept the condition is true; if deny, false.
15737 If the ACL returns defer the result is a forced-fail.
15738 </para>
15739 </listitem></varlistentry>
15740 <varlistentry>
15741 <term><emphasis role="bold">bool&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15742 <listitem>
15743 <para>
15744 <indexterm role="concept">
15745 <primary>expansion</primary>
15746 <secondary>boolean parsing</secondary>
15747 </indexterm>
15748 <indexterm role="concept">
15749 <primary><option>bool</option> expansion condition</primary>
15750 </indexterm>
15751 This condition turns a string holding a true or false representation into
15752 a boolean state.  It parses <quote>true</quote>, <quote>false</quote>, <quote>yes</quote> and <quote>no</quote>
15753 (case-insensitively); also integer numbers map to true if non-zero,
15754 false if zero.
15755 An empty string is treated as false.
15756 Leading and trailing whitespace is ignored;
15757 thus a string consisting only of whitespace is false.
15758 All other string values will result in expansion failure.
15759 </para>
15760 <para>
15761 When combined with ACL variables, this expansion condition will let you
15762 make decisions in one place and act on those decisions in another place.
15763 For example:
15764 </para>
15765 <literallayout class="monospaced">
15766 ${if bool{$acl_m_privileged_sender} ...
15767 </literallayout>
15768 </listitem></varlistentry>
15769 <varlistentry>
15770 <term><emphasis role="bold">bool_lax&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15771 <listitem>
15772 <para>
15773 <indexterm role="concept">
15774 <primary>expansion</primary>
15775 <secondary>boolean parsing</secondary>
15776 </indexterm>
15777 <indexterm role="concept">
15778 <primary><option>bool_lax</option> expansion condition</primary>
15779 </indexterm>
15780 Like <option>bool</option>, this condition turns a string into a boolean state.  But
15781 where <option>bool</option> accepts a strict set of strings, <option>bool_lax</option> uses the same
15782 loose definition that the Router <option>condition</option> option uses.  The empty string
15783 and the values <quote>false</quote>, <quote>no</quote> and <quote>0</quote> map to false, all others map to
15784 true.  Leading and trailing whitespace is ignored.
15785 </para>
15786 <para>
15787 Note that where <quote>bool{00}</quote> is false, <quote>bool_lax{00}</quote> is true.
15788 </para>
15789 </listitem></varlistentry>
15790 <varlistentry>
15791 <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>
15792 <listitem>
15793 <para>
15794 <indexterm role="concept">
15795 <primary>expansion</primary>
15796 <secondary>encrypted comparison</secondary>
15797 </indexterm>
15798 <indexterm role="concept">
15799 <primary>encrypted strings, comparing</primary>
15800 </indexterm>
15801 <indexterm role="concept">
15802 <primary><option>crypteq</option> expansion condition</primary>
15803 </indexterm>
15804 This condition is included in the Exim binary if it is built to support any
15805 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
15806 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
15807 included in the binary.
15808 </para>
15809 <para>
15810 The <option>crypteq</option> condition has two arguments. The first is encrypted and
15811 compared against the second, which is already encrypted. The second string may
15812 be in the LDAP form for storing encrypted strings, which starts with the
15813 encryption type in curly brackets, followed by the data. If the second string
15814 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
15815 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
15816 Typically this will be a field from a password file. An example of an encrypted
15817 string in LDAP form is:
15818 </para>
15819 <literallayout class="monospaced">
15820 {md5}CY9rzUYh03PK3k6DJie09g==
15821 </literallayout>
15822 <para>
15823 If such a string appears directly in an expansion, the curly brackets have to
15824 be quoted, because they are part of the expansion syntax. For example:
15825 </para>
15826 <literallayout class="monospaced">
15827 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
15828 </literallayout>
15829 <para>
15830 The following encryption types (whose names are matched case-independently) are
15831 supported:
15832 </para>
15833 <itemizedlist>
15834 <listitem>
15835 <para>
15836 <indexterm role="concept">
15837 <primary>MD5 hash</primary>
15838 </indexterm>
15839 <indexterm role="concept">
15840 <primary>base64 encoding</primary>
15841 <secondary>in encrypted password</secondary>
15842 </indexterm>
15843 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
15844 printable characters to compare with the remainder of the second string. If the
15845 length of the comparison string is 24, Exim assumes that it is base64 encoded
15846 (as in the above example). If the length is 32, Exim assumes that it is a
15847 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
15848 comparison fails.
15849 </para>
15850 </listitem>
15851 <listitem>
15852 <para>
15853 <indexterm role="concept">
15854 <primary>SHA-1 hash</primary>
15855 </indexterm>
15856 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
15857 printable characters to compare with the remainder of the second string. If the
15858 length of the comparison string is 28, Exim assumes that it is base64 encoded.
15859 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
15860 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
15861 </para>
15862 </listitem>
15863 <listitem>
15864 <para>
15865 <indexterm role="concept">
15866 <primary><function>crypt()</function></primary>
15867 </indexterm>
15868 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
15869 only the first eight characters of the password. However, in modern operating
15870 systems this is no longer true, and in many cases the entire password is used,
15871 whatever its length.
15872 </para>
15873 </listitem>
15874 <listitem>
15875 <para>
15876 <indexterm role="concept">
15877 <primary><function>crypt16()</function></primary>
15878 </indexterm>
15879 <option>{crypt16}</option> calls the <function>crypt16()</function> function, which was originally created to
15880 use up to 16 characters of the password in some operating systems. Again, in
15881 modern operating systems, more characters may be used.
15882 </para>
15883 </listitem>
15884 </itemizedlist>
15885 <para>
15886 Exim has its own version of <function>crypt16()</function>, which is just a double call to
15887 <function>crypt()</function>. For operating systems that have their own version, setting
15888 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
15889 operating system version instead of its own. This option is set by default in
15890 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
15891 support <function>crypt16()</function>.
15892 </para>
15893 <para>
15894 Some years after Exim&#x2019;s <function>crypt16()</function> was implemented, a user discovered that
15895 it was not using the same algorithm as some operating systems&#x2019; versions. It
15896 turns out that as well as <function>crypt16()</function> there is a function called
15897 <function>bigcrypt()</function> in some operating systems. This may or may not use the same
15898 algorithm, and both of them may be different to Exim&#x2019;s built-in <function>crypt16()</function>.
15899 </para>
15900 <para>
15901 However, since there is now a move away from the traditional <function>crypt()</function>
15902 functions towards using SHA1 and other algorithms, tidying up this area of
15903 Exim is seen as very low priority.
15904 </para>
15905 <para>
15906 If you do not put a encryption type (in curly brackets) in a <option>crypteq</option>
15907 comparison, the default is usually either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as
15908 determined by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default
15909 default is <literal>{crypt}</literal>. Whatever the default, you can always use either
15910 function by specifying it explicitly in curly brackets.
15911 </para>
15912 </listitem></varlistentry>
15913 <varlistentry>
15914 <term><emphasis role="bold">def:</emphasis>&lt;<emphasis>variable&nbsp;name</emphasis>&gt;</term>
15915 <listitem>
15916 <para>
15917 <indexterm role="concept">
15918 <primary>expansion</primary>
15919 <secondary>checking for empty variable</secondary>
15920 </indexterm>
15921 <indexterm role="concept">
15922 <primary><option>def</option> expansion condition</primary>
15923 </indexterm>
15924 The <option>def</option> condition must be followed by the name of one of the expansion
15925 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
15926 variable does not contain the empty string. For example:
15927 </para>
15928 <literallayout class="monospaced">
15929 ${if def:sender_ident {from $sender_ident}}
15930 </literallayout>
15931 <para>
15932 Note that the variable name is given without a leading <option>$</option> character. If the
15933 variable does not exist, the expansion fails.
15934 </para>
15935 </listitem></varlistentry>
15936 <varlistentry>
15937 <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>
15938 <listitem>
15939 <para>
15940 <indexterm role="concept">
15941 <primary>expansion</primary>
15942 <secondary>checking header line existence</secondary>
15943 </indexterm>
15944 This condition is true if a message is being processed and the named header
15945 exists in the message. For example,
15946 </para>
15947 <literallayout class="monospaced">
15948 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
15949 </literallayout>
15950 <para>
15951 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
15952 the header name must be terminated by a colon if white space does not follow.
15953 </para>
15954 </listitem></varlistentry>
15955 <varlistentry>
15956 <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>
15957 <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>
15958 <listitem>
15959 <para>
15960 <indexterm role="concept">
15961 <primary>string</primary>
15962 <secondary>comparison</secondary>
15963 </indexterm>
15964 <indexterm role="concept">
15965 <primary>expansion</primary>
15966 <secondary>string comparison</secondary>
15967 </indexterm>
15968 <indexterm role="concept">
15969 <primary><option>eq</option> expansion condition</primary>
15970 </indexterm>
15971 <indexterm role="concept">
15972 <primary><option>eqi</option> expansion condition</primary>
15973 </indexterm>
15974 The two substrings are first expanded. The condition is true if the two
15975 resulting strings are identical. For <option>eq</option> the comparison includes the case of
15976 letters, whereas for <option>eqi</option> the comparison is case-independent.
15977 </para>
15978 </listitem></varlistentry>
15979 <varlistentry>
15980 <term><emphasis role="bold">exists&nbsp;{</emphasis>&lt;<emphasis>file&nbsp;name</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15981 <listitem>
15982 <para>
15983 <indexterm role="concept">
15984 <primary>expansion</primary>
15985 <secondary>file existence test</secondary>
15986 </indexterm>
15987 <indexterm role="concept">
15988 <primary>file</primary>
15989 <secondary>existence test</secondary>
15990 </indexterm>
15991 <indexterm role="concept">
15992 <primary><option>exists</option>, expansion condition</primary>
15993 </indexterm>
15994 The substring is first expanded and then interpreted as an absolute path. The
15995 condition is true if the named file (or directory) exists. The existence test
15996 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
15997 users&#x2019; filter files may be locked out by the system administrator.
15998 </para>
15999 </listitem></varlistentry>
16000 <varlistentry>
16001 <term><emphasis role="bold">first_delivery</emphasis></term>
16002 <listitem>
16003 <para>
16004 <indexterm role="concept">
16005 <primary>delivery</primary>
16006 <secondary>first</secondary>
16007 </indexterm>
16008 <indexterm role="concept">
16009 <primary>first delivery</primary>
16010 </indexterm>
16011 <indexterm role="concept">
16012 <primary>expansion</primary>
16013 <secondary>first delivery test</secondary>
16014 </indexterm>
16015 <indexterm role="concept">
16016 <primary><option>first_delivery</option> expansion condition</primary>
16017 </indexterm>
16018 This condition, which has no data, is true during a message&#x2019;s first delivery
16019 attempt. It is false during any subsequent delivery attempts.
16020 </para>
16021 </listitem></varlistentry>
16022 <varlistentry>
16023 <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>
16024 <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>
16025 <listitem>
16026 <para>
16027 <indexterm role="concept">
16028 <primary>list</primary>
16029 <secondary>iterative conditions</secondary>
16030 </indexterm>
16031 <indexterm role="concept">
16032 <primary>expansion</primary>
16033 <secondary><emphasis role="bold">forall</emphasis> condition</secondary>
16034 </indexterm>
16035 <indexterm role="concept">
16036 <primary>expansion</primary>
16037 <secondary><emphasis role="bold">forany</emphasis> condition</secondary>
16038 </indexterm>
16039 <indexterm role="variable">
16040 <primary><varname>$item</varname></primary>
16041 </indexterm>
16042 These conditions iterate over a list. The first argument is expanded to form
16043 the list. By default, the list separator is a colon, but it can be changed by
16044 the normal method. The second argument is interpreted as a condition that is to
16045 be applied to each item in the list in turn. During the interpretation of the
16046 condition, the current list item is placed in a variable called <varname>$item</varname>.
16047 </para>
16048 <itemizedlist>
16049 <listitem>
16050 <para>
16051 For <emphasis role="bold">forany</emphasis>, interpretation stops if the condition is true for any item, and
16052 the result of the whole condition is true. If the condition is false for all
16053 items in the list, the overall condition is false.
16054 </para>
16055 </listitem>
16056 <listitem>
16057 <para>
16058 For <emphasis role="bold">forall</emphasis>, interpretation stops if the condition is false for any item,
16059 and the result of the whole condition is false. If the condition is true for
16060 all items in the list, the overall condition is true.
16061 </para>
16062 </listitem>
16063 </itemizedlist>
16064 <para>
16065 Note that negation of <emphasis role="bold">forany</emphasis> means that the condition must be false for all
16066 items for the overall condition to succeed, and negation of <emphasis role="bold">forall</emphasis> means
16067 that the condition must be false for at least one item. In this example, the
16068 list separator is changed to a comma:
16069 </para>
16070 <literallayout class="monospaced">
16071 ${if forany{&lt;, $recipients}{match{$item}{^user3@}}{yes}{no}}
16072 </literallayout>
16073 <para>
16074 The value of <varname>$item</varname> is saved and restored while <emphasis role="bold">forany</emphasis> or <emphasis role="bold">forall</emphasis> is
16075 being processed, to enable these expansion items to be nested.
16076 </para>
16077 <para>
16078 To scan a named list, expand it with the <emphasis role="bold">listnamed</emphasis> operator.
16079 </para>
16080 </listitem></varlistentry>
16081 <varlistentry>
16082 <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>
16083 <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>
16084 <listitem>
16085 <para>
16086 <indexterm role="concept">
16087 <primary>string</primary>
16088 <secondary>comparison</secondary>
16089 </indexterm>
16090 <indexterm role="concept">
16091 <primary>expansion</primary>
16092 <secondary>string comparison</secondary>
16093 </indexterm>
16094 <indexterm role="concept">
16095 <primary><option>ge</option> expansion condition</primary>
16096 </indexterm>
16097 <indexterm role="concept">
16098 <primary><option>gei</option> expansion condition</primary>
16099 </indexterm>
16100 The two substrings are first expanded. The condition is true if the first
16101 string is lexically greater than or equal to the second string. For <option>ge</option> the
16102 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
16103 case-independent.
16104 </para>
16105 </listitem></varlistentry>
16106 <varlistentry>
16107 <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>
16108 <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>
16109 <listitem>
16110 <para>
16111 <indexterm role="concept">
16112 <primary>string</primary>
16113 <secondary>comparison</secondary>
16114 </indexterm>
16115 <indexterm role="concept">
16116 <primary>expansion</primary>
16117 <secondary>string comparison</secondary>
16118 </indexterm>
16119 <indexterm role="concept">
16120 <primary><option>gt</option> expansion condition</primary>
16121 </indexterm>
16122 <indexterm role="concept">
16123 <primary><option>gti</option> expansion condition</primary>
16124 </indexterm>
16125 The two substrings are first expanded. The condition is true if the first
16126 string is lexically greater than the second string. For <option>gt</option> the comparison
16127 includes the case of letters, whereas for <option>gti</option> the comparison is
16128 case-independent.
16129 </para>
16130 </listitem></varlistentry>
16131 <varlistentry>
16132 <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>
16133 <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>
16134 <listitem>
16135 <para>
16136 <indexterm role="concept">
16137 <primary>string</primary>
16138 <secondary>comparison</secondary>
16139 </indexterm>
16140 <indexterm role="concept">
16141 <primary>list</primary>
16142 <secondary>iterative conditions</secondary>
16143 </indexterm>
16144 Both strings are expanded; the second string is treated as a list of simple
16145 strings; if the first string is a member of the second, then the condition
16146 is true.
16147 </para>
16148 <para>
16149 These are simpler to use versions of the more powerful <emphasis role="bold">forany</emphasis> condition.
16150 Examples, and the <emphasis role="bold">forany</emphasis> equivalents:
16151 </para>
16152 <literallayout class="monospaced">
16153 ${if inlist{needle}{foo:needle:bar}}
16154   ${if forany{foo:needle:bar}{eq{$item}{needle}}}
16155 ${if inlisti{Needle}{fOo:NeeDLE:bAr}}
16156   ${if forany{fOo:NeeDLE:bAr}{eqi{$item}{Needle}}}
16157 </literallayout>
16158 </listitem></varlistentry>
16159 <varlistentry>
16160 <term><emphasis role="bold">isip&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16161 <term><emphasis role="bold">isip4&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16162 <term><emphasis role="bold">isip6&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16163 <listitem>
16164 <para>
16165 <indexterm role="concept">
16166 <primary>IP address</primary>
16167 <secondary>testing string format</secondary>
16168 </indexterm>
16169 <indexterm role="concept">
16170 <primary>string</primary>
16171 <secondary>testing for IP address</secondary>
16172 </indexterm>
16173 <indexterm role="concept">
16174 <primary><option>isip</option> expansion condition</primary>
16175 </indexterm>
16176 <indexterm role="concept">
16177 <primary><option>isip4</option> expansion condition</primary>
16178 </indexterm>
16179 <indexterm role="concept">
16180 <primary><option>isip6</option> expansion condition</primary>
16181 </indexterm>
16182 The substring is first expanded, and then tested to see if it has the form of
16183 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
16184 <option>isip4</option> and <option>isip6</option> test specifically for IPv4 or IPv6 addresses.
16185 </para>
16186 <para>
16187 For an IPv4 address, the test is for four dot-separated components, each of
16188 which consists of from one to three digits. For an IPv6 address, up to eight
16189 colon-separated components are permitted, each containing from one to four
16190 hexadecimal digits. There may be fewer than eight components if an empty
16191 component (adjacent colons) is present. Only one empty component is permitted.
16192 </para>
16193 <para>
16194 <emphasis role="bold">Note</emphasis>: The checks are just on the form of the address; actual numerical
16195 values are not considered. Thus, for example, 999.999.999.999 passes the IPv4
16196 check. The main use of these tests is to distinguish between IP addresses and
16197 host names, or between IPv4 and IPv6 addresses. For example, you could use
16198 </para>
16199 <literallayout class="monospaced">
16200 ${if isip4{$sender_host_address}...
16201 </literallayout>
16202 <para>
16203 to test which IP version an incoming SMTP connection is using.
16204 </para>
16205 </listitem></varlistentry>
16206 <varlistentry>
16207 <term><emphasis role="bold">ldapauth&nbsp;{</emphasis>&lt;<emphasis>ldap&nbsp;query</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16208 <listitem>
16209 <para>
16210 <indexterm role="concept">
16211 <primary>LDAP</primary>
16212 <secondary>use for authentication</secondary>
16213 </indexterm>
16214 <indexterm role="concept">
16215 <primary>expansion</primary>
16216 <secondary>LDAP authentication test</secondary>
16217 </indexterm>
16218 <indexterm role="concept">
16219 <primary><option>ldapauth</option> expansion condition</primary>
16220 </indexterm>
16221 This condition supports user authentication using LDAP. See section
16222 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
16223 queries. For this use, the query must contain a user name and password. The
16224 query itself is not used, and can be empty. The condition is true if the
16225 password is not empty, and the user name and password are accepted by the LDAP
16226 server. An empty password is rejected without calling LDAP because LDAP binds
16227 with an empty password are considered anonymous regardless of the username, and
16228 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
16229 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
16230 this can be used.
16231 </para>
16232 </listitem></varlistentry>
16233 <varlistentry>
16234 <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>
16235 <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>
16236 <listitem>
16237 <para>
16238 <indexterm role="concept">
16239 <primary>string</primary>
16240 <secondary>comparison</secondary>
16241 </indexterm>
16242 <indexterm role="concept">
16243 <primary>expansion</primary>
16244 <secondary>string comparison</secondary>
16245 </indexterm>
16246 <indexterm role="concept">
16247 <primary><option>le</option> expansion condition</primary>
16248 </indexterm>
16249 <indexterm role="concept">
16250 <primary><option>lei</option> expansion condition</primary>
16251 </indexterm>
16252 The two substrings are first expanded. The condition is true if the first
16253 string is lexically less than or equal to the second string. For <option>le</option> the
16254 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
16255 case-independent.
16256 </para>
16257 </listitem></varlistentry>
16258 <varlistentry>
16259 <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>
16260 <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>
16261 <listitem>
16262 <para>
16263 <indexterm role="concept">
16264 <primary>string</primary>
16265 <secondary>comparison</secondary>
16266 </indexterm>
16267 <indexterm role="concept">
16268 <primary>expansion</primary>
16269 <secondary>string comparison</secondary>
16270 </indexterm>
16271 <indexterm role="concept">
16272 <primary><option>lt</option> expansion condition</primary>
16273 </indexterm>
16274 <indexterm role="concept">
16275 <primary><option>lti</option> expansion condition</primary>
16276 </indexterm>
16277 The two substrings are first expanded. The condition is true if the first
16278 string is lexically less than the second string. For <option>lt</option> the comparison
16279 includes the case of letters, whereas for <option>lti</option> the comparison is
16280 case-independent.
16281 </para>
16282 </listitem></varlistentry>
16283 <varlistentry>
16284 <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>
16285 <listitem>
16286 <para>
16287 <indexterm role="concept">
16288 <primary>expansion</primary>
16289 <secondary>regular expression comparison</secondary>
16290 </indexterm>
16291 <indexterm role="concept">
16292 <primary>regular expressions</primary>
16293 <secondary>match in expanded string</secondary>
16294 </indexterm>
16295 <indexterm role="concept">
16296 <primary><option>match</option> expansion condition</primary>
16297 </indexterm>
16298 The two substrings are first expanded. The second is then treated as a regular
16299 expression and applied to the first. Because of the pre-expansion, if the
16300 regular expression contains dollar, or backslash characters, they must be
16301 escaped. Care must also be taken if the regular expression contains braces
16302 (curly brackets). A closing brace must be escaped so that it is not taken as a
16303 premature termination of &lt;<emphasis>string2</emphasis>&gt;. The easiest approach is to use the
16304 <literal>\N</literal> feature to disable expansion of the regular expression.
16305 For example,
16306 </para>
16307 <literallayout class="monospaced">
16308 ${if match {$local_part}{\N^\d{3}\N} ...
16309 </literallayout>
16310 <para>
16311 If the whole expansion string is in double quotes, further escaping of
16312 backslashes is also required.
16313 </para>
16314 <para>
16315 The condition is true if the regular expression match succeeds.
16316 The regular expression is not required to begin with a circumflex
16317 metacharacter, but if there is no circumflex, the expression is not anchored,
16318 and it may match anywhere in the subject, not just at the start. If you want
16319 the pattern to match at the end of the subject, you must include the <literal>$</literal>
16320 metacharacter at an appropriate point.
16321 </para>
16322 <para>
16323 <indexterm role="concept">
16324 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
16325 <secondary>in <option>if</option> expansion</secondary>
16326 </indexterm>
16327 At the start of an <option>if</option> expansion the values of the numeric variable
16328 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
16329 succeeds causes them to be reset to the substrings of that condition and they
16330 will have these values during the expansion of the success string. At the end
16331 of the <option>if</option> expansion, the previous values are restored. After testing a
16332 combination of conditions using <option>or</option>, the subsequent values of the numeric
16333 variables are those of the condition that succeeded.
16334 </para>
16335 </listitem></varlistentry>
16336 <varlistentry>
16337 <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>
16338 <listitem>
16339 <para>
16340 <indexterm role="concept">
16341 <primary><option>match_address</option> expansion condition</primary>
16342 </indexterm>
16343 See <emphasis role="bold">match_local_part</emphasis>.
16344 </para>
16345 </listitem></varlistentry>
16346 <varlistentry>
16347 <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>
16348 <listitem>
16349 <para>
16350 <indexterm role="concept">
16351 <primary><option>match_domain</option> expansion condition</primary>
16352 </indexterm>
16353 See <emphasis role="bold">match_local_part</emphasis>.
16354 </para>
16355 </listitem></varlistentry>
16356 <varlistentry>
16357 <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>
16358 <listitem>
16359 <para>
16360 <indexterm role="concept">
16361 <primary><option>match_ip</option> expansion condition</primary>
16362 </indexterm>
16363 This condition matches an IP address to a list of IP address patterns. It must
16364 be followed by two argument strings. The first (after expansion) must be an IP
16365 address or an empty string. The second (not expanded) is a restricted host
16366 list that can match only an IP address, not a host name. For example:
16367 </para>
16368 <literallayout class="monospaced">
16369 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
16370 </literallayout>
16371 <para>
16372 The specific types of host list item that are permitted in the list are:
16373 </para>
16374 <itemizedlist>
16375 <listitem>
16376 <para>
16377 An IP address, optionally with a CIDR mask.
16378 </para>
16379 </listitem>
16380 <listitem>
16381 <para>
16382 A single asterisk, which matches any IP address.
16383 </para>
16384 </listitem>
16385 <listitem>
16386 <para>
16387 An empty item, which matches only if the IP address is empty. This could be
16388 useful for testing for a locally submitted message or one from specific hosts
16389 in a single test such as
16390 </para>
16391 <literallayout class="monospaced">
16392   ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
16393 </literallayout>
16394 <para>
16395 where the first item in the list is the empty string.
16396 </para>
16397 </listitem>
16398 <listitem>
16399 <para>
16400 The item @[] matches any of the local host&#x2019;s interface addresses.
16401 </para>
16402 </listitem>
16403 <listitem>
16404 <para>
16405 Single-key lookups are assumed to be like <quote>net-</quote> style lookups in host lists,
16406 even if <literal>net-</literal> is not specified. There is never any attempt to turn the IP
16407 address into a host name. The most common type of linear search for
16408 <emphasis role="bold">match_ip</emphasis> is likely to be <emphasis role="bold">iplsearch</emphasis>, in which the file can contain CIDR
16409 masks. For example:
16410 </para>
16411 <literallayout class="monospaced">
16412   ${if match_ip{$sender_host_address}{iplsearch;/some/file}...
16413 </literallayout>
16414 <para>
16415 It is of course possible to use other kinds of lookup, and in such a case, you
16416 do need to specify the <literal>net-</literal> prefix if you want to specify a specific
16417 address mask, for example:
16418 </para>
16419 <literallayout class="monospaced">
16420   ${if match_ip{$sender_host_address}{net24-dbm;/some/file}...
16421 </literallayout>
16422 <para>
16423 However, unless you are combining a <option>match_ip</option> condition with others, it is
16424 just as easy to use the fact that a lookup is itself a condition, and write:
16425 </para>
16426 <literallayout class="monospaced">
16427   ${lookup{${mask:$sender_host_address/24}}dbm{/a/file}...
16428 </literallayout>
16429 </listitem>
16430 </itemizedlist>
16431 <para>
16432 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
16433 Exim was built with the EXPAND_LISTMATCH_RHS option.
16434 </para>
16435 <para>
16436 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
16437 </para>
16438 </listitem></varlistentry>
16439 <varlistentry>
16440 <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>
16441 <listitem>
16442 <para>
16443 <indexterm role="concept">
16444 <primary>domain list</primary>
16445 <secondary>in expansion condition</secondary>
16446 </indexterm>
16447 <indexterm role="concept">
16448 <primary>address list</primary>
16449 <secondary>in expansion condition</secondary>
16450 </indexterm>
16451 <indexterm role="concept">
16452 <primary>local part</primary>
16453 <secondary>list, in expansion condition</secondary>
16454 </indexterm>
16455 <indexterm role="concept">
16456 <primary><option>match_local_part</option> expansion condition</primary>
16457 </indexterm>
16458 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
16459 possible to test domain, address, and local part lists within expansions. Each
16460 condition requires two arguments: an item and a list to match. A trivial
16461 example is:
16462 </para>
16463 <literallayout class="monospaced">
16464 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
16465 </literallayout>
16466 <para>
16467 In each case, the second argument may contain any of the allowable items for a
16468 list of the appropriate type. Also, because the second argument (after
16469 expansion) is a standard form of list, it is possible to refer to a named list.
16470 Thus, you can use conditions like this:
16471 </para>
16472 <literallayout class="monospaced">
16473 ${if match_domain{$domain}{+local_domains}{...
16474 </literallayout>
16475 <para>
16476 <indexterm role="concept">
16477 <primary><literal>+caseful</literal></primary>
16478 </indexterm>
16479 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
16480 item can be used, as in all address lists, to cause subsequent items to
16481 have their local parts matched casefully. Domains are always matched
16482 caselessly.
16483 </para>
16484 <para>
16485 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
16486 Exim was built with the EXPAND_LISTMATCH_RHS option.
16487 </para>
16488 <para>
16489 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
16490 hosts have two identities: a name and an IP address, and it is not clear
16491 how to specify cleanly how such a test would work. However, IP addresses can be
16492 matched using <option>match_ip</option>.
16493 </para>
16494 </listitem></varlistentry>
16495 <varlistentry>
16496 <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>
16497 <listitem>
16498 <para>
16499 <indexterm role="concept">
16500 <primary>PAM authentication</primary>
16501 </indexterm>
16502 <indexterm role="concept">
16503 <primary>AUTH</primary>
16504 <secondary>with PAM</secondary>
16505 </indexterm>
16506 <indexterm role="concept">
16507 <primary>Solaris</primary>
16508 <secondary>PAM support</secondary>
16509 </indexterm>
16510 <indexterm role="concept">
16511 <primary>expansion</primary>
16512 <secondary>PAM authentication test</secondary>
16513 </indexterm>
16514 <indexterm role="concept">
16515 <primary><option>pam</option> expansion condition</primary>
16516 </indexterm>
16517 <emphasis>Pluggable Authentication Modules</emphasis>
16518 (<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
16519 available in the latest releases of Solaris and in some GNU/Linux
16520 distributions. The Exim support, which is intended for use in conjunction with
16521 the SMTP AUTH command, is available only if Exim is compiled with
16522 </para>
16523 <literallayout class="monospaced">
16524 SUPPORT_PAM=yes
16525 </literallayout>
16526 <para>
16527 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
16528 in some releases of GNU/Linux <option>-ldl</option> is also needed.
16529 </para>
16530 <para>
16531 The argument string is first expanded, and the result must be a
16532 colon-separated list of strings. Leading and trailing white space is ignored.
16533 The PAM module is initialized with the service name <quote>exim</quote> and the user name
16534 taken from the first item in the colon-separated data string (&lt;<emphasis>string1</emphasis>&gt;).
16535 The remaining items in the data string are passed over in response to requests
16536 from the authentication function. In the simple case there will only be one
16537 request, for a password, so the data consists of just two strings.
16538 </para>
16539 <para>
16540 There can be problems if any of the strings are permitted to contain colon
16541 characters. In the usual way, these have to be doubled to avoid being taken as
16542 separators. If the data is being inserted from a variable, the <option>sg</option> expansion
16543 item can be used to double any existing colons. For example, the configuration
16544 of a LOGIN authenticator might contain this setting:
16545 </para>
16546 <literallayout class="monospaced">
16547 server_condition = ${if pam{$auth1:${sg{$auth2}{:}{::}}}}
16548 </literallayout>
16549 <para>
16550 For a PLAIN authenticator you could use:
16551 </para>
16552 <literallayout class="monospaced">
16553 server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}}
16554 </literallayout>
16555 <para>
16556 In some operating systems, PAM authentication can be done only from a process
16557 running as root. Since Exim is running as the Exim user when receiving
16558 messages, this means that PAM cannot be used directly in those systems.
16559 A patched version of the <emphasis>pam_unix</emphasis> module that comes with the
16560 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>.
16561 The patched module allows one special uid/gid combination, in addition to root,
16562 to authenticate. If you build the patched module to allow the Exim user and
16563 group, PAM can then be used from an Exim authenticator.
16564 </para>
16565 </listitem></varlistentry>
16566 <varlistentry>
16567 <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>
16568 <listitem>
16569 <para>
16570 <indexterm role="concept">
16571 <primary><emphasis>pwcheck</emphasis> daemon</primary>
16572 </indexterm>
16573 <indexterm role="concept">
16574 <primary>Cyrus</primary>
16575 </indexterm>
16576 <indexterm role="concept">
16577 <primary>expansion</primary>
16578 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
16579 </indexterm>
16580 <indexterm role="concept">
16581 <primary><option>pwcheck</option> expansion condition</primary>
16582 </indexterm>
16583 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
16584 This is one way of making it possible for passwords to be checked by a process
16585 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
16586 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
16587 </para>
16588 <para>
16589 The pwcheck support is not included in Exim by default. You need to specify
16590 the location of the pwcheck daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
16591 building Exim. For example:
16592 </para>
16593 <literallayout class="monospaced">
16594 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
16595 </literallayout>
16596 <para>
16597 You do not need to install the full Cyrus software suite in order to use
16598 the pwcheck daemon. You can compile and install just the daemon alone
16599 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
16600 access to the <filename>/var/pwcheck</filename> directory.
16601 </para>
16602 <para>
16603 The <option>pwcheck</option> condition takes one argument, which must be the user name and
16604 password, separated by a colon. For example, in a LOGIN authenticator
16605 configuration, you might have this:
16606 </para>
16607 <literallayout class="monospaced">
16608 server_condition = ${if pwcheck{$auth1:$auth2}}
16609 </literallayout>
16610 <para>
16611 Again, for a PLAIN authenticator configuration, this would be:
16612 </para>
16613 <literallayout class="monospaced">
16614 server_condition = ${if pwcheck{$auth2:$auth3}}
16615 </literallayout>
16616 </listitem></varlistentry>
16617 <varlistentry>
16618 <term><emphasis role="bold">queue_running</emphasis></term>
16619 <listitem>
16620 <para>
16621 <indexterm role="concept">
16622 <primary>queue runner</primary>
16623 <secondary>detecting when delivering from</secondary>
16624 </indexterm>
16625 <indexterm role="concept">
16626 <primary>expansion</primary>
16627 <secondary>queue runner test</secondary>
16628 </indexterm>
16629 <indexterm role="concept">
16630 <primary><option>queue_running</option> expansion condition</primary>
16631 </indexterm>
16632 This condition, which has no data, is true during delivery attempts that are
16633 initiated by queue runner processes, and false otherwise.
16634 </para>
16635 </listitem></varlistentry>
16636 <varlistentry>
16637 <term><emphasis role="bold">radius&nbsp;{</emphasis>&lt;<emphasis>authentication&nbsp;string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16638 <listitem>
16639 <para>
16640 <indexterm role="concept">
16641 <primary>Radius</primary>
16642 </indexterm>
16643 <indexterm role="concept">
16644 <primary>expansion</primary>
16645 <secondary>Radius authentication</secondary>
16646 </indexterm>
16647 <indexterm role="concept">
16648 <primary><option>radius</option> expansion condition</primary>
16649 </indexterm>
16650 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
16651 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
16652 the Radius client configuration file in order to build Exim with Radius
16653 support.
16654 </para>
16655 <para>
16656 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
16657 library, using the original API. If you are using release 0.4.0 or later of
16658 this library, you need to set
16659 </para>
16660 <literallayout class="monospaced">
16661 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
16662 </literallayout>
16663 <para>
16664 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
16665 <option>libradius</option> library that comes with FreeBSD. To do this, set
16666 </para>
16667 <literallayout class="monospaced">
16668 RADIUS_LIB_TYPE=RADLIB
16669 </literallayout>
16670 <para>
16671 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
16672 You may also have to supply a suitable setting in EXTRALIBS so that the
16673 Radius library can be found when Exim is linked.
16674 </para>
16675 <para>
16676 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
16677 Radius client library, which calls the Radius server. The condition is true if
16678 the authentication is successful. For example:
16679 </para>
16680 <literallayout class="monospaced">
16681 server_condition = ${if radius{&lt;arguments&gt;}}
16682 </literallayout>
16683 </listitem></varlistentry>
16684 <varlistentry>
16685 <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>
16686 <listitem>
16687 <para>
16688 <indexterm role="concept">
16689 <primary><emphasis>saslauthd</emphasis> daemon</primary>
16690 </indexterm>
16691 <indexterm role="concept">
16692 <primary>Cyrus</primary>
16693 </indexterm>
16694 <indexterm role="concept">
16695 <primary>expansion</primary>
16696 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
16697 </indexterm>
16698 <indexterm role="concept">
16699 <primary><option>saslauthd</option> expansion condition</primary>
16700 </indexterm>
16701 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
16702 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
16703 Using this daemon is one way of making it possible for passwords to be checked
16704 by a process that is not running as root.
16705 </para>
16706 <para>
16707 The saslauthd support is not included in Exim by default. You need to specify
16708 the location of the saslauthd daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
16709 building Exim. For example:
16710 </para>
16711 <literallayout class="monospaced">
16712 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
16713 </literallayout>
16714 <para>
16715 You do not need to install the full Cyrus software suite in order to use
16716 the saslauthd daemon. You can compile and install just the daemon alone
16717 from the Cyrus SASL library.
16718 </para>
16719 <para>
16720 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
16721 two are mandatory. For example:
16722 </para>
16723 <literallayout class="monospaced">
16724 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
16725 </literallayout>
16726 <para>
16727 The service and the realm are optional (which is why the arguments are enclosed
16728 in their own set of braces). For details of the meaning of the service and
16729 realm, and how to run the daemon, consult the Cyrus documentation.
16730 </para>
16731 </listitem></varlistentry>
16732 </variablelist>
16733 </section>
16734 <section id="SECID84">
16735 <title>Combining expansion conditions</title>
16736 <para>
16737 <indexterm role="concept">
16738 <primary>expansion</primary>
16739 <secondary>combining conditions</secondary>
16740 </indexterm>
16741 Several conditions can be tested at once by combining them using the <option>and</option>
16742 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
16743 conditions on their own, and precede their lists of sub-conditions. Each
16744 sub-condition must be enclosed in braces within the overall braces that contain
16745 the list. No repetition of <option>if</option> is used.
16746 </para>
16747 <variablelist>
16748 <varlistentry>
16749 <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>
16750 <listitem>
16751 <para>
16752 <indexterm role="concept">
16753 <primary><quote>or</quote> expansion condition</primary>
16754 </indexterm>
16755 <indexterm role="concept">
16756 <primary>expansion</primary>
16757 <secondary><quote>or</quote> of conditions</secondary>
16758 </indexterm>
16759 The sub-conditions are evaluated from left to right. The condition is true if
16760 any one of the sub-conditions is true.
16761 For example,
16762 </para>
16763 <literallayout class="monospaced">
16764 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
16765 </literallayout>
16766 <para>
16767 When a true sub-condition is found, the following ones are parsed but not
16768 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
16769 numeric variables afterwards are taken from the first one that succeeds.
16770 </para>
16771 </listitem></varlistentry>
16772 <varlistentry>
16773 <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>
16774 <listitem>
16775 <para>
16776 <indexterm role="concept">
16777 <primary><quote>and</quote> expansion condition</primary>
16778 </indexterm>
16779 <indexterm role="concept">
16780 <primary>expansion</primary>
16781 <secondary><quote>and</quote> of conditions</secondary>
16782 </indexterm>
16783 The sub-conditions are evaluated from left to right. The condition is true if
16784 all of the sub-conditions are true. If there are several <quote>match</quote>
16785 sub-conditions, the values of the numeric variables afterwards are taken from
16786 the last one. When a false sub-condition is found, the following ones are
16787 parsed but not evaluated.
16788 </para>
16789 </listitem></varlistentry>
16790 </variablelist>
16791 <para>
16792 <indexterm role="concept" startref="IIDexpcond" class="endofrange"/>
16793 </para>
16794 </section>
16795 <section id="SECTexpvar">
16796 <title>Expansion variables</title>
16797 <para>
16798 <indexterm role="concept">
16799 <primary>expansion</primary>
16800 <secondary>variables, list of</secondary>
16801 </indexterm>
16802 This section contains an alphabetical list of all the expansion variables. Some
16803 of them are available only when Exim is compiled with specific options such as
16804 support for TLS or the content scanning extension.
16805 </para>
16806 <variablelist>
16807 <varlistentry>
16808 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
16809 <listitem>
16810 <para>
16811 <indexterm role="concept">
16812 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
16813 </indexterm>
16814 When a <option>match</option> expansion condition succeeds, these variables contain the
16815 captured substrings identified by the regular expression during subsequent
16816 processing of the success string of the containing <option>if</option> expansion item.
16817 However, they do not retain their values afterwards; in fact, their previous
16818 values are restored at the end of processing an <option>if</option> item. The numerical
16819 variables may also be set externally by some other matching process which
16820 precedes the expansion of the string. For example, the commands available in
16821 Exim filter files include an <option>if</option> command with its own regular expression
16822 matching condition.
16823 </para>
16824 </listitem></varlistentry>
16825 <varlistentry>
16826 <term><varname>$acl_arg1</varname>, <varname>$acl_arg2</varname>, etc</term>
16827 <listitem>
16828 <para>
16829 Within an acl condition, expansion condition or expansion item
16830 any arguments are copied to these variables,
16831 any unused variables being made empty.
16832 </para>
16833 </listitem></varlistentry>
16834 <varlistentry>
16835 <term><varname>$acl_c...</varname></term>
16836 <listitem>
16837 <para>
16838 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
16839 can be given any name that starts with <varname>$acl_c</varname> and is at least six characters
16840 long, but the sixth character must be either a digit or an underscore. For
16841 example: <varname>$acl_c5</varname>, <varname>$acl_c_mycount</varname>. The values of the <varname>$acl_c...</varname>
16842 variables persist throughout the lifetime of an SMTP connection. They can be
16843 used to pass information between ACLs and between different invocations of the
16844 same ACL. When a message is received, the values of these variables are saved
16845 with the message, and can be accessed by filters, routers, and transports
16846 during subsequent delivery.
16847 </para>
16848 </listitem></varlistentry>
16849 <varlistentry>
16850 <term><varname>$acl_m...</varname></term>
16851 <listitem>
16852 <para>
16853 These variables are like the <varname>$acl_c...</varname> variables, except that their values
16854 are reset after a message has been received. Thus, if several messages are
16855 received in one SMTP connection, <varname>$acl_m...</varname> values are not passed on from one
16856 message to the next, as <varname>$acl_c...</varname> values are. The <varname>$acl_m...</varname> variables are
16857 also reset by MAIL, RSET, EHLO, HELO, and after starting a TLS session. When a
16858 message is received, the values of these variables are saved with the message,
16859 and can be accessed by filters, routers, and transports during subsequent
16860 delivery.
16861 </para>
16862 </listitem></varlistentry>
16863 <varlistentry>
16864 <term><varname>$acl_narg</varname></term>
16865 <listitem>
16866 <para>
16867 Within an acl condition, expansion condition or expansion item
16868 this variable has the number of arguments.
16869 </para>
16870 </listitem></varlistentry>
16871 <varlistentry>
16872 <term><varname>$acl_verify_message</varname></term>
16873 <listitem>
16874 <para>
16875 <indexterm role="variable">
16876 <primary><varname>$acl_verify_message</varname></primary>
16877 </indexterm>
16878 After an address verification has failed, this variable contains the failure
16879 message. It retains its value for use in subsequent modifiers. The message can
16880 be preserved by coding like this:
16881 </para>
16882 <literallayout class="monospaced">
16883 warn !verify = sender
16884      set acl_m0 = $acl_verify_message
16885 </literallayout>
16886 <para>
16887 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
16888 <option>log_message</option> modifiers, to include information about the verification
16889 failure.
16890 </para>
16891 </listitem></varlistentry>
16892 <varlistentry>
16893 <term><varname>$address_data</varname></term>
16894 <listitem>
16895 <para>
16896 <indexterm role="variable">
16897 <primary><varname>$address_data</varname></primary>
16898 </indexterm>
16899 This variable is set by means of the <option>address_data</option> option in routers. The
16900 value then remains with the address while it is processed by subsequent routers
16901 and eventually a transport. If the transport is handling multiple addresses,
16902 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
16903 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
16904 user filter files.
16905 </para>
16906 <para>
16907 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
16908 a recipient address, the final value is still in the variable for subsequent
16909 conditions and modifiers of the ACL statement. If routing the address caused it
16910 to be redirected to just one address, the child address is also routed as part
16911 of the verification, and in this case the final value of <varname>$address_data</varname> is
16912 from the child&#x2019;s routing.
16913 </para>
16914 <para>
16915 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
16916 sender address, the final value is also preserved, but this time in
16917 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
16918 address.
16919 </para>
16920 <para>
16921 In both cases (recipient and sender verification), the value does not persist
16922 after the end of the current ACL statement. If you want to preserve
16923 these values for longer, you can save them in ACL variables.
16924 </para>
16925 </listitem></varlistentry>
16926 <varlistentry>
16927 <term><varname>$address_file</varname></term>
16928 <listitem>
16929 <para>
16930 <indexterm role="variable">
16931 <primary><varname>$address_file</varname></primary>
16932 </indexterm>
16933 When, as a result of aliasing, forwarding, or filtering, a message is directed
16934 to a specific file, this variable holds the name of the file when the transport
16935 is running. At other times, the variable is empty. For example, using the
16936 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
16937 </para>
16938 <literallayout class="monospaced">
16939 /home/r2d2/savemail
16940 </literallayout>
16941 <para>
16942 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
16943 contains the text string <literal>/home/r2d2/savemail</literal>.
16944 <indexterm role="concept">
16945 <primary>Sieve filter</primary>
16946 <secondary>value of <varname>$address_file</varname></secondary>
16947 </indexterm>
16948 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
16949 then up to the transport configuration to generate an appropriate absolute path
16950 to the relevant file.
16951 </para>
16952 </listitem></varlistentry>
16953 <varlistentry>
16954 <term><varname>$address_pipe</varname></term>
16955 <listitem>
16956 <para>
16957 <indexterm role="variable">
16958 <primary><varname>$address_pipe</varname></primary>
16959 </indexterm>
16960 When, as a result of aliasing or forwarding, a message is directed to a pipe,
16961 this variable holds the pipe command when the transport is running.
16962 </para>
16963 </listitem></varlistentry>
16964 <varlistentry>
16965 <term><varname>$auth1</varname> &ndash; <varname>$auth3</varname></term>
16966 <listitem>
16967 <para>
16968 <indexterm role="variable">
16969 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
16970 </indexterm>
16971 These variables are used in SMTP authenticators (see chapters
16972 <xref linkend="CHAPplaintext"/>&ndash;<xref linkend="CHAPspa"/>). Elsewhere, they are empty.
16973 </para>
16974 </listitem></varlistentry>
16975 <varlistentry>
16976 <term><varname>$authenticated_id</varname></term>
16977 <listitem>
16978 <para>
16979 <indexterm role="concept">
16980 <primary>authentication</primary>
16981 <secondary>id</secondary>
16982 </indexterm>
16983 <indexterm role="variable">
16984 <primary><varname>$authenticated_id</varname></primary>
16985 </indexterm>
16986 When a server successfully authenticates a client it may be configured to
16987 preserve some of the authentication information in the variable
16988 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
16989 user/password authenticator configuration might preserve the user name for use
16990 in the routers. Note that this is not the same information that is saved in
16991 <varname>$sender_host_authenticated</varname>.
16992 When a message is submitted locally (that is, not over a TCP connection)
16993 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
16994 process. However, a trusted user can override this by means of the <option>-oMai</option>
16995 command line option.
16996 </para>
16997 </listitem></varlistentry>
16998 <varlistentry>
16999 <term><varname>$authenticated_fail_id</varname></term>
17000 <listitem>
17001 <para>
17002 <indexterm role="concept">
17003 <primary>authentication</primary>
17004 <secondary>fail</secondary>
17005 </indexterm>
17006 <indexterm role="variable">
17007 <primary><varname>$authenticated_fail_id</varname></primary>
17008 </indexterm>
17009 When an authentication attempt fails, the variable <varname>$authenticated_fail_id</varname>
17010 will contain the failed authentication id. If more than one authentication
17011 id is attempted, it will contain only the last one. The variable is
17012 available for processing in the ACL&#x2019;s, generally the quit or notquit ACL.
17013 A message to a local recipient could still be accepted without requiring
17014 authentication, which means this variable could also be visible in all of
17015 the ACL&#x2019;s as well.
17016 </para>
17017 </listitem></varlistentry>
17018 <varlistentry>
17019 <term><varname>$authenticated_sender</varname></term>
17020 <listitem>
17021 <para>
17022 <indexterm role="concept">
17023 <primary>sender</primary>
17024 <secondary>authenticated</secondary>
17025 </indexterm>
17026 <indexterm role="concept">
17027 <primary>authentication</primary>
17028 <secondary>sender</secondary>
17029 </indexterm>
17030 <indexterm role="concept">
17031 <primary>AUTH</primary>
17032 <secondary>on MAIL command</secondary>
17033 </indexterm>
17034 <indexterm role="variable">
17035 <primary><varname>$authenticated_sender</varname></primary>
17036 </indexterm>
17037 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
17038 SMTP MAIL command if it believes the sender is sufficiently trusted, as
17039 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
17040 <quote>&lt;&gt;</quote>, it is set as the authenticated sender of the message, and the value is
17041 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
17042 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
17043 </para>
17044 <para>
17045 <indexterm role="variable">
17046 <primary><varname>$qualify_domain</varname></primary>
17047 </indexterm>
17048 When a message is submitted locally (that is, not over a TCP connection), the
17049 value of <varname>$authenticated_sender</varname> is an address constructed from the login
17050 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
17051 can override this by means of the <option>-oMas</option> command line option.
17052 </para>
17053 </listitem></varlistentry>
17054 <varlistentry>
17055 <term><varname>$authentication_failed</varname></term>
17056 <listitem>
17057 <para>
17058 <indexterm role="concept">
17059 <primary>authentication</primary>
17060 <secondary>failure</secondary>
17061 </indexterm>
17062 <indexterm role="variable">
17063 <primary><varname>$authentication_failed</varname></primary>
17064 </indexterm>
17065 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
17066 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
17067 possible to distinguish between <quote>did not try to authenticate</quote>
17068 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
17069 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
17070 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>). Failure includes any
17071 negative response to an AUTH command, including (for example) an attempt to use
17072 an undefined mechanism.
17073 </para>
17074 </listitem></varlistentry>
17075 <varlistentry>
17076 <term><varname>$av_failed</varname></term>
17077 <listitem>
17078 <para>
17079 <indexterm role="concept">
17080 <primary>content scanning</primary>
17081 <secondary>AV scanner failure</secondary>
17082 </indexterm>
17083 This variable is available when Exim is compiled with the content-scanning
17084 extension. It is set to <quote>0</quote> by default, but will be set to <quote>1</quote> if any
17085 problem occurs with the virus scanner (specified by <option>av_scanner</option>) during
17086 the ACL malware condition.
17087 </para>
17088 </listitem></varlistentry>
17089 <varlistentry>
17090 <term><varname>$body_linecount</varname></term>
17091 <listitem>
17092 <para>
17093 <indexterm role="concept">
17094 <primary>message body</primary>
17095 <secondary>line count</secondary>
17096 </indexterm>
17097 <indexterm role="concept">
17098 <primary>body of message</primary>
17099 <secondary>line count</secondary>
17100 </indexterm>
17101 <indexterm role="variable">
17102 <primary><varname>$body_linecount</varname></primary>
17103 </indexterm>
17104 When a message is being received or delivered, this variable contains the
17105 number of lines in the message&#x2019;s body. See also <varname>$message_linecount</varname>.
17106 </para>
17107 </listitem></varlistentry>
17108 <varlistentry>
17109 <term><varname>$body_zerocount</varname></term>
17110 <listitem>
17111 <para>
17112 <indexterm role="concept">
17113 <primary>message body</primary>
17114 <secondary>binary zero count</secondary>
17115 </indexterm>
17116 <indexterm role="concept">
17117 <primary>body of message</primary>
17118 <secondary>binary zero count</secondary>
17119 </indexterm>
17120 <indexterm role="concept">
17121 <primary>binary zero</primary>
17122 <secondary>in message body</secondary>
17123 </indexterm>
17124 <indexterm role="variable">
17125 <primary><varname>$body_zerocount</varname></primary>
17126 </indexterm>
17127 When a message is being received or delivered, this variable contains the
17128 number of binary zero bytes (ASCII NULs) in the message&#x2019;s body.
17129 </para>
17130 </listitem></varlistentry>
17131 <varlistentry>
17132 <term><varname>$bounce_recipient</varname></term>
17133 <listitem>
17134 <para>
17135 <indexterm role="variable">
17136 <primary><varname>$bounce_recipient</varname></primary>
17137 </indexterm>
17138 This is set to the recipient address of a bounce message while Exim is creating
17139 it. It is useful if a customized bounce message text file is in use (see
17140 chapter <xref linkend="CHAPemsgcust"/>).
17141 </para>
17142 </listitem></varlistentry>
17143 <varlistentry>
17144 <term><varname>$bounce_return_size_limit</varname></term>
17145 <listitem>
17146 <para>
17147 <indexterm role="variable">
17148 <primary><varname>$bounce_return_size_limit</varname></primary>
17149 </indexterm>
17150 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
17151 up to a multiple of 1000. It is useful when a customized error message text
17152 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
17153 </para>
17154 </listitem></varlistentry>
17155 <varlistentry>
17156 <term><varname>$caller_gid</varname></term>
17157 <listitem>
17158 <para>
17159 <indexterm role="concept">
17160 <primary>gid (group id)</primary>
17161 <secondary>caller</secondary>
17162 </indexterm>
17163 <indexterm role="variable">
17164 <primary><varname>$caller_gid</varname></primary>
17165 </indexterm>
17166 The real group id under which the process that called Exim was running. This is
17167 not the same as the group id of the originator of a message (see
17168 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
17169 incarnation normally contains the Exim gid.
17170 </para>
17171 </listitem></varlistentry>
17172 <varlistentry>
17173 <term><varname>$caller_uid</varname></term>
17174 <listitem>
17175 <para>
17176 <indexterm role="concept">
17177 <primary>uid (user id)</primary>
17178 <secondary>caller</secondary>
17179 </indexterm>
17180 <indexterm role="variable">
17181 <primary><varname>$caller_uid</varname></primary>
17182 </indexterm>
17183 The real user id under which the process that called Exim was running. This is
17184 not the same as the user id of the originator of a message (see
17185 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
17186 incarnation normally contains the Exim uid.
17187 </para>
17188 </listitem></varlistentry>
17189 <varlistentry>
17190 <term><varname>$compile_date</varname></term>
17191 <listitem>
17192 <para>
17193 <indexterm role="variable">
17194 <primary><varname>$compile_date</varname></primary>
17195 </indexterm>
17196 The date on which the Exim binary was compiled.
17197 </para>
17198 </listitem></varlistentry>
17199 <varlistentry>
17200 <term><varname>$compile_number</varname></term>
17201 <listitem>
17202 <para>
17203 <indexterm role="variable">
17204 <primary><varname>$compile_number</varname></primary>
17205 </indexterm>
17206 The building process for Exim keeps a count of the number
17207 of times it has been compiled. This serves to distinguish different
17208 compilations of the same version of the program.
17209 </para>
17210 </listitem></varlistentry>
17211 <varlistentry>
17212 <term><varname>$demime_errorlevel</varname></term>
17213 <listitem>
17214 <para>
17215 <indexterm role="variable">
17216 <primary><varname>$demime_errorlevel</varname></primary>
17217 </indexterm>
17218 This variable is available when Exim is compiled with
17219 the content-scanning extension and the obsolete <option>demime</option> condition. For
17220 details, see section <xref linkend="SECTdemimecond"/>.
17221 </para>
17222 </listitem></varlistentry>
17223 <varlistentry>
17224 <term><varname>$demime_reason</varname></term>
17225 <listitem>
17226 <para>
17227 <indexterm role="variable">
17228 <primary><varname>$demime_reason</varname></primary>
17229 </indexterm>
17230 This variable is available when Exim is compiled with the
17231 content-scanning extension and the obsolete <option>demime</option> condition. For details,
17232 see section <xref linkend="SECTdemimecond"/>.
17233 </para>
17234 </listitem></varlistentry>
17235 <varlistentry>
17236 <term><varname>$dnslist_domain</varname></term>
17237 <term><varname>$dnslist_matched</varname></term>
17238 <term><varname>$dnslist_text</varname></term>
17239 <term><varname>$dnslist_value</varname></term>
17240 <listitem>
17241 <para>
17242 <indexterm role="variable">
17243 <primary><varname>$dnslist_domain</varname></primary>
17244 </indexterm>
17245 <indexterm role="variable">
17246 <primary><varname>$dnslist_matched</varname></primary>
17247 </indexterm>
17248 <indexterm role="variable">
17249 <primary><varname>$dnslist_text</varname></primary>
17250 </indexterm>
17251 <indexterm role="variable">
17252 <primary><varname>$dnslist_value</varname></primary>
17253 </indexterm>
17254 <indexterm role="concept">
17255 <primary>black list (DNS)</primary>
17256 </indexterm>
17257 When a DNS (black) list lookup succeeds, these variables are set to contain
17258 the following data from the lookup: the list&#x2019;s domain name, the key that was
17259 looked up, the contents of any associated TXT record, and the value from the
17260 main A record. See section <xref linkend="SECID204"/> for more details.
17261 </para>
17262 </listitem></varlistentry>
17263 <varlistentry>
17264 <term><varname>$domain</varname></term>
17265 <listitem>
17266 <para>
17267 <indexterm role="variable">
17268 <primary><varname>$domain</varname></primary>
17269 </indexterm>
17270 When an address is being routed, or delivered on its own, this variable
17271 contains the domain. Uppercase letters in the domain are converted into lower
17272 case for <varname>$domain</varname>.
17273 </para>
17274 <para>
17275 Global address rewriting happens when a message is received, so the value of
17276 <varname>$domain</varname> during routing and delivery is the value after rewriting. <varname>$domain</varname>
17277 is set during user filtering, but not during system filtering, because a
17278 message may have many recipients and the system filter is called just once.
17279 </para>
17280 <para>
17281 When more than one address is being delivered at once (for example, several
17282 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
17283 have the same domain. Transports can be restricted to handling only one domain
17284 at a time if the value of <varname>$domain</varname> is required at transport time &ndash; this is
17285 the default for local transports. For further details of the environment in
17286 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
17287 </para>
17288 <para>
17289 <indexterm role="option">
17290 <primary><option>delay_warning_condition</option></primary>
17291 </indexterm>
17292 At the end of a delivery, if all deferred addresses have the same domain, it is
17293 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
17294 </para>
17295 <para>
17296 The <varname>$domain</varname> variable is also used in some other circumstances:
17297 </para>
17298 <itemizedlist>
17299 <listitem>
17300 <para>
17301 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
17302 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
17303 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
17304 normally set during the running of the MAIL ACL. However, if the sender address
17305 is verified with a callout during the MAIL ACL, the sender domain is placed in
17306 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
17307 the <command>smtp</command> transport.
17308 </para>
17309 </listitem>
17310 <listitem>
17311 <para>
17312 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
17313 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
17314 it can be used in the expansion of the replacement address, for example, to
17315 rewrite domains by file lookup.
17316 </para>
17317 </listitem>
17318 <listitem>
17319 <para>
17320 With one important exception, whenever a domain list is being scanned,
17321 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
17322 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
17323 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
17324 that, in a RCPT ACL, the sender domain list can be dependent on the
17325 recipient domain (which is what is in <varname>$domain</varname> at this time).
17326 </para>
17327 </listitem>
17328 <listitem>
17329 <para>
17330 <indexterm role="concept">
17331 <primary>ETRN</primary>
17332 <secondary>value of <varname>$domain</varname></secondary>
17333 </indexterm>
17334 <indexterm role="option">
17335 <primary><option>smtp_etrn_command</option></primary>
17336 </indexterm>
17337 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
17338 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
17339 </para>
17340 </listitem>
17341 </itemizedlist>
17342 </listitem></varlistentry>
17343 <varlistentry>
17344 <term><varname>$domain_data</varname></term>
17345 <listitem>
17346 <para>
17347 <indexterm role="variable">
17348 <primary><varname>$domain_data</varname></primary>
17349 </indexterm>
17350 When the <option>domains</option> option on a router matches a domain by
17351 means of a lookup, the data read by the lookup is available during the running
17352 of the router as <varname>$domain_data</varname>. In addition, if the driver routes the
17353 address to a transport, the value is available in that transport. If the
17354 transport is handling multiple addresses, the value from the first address is
17355 used.
17356 </para>
17357 <para>
17358 <varname>$domain_data</varname> is also set when the <option>domains</option> condition in an ACL matches a
17359 domain by means of a lookup. The data read by the lookup is available during
17360 the rest of the ACL statement. In all other situations, this variable expands
17361 to nothing.
17362 </para>
17363 </listitem></varlistentry>
17364 <varlistentry>
17365 <term><varname>$exim_gid</varname></term>
17366 <listitem>
17367 <para>
17368 <indexterm role="variable">
17369 <primary><varname>$exim_gid</varname></primary>
17370 </indexterm>
17371 This variable contains the numerical value of the Exim group id.
17372 </para>
17373 </listitem></varlistentry>
17374 <varlistentry>
17375 <term><varname>$exim_path</varname></term>
17376 <listitem>
17377 <para>
17378 <indexterm role="variable">
17379 <primary><varname>$exim_path</varname></primary>
17380 </indexterm>
17381 This variable contains the path to the Exim binary.
17382 </para>
17383 </listitem></varlistentry>
17384 <varlistentry>
17385 <term><varname>$exim_uid</varname></term>
17386 <listitem>
17387 <para>
17388 <indexterm role="variable">
17389 <primary><varname>$exim_uid</varname></primary>
17390 </indexterm>
17391 This variable contains the numerical value of the Exim user id.
17392 </para>
17393 </listitem></varlistentry>
17394 <varlistentry>
17395 <term><varname>$found_extension</varname></term>
17396 <listitem>
17397 <para>
17398 <indexterm role="variable">
17399 <primary><varname>$found_extension</varname></primary>
17400 </indexterm>
17401 This variable is available when Exim is compiled with the
17402 content-scanning extension and the obsolete <option>demime</option> condition. For details,
17403 see section <xref linkend="SECTdemimecond"/>.
17404 </para>
17405 </listitem></varlistentry>
17406 <varlistentry>
17407 <term><varname>$header_</varname>&lt;<emphasis>name</emphasis>&gt;</term>
17408 <listitem>
17409 <para>
17410 This is not strictly an expansion variable. It is expansion syntax for
17411 inserting the message header line with the given name. Note that the name must
17412 be terminated by colon or white space, because it may contain a wide variety of
17413 characters. Note also that braces must <emphasis>not</emphasis> be used.
17414 </para>
17415 </listitem></varlistentry>
17416 <varlistentry>
17417 <term><varname>$headers_added</varname></term>
17418 <listitem>
17419 <para>
17420 <indexterm role="variable">
17421 <primary><varname>$headers_added</varname></primary>
17422 </indexterm>
17423 Within an ACL this variable contains the headers added so far by
17424 the ACL modifier add_header (section <xref linkend="SECTaddheadacl"/>).
17425 The headers are a newline-separated list.
17426 </para>
17427 </listitem></varlistentry>
17428 <varlistentry>
17429 <term><varname>$home</varname></term>
17430 <listitem>
17431 <para>
17432 <indexterm role="variable">
17433 <primary><varname>$home</varname></primary>
17434 </indexterm>
17435 When the <option>check_local_user</option> option is set for a router, the user&#x2019;s home
17436 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
17437 means it is set during the running of users&#x2019; filter files. A router may also
17438 explicitly set a home directory for use by a transport; this can be overridden
17439 by a setting on the transport itself.
17440 </para>
17441 <para>
17442 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
17443 of the environment variable HOME.
17444 </para>
17445 </listitem></varlistentry>
17446 <varlistentry>
17447 <term><varname>$host</varname></term>
17448 <listitem>
17449 <para>
17450 <indexterm role="variable">
17451 <primary><varname>$host</varname></primary>
17452 </indexterm>
17453 If a router assigns an address to a transport (any transport), and passes a
17454 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
17455 to run is the name of the first host on the list. Note that this applies both
17456 to local and remote transports.
17457 </para>
17458 <para>
17459 <indexterm role="concept">
17460 <primary>transport</primary>
17461 <secondary>filter</secondary>
17462 </indexterm>
17463 <indexterm role="concept">
17464 <primary>filter</primary>
17465 <secondary>transport filter</secondary>
17466 </indexterm>
17467 For the <command>smtp</command> transport, if there is more than one host, the value of
17468 <varname>$host</varname> changes as the transport works its way through the list. In
17469 particular, when the <command>smtp</command> transport is expanding its options for encryption
17470 using TLS, or for specifying a transport filter (see chapter
17471 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
17472 is connected.
17473 </para>
17474 <para>
17475 When used in the client part of an authenticator configuration (see chapter
17476 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
17477 client is connected.
17478 </para>
17479 </listitem></varlistentry>
17480 <varlistentry>
17481 <term><varname>$host_address</varname></term>
17482 <listitem>
17483 <para>
17484 <indexterm role="variable">
17485 <primary><varname>$host_address</varname></primary>
17486 </indexterm>
17487 This variable is set to the remote host&#x2019;s IP address whenever <varname>$host</varname> is set
17488 for a remote connection. It is also set to the IP address that is being checked
17489 when the <option>ignore_target_hosts</option> option is being processed.
17490 </para>
17491 </listitem></varlistentry>
17492 <varlistentry>
17493 <term><varname>$host_data</varname></term>
17494 <listitem>
17495 <para>
17496 <indexterm role="variable">
17497 <primary><varname>$host_data</varname></primary>
17498 </indexterm>
17499 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
17500 result of the lookup is made available in the <varname>$host_data</varname> variable. This
17501 allows you, for example, to do things like this:
17502 </para>
17503 <literallayout class="monospaced">
17504 deny  hosts = net-lsearch;/some/file
17505 message = $host_data
17506 </literallayout>
17507 </listitem></varlistentry>
17508 <varlistentry>
17509 <term><varname>$host_lookup_deferred</varname></term>
17510 <listitem>
17511 <para>
17512 <indexterm role="concept">
17513 <primary>host name</primary>
17514 <secondary>lookup, failure of</secondary>
17515 </indexterm>
17516 <indexterm role="variable">
17517 <primary><varname>$host_lookup_deferred</varname></primary>
17518 </indexterm>
17519 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
17520 message comes from a remote host and there is an attempt to look up the host&#x2019;s
17521 name from its IP address, and the attempt is not successful, one of these
17522 variables is set to <quote>1</quote>.
17523 </para>
17524 <itemizedlist>
17525 <listitem>
17526 <para>
17527 If the lookup receives a definite negative response (for example, a DNS lookup
17528 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
17529 </para>
17530 </listitem>
17531 <listitem>
17532 <para>
17533 If there is any kind of problem during the lookup, such that Exim cannot
17534 tell whether or not the host name is defined (for example, a timeout for a DNS
17535 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
17536 </para>
17537 </listitem>
17538 </itemizedlist>
17539 <para>
17540 Looking up a host&#x2019;s name from its IP address consists of more than just a
17541 single reverse lookup. Exim checks that a forward lookup of at least one of the
17542 names it receives from a reverse lookup yields the original IP address. If this
17543 is not the case, Exim does not accept the looked up name(s), and
17544 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
17545 IP address (for example, the existence of a PTR record in the DNS) is not
17546 sufficient on its own for the success of a host name lookup. If the reverse
17547 lookup succeeds, but there is a lookup problem such as a timeout when checking
17548 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
17549 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
17550 </para>
17551 </listitem></varlistentry>
17552 <varlistentry>
17553 <term><varname>$host_lookup_failed</varname></term>
17554 <listitem>
17555 <para>
17556 <indexterm role="variable">
17557 <primary><varname>$host_lookup_failed</varname></primary>
17558 </indexterm>
17559 See <varname>$host_lookup_deferred</varname>.
17560 </para>
17561 </listitem></varlistentry>
17562 <varlistentry>
17563 <term><varname>$host_port</varname></term>
17564 <listitem>
17565 <para>
17566 <indexterm role="variable">
17567 <primary><varname>$host_port</varname></primary>
17568 </indexterm>
17569 This variable is set to the remote host&#x2019;s TCP port whenever <varname>$host</varname> is set
17570 for an outbound connection.
17571 </para>
17572 </listitem></varlistentry>
17573 <varlistentry>
17574 <term><varname>$inode</varname></term>
17575 <listitem>
17576 <para>
17577 <indexterm role="variable">
17578 <primary><varname>$inode</varname></primary>
17579 </indexterm>
17580 The only time this variable is set is while expanding the <option>directory_file</option>
17581 option in the <command>appendfile</command> transport. The variable contains the inode number
17582 of the temporary file which is about to be renamed. It can be used to construct
17583 a unique name for the file.
17584 </para>
17585 </listitem></varlistentry>
17586 <varlistentry>
17587 <term><varname>$interface_address</varname></term>
17588 <listitem>
17589 <para>
17590 <indexterm role="variable">
17591 <primary><varname>$interface_address</varname></primary>
17592 </indexterm>
17593 This is an obsolete name for <varname>$received_ip_address</varname>.
17594 </para>
17595 </listitem></varlistentry>
17596 <varlistentry>
17597 <term><varname>$interface_port</varname></term>
17598 <listitem>
17599 <para>
17600 <indexterm role="variable">
17601 <primary><varname>$interface_port</varname></primary>
17602 </indexterm>
17603 This is an obsolete name for <varname>$received_port</varname>.
17604 </para>
17605 </listitem></varlistentry>
17606 <varlistentry>
17607 <term><varname>$item</varname></term>
17608 <listitem>
17609 <para>
17610 <indexterm role="variable">
17611 <primary><varname>$item</varname></primary>
17612 </indexterm>
17613 This variable is used during the expansion of <emphasis role="bold">forall</emphasis> and <emphasis role="bold">forany</emphasis>
17614 conditions (see section <xref linkend="SECTexpcond"/>), and <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and
17615 <emphasis role="bold">reduce</emphasis> items (see section <xref linkend="SECTexpcond"/>). In other circumstances, it is
17616 empty.
17617 </para>
17618 </listitem></varlistentry>
17619 <varlistentry>
17620 <term><varname>$ldap_dn</varname></term>
17621 <listitem>
17622 <para>
17623 <indexterm role="variable">
17624 <primary><varname>$ldap_dn</varname></primary>
17625 </indexterm>
17626 This variable, which is available only when Exim is compiled with LDAP support,
17627 contains the DN from the last entry in the most recently successful LDAP
17628 lookup.
17629 </para>
17630 </listitem></varlistentry>
17631 <varlistentry>
17632 <term><varname>$load_average</varname></term>
17633 <listitem>
17634 <para>
17635 <indexterm role="variable">
17636 <primary><varname>$load_average</varname></primary>
17637 </indexterm>
17638 This variable contains the system load average, multiplied by 1000 so that it
17639 is an integer. For example, if the load average is 0.21, the value of the
17640 variable is 210. The value is recomputed every time the variable is referenced.
17641 </para>
17642 </listitem></varlistentry>
17643 <varlistentry>
17644 <term><varname>$local_part</varname></term>
17645 <listitem>
17646 <para>
17647 <indexterm role="variable">
17648 <primary><varname>$local_part</varname></primary>
17649 </indexterm>
17650 When an address is being routed, or delivered on its own, this
17651 variable contains the local part. When a number of addresses are being
17652 delivered together (for example, multiple RCPT commands in an SMTP
17653 session), <varname>$local_part</varname> is not set.
17654 </para>
17655 <para>
17656 Global address rewriting happens when a message is received, so the value of
17657 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
17658 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
17659 because a message may have many recipients and the system filter is called just
17660 once.
17661 </para>
17662 <para>
17663 <indexterm role="variable">
17664 <primary><varname>$local_part_prefix</varname></primary>
17665 </indexterm>
17666 <indexterm role="variable">
17667 <primary><varname>$local_part_suffix</varname></primary>
17668 </indexterm>
17669 If a local part prefix or suffix has been recognized, it is not included in the
17670 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
17671 any prefix or suffix are in <varname>$local_part_prefix</varname> and
17672 <varname>$local_part_suffix</varname>, respectively.
17673 </para>
17674 <para>
17675 When a message is being delivered to a file, pipe, or autoreply transport as a
17676 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
17677 the parent address, not to the file name or command (see <varname>$address_file</varname> and
17678 <varname>$address_pipe</varname>).
17679 </para>
17680 <para>
17681 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
17682 local part of the recipient address.
17683 </para>
17684 <para>
17685 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
17686 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
17687 it can be used in the expansion of the replacement address, for example.
17688 </para>
17689 <para>
17690 In all cases, all quoting is removed from the local part. For example, for both
17691 the addresses
17692 </para>
17693 <literallayout class="monospaced">
17694 "abc:xyz"@test.example
17695 abc\:xyz@test.example
17696 </literallayout>
17697 <para>
17698 the value of <varname>$local_part</varname> is
17699 </para>
17700 <literallayout class="monospaced">
17701 abc:xyz
17702 </literallayout>
17703 <para>
17704 If you use <varname>$local_part</varname> to create another address, you should always wrap it
17705 inside a quoting operator. For example, in a <command>redirect</command> router you could
17706 have:
17707 </para>
17708 <literallayout class="monospaced">
17709 data = ${quote_local_part:$local_part}@new.domain.example
17710 </literallayout>
17711 <para>
17712 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
17713 to process local parts in a case-dependent manner in a router, you can set the
17714 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
17715 </para>
17716 </listitem></varlistentry>
17717 <varlistentry>
17718 <term><varname>$local_part_data</varname></term>
17719 <listitem>
17720 <para>
17721 <indexterm role="variable">
17722 <primary><varname>$local_part_data</varname></primary>
17723 </indexterm>
17724 When the <option>local_parts</option> option on a router matches a local part by means of a
17725 lookup, the data read by the lookup is available during the running of the
17726 router as <varname>$local_part_data</varname>. In addition, if the driver routes the address
17727 to a transport, the value is available in that transport. If the transport is
17728 handling multiple addresses, the value from the first address is used.
17729 </para>
17730 <para>
17731 <varname>$local_part_data</varname> is also set when the <option>local_parts</option> condition in an ACL
17732 matches a local part by means of a lookup. The data read by the lookup is
17733 available during the rest of the ACL statement. In all other situations, this
17734 variable expands to nothing.
17735 </para>
17736 </listitem></varlistentry>
17737 <varlistentry>
17738 <term><varname>$local_part_prefix</varname></term>
17739 <listitem>
17740 <para>
17741 <indexterm role="variable">
17742 <primary><varname>$local_part_prefix</varname></primary>
17743 </indexterm>
17744 When an address is being routed or delivered, and a
17745 specific prefix for the local part was recognized, it is available in this
17746 variable, having been removed from <varname>$local_part</varname>.
17747 </para>
17748 </listitem></varlistentry>
17749 <varlistentry>
17750 <term><varname>$local_part_suffix</varname></term>
17751 <listitem>
17752 <para>
17753 <indexterm role="variable">
17754 <primary><varname>$local_part_suffix</varname></primary>
17755 </indexterm>
17756 When an address is being routed or delivered, and a
17757 specific suffix for the local part was recognized, it is available in this
17758 variable, having been removed from <varname>$local_part</varname>.
17759 </para>
17760 </listitem></varlistentry>
17761 <varlistentry>
17762 <term><varname>$local_scan_data</varname></term>
17763 <listitem>
17764 <para>
17765 <indexterm role="variable">
17766 <primary><varname>$local_scan_data</varname></primary>
17767 </indexterm>
17768 This variable contains the text returned by the <function>local_scan()</function> function when
17769 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
17770 </para>
17771 </listitem></varlistentry>
17772 <varlistentry>
17773 <term><varname>$local_user_gid</varname></term>
17774 <listitem>
17775 <para>
17776 <indexterm role="variable">
17777 <primary><varname>$local_user_gid</varname></primary>
17778 </indexterm>
17779 See <varname>$local_user_uid</varname>.
17780 </para>
17781 </listitem></varlistentry>
17782 <varlistentry>
17783 <term><varname>$local_user_uid</varname></term>
17784 <listitem>
17785 <para>
17786 <indexterm role="variable">
17787 <primary><varname>$local_user_uid</varname></primary>
17788 </indexterm>
17789 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
17790 <option>check_local_user</option> router precondition succeeds. This means that their values
17791 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
17792 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
17793 router-specific expansions. At all other times, the values in these variables
17794 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
17795 </para>
17796 </listitem></varlistentry>
17797 <varlistentry>
17798 <term><varname>$localhost_number</varname></term>
17799 <listitem>
17800 <para>
17801 <indexterm role="variable">
17802 <primary><varname>$localhost_number</varname></primary>
17803 </indexterm>
17804 This contains the expanded value of the
17805 <option>localhost_number</option> option. The expansion happens after the main options have
17806 been read.
17807 </para>
17808 </listitem></varlistentry>
17809 <varlistentry>
17810 <term><varname>$log_inodes</varname></term>
17811 <listitem>
17812 <para>
17813 <indexterm role="variable">
17814 <primary><varname>$log_inodes</varname></primary>
17815 </indexterm>
17816 The number of free inodes in the disk partition where Exim&#x2019;s
17817 log files are being written. The value is recalculated whenever the variable is
17818 referenced. If the relevant file system does not have the concept of inodes,
17819 the value of is -1. See also the <option>check_log_inodes</option> option.
17820 </para>
17821 </listitem></varlistentry>
17822 <varlistentry>
17823 <term><varname>$log_space</varname></term>
17824 <listitem>
17825 <para>
17826 <indexterm role="variable">
17827 <primary><varname>$log_space</varname></primary>
17828 </indexterm>
17829 The amount of free space (as a number of kilobytes) in the disk
17830 partition where Exim&#x2019;s log files are being written. The value is recalculated
17831 whenever the variable is referenced. If the operating system does not have the
17832 ability to find the amount of free space (only true for experimental systems),
17833 the space value is -1. See also the <option>check_log_space</option> option.
17834 </para>
17835 </listitem></varlistentry>
17836 <varlistentry>
17837 <term><varname>$lookup_dnssec_authenticated</varname></term>
17838 <listitem>
17839 <para>
17840 <indexterm role="variable">
17841 <primary><varname>$lookup_dnssec_authenticated</varname></primary>
17842 </indexterm>
17843 This variable is set after a DNS lookup done by
17844 a dnsdb lookup expansion, dnslookup router or smtp transport.
17845 It will be empty if <command>DNSSEC</command> was not requested,
17846 <quote>no</quote> if the result was not labelled as authenticated data
17847 and <quote>yes</quote> if it was.
17848 </para>
17849 </listitem></varlistentry>
17850 <varlistentry>
17851 <term><varname>$mailstore_basename</varname></term>
17852 <listitem>
17853 <para>
17854 <indexterm role="variable">
17855 <primary><varname>$mailstore_basename</varname></primary>
17856 </indexterm>
17857 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
17858 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
17859 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
17860 contains the basename of the files that are being written, that is, the name
17861 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
17862 variable is empty.
17863 </para>
17864 </listitem></varlistentry>
17865 <varlistentry>
17866 <term><varname>$malware_name</varname></term>
17867 <listitem>
17868 <para>
17869 <indexterm role="variable">
17870 <primary><varname>$malware_name</varname></primary>
17871 </indexterm>
17872 This variable is available when Exim is compiled with the
17873 content-scanning extension. It is set to the name of the virus that was found
17874 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
17875 </para>
17876 </listitem></varlistentry>
17877 <varlistentry>
17878 <term><varname>$max_received_linelength</varname></term>
17879 <listitem>
17880 <para>
17881 <indexterm role="variable">
17882 <primary><varname>$max_received_linelength</varname></primary>
17883 </indexterm>
17884 <indexterm role="concept">
17885 <primary>maximum</primary>
17886 <secondary>line length</secondary>
17887 </indexterm>
17888 <indexterm role="concept">
17889 <primary>line length</primary>
17890 <secondary>maximum</secondary>
17891 </indexterm>
17892 This variable contains the number of bytes in the longest line that was
17893 received as part of the message, not counting the line termination
17894 character(s).
17895 </para>
17896 </listitem></varlistentry>
17897 <varlistentry>
17898 <term><varname>$message_age</varname></term>
17899 <listitem>
17900 <para>
17901 <indexterm role="concept">
17902 <primary>message</primary>
17903 <secondary>age of</secondary>
17904 </indexterm>
17905 <indexterm role="variable">
17906 <primary><varname>$message_age</varname></primary>
17907 </indexterm>
17908 This variable is set at the start of a delivery attempt to contain the number
17909 of seconds since the message was received. It does not change during a single
17910 delivery attempt.
17911 </para>
17912 </listitem></varlistentry>
17913 <varlistentry>
17914 <term><varname>$message_body</varname></term>
17915 <listitem>
17916 <para>
17917 <indexterm role="concept">
17918 <primary>body of message</primary>
17919 <secondary>expansion variable</secondary>
17920 </indexterm>
17921 <indexterm role="concept">
17922 <primary>message body</primary>
17923 <secondary>in expansion</secondary>
17924 </indexterm>
17925 <indexterm role="concept">
17926 <primary>binary zero</primary>
17927 <secondary>in message body</secondary>
17928 </indexterm>
17929 <indexterm role="variable">
17930 <primary><varname>$message_body</varname></primary>
17931 </indexterm>
17932 <indexterm role="option">
17933 <primary><option>message_body_visible</option></primary>
17934 </indexterm>
17935 This variable contains the initial portion of a message&#x2019;s body while it is
17936 being delivered, and is intended mainly for use in filter files. The maximum
17937 number of characters of the body that are put into the variable is set by the
17938 <option>message_body_visible</option> configuration option; the default is 500.
17939 </para>
17940 <para>
17941 <indexterm role="option">
17942 <primary><option>message_body_newlines</option></primary>
17943 </indexterm>
17944 By default, newlines are converted into spaces in <varname>$message_body</varname>, to make it
17945 easier to search for phrases that might be split over a line break. However,
17946 this can be disabled by setting <option>message_body_newlines</option> to be true. Binary
17947 zeros are always converted into spaces.
17948 </para>
17949 </listitem></varlistentry>
17950 <varlistentry>
17951 <term><varname>$message_body_end</varname></term>
17952 <listitem>
17953 <para>
17954 <indexterm role="concept">
17955 <primary>body of message</primary>
17956 <secondary>expansion variable</secondary>
17957 </indexterm>
17958 <indexterm role="concept">
17959 <primary>message body</primary>
17960 <secondary>in expansion</secondary>
17961 </indexterm>
17962 <indexterm role="variable">
17963 <primary><varname>$message_body_end</varname></primary>
17964 </indexterm>
17965 This variable contains the final portion of a message&#x2019;s
17966 body while it is being delivered. The format and maximum size are as for
17967 <varname>$message_body</varname>.
17968 </para>
17969 </listitem></varlistentry>
17970 <varlistentry>
17971 <term><varname>$message_body_size</varname></term>
17972 <listitem>
17973 <para>
17974 <indexterm role="concept">
17975 <primary>body of message</primary>
17976 <secondary>size</secondary>
17977 </indexterm>
17978 <indexterm role="concept">
17979 <primary>message body</primary>
17980 <secondary>size</secondary>
17981 </indexterm>
17982 <indexterm role="variable">
17983 <primary><varname>$message_body_size</varname></primary>
17984 </indexterm>
17985 When a message is being delivered, this variable contains the size of the body
17986 in bytes. The count starts from the character after the blank line that
17987 separates the body from the header. Newlines are included in the count. See
17988 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
17989 </para>
17990 </listitem></varlistentry>
17991 <varlistentry>
17992 <term><varname>$message_exim_id</varname></term>
17993 <listitem>
17994 <para>
17995 <indexterm role="variable">
17996 <primary><varname>$message_exim_id</varname></primary>
17997 </indexterm>
17998 When a message is being received or delivered, this variable contains the
17999 unique message id that is generated and used by Exim to identify the message.
18000 An id is not created for a message until after its header has been successfully
18001 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
18002 line; it is the local id that Exim assigns to the message, for example:
18003 <literal>1BXTIK-0001yO-VA</literal>.
18004 </para>
18005 </listitem></varlistentry>
18006 <varlistentry>
18007 <term><varname>$message_headers</varname></term>
18008 <listitem>
18009 <para>
18010 <indexterm role="variable">
18011 <primary><varname>$message_headers</varname></primary>
18012 </indexterm>
18013 This variable contains a concatenation of all the header lines when a message
18014 is being processed, except for lines added by routers or transports. The header
18015 lines are separated by newline characters. Their contents are decoded in the
18016 same way as a header line that is inserted by <option>bheader</option>.
18017 </para>
18018 </listitem></varlistentry>
18019 <varlistentry>
18020 <term><varname>$message_headers_raw</varname></term>
18021 <listitem>
18022 <para>
18023 <indexterm role="variable">
18024 <primary><varname>$message_headers_raw</varname></primary>
18025 </indexterm>
18026 This variable is like <varname>$message_headers</varname> except that no processing of the
18027 contents of header lines is done.
18028 </para>
18029 </listitem></varlistentry>
18030 <varlistentry>
18031 <term><varname>$message_id</varname></term>
18032 <listitem>
18033 <para>
18034 This is an old name for <varname>$message_exim_id</varname>. It is now deprecated.
18035 </para>
18036 </listitem></varlistentry>
18037 <varlistentry>
18038 <term><varname>$message_linecount</varname></term>
18039 <listitem>
18040 <para>
18041 <indexterm role="variable">
18042 <primary><varname>$message_linecount</varname></primary>
18043 </indexterm>
18044 This variable contains the total number of lines in the header and body of the
18045 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
18046 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
18047 number of lines received. Before delivery happens (that is, before filters,
18048 routers, and transports run) the count is increased to include the
18049 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
18050 lines that are added by ACLs. The blank line that separates the message header
18051 from the body is not counted.
18052 </para>
18053 <para>
18054 As with the special case of <varname>$message_size</varname>, during the expansion of the
18055 appendfile transport&#x2019;s maildir_tag option in maildir format, the value of
18056 <varname>$message_linecount</varname> is the precise size of the number of newlines in the
18057 file that has been written (minus one for the blank line between the
18058 header and the body).
18059 </para>
18060 <para>
18061 Here is an example of the use of this variable in a DATA ACL:
18062 </para>
18063 <literallayout class="monospaced">
18064 deny message   = Too many lines in message header
18065      condition = \
18066       ${if &lt;{250}{${eval:$message_linecount - $body_linecount}}}
18067 </literallayout>
18068 <para>
18069 In the MAIL and RCPT ACLs, the value is zero because at that stage the
18070 message has not yet been received.
18071 </para>
18072 </listitem></varlistentry>
18073 <varlistentry>
18074 <term><varname>$message_size</varname></term>
18075 <listitem>
18076 <para>
18077 <indexterm role="concept">
18078 <primary>size</primary>
18079 <secondary>of message</secondary>
18080 </indexterm>
18081 <indexterm role="concept">
18082 <primary>message</primary>
18083 <secondary>size</secondary>
18084 </indexterm>
18085 <indexterm role="variable">
18086 <primary><varname>$message_size</varname></primary>
18087 </indexterm>
18088 When a message is being processed, this variable contains its size in bytes. In
18089 most cases, the size includes those headers that were received with the
18090 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
18091 deliveries as they are written. However, there is one special case: during the
18092 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
18093 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
18094 precise size of the file that has been written. See also
18095 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
18096 </para>
18097 <para>
18098 <indexterm role="concept">
18099 <primary>RCPT</primary>
18100 <secondary>value of <varname>$message_size</varname></secondary>
18101 </indexterm>
18102 While running a per message ACL (mail/rcpt/predata), <varname>$message_size</varname>
18103 contains the size supplied on the MAIL command, or -1 if no size was given. The
18104 value may not, of course, be truthful.
18105 </para>
18106 </listitem></varlistentry>
18107 <varlistentry>
18108 <term><varname>$mime_</varname><emphasis>xxx</emphasis></term>
18109 <listitem>
18110 <para>
18111 A number of variables whose names start with <varname>$mime</varname> are
18112 available when Exim is compiled with the content-scanning extension. For
18113 details, see section <xref linkend="SECTscanmimepart"/>.
18114 </para>
18115 </listitem></varlistentry>
18116 <varlistentry>
18117 <term><varname>$n0</varname> &ndash; <varname>$n9</varname></term>
18118 <listitem>
18119 <para>
18120 These variables are counters that can be incremented by means
18121 of the <option>add</option> command in filter files.
18122 </para>
18123 </listitem></varlistentry>
18124 <varlistentry>
18125 <term><varname>$original_domain</varname></term>
18126 <listitem>
18127 <para>
18128 <indexterm role="variable">
18129 <primary><varname>$domain</varname></primary>
18130 </indexterm>
18131 <indexterm role="variable">
18132 <primary><varname>$original_domain</varname></primary>
18133 </indexterm>
18134 When a top-level address is being processed for delivery, this contains the
18135 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
18136 generated by an alias, forward, or filter file) is being processed, this
18137 variable contains the domain of the original address (lower cased). This
18138 differs from <varname>$parent_domain</varname> only when there is more than one level of
18139 aliasing or forwarding. When more than one address is being delivered in a
18140 single transport run, <varname>$original_domain</varname> is not set.
18141 </para>
18142 <para>
18143 If a new address is created by means of a <option>deliver</option> command in a system
18144 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
18145 part <emphasis>system-filter</emphasis> and the default qualify domain.
18146 </para>
18147 </listitem></varlistentry>
18148 <varlistentry>
18149 <term><varname>$original_local_part</varname></term>
18150 <listitem>
18151 <para>
18152 <indexterm role="variable">
18153 <primary><varname>$local_part</varname></primary>
18154 </indexterm>
18155 <indexterm role="variable">
18156 <primary><varname>$original_local_part</varname></primary>
18157 </indexterm>
18158 When a top-level address is being processed for delivery, this contains the
18159 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
18160 local part, because <varname>$original_local_part</varname> always contains the full local
18161 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
18162 filter file) is being processed, this variable contains the full local part of
18163 the original address.
18164 </para>
18165 <para>
18166 If the router that did the redirection processed the local part
18167 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
18168 This variable differs from <varname>$parent_local_part</varname> only when there is more than
18169 one level of aliasing or forwarding. When more than one address is being
18170 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
18171 </para>
18172 <para>
18173 If a new address is created by means of a <option>deliver</option> command in a system
18174 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
18175 part <emphasis>system-filter</emphasis> and the default qualify domain.
18176 </para>
18177 </listitem></varlistentry>
18178 <varlistentry>
18179 <term><varname>$originator_gid</varname></term>
18180 <listitem>
18181 <para>
18182 <indexterm role="concept">
18183 <primary>gid (group id)</primary>
18184 <secondary>of originating user</secondary>
18185 </indexterm>
18186 <indexterm role="concept">
18187 <primary>sender</primary>
18188 <secondary>gid</secondary>
18189 </indexterm>
18190 <indexterm role="variable">
18191 <primary><varname>$caller_gid</varname></primary>
18192 </indexterm>
18193 <indexterm role="variable">
18194 <primary><varname>$originator_gid</varname></primary>
18195 </indexterm>
18196 This variable contains the value of <varname>$caller_gid</varname> that was set when the
18197 message was received. For messages received via the command line, this is the
18198 gid of the sending user. For messages received by SMTP over TCP/IP, this is
18199 normally the gid of the Exim user.
18200 </para>
18201 </listitem></varlistentry>
18202 <varlistentry>
18203 <term><varname>$originator_uid</varname></term>
18204 <listitem>
18205 <para>
18206 <indexterm role="concept">
18207 <primary>uid (user id)</primary>
18208 <secondary>of originating user</secondary>
18209 </indexterm>
18210 <indexterm role="concept">
18211 <primary>sender</primary>
18212 <secondary>uid</secondary>
18213 </indexterm>
18214 <indexterm role="variable">
18215 <primary><varname>$caller_uid</varname></primary>
18216 </indexterm>
18217 <indexterm role="variable">
18218 <primary><varname>$originaltor_uid</varname></primary>
18219 </indexterm>
18220 The value of <varname>$caller_uid</varname> that was set when the message was received. For
18221 messages received via the command line, this is the uid of the sending user.
18222 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
18223 user.
18224 </para>
18225 </listitem></varlistentry>
18226 <varlistentry>
18227 <term><varname>$parent_domain</varname></term>
18228 <listitem>
18229 <para>
18230 <indexterm role="variable">
18231 <primary><varname>$parent_domain</varname></primary>
18232 </indexterm>
18233 This variable is similar to <varname>$original_domain</varname> (see
18234 above), except that it refers to the immediately preceding parent address.
18235 </para>
18236 </listitem></varlistentry>
18237 <varlistentry>
18238 <term><varname>$parent_local_part</varname></term>
18239 <listitem>
18240 <para>
18241 <indexterm role="variable">
18242 <primary><varname>$parent_local_part</varname></primary>
18243 </indexterm>
18244 This variable is similar to <varname>$original_local_part</varname>
18245 (see above), except that it refers to the immediately preceding parent address.
18246 </para>
18247 </listitem></varlistentry>
18248 <varlistentry>
18249 <term><varname>$pid</varname></term>
18250 <listitem>
18251 <para>
18252 <indexterm role="concept">
18253 <primary>pid (process id)</primary>
18254 <secondary>of current process</secondary>
18255 </indexterm>
18256 <indexterm role="variable">
18257 <primary><varname>$pid</varname></primary>
18258 </indexterm>
18259 This variable contains the current process id.
18260 </para>
18261 </listitem></varlistentry>
18262 <varlistentry>
18263 <term><varname>$pipe_addresses</varname></term>
18264 <listitem>
18265 <para>
18266 <indexterm role="concept">
18267 <primary>filter</primary>
18268 <secondary>transport filter</secondary>
18269 </indexterm>
18270 <indexterm role="concept">
18271 <primary>transport</primary>
18272 <secondary>filter</secondary>
18273 </indexterm>
18274 <indexterm role="variable">
18275 <primary><varname>$pipe_addresses</varname></primary>
18276 </indexterm>
18277 This is not an expansion variable, but is mentioned here because the string
18278 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
18279 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
18280 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
18281 It cannot be used in general expansion strings, and provokes an <quote>unknown
18282 variable</quote> error if encountered.
18283 </para>
18284 </listitem></varlistentry>
18285 <varlistentry>
18286 <term><varname>$primary_hostname</varname></term>
18287 <listitem>
18288 <para>
18289 <indexterm role="variable">
18290 <primary><varname>$primary_hostname</varname></primary>
18291 </indexterm>
18292 This variable contains the value set by <option>primary_hostname</option> in the
18293 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
18294 a single-component name, Exim calls <function>gethostbyname()</function> (or
18295 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
18296 qualified host name. See also <varname>$smtp_active_hostname</varname>.
18297 </para>
18298 </listitem></varlistentry>
18299 <varlistentry>
18300 <term><varname>$prvscheck_address</varname></term>
18301 <listitem>
18302 <para>
18303 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
18304 which is described in sections <xref linkend="SECTexpansionitems"/> and
18305 <xref linkend="SECTverifyPRVS"/>.
18306 </para>
18307 </listitem></varlistentry>
18308 <varlistentry>
18309 <term><varname>$prvscheck_keynum</varname></term>
18310 <listitem>
18311 <para>
18312 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
18313 which is described in sections <xref linkend="SECTexpansionitems"/> and
18314 <xref linkend="SECTverifyPRVS"/>.
18315 </para>
18316 </listitem></varlistentry>
18317 <varlistentry>
18318 <term><varname>$prvscheck_result</varname></term>
18319 <listitem>
18320 <para>
18321 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
18322 which is described in sections <xref linkend="SECTexpansionitems"/> and
18323 <xref linkend="SECTverifyPRVS"/>.
18324 </para>
18325 </listitem></varlistentry>
18326 <varlistentry>
18327 <term><varname>$qualify_domain</varname></term>
18328 <listitem>
18329 <para>
18330 <indexterm role="variable">
18331 <primary><varname>$qualify_domain</varname></primary>
18332 </indexterm>
18333 The value set for the <option>qualify_domain</option> option in the configuration file.
18334 </para>
18335 </listitem></varlistentry>
18336 <varlistentry>
18337 <term><varname>$qualify_recipient</varname></term>
18338 <listitem>
18339 <para>
18340 <indexterm role="variable">
18341 <primary><varname>$qualify_recipient</varname></primary>
18342 </indexterm>
18343 The value set for the <option>qualify_recipient</option> option in the configuration file,
18344 or if not set, the value of <varname>$qualify_domain</varname>.
18345 </para>
18346 </listitem></varlistentry>
18347 <varlistentry>
18348 <term><varname>$rcpt_count</varname></term>
18349 <listitem>
18350 <para>
18351 <indexterm role="variable">
18352 <primary><varname>$rcpt_count</varname></primary>
18353 </indexterm>
18354 When a message is being received by SMTP, this variable contains the number of
18355 RCPT commands received for the current message. If this variable is used in a
18356 RCPT ACL, its value includes the current command.
18357 </para>
18358 </listitem></varlistentry>
18359 <varlistentry>
18360 <term><varname>$rcpt_defer_count</varname></term>
18361 <listitem>
18362 <para>
18363 <indexterm role="variable">
18364 <primary><varname>$rcpt_defer_count</varname></primary>
18365 </indexterm>
18366 <indexterm role="concept">
18367 <primary>4<emphasis>xx</emphasis> responses</primary>
18368 <secondary>count of</secondary>
18369 </indexterm>
18370 When a message is being received by SMTP, this variable contains the number of
18371 RCPT commands in the current message that have previously been rejected with a
18372 temporary (4<emphasis>xx</emphasis>) response.
18373 </para>
18374 </listitem></varlistentry>
18375 <varlistentry>
18376 <term><varname>$rcpt_fail_count</varname></term>
18377 <listitem>
18378 <para>
18379 <indexterm role="variable">
18380 <primary><varname>$rcpt_fail_count</varname></primary>
18381 </indexterm>
18382 When a message is being received by SMTP, this variable contains the number of
18383 RCPT commands in the current message that have previously been rejected with a
18384 permanent (5<emphasis>xx</emphasis>) response.
18385 </para>
18386 </listitem></varlistentry>
18387 <varlistentry>
18388 <term><varname>$received_count</varname></term>
18389 <listitem>
18390 <para>
18391 <indexterm role="variable">
18392 <primary><varname>$received_count</varname></primary>
18393 </indexterm>
18394 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
18395 including the one added by Exim (so its value is always greater than zero). It
18396 is available in the DATA ACL, the non-SMTP ACL, and while routing and
18397 delivering.
18398 </para>
18399 </listitem></varlistentry>
18400 <varlistentry>
18401 <term><varname>$received_for</varname></term>
18402 <listitem>
18403 <para>
18404 <indexterm role="variable">
18405 <primary><varname>$received_for</varname></primary>
18406 </indexterm>
18407 If there is only a single recipient address in an incoming message, this
18408 variable contains that address when the <emphasis>Received:</emphasis> header line is being
18409 built. The value is copied after recipient rewriting has happened, but before
18410 the <function>local_scan()</function> function is run.
18411 </para>
18412 </listitem></varlistentry>
18413 <varlistentry>
18414 <term><varname>$received_ip_address</varname></term>
18415 <listitem>
18416 <para>
18417 <indexterm role="variable">
18418 <primary><varname>$received_ip_address</varname></primary>
18419 </indexterm>
18420 As soon as an Exim server starts processing an incoming TCP/IP connection, this
18421 variable is set to the address of the local IP interface, and <varname>$received_port</varname>
18422 is set to the local port number. (The remote IP address and port are in
18423 <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.) When testing with <option>-bh</option>,
18424 the port value is -1 unless it has been set using the <option>-oMi</option> command line
18425 option.
18426 </para>
18427 <para>
18428 As well as being useful in ACLs (including the <quote>connect</quote> ACL), these variable
18429 could be used, for example, to make the file name for a TLS certificate depend
18430 on which interface and/or port is being used for the incoming connection. The
18431 values of <varname>$received_ip_address</varname> and <varname>$received_port</varname> are saved with any
18432 messages that are received, thus making these variables available at delivery
18433 time.
18434 For outbound connections see <varname>$sending_ip_address</varname>.
18435 </para>
18436 </listitem></varlistentry>
18437 <varlistentry>
18438 <term><varname>$received_port</varname></term>
18439 <listitem>
18440 <para>
18441 <indexterm role="variable">
18442 <primary><varname>$received_port</varname></primary>
18443 </indexterm>
18444 See <varname>$received_ip_address</varname>.
18445 </para>
18446 </listitem></varlistentry>
18447 <varlistentry>
18448 <term><varname>$received_protocol</varname></term>
18449 <listitem>
18450 <para>
18451 <indexterm role="variable">
18452 <primary><varname>$received_protocol</varname></primary>
18453 </indexterm>
18454 When a message is being processed, this variable contains the name of the
18455 protocol by which it was received. Most of the names used by Exim are defined
18456 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
18457 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
18458 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
18459 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
18460 connection and the client was successfully authenticated.
18461 </para>
18462 <para>
18463 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
18464 automatically set up on connection without the use of STARTTLS (see
18465 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
18466 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
18467 where the client initially uses EHLO, sets up an encrypted connection using
18468 STARTTLS, and then uses HELO afterwards.
18469 </para>
18470 <para>
18471 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
18472 messages that are injected locally by trusted callers. This is commonly used to
18473 identify messages that are being re-injected after some kind of scanning.
18474 </para>
18475 </listitem></varlistentry>
18476 <varlistentry>
18477 <term><varname>$received_time</varname></term>
18478 <listitem>
18479 <para>
18480 <indexterm role="variable">
18481 <primary><varname>$received_time</varname></primary>
18482 </indexterm>
18483 This variable contains the date and time when the current message was received,
18484 as a number of seconds since the start of the Unix epoch.
18485 </para>
18486 </listitem></varlistentry>
18487 <varlistentry>
18488 <term><varname>$recipient_data</varname></term>
18489 <listitem>
18490 <para>
18491 <indexterm role="variable">
18492 <primary><varname>$recipient_data</varname></primary>
18493 </indexterm>
18494 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
18495 condition. It contains the data from the lookup, and the value remains set
18496 until the next <option>recipients</option> test. Thus, you can do things like this:
18497 </para>
18498 <literallayout>
18499 <literal>require recipients  = cdb*@;/some/file</literal>
18500 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
18501 </literallayout>
18502 <para>
18503 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
18504 method in the address list, using the semicolon syntax as in the example above.
18505 The variable is not set for a lookup that is used as part of the string
18506 expansion that all such lists undergo before being interpreted.
18507 </para>
18508 </listitem></varlistentry>
18509 <varlistentry>
18510 <term><varname>$recipient_verify_failure</varname></term>
18511 <listitem>
18512 <para>
18513 <indexterm role="variable">
18514 <primary><varname>$recipient_verify_failure</varname></primary>
18515 </indexterm>
18516 In an ACL, when a recipient verification fails, this variable contains
18517 information about the failure. It is set to one of the following words:
18518 </para>
18519 <itemizedlist>
18520 <listitem>
18521 <para>
18522 <quote>qualify</quote>: The address was unqualified (no domain), and the message
18523 was neither local nor came from an exempted host.
18524 </para>
18525 </listitem>
18526 <listitem>
18527 <para>
18528 <quote>route</quote>: Routing failed.
18529 </para>
18530 </listitem>
18531 <listitem>
18532 <para>
18533 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
18534 or before the MAIL command (that is, on initial connection, HELO, or
18535 MAIL).
18536 </para>
18537 </listitem>
18538 <listitem>
18539 <para>
18540 <quote>recipient</quote>: The RCPT command in a callout was rejected.
18541 </para>
18542 </listitem>
18543 <listitem>
18544 <para>
18545 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
18546 </para>
18547 </listitem>
18548 </itemizedlist>
18549 <para>
18550 The main use of this variable is expected to be to distinguish between
18551 rejections of MAIL and rejections of RCPT.
18552 </para>
18553 </listitem></varlistentry>
18554 <varlistentry>
18555 <term><varname>$recipients</varname></term>
18556 <listitem>
18557 <para>
18558 <indexterm role="variable">
18559 <primary><varname>$recipients</varname></primary>
18560 </indexterm>
18561 This variable contains a list of envelope recipients for a message. A comma and
18562 a space separate the addresses in the replacement text. However, the variable
18563 is not generally available, to prevent exposure of Bcc recipients in
18564 unprivileged users&#x2019; filter files. You can use <varname>$recipients</varname> only in these
18565 cases:
18566 </para>
18567 <orderedlist numeration="arabic">
18568 <listitem>
18569 <para>
18570 In a system filter file.
18571 </para>
18572 </listitem>
18573 <listitem>
18574 <para>
18575 In the ACLs associated with the DATA command and with non-SMTP messages, that
18576 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
18577 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
18578 <option>acl_not_smtp_mime</option>.
18579 </para>
18580 </listitem>
18581 <listitem>
18582 <para>
18583 From within a <function>local_scan()</function> function.
18584 </para>
18585 </listitem>
18586 </orderedlist>
18587 </listitem></varlistentry>
18588 <varlistentry>
18589 <term><varname>$recipients_count</varname></term>
18590 <listitem>
18591 <para>
18592 <indexterm role="variable">
18593 <primary><varname>$recipients_count</varname></primary>
18594 </indexterm>
18595 When a message is being processed, this variable contains the number of
18596 envelope recipients that came with the message. Duplicates are not excluded
18597 from the count. While a message is being received over SMTP, the number
18598 increases for each accepted recipient. It can be referenced in an ACL.
18599 </para>
18600 </listitem></varlistentry>
18601 <varlistentry>
18602 <term><varname>$regex_match_string</varname></term>
18603 <listitem>
18604 <para>
18605 <indexterm role="variable">
18606 <primary><varname>$regex_match_string</varname></primary>
18607 </indexterm>
18608 This variable is set to contain the matching regular expression after a
18609 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
18610 </para>
18611 </listitem></varlistentry>
18612 <varlistentry>
18613 <term><varname>$reply_address</varname></term>
18614 <listitem>
18615 <para>
18616 <indexterm role="variable">
18617 <primary><varname>$reply_address</varname></primary>
18618 </indexterm>
18619 When a message is being processed, this variable contains the contents of the
18620 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
18621 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
18622 white space, the value is not processed in any way. In particular, no RFC 2047
18623 decoding or character code translation takes place.
18624 </para>
18625 </listitem></varlistentry>
18626 <varlistentry>
18627 <term><varname>$return_path</varname></term>
18628 <listitem>
18629 <para>
18630 <indexterm role="variable">
18631 <primary><varname>$return_path</varname></primary>
18632 </indexterm>
18633 When a message is being delivered, this variable contains the return path &ndash;
18634 the sender field that will be sent as part of the envelope. It is not enclosed
18635 in &lt;&gt; characters. At the start of routing an address, <varname>$return_path</varname> has the
18636 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
18637 mailing list has been expanded by a router which specifies a different address
18638 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
18639 address, whereas <varname>$sender_address</varname> always contains the original sender address
18640 that was received with the message. In other words, <varname>$sender_address</varname> contains
18641 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
18642 envelope sender.
18643 </para>
18644 </listitem></varlistentry>
18645 <varlistentry>
18646 <term><varname>$return_size_limit</varname></term>
18647 <listitem>
18648 <para>
18649 <indexterm role="variable">
18650 <primary><varname>$return_size_limit</varname></primary>
18651 </indexterm>
18652 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
18653 </para>
18654 </listitem></varlistentry>
18655 <varlistentry>
18656 <term><varname>$router_name</varname></term>
18657 <listitem>
18658 <para>
18659 <indexterm role="concept">
18660 <primary>router</primary>
18661 <secondary>name</secondary>
18662 </indexterm>
18663 <indexterm role="concept">
18664 <primary>name</primary>
18665 <secondary>of router</secondary>
18666 </indexterm>
18667 <indexterm role="variable">
18668 <primary><varname>$router_name</varname></primary>
18669 </indexterm>
18670 During the running of a router this variable contains its name.
18671 </para>
18672 </listitem></varlistentry>
18673 <varlistentry>
18674 <term><varname>$runrc</varname></term>
18675 <listitem>
18676 <para>
18677 <indexterm role="concept">
18678 <primary>return code</primary>
18679 <secondary>from <option>run</option> expansion</secondary>
18680 </indexterm>
18681 <indexterm role="variable">
18682 <primary><varname>$runrc</varname></primary>
18683 </indexterm>
18684 This variable contains the return code from a command that is run by the
18685 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
18686 assume the order in which option values are expanded, except for those
18687 preconditions whose order of testing is documented. Therefore, you cannot
18688 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
18689 another.
18690 </para>
18691 </listitem></varlistentry>
18692 <varlistentry>
18693 <term><varname>$self_hostname</varname></term>
18694 <listitem>
18695 <para>
18696 <indexterm role="option">
18697 <primary><option>self</option></primary>
18698 <secondary>value of host name</secondary>
18699 </indexterm>
18700 <indexterm role="variable">
18701 <primary><varname>$self_hostname</varname></primary>
18702 </indexterm>
18703 When an address is routed to a supposedly remote host that turns out to be the
18704 local host, what happens is controlled by the <option>self</option> generic router option.
18705 One of its values causes the address to be passed to another router. When this
18706 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
18707 original router encountered. In other circumstances its contents are null.
18708 </para>
18709 </listitem></varlistentry>
18710 <varlistentry>
18711 <term><varname>$sender_address</varname></term>
18712 <listitem>
18713 <para>
18714 <indexterm role="variable">
18715 <primary><varname>$sender_address</varname></primary>
18716 </indexterm>
18717 When a message is being processed, this variable contains the sender&#x2019;s address
18718 that was received in the message&#x2019;s envelope. The case of letters in the address
18719 is retained, in both the local part and the domain. For bounce messages, the
18720 value of this variable is the empty string. See also <varname>$return_path</varname>.
18721 </para>
18722 </listitem></varlistentry>
18723 <varlistentry>
18724 <term><varname>$sender_address_data</varname></term>
18725 <listitem>
18726 <para>
18727 <indexterm role="variable">
18728 <primary><varname>$address_data</varname></primary>
18729 </indexterm>
18730 <indexterm role="variable">
18731 <primary><varname>$sender_address_data</varname></primary>
18732 </indexterm>
18733 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
18734 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
18735 distinguish it from data from a recipient address. The value does not persist
18736 after the end of the current ACL statement. If you want to preserve it for
18737 longer, you can save it in an ACL variable.
18738 </para>
18739 </listitem></varlistentry>
18740 <varlistentry>
18741 <term><varname>$sender_address_domain</varname></term>
18742 <listitem>
18743 <para>
18744 <indexterm role="variable">
18745 <primary><varname>$sender_address_domain</varname></primary>
18746 </indexterm>
18747 The domain portion of <varname>$sender_address</varname>.
18748 </para>
18749 </listitem></varlistentry>
18750 <varlistentry>
18751 <term><varname>$sender_address_local_part</varname></term>
18752 <listitem>
18753 <para>
18754 <indexterm role="variable">
18755 <primary><varname>$sender_address_local_part</varname></primary>
18756 </indexterm>
18757 The local part portion of <varname>$sender_address</varname>.
18758 </para>
18759 </listitem></varlistentry>
18760 <varlistentry>
18761 <term><varname>$sender_data</varname></term>
18762 <listitem>
18763 <para>
18764 <indexterm role="variable">
18765 <primary><varname>$sender_data</varname></primary>
18766 </indexterm>
18767 This variable is set after a lookup success in an ACL <option>senders</option> condition or
18768 in a router <option>senders</option> option. It contains the data from the lookup, and the
18769 value remains set until the next <option>senders</option> test. Thus, you can do things like
18770 this:
18771 </para>
18772 <literallayout>
18773 <literal>require senders      = cdb*@;/some/file</literal>
18774 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
18775 </literallayout>
18776 <para>
18777 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
18778 method in the address list, using the semicolon syntax as in the example above.
18779 The variable is not set for a lookup that is used as part of the string
18780 expansion that all such lists undergo before being interpreted.
18781 </para>
18782 </listitem></varlistentry>
18783 <varlistentry>
18784 <term><varname>$sender_fullhost</varname></term>
18785 <listitem>
18786 <para>
18787 <indexterm role="variable">
18788 <primary><varname>$sender_fullhost</varname></primary>
18789 </indexterm>
18790 When a message is received from a remote host, this variable contains the host
18791 name and IP address in a single string. It ends with the IP address in square
18792 brackets, followed by a colon and a port number if the logging of ports is
18793 enabled. The format of the rest of the string depends on whether the host
18794 issued a HELO or EHLO SMTP command, and whether the host name was verified by
18795 looking up its IP address. (Looking up the IP address can be forced by the
18796 <option>host_lookup</option> option, independent of verification.) A plain host name at the
18797 start of the string is a verified host name; if this is not present,
18798 verification either failed or was not requested. A host name in parentheses is
18799 the argument of a HELO or EHLO command. This is omitted if it is identical to
18800 the verified host name or to the host&#x2019;s IP address in square brackets.
18801 </para>
18802 </listitem></varlistentry>
18803 <varlistentry>
18804 <term><varname>$sender_helo_name</varname></term>
18805 <listitem>
18806 <para>
18807 <indexterm role="variable">
18808 <primary><varname>$sender_helo_name</varname></primary>
18809 </indexterm>
18810 When a message is received from a remote host that has issued a HELO or EHLO
18811 command, the argument of that command is placed in this variable. It is also
18812 set if HELO or EHLO is used when a message is received using SMTP locally via
18813 the <option>-bs</option> or <option>-bS</option> options.
18814 </para>
18815 </listitem></varlistentry>
18816 <varlistentry>
18817 <term><varname>$sender_host_address</varname></term>
18818 <listitem>
18819 <para>
18820 <indexterm role="variable">
18821 <primary><varname>$sender_host_address</varname></primary>
18822 </indexterm>
18823 When a message is received from a remote host using SMTP,
18824 this variable contains that
18825 host&#x2019;s IP address. For locally non-SMTP submitted messages, it is empty.
18826 </para>
18827 </listitem></varlistentry>
18828 <varlistentry>
18829 <term><varname>$sender_host_authenticated</varname></term>
18830 <listitem>
18831 <para>
18832 <indexterm role="variable">
18833 <primary><varname>$sender_host_authenticated</varname></primary>
18834 </indexterm>
18835 This variable contains the name (not the public name) of the authenticator
18836 driver that successfully authenticated the client from which the message was
18837 received. It is empty if there was no successful authentication. See also
18838 <varname>$authenticated_id</varname>.
18839 </para>
18840 </listitem></varlistentry>
18841 <varlistentry>
18842 <term><varname>$sender_host_dnssec</varname></term>
18843 <listitem>
18844 <para>
18845 <indexterm role="variable">
18846 <primary><varname>$sender_host_dnssec</varname></primary>
18847 </indexterm>
18848 If an attempt to populate <varname>$sender_host_name</varname> has been made
18849 (by reference, <option>hosts_lookup</option> or
18850 otherwise) then this boolean will have been set true if, and only if, the
18851 resolver library states that the reverse DNS was authenticated data.  At all
18852 other times, this variable is false.
18853 </para>
18854 <para>
18855 It is likely that you will need to coerce DNSSEC support on in the resolver
18856 library, by setting:
18857 </para>
18858 <literallayout class="monospaced">
18859 dns_dnssec_ok = 1
18860 </literallayout>
18861 <para>
18862 Exim does not perform DNSSEC validation itself, instead leaving that to a
18863 validating resolver (eg, unbound, or bind with suitable configuration).
18864 </para>
18865 <para>
18866 Exim does not (currently) check to see if the forward DNS was also secured
18867 with DNSSEC, only the reverse DNS.
18868 </para>
18869 <para>
18870 If you have changed <option>host_lookup_order</option> so that <literal>bydns</literal> is not the first
18871 mechanism in the list, then this variable will be false.
18872 </para>
18873 </listitem></varlistentry>
18874 <varlistentry>
18875 <term><varname>$sender_host_name</varname></term>
18876 <listitem>
18877 <para>
18878 <indexterm role="variable">
18879 <primary><varname>$sender_host_name</varname></primary>
18880 </indexterm>
18881 When a message is received from a remote host, this variable contains the
18882 host&#x2019;s name as obtained by looking up its IP address. For messages received by
18883 other means, this variable is empty.
18884 </para>
18885 <para>
18886 <indexterm role="variable">
18887 <primary><varname>$host_lookup_failed</varname></primary>
18888 </indexterm>
18889 If the host name has not previously been looked up, a reference to
18890 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
18891 A looked up name is accepted only if it leads back to the original IP address
18892 via a forward lookup. If either the reverse or the forward lookup fails to find
18893 any data, or if the forward lookup does not yield the original IP address,
18894 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
18895 </para>
18896 <para>
18897 <indexterm role="variable">
18898 <primary><varname>$host_lookup_deferred</varname></primary>
18899 </indexterm>
18900 However, if either of the lookups cannot be completed (for example, there is a
18901 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
18902 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
18903 </para>
18904 <para>
18905 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
18906 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
18907 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
18908 is set to <quote>1</quote>.
18909 </para>
18910 <para>
18911 Exim does not automatically look up every calling host&#x2019;s name. If you want
18912 maximum efficiency, you should arrange your configuration so that it avoids
18913 these lookups altogether. The lookup happens only if one or more of the
18914 following are true:
18915 </para>
18916 <itemizedlist>
18917 <listitem>
18918 <para>
18919 A string containing <varname>$sender_host_name</varname> is expanded.
18920 </para>
18921 </listitem>
18922 <listitem>
18923 <para>
18924 The calling host matches the list in <option>host_lookup</option>. In the default
18925 configuration, this option is set to *, so it must be changed if lookups are
18926 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
18927 </para>
18928 </listitem>
18929 <listitem>
18930 <para>
18931 Exim needs the host name in order to test an item in a host list. The items
18932 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
18933 <xref linkend="SECThoslispatnamsk"/>.
18934 </para>
18935 </listitem>
18936 <listitem>
18937 <para>
18938 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
18939 In this case, the host name is required to compare with the name quoted in any
18940 EHLO or HELO commands that the client issues.
18941 </para>
18942 </listitem>
18943 <listitem>
18944 <para>
18945 The remote host issues a EHLO or HELO command that quotes one of the
18946 domains in <option>helo_lookup_domains</option>. The default value of this option is
18947 </para>
18948 <literallayout class="monospaced">
18949   helo_lookup_domains = @ : @[]
18950 </literallayout>
18951 <para>
18952 which causes a lookup if a remote host (incorrectly) gives the server&#x2019;s name or
18953 IP address in an EHLO or HELO command.
18954 </para>
18955 </listitem>
18956 </itemizedlist>
18957 </listitem></varlistentry>
18958 <varlistentry>
18959 <term><varname>$sender_host_port</varname></term>
18960 <listitem>
18961 <para>
18962 <indexterm role="variable">
18963 <primary><varname>$sender_host_port</varname></primary>
18964 </indexterm>
18965 When a message is received from a remote host, this variable contains the port
18966 number that was used on the remote host.
18967 </para>
18968 </listitem></varlistentry>
18969 <varlistentry>
18970 <term><varname>$sender_ident</varname></term>
18971 <listitem>
18972 <para>
18973 <indexterm role="variable">
18974 <primary><varname>$sender_ident</varname></primary>
18975 </indexterm>
18976 When a message is received from a remote host, this variable contains the
18977 identification received in response to an RFC 1413 request. When a message has
18978 been received locally, this variable contains the login name of the user that
18979 called Exim.
18980 </para>
18981 </listitem></varlistentry>
18982 <varlistentry>
18983 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
18984 <listitem>
18985 <para>
18986 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
18987 <option>ratelimit</option> ACL condition. Details are given in section
18988 <xref linkend="SECTratelimiting"/>.
18989 </para>
18990 </listitem></varlistentry>
18991 <varlistentry>
18992 <term><varname>$sender_rcvhost</varname></term>
18993 <listitem>
18994 <para>
18995 <indexterm role="concept">
18996 <primary>DNS</primary>
18997 <secondary>reverse lookup</secondary>
18998 </indexterm>
18999 <indexterm role="concept">
19000 <primary>reverse DNS lookup</primary>
19001 </indexterm>
19002 <indexterm role="variable">
19003 <primary><varname>$sender_rcvhost</varname></primary>
19004 </indexterm>
19005 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
19006 either the verified host name (as obtained from a reverse DNS lookup) or, if
19007 there is no verified host name, the IP address in square brackets. After that
19008 there may be text in parentheses. When the first item is a verified host name,
19009 the first thing in the parentheses is the IP address in square brackets,
19010 followed by a colon and a port number if port logging is enabled. When the
19011 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
19012 the parentheses.
19013 </para>
19014 <para>
19015 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
19016 was used and its argument was not identical to the real host name or IP
19017 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
19018 all three items are present in the parentheses, a newline and tab are inserted
19019 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
19020 </para>
19021 </listitem></varlistentry>
19022 <varlistentry>
19023 <term><varname>$sender_verify_failure</varname></term>
19024 <listitem>
19025 <para>
19026 <indexterm role="variable">
19027 <primary><varname>$sender_verify_failure</varname></primary>
19028 </indexterm>
19029 In an ACL, when a sender verification fails, this variable contains information
19030 about the failure. The details are the same as for
19031 <varname>$recipient_verify_failure</varname>.
19032 </para>
19033 </listitem></varlistentry>
19034 <varlistentry>
19035 <term><varname>$sending_ip_address</varname></term>
19036 <listitem>
19037 <para>
19038 <indexterm role="variable">
19039 <primary><varname>$sending_ip_address</varname></primary>
19040 </indexterm>
19041 This variable is set whenever an outgoing SMTP connection to another host has
19042 been set up. It contains the IP address of the local interface that is being
19043 used. This is useful if a host that has more than one IP address wants to take
19044 on different personalities depending on which one is being used. For incoming
19045 connections, see <varname>$received_ip_address</varname>.
19046 </para>
19047 </listitem></varlistentry>
19048 <varlistentry>
19049 <term><varname>$sending_port</varname></term>
19050 <listitem>
19051 <para>
19052 <indexterm role="variable">
19053 <primary><varname>$sending_port</varname></primary>
19054 </indexterm>
19055 This variable is set whenever an outgoing SMTP connection to another host has
19056 been set up. It contains the local port that is being used. For incoming
19057 connections, see <varname>$received_port</varname>.
19058 </para>
19059 </listitem></varlistentry>
19060 <varlistentry>
19061 <term><varname>$smtp_active_hostname</varname></term>
19062 <listitem>
19063 <para>
19064 <indexterm role="variable">
19065 <primary><varname>$smtp_active_hostname</varname></primary>
19066 </indexterm>
19067 During an incoming SMTP session, this variable contains the value of the active
19068 host name, as specified by the <option>smtp_active_hostname</option> option. The value of
19069 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
19070 value can be consulted during routing and delivery.
19071 </para>
19072 </listitem></varlistentry>
19073 <varlistentry>
19074 <term><varname>$smtp_command</varname></term>
19075 <listitem>
19076 <para>
19077 <indexterm role="variable">
19078 <primary><varname>$smtp_command</varname></primary>
19079 </indexterm>
19080 During the processing of an incoming SMTP command, this variable contains the
19081 entire command. This makes it possible to distinguish between HELO and EHLO in
19082 the HELO ACL, and also to distinguish between commands such as these:
19083 </para>
19084 <literallayout class="monospaced">
19085 MAIL FROM:&lt;&gt;
19086 MAIL FROM: &lt;&gt;
19087 </literallayout>
19088 <para>
19089 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
19090 command, the address in <varname>$smtp_command</varname> is the original address before any
19091 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
19092 the address after SMTP-time rewriting.
19093 </para>
19094 </listitem></varlistentry>
19095 <varlistentry>
19096 <term><varname>$smtp_command_argument</varname></term>
19097 <listitem>
19098 <para>
19099 <indexterm role="concept">
19100 <primary>SMTP</primary>
19101 <secondary>command, argument for</secondary>
19102 </indexterm>
19103 <indexterm role="variable">
19104 <primary><varname>$smtp_command_argument</varname></primary>
19105 </indexterm>
19106 While an ACL is running to check an SMTP command, this variable contains the
19107 argument, that is, the text that follows the command name, with leading white
19108 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
19109 somewhat redundant, but is retained for backwards compatibility.
19110 </para>
19111 </listitem></varlistentry>
19112 <varlistentry>
19113 <term><varname>$smtp_count_at_connection_start</varname></term>
19114 <listitem>
19115 <para>
19116 <indexterm role="variable">
19117 <primary><varname>$smtp_count_at_connection_start</varname></primary>
19118 </indexterm>
19119 This variable is set greater than zero only in processes spawned by the Exim
19120 daemon for handling incoming SMTP connections. The name is deliberately long,
19121 in order to emphasize what the contents are. When the daemon accepts a new
19122 connection, it increments this variable. A copy of the variable is passed to
19123 the child process that handles the connection, but its value is fixed, and
19124 never changes. It is only an approximation of how many incoming connections
19125 there actually are, because many other connections may come and go while a
19126 single connection is being processed. When a child process terminates, the
19127 daemon decrements its copy of the variable.
19128 </para>
19129 </listitem></varlistentry>
19130 <varlistentry>
19131 <term><varname>$sn0</varname> &ndash; <varname>$sn9</varname></term>
19132 <listitem>
19133 <para>
19134 These variables are copies of the values of the <varname>$n0</varname> &ndash; <varname>$n9</varname> accumulators
19135 that were current at the end of the system filter file. This allows a system
19136 filter file to set values that can be tested in users&#x2019; filter files. For
19137 example, a system filter could set a value indicating how likely it is that a
19138 message is junk mail.
19139 </para>
19140 </listitem></varlistentry>
19141 <varlistentry>
19142 <term><varname>$spam_</varname><emphasis>xxx</emphasis></term>
19143 <listitem>
19144 <para>
19145 A number of variables whose names start with <varname>$spam</varname> are available when Exim
19146 is compiled with the content-scanning extension. For details, see section
19147 <xref linkend="SECTscanspamass"/>.
19148 </para>
19149 </listitem></varlistentry>
19150 <varlistentry>
19151 <term><varname>$spool_directory</varname></term>
19152 <listitem>
19153 <para>
19154 <indexterm role="variable">
19155 <primary><varname>$spool_directory</varname></primary>
19156 </indexterm>
19157 The name of Exim&#x2019;s spool directory.
19158 </para>
19159 </listitem></varlistentry>
19160 <varlistentry>
19161 <term><varname>$spool_inodes</varname></term>
19162 <listitem>
19163 <para>
19164 <indexterm role="variable">
19165 <primary><varname>$spool_inodes</varname></primary>
19166 </indexterm>
19167 The number of free inodes in the disk partition where Exim&#x2019;s spool files are
19168 being written. The value is recalculated whenever the variable is referenced.
19169 If the relevant file system does not have the concept of inodes, the value of
19170 is -1. See also the <option>check_spool_inodes</option> option.
19171 </para>
19172 </listitem></varlistentry>
19173 <varlistentry>
19174 <term><varname>$spool_space</varname></term>
19175 <listitem>
19176 <para>
19177 <indexterm role="variable">
19178 <primary><varname>$spool_space</varname></primary>
19179 </indexterm>
19180 The amount of free space (as a number of kilobytes) in the disk partition where
19181 Exim&#x2019;s spool files are being written. The value is recalculated whenever the
19182 variable is referenced. If the operating system does not have the ability to
19183 find the amount of free space (only true for experimental systems), the space
19184 value is -1. For example, to check in an ACL that there is at least 50
19185 megabytes free on the spool, you could write:
19186 </para>
19187 <literallayout class="monospaced">
19188 condition = ${if &gt; {$spool_space}{50000}}
19189 </literallayout>
19190 <para>
19191 See also the <option>check_spool_space</option> option.
19192 </para>
19193 </listitem></varlistentry>
19194 <varlistentry>
19195 <term><varname>$thisaddress</varname></term>
19196 <listitem>
19197 <para>
19198 <indexterm role="variable">
19199 <primary><varname>$thisaddress</varname></primary>
19200 </indexterm>
19201 This variable is set only during the processing of the <option>foranyaddress</option>
19202 command in a filter file. Its use is explained in the description of that
19203 command, which can be found in the separate document entitled <emphasis>Exim&#x2019;s
19204 interfaces to mail filtering</emphasis>.
19205 </para>
19206 </listitem></varlistentry>
19207 <varlistentry>
19208 <term><varname>$tls_in_bits</varname></term>
19209 <listitem>
19210 <para>
19211 <indexterm role="variable">
19212 <primary><varname>$tls_in_bits</varname></primary>
19213 </indexterm>
19214 Contains an approximation of the TLS cipher&#x2019;s bit-strength
19215 on the inbound connection; the meaning of
19216 this depends upon the TLS implementation used.
19217 If TLS has not been negotiated, the value will be 0.
19218 The value of this is automatically fed into the Cyrus SASL authenticator
19219 when acting as a server, to specify the "external SSF" (a SASL term).
19220 </para>
19221 <para>
19222 The deprecated <varname>$tls_bits</varname> variable refers to the inbound side
19223 except when used in the context of an outbound SMTP delivery, when it refers to
19224 the outbound.
19225 </para>
19226 </listitem></varlistentry>
19227 <varlistentry>
19228 <term><varname>$tls_out_bits</varname></term>
19229 <listitem>
19230 <para>
19231 <indexterm role="variable">
19232 <primary><varname>$tls_out_bits</varname></primary>
19233 </indexterm>
19234 Contains an approximation of the TLS cipher&#x2019;s bit-strength
19235 on an outbound SMTP connection; the meaning of
19236 this depends upon the TLS implementation used.
19237 If TLS has not been negotiated, the value will be 0.
19238 </para>
19239 </listitem></varlistentry>
19240 <varlistentry>
19241 <term><varname>$tls_in_ourcert</varname></term>
19242 <listitem>
19243 <para>
19244 <indexterm role="variable">
19245 <primary><varname>$tls_in_ourcert</varname></primary>
19246 </indexterm>
19247 This variable refers to the certificate presented to the peer of an
19248 inbound connection when the message was received.
19249 It is only useful as the argument of a
19250 </para>
19251 <para revisionflag="changed">
19252 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
19253 </para>
19254 <para>
19255 or a <option>def</option> condition.
19256 </para>
19257 </listitem></varlistentry>
19258 <varlistentry>
19259 <term><varname>$tls_in_peercert</varname></term>
19260 <listitem>
19261 <para>
19262 <indexterm role="variable">
19263 <primary><varname>$tls_in_peercert</varname></primary>
19264 </indexterm>
19265 This variable refers to the certificate presented by the peer of an
19266 inbound connection when the message was received.
19267 It is only useful as the argument of a
19268 </para>
19269 <para revisionflag="changed">
19270 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
19271 </para>
19272 <para>
19273 or a <option>def</option> condition.
19274 </para>
19275 </listitem></varlistentry>
19276 <varlistentry>
19277 <term><varname>$tls_out_ourcert</varname></term>
19278 <listitem>
19279 <para>
19280 <indexterm role="variable">
19281 <primary><varname>$tls_out_ourcert</varname></primary>
19282 </indexterm>
19283 This variable refers to the certificate presented to the peer of an
19284 outbound connection.  It is only useful as the argument of a
19285 </para>
19286 <para revisionflag="changed">
19287 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
19288 </para>
19289 <para>
19290 or a <option>def</option> condition.
19291 </para>
19292 </listitem></varlistentry>
19293 <varlistentry>
19294 <term><varname>$tls_out_peercert</varname></term>
19295 <listitem>
19296 <para>
19297 <indexterm role="variable">
19298 <primary><varname>$tls_out_peercert</varname></primary>
19299 </indexterm>
19300 This variable refers to the certificate presented by the peer of an
19301 outbound connection.  It is only useful as the argument of a
19302 </para>
19303 <para revisionflag="changed">
19304 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
19305 </para>
19306 <para>
19307 or a <option>def</option> condition.
19308 </para>
19309 </listitem></varlistentry>
19310 <varlistentry>
19311 <term><varname>$tls_in_certificate_verified</varname></term>
19312 <listitem>
19313 <para>
19314 <indexterm role="variable">
19315 <primary><varname>$tls_in_certificate_verified</varname></primary>
19316 </indexterm>
19317 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
19318 message was received, and <quote>0</quote> otherwise.
19319 </para>
19320 <para>
19321 The deprecated <varname>$tls_certificate_verfied</varname> variable refers to the inbound side
19322 except when used in the context of an outbound SMTP delivery, when it refers to
19323 the outbound.
19324 </para>
19325 </listitem></varlistentry>
19326 <varlistentry>
19327 <term><varname>$tls_out_certificate_verified</varname></term>
19328 <listitem>
19329 <para>
19330 <indexterm role="variable">
19331 <primary><varname>$tls_out_certificate_verified</varname></primary>
19332 </indexterm>
19333 This variable is set to <quote>1</quote> if a TLS certificate was verified when an
19334 outbound SMTP connection was made,
19335 and <quote>0</quote> otherwise.
19336 </para>
19337 </listitem></varlistentry>
19338 <varlistentry>
19339 <term><varname>$tls_in_cipher</varname></term>
19340 <listitem>
19341 <para>
19342 <indexterm role="variable">
19343 <primary><varname>$tls_in_cipher</varname></primary>
19344 </indexterm>
19345 <indexterm role="variable">
19346 <primary><varname>$tls_cipher</varname></primary>
19347 </indexterm>
19348 When a message is received from a remote host over an encrypted SMTP
19349 connection, this variable is set to the cipher suite that was negotiated, for
19350 example DES-CBC3-SHA. In other circumstances, in particular, for message
19351 received over unencrypted connections, the variable is empty. Testing
19352 <varname>$tls_cipher</varname> for emptiness is one way of distinguishing between encrypted and
19353 non-encrypted connections during ACL processing.
19354 </para>
19355 <para>
19356 The deprecated <varname>$tls_cipher</varname> variable is the same as <varname>$tls_in_cipher</varname> during message reception,
19357 but in the context of an outward SMTP delivery taking place via the <command>smtp</command> transport
19358 becomes the same as <varname>$tls_out_cipher</varname>.
19359 </para>
19360 </listitem></varlistentry>
19361 <varlistentry>
19362 <term><varname>$tls_out_cipher</varname></term>
19363 <listitem>
19364 <para>
19365 <indexterm role="variable">
19366 <primary><varname>$tls_out_cipher</varname></primary>
19367 </indexterm>
19368 This variable is
19369 cleared before any outgoing SMTP connection is made,
19370 and then set to the outgoing cipher suite if one is negotiated. See chapter
19371 <xref linkend="CHAPTLS"/> for details of TLS support and chapter <xref linkend="CHAPsmtptrans"/> for
19372 details of the <command>smtp</command> transport.
19373 </para>
19374 </listitem></varlistentry>
19375 <varlistentry>
19376 <term><varname>$tls_in_ocsp</varname></term>
19377 <listitem>
19378 <para>
19379 <indexterm role="variable">
19380 <primary><varname>$tls_in_ocsp</varname></primary>
19381 </indexterm>
19382 When a message is received from a remote client connection
19383 the result of any OCSP request from the client is encoded in this variable:
19384 </para>
19385 <literallayout class="monospaced">
19386 0 OCSP proof was not requested (default value)
19387 1 No response to request
19388 2 Response not verified
19389 3 Verification failed
19390 4 Verification succeeded
19391 </literallayout>
19392 </listitem></varlistentry>
19393 <varlistentry>
19394 <term><varname>$tls_out_ocsp</varname></term>
19395 <listitem>
19396 <para>
19397 <indexterm role="variable">
19398 <primary><varname>$tls_out_ocsp</varname></primary>
19399 </indexterm>
19400 When a message is sent to a remote host connection
19401 the result of any OCSP request made is encoded in this variable.
19402 See <varname>$tls_in_ocsp</varname> for values.
19403 </para>
19404 </listitem></varlistentry>
19405 <varlistentry>
19406 <term><varname>$tls_in_peerdn</varname></term>
19407 <listitem>
19408 <para>
19409 <indexterm role="variable">
19410 <primary><varname>$tls_in_peerdn</varname></primary>
19411 </indexterm>
19412 <indexterm role="variable">
19413 <primary><varname>$tls_peerdn</varname></primary>
19414 </indexterm>
19415 When a message is received from a remote host over an encrypted SMTP
19416 connection, and Exim is configured to request a certificate from the client,
19417 the value of the Distinguished Name of the certificate is made available in the
19418 <varname>$tls_in_peerdn</varname> during subsequent processing.
19419 </para>
19420 <para>
19421 The deprecated <varname>$tls_peerdn</varname> variable refers to the inbound side
19422 except when used in the context of an outbound SMTP delivery, when it refers to
19423 the outbound.
19424 </para>
19425 </listitem></varlistentry>
19426 <varlistentry>
19427 <term><varname>$tls_out_peerdn</varname></term>
19428 <listitem>
19429 <para>
19430 <indexterm role="variable">
19431 <primary><varname>$tls_out_peerdn</varname></primary>
19432 </indexterm>
19433 When a message is being delivered to a remote host over an encrypted SMTP
19434 connection, and Exim is configured to request a certificate from the server,
19435 the value of the Distinguished Name of the certificate is made available in the
19436 <varname>$tls_out_peerdn</varname> during subsequent processing.
19437 </para>
19438 </listitem></varlistentry>
19439 <varlistentry>
19440 <term><varname>$tls_in_sni</varname></term>
19441 <listitem>
19442 <para>
19443 <indexterm role="variable">
19444 <primary><varname>$tls_in_sni</varname></primary>
19445 </indexterm>
19446 <indexterm role="variable">
19447 <primary><varname>$tls_sni</varname></primary>
19448 </indexterm>
19449 <indexterm role="concept">
19450 <primary>TLS</primary>
19451 <secondary>Server Name Indication</secondary>
19452 </indexterm>
19453 When a TLS session is being established, if the client sends the Server
19454 Name Indication extension, the value will be placed in this variable.
19455 If the variable appears in <option>tls_certificate</option> then this option and
19456 some others, described in <xref linkend="SECTtlssni"/>,
19457 will be re-expanded early in the TLS session, to permit
19458 a different certificate to be presented (and optionally a different key to be
19459 used) to the client, based upon the value of the SNI extension.
19460 </para>
19461 <para>
19462 The deprecated <varname>$tls_sni</varname> variable refers to the inbound side
19463 except when used in the context of an outbound SMTP delivery, when it refers to
19464 the outbound.
19465 </para>
19466 </listitem></varlistentry>
19467 <varlistentry>
19468 <term><varname>$tls_out_sni</varname></term>
19469 <listitem>
19470 <para>
19471 <indexterm role="variable">
19472 <primary><varname>$tls_out_sni</varname></primary>
19473 </indexterm>
19474 <indexterm role="concept">
19475 <primary>TLS</primary>
19476 <secondary>Server Name Indication</secondary>
19477 </indexterm>
19478 During outbound
19479 SMTP deliveries, this variable reflects the value of the <option>tls_sni</option> option on
19480 the transport.
19481 </para>
19482 </listitem></varlistentry>
19483 <varlistentry>
19484 <term><varname>$tod_bsdinbox</varname></term>
19485 <listitem>
19486 <para>
19487 <indexterm role="variable">
19488 <primary><varname>$tod_bsdinbox</varname></primary>
19489 </indexterm>
19490 The time of day and the date, in the format required for BSD-style mailbox
19491 files, for example: Thu Oct 17 17:14:09 1995.
19492 </para>
19493 </listitem></varlistentry>
19494 <varlistentry>
19495 <term><varname>$tod_epoch</varname></term>
19496 <listitem>
19497 <para>
19498 <indexterm role="variable">
19499 <primary><varname>$tod_epoch</varname></primary>
19500 </indexterm>
19501 The time and date as a number of seconds since the start of the Unix epoch.
19502 </para>
19503 </listitem></varlistentry>
19504 <varlistentry>
19505 <term><varname>$tod_epoch_l</varname></term>
19506 <listitem>
19507 <para>
19508 <indexterm role="variable">
19509 <primary><varname>$tod_epoch_l</varname></primary>
19510 </indexterm>
19511 The time and date as a number of microseconds since the start of the Unix epoch.
19512 </para>
19513 </listitem></varlistentry>
19514 <varlistentry>
19515 <term><varname>$tod_full</varname></term>
19516 <listitem>
19517 <para>
19518 <indexterm role="variable">
19519 <primary><varname>$tod_full</varname></primary>
19520 </indexterm>
19521 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
19522 +0100. The timezone is always given as a numerical offset from UTC, with
19523 positive values used for timezones that are ahead (east) of UTC, and negative
19524 values for those that are behind (west).
19525 </para>
19526 </listitem></varlistentry>
19527 <varlistentry>
19528 <term><varname>$tod_log</varname></term>
19529 <listitem>
19530 <para>
19531 <indexterm role="variable">
19532 <primary><varname>$tod_log</varname></primary>
19533 </indexterm>
19534 The time and date in the format used for writing Exim&#x2019;s log files, for example:
19535 1995-10-12 15:32:29, but without a timezone.
19536 </para>
19537 </listitem></varlistentry>
19538 <varlistentry>
19539 <term><varname>$tod_logfile</varname></term>
19540 <listitem>
19541 <para>
19542 <indexterm role="variable">
19543 <primary><varname>$tod_logfile</varname></primary>
19544 </indexterm>
19545 This variable contains the date in the format yyyymmdd. This is the format that
19546 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
19547 flag.
19548 </para>
19549 </listitem></varlistentry>
19550 <varlistentry>
19551 <term><varname>$tod_zone</varname></term>
19552 <listitem>
19553 <para>
19554 <indexterm role="variable">
19555 <primary><varname>$tod_zone</varname></primary>
19556 </indexterm>
19557 This variable contains the numerical value of the local timezone, for example:
19558 -0500.
19559 </para>
19560 </listitem></varlistentry>
19561 <varlistentry>
19562 <term><varname>$tod_zulu</varname></term>
19563 <listitem>
19564 <para>
19565 <indexterm role="variable">
19566 <primary><varname>$tod_zulu</varname></primary>
19567 </indexterm>
19568 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
19569 by ISO 8601, for example: 20030221154023Z.
19570 </para>
19571 </listitem></varlistentry>
19572 <varlistentry>
19573 <term><varname>$transport_name</varname></term>
19574 <listitem>
19575 <para>
19576 <indexterm role="concept">
19577 <primary>transport</primary>
19578 <secondary>name</secondary>
19579 </indexterm>
19580 <indexterm role="concept">
19581 <primary>name</primary>
19582 <secondary>of transport</secondary>
19583 </indexterm>
19584 <indexterm role="variable">
19585 <primary><varname>$transport_name</varname></primary>
19586 </indexterm>
19587 During the running of a transport, this variable contains its name.
19588 </para>
19589 </listitem></varlistentry>
19590 <varlistentry>
19591 <term><varname>$value</varname></term>
19592 <listitem>
19593 <para>
19594 <indexterm role="variable">
19595 <primary><varname>$value</varname></primary>
19596 </indexterm>
19597 This variable contains the result of an expansion lookup, extraction operation,
19598 or external command, as described above. It is also used during a
19599 <emphasis role="bold">reduce</emphasis> expansion.
19600 </para>
19601 </listitem></varlistentry>
19602 <varlistentry>
19603 <term><varname>$verify_mode</varname></term>
19604 <listitem>
19605 <para>
19606 <indexterm role="variable">
19607 <primary><varname>$verify_mode</varname></primary>
19608 </indexterm>
19609 While a router or transport is being run in verify mode
19610 or for cutthrough delivery,
19611 contains "S" for sender-verification or "R" for recipient-verification.
19612 Otherwise, empty.
19613 </para>
19614 </listitem></varlistentry>
19615 <varlistentry>
19616 <term><varname>$version_number</varname></term>
19617 <listitem>
19618 <para>
19619 <indexterm role="variable">
19620 <primary><varname>$version_number</varname></primary>
19621 </indexterm>
19622 The version number of Exim.
19623 </para>
19624 </listitem></varlistentry>
19625 <varlistentry>
19626 <term><varname>$warn_message_delay</varname></term>
19627 <listitem>
19628 <para>
19629 <indexterm role="variable">
19630 <primary><varname>$warn_message_delay</varname></primary>
19631 </indexterm>
19632 This variable is set only during the creation of a message warning about a
19633 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
19634 </para>
19635 </listitem></varlistentry>
19636 <varlistentry>
19637 <term><varname>$warn_message_recipients</varname></term>
19638 <listitem>
19639 <para>
19640 <indexterm role="variable">
19641 <primary><varname>$warn_message_recipients</varname></primary>
19642 </indexterm>
19643 This variable is set only during the creation of a message warning about a
19644 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
19645 </para>
19646 </listitem></varlistentry>
19647 </variablelist>
19648 <para>
19649 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
19650 </para>
19651 </section>
19652 </chapter>
19653
19654 <chapter id="CHAPperl">
19655 <title>Embedded Perl</title>
19656 <para>
19657 <indexterm role="concept" id="IIDperl" class="startofrange">
19658 <primary>Perl</primary>
19659 <secondary>calling from Exim</secondary>
19660 </indexterm>
19661 Exim can be built to include an embedded Perl interpreter. When this is done,
19662 Perl subroutines can be called as part of the string expansion process. To make
19663 use of the Perl support, you need version 5.004 or later of Perl installed on
19664 your system. To include the embedded interpreter in the Exim binary, include
19665 the line
19666 </para>
19667 <literallayout class="monospaced">
19668 EXIM_PERL = perl.o
19669 </literallayout>
19670 <para>
19671 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
19672 </para>
19673 <section id="SECID85">
19674 <title>Setting up so Perl can be used</title>
19675 <para>
19676 <indexterm role="option">
19677 <primary><option>perl_startup</option></primary>
19678 </indexterm>
19679 Access to Perl subroutines is via a global configuration option called
19680 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
19681 no <option>perl_startup</option> option in the Exim configuration file then no Perl
19682 interpreter is started and there is almost no overhead for Exim (since none of
19683 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
19684 option then the associated value is taken to be Perl code which is executed in
19685 a newly created Perl interpreter.
19686 </para>
19687 <para>
19688 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
19689 need backslashes before any characters to escape special meanings. The option
19690 should usually be something like
19691 </para>
19692 <literallayout class="monospaced">
19693 perl_startup = do '/etc/exim.pl'
19694 </literallayout>
19695 <para>
19696 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
19697 use from Exim. Exim can be configured either to start up a Perl interpreter as
19698 soon as it is entered, or to wait until the first time it is needed. Starting
19699 the interpreter at the beginning ensures that it is done while Exim still has
19700 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
19701 fact used in a particular run. Also, note that this does not mean that Exim is
19702 necessarily running as root when Perl is called at a later time. By default,
19703 the interpreter is started only when it is needed, but this can be changed in
19704 two ways:
19705 </para>
19706 <itemizedlist>
19707 <listitem>
19708 <para>
19709 <indexterm role="option">
19710 <primary><option>perl_at_start</option></primary>
19711 </indexterm>
19712 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
19713 a startup when Exim is entered.
19714 </para>
19715 </listitem>
19716 <listitem>
19717 <para>
19718 The command line option <option>-ps</option> also requests a startup when Exim is entered,
19719 overriding the setting of <option>perl_at_start</option>.
19720 </para>
19721 </listitem>
19722 </itemizedlist>
19723 <para>
19724 There is also a command line option <option>-pd</option> (for delay) which suppresses the
19725 initial startup, even if <option>perl_at_start</option> is set.
19726 </para>
19727 </section>
19728 <section id="SECID86">
19729 <title>Calling Perl subroutines</title>
19730 <para>
19731 When the configuration file includes a <option>perl_startup</option> option you can make use
19732 of the string expansion item to call the Perl subroutines that are defined
19733 by the <option>perl_startup</option> code. The operator is used in any of the following
19734 forms:
19735 </para>
19736 <literallayout class="monospaced">
19737 ${perl{foo}}
19738 ${perl{foo}{argument}}
19739 ${perl{foo}{argument1}{argument2} ... }
19740 </literallayout>
19741 <para>
19742 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
19743 arguments may be passed. Passing more than this results in an expansion failure
19744 with an error message of the form
19745 </para>
19746 <literallayout class="monospaced">
19747 Too many arguments passed to Perl subroutine "foo" (max is 8)
19748 </literallayout>
19749 <para>
19750 The return value of the Perl subroutine is evaluated in a scalar context before
19751 it is passed back to Exim to be inserted into the expanded string. If the
19752 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
19753 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
19754 by obeying Perl&#x2019;s <option>die</option> function, the expansion fails with the error message
19755 that was passed to <option>die</option>.
19756 </para>
19757 </section>
19758 <section id="SECID87">
19759 <title>Calling Exim functions from Perl</title>
19760 <para>
19761 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
19762 is available to call back into Exim&#x2019;s string expansion function. For example,
19763 the Perl code
19764 </para>
19765 <literallayout class="monospaced">
19766 my $lp = Exim::expand_string('$local_part');
19767 </literallayout>
19768 <para>
19769 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
19770 Note those are single quotes and not double quotes to protect against
19771 <varname>$local_part</varname> being interpolated as a Perl variable.
19772 </para>
19773 <para>
19774 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
19775 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
19776 expansion string, the Perl call from the original expansion string fails with
19777 an appropriate error message, in the same way as if <option>die</option> were used.
19778 </para>
19779 <para>
19780 <indexterm role="concept">
19781 <primary>debugging</primary>
19782 <secondary>from embedded Perl</secondary>
19783 </indexterm>
19784 <indexterm role="concept">
19785 <primary>log</primary>
19786 <secondary>writing from embedded Perl</secondary>
19787 </indexterm>
19788 Two other Exim functions are available for use from within Perl code.
19789 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim&#x2019;s
19790 debugging is enabled. If you want a newline at the end, you must supply it.
19791 <emphasis>Exim::log_write()</emphasis> writes a string to Exim&#x2019;s main log, adding a leading
19792 timestamp. In this case, you should not supply a terminating newline.
19793 </para>
19794 </section>
19795 <section id="SECID88">
19796 <title>Use of standard output and error by Perl</title>
19797 <para>
19798 <indexterm role="concept">
19799 <primary>Perl</primary>
19800 <secondary>standard output and error</secondary>
19801 </indexterm>
19802 You should not write to the standard error or output streams from within your
19803 Perl code, as it is not defined how these are set up. In versions of Exim
19804 before 4.50, it is possible for the standard output or error to refer to the
19805 SMTP connection during message reception via the daemon. Writing to this stream
19806 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
19807 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
19808 avoided, but the output is lost.
19809 </para>
19810 <para>
19811 <indexterm role="concept">
19812 <primary>Perl</primary>
19813 <secondary>use of <option>warn</option></secondary>
19814 </indexterm>
19815 The Perl <option>warn</option> statement writes to the standard error stream by default.
19816 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
19817 you have no control. When Exim starts up the Perl interpreter, it arranges for
19818 output from the <option>warn</option> statement to be written to the Exim main log. You can
19819 change this by including appropriate Perl magic somewhere in your Perl code.
19820 For example, to discard <option>warn</option> output completely, you need this:
19821 </para>
19822 <literallayout class="monospaced">
19823 $SIG{__WARN__} = sub { };
19824 </literallayout>
19825 <para>
19826 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
19827 example, the code for the subroutine is empty, so it does nothing, but you can
19828 include any Perl code that you like. The text of the <option>warn</option> message is passed
19829 as the first subroutine argument.
19830 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
19831 </para>
19832 </section>
19833 </chapter>
19834
19835 <chapter id="CHAPinterfaces">
19836 <title>Starting the daemon and the use of network interfaces</title>
19837 <titleabbrev>Starting the daemon</titleabbrev>
19838 <para>
19839 <indexterm role="concept">
19840 <primary>daemon</primary>
19841 <secondary>starting</secondary>
19842 </indexterm>
19843 <indexterm role="concept">
19844 <primary>interface</primary>
19845 <secondary>listening</secondary>
19846 </indexterm>
19847 <indexterm role="concept">
19848 <primary>network interface</primary>
19849 </indexterm>
19850 <indexterm role="concept">
19851 <primary>interface</primary>
19852 <secondary>network</secondary>
19853 </indexterm>
19854 <indexterm role="concept">
19855 <primary>IP address</primary>
19856 <secondary>for listening</secondary>
19857 </indexterm>
19858 <indexterm role="concept">
19859 <primary>daemon</primary>
19860 <secondary>listening IP addresses</secondary>
19861 </indexterm>
19862 <indexterm role="concept">
19863 <primary>TCP/IP</primary>
19864 <secondary>setting listening interfaces</secondary>
19865 </indexterm>
19866 <indexterm role="concept">
19867 <primary>TCP/IP</primary>
19868 <secondary>setting listening ports</secondary>
19869 </indexterm>
19870 A host that is connected to a TCP/IP network may have one or more physical
19871 hardware network interfaces. Each of these interfaces may be configured as one
19872 or more <quote>logical</quote> interfaces, which are the entities that a program actually
19873 works with. Each of these logical interfaces is associated with an IP address.
19874 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
19875 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
19876 knowledge about the host&#x2019;s interfaces for use in three different circumstances:
19877 </para>
19878 <orderedlist numeration="arabic">
19879 <listitem>
19880 <para>
19881 When a listening daemon is started, Exim needs to know which interfaces
19882 and ports to listen on.
19883 </para>
19884 </listitem>
19885 <listitem>
19886 <para>
19887 When Exim is routing an address, it needs to know which IP addresses
19888 are associated with local interfaces. This is required for the correct
19889 processing of MX lists by removing the local host and others with the
19890 same or higher priority values. Also, Exim needs to detect cases
19891 when an address is routed to an IP address that in fact belongs to the
19892 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
19893 option of the smtp transport is set (as appropriate), this is treated
19894 as an error situation.
19895 </para>
19896 </listitem>
19897 <listitem>
19898 <para>
19899 When Exim connects to a remote host, it may need to know which interface to use
19900 for the outgoing connection.
19901 </para>
19902 </listitem>
19903 </orderedlist>
19904 <para>
19905 Exim&#x2019;s default behaviour is likely to be appropriate in the vast majority
19906 of cases. If your host has only one interface, and you want all its IP
19907 addresses to be treated in the same way, and you are using only the
19908 standard SMTP port, you should not need to take any special action. The
19909 rest of this chapter does not apply to you.
19910 </para>
19911 <para>
19912 In a more complicated situation you may want to listen only on certain
19913 interfaces, or on different ports, and for this reason there are a number of
19914 options that can be used to influence Exim&#x2019;s behaviour. The rest of this
19915 chapter describes how they operate.
19916 </para>
19917 <para>
19918 When a message is received over TCP/IP, the interface and port that were
19919 actually used are set in <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
19920 </para>
19921 <section id="SECID89">
19922 <title>Starting a listening daemon</title>
19923 <para>
19924 When a listening daemon is started (by means of the <option>-bd</option> command line
19925 option), the interfaces and ports on which it listens are controlled by the
19926 following options:
19927 </para>
19928 <itemizedlist>
19929 <listitem>
19930 <para>
19931 <option>daemon_smtp_ports</option> contains a list of default ports
19932 or service names.
19933 (For backward compatibility, this option can also be specified in the singular.)
19934 </para>
19935 </listitem>
19936 <listitem>
19937 <para>
19938 <option>local_interfaces</option> contains list of interface IP addresses on which to
19939 listen. Each item may optionally also specify a port.
19940 </para>
19941 </listitem>
19942 </itemizedlist>
19943 <para>
19944 The default list separator in both cases is a colon, but this can be changed as
19945 described in section <xref linkend="SECTlistconstruct"/>. When IPv6 addresses are involved,
19946 it is usually best to change the separator to avoid having to double all the
19947 colons. For example:
19948 </para>
19949 <literallayout class="monospaced">
19950 local_interfaces = &lt;; 127.0.0.1 ; \
19951                       192.168.23.65 ; \
19952                       ::1 ; \
19953                       3ffe:ffff:836f::fe86:a061
19954 </literallayout>
19955 <para>
19956 There are two different formats for specifying a port along with an IP address
19957 in <option>local_interfaces</option>:
19958 </para>
19959 <orderedlist numeration="arabic">
19960 <listitem>
19961 <para>
19962 The port is added onto the address with a dot separator. For example, to listen
19963 on port 1234 on two different IP addresses:
19964 </para>
19965 <literallayout class="monospaced">
19966 local_interfaces = &lt;; 192.168.23.65.1234 ; \
19967                       3ffe:ffff:836f::fe86:a061.1234
19968 </literallayout>
19969 </listitem>
19970 <listitem>
19971 <para>
19972 The IP address is enclosed in square brackets, and the port is added
19973 with a colon separator, for example:
19974 </para>
19975 <literallayout class="monospaced">
19976 local_interfaces = &lt;; [192.168.23.65]:1234 ; \
19977                       [3ffe:ffff:836f::fe86:a061]:1234
19978 </literallayout>
19979 </listitem>
19980 </orderedlist>
19981 <para>
19982 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
19983 default setting contains just one port:
19984 </para>
19985 <literallayout class="monospaced">
19986 daemon_smtp_ports = smtp
19987 </literallayout>
19988 <para>
19989 If more than one port is listed, each interface that does not have its own port
19990 specified listens on all of them. Ports that are listed in
19991 <option>daemon_smtp_ports</option> can be identified either by name (defined in
19992 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
19993 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
19994 </para>
19995 </section>
19996 <section id="SECID90">
19997 <title>Special IP listening addresses</title>
19998 <para>
19999 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
20000 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
20001 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
20002 instead of setting up separate listening sockets for each interface. The
20003 default value of <option>local_interfaces</option> is
20004 </para>
20005 <literallayout class="monospaced">
20006 local_interfaces = 0.0.0.0
20007 </literallayout>
20008 <para>
20009 when Exim is built without IPv6 support; otherwise it is:
20010 </para>
20011 <literallayout class="monospaced">
20012 local_interfaces = &lt;; ::0 ; 0.0.0.0
20013 </literallayout>
20014 <para>
20015 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
20016 </para>
20017 </section>
20018 <section id="SECID91">
20019 <title>Overriding local_interfaces and daemon_smtp_ports</title>
20020 <para>
20021 The <option>-oX</option> command line option can be used to override the values of
20022 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
20023 instance. Another way of doing this would be to use macros and the <option>-D</option>
20024 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
20025 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
20026 exim.
20027 </para>
20028 <para>
20029 The value of <option>-oX</option> is a list of items. The default colon separator can be
20030 changed in the usual way if required. If there are any items that do not
20031 contain dots or colons (that is, are not IP addresses), the value of
20032 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
20033 items that do contain dots or colons, the value of <option>local_interfaces</option> is
20034 replaced by those items. Thus, for example,
20035 </para>
20036 <literallayout class="monospaced">
20037 -oX 1225
20038 </literallayout>
20039 <para>
20040 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
20041 whereas
20042 </para>
20043 <literallayout class="monospaced">
20044 -oX 192.168.34.5.1125
20045 </literallayout>
20046 <para>
20047 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
20048 (However, since <option>local_interfaces</option> now contains no items without ports, the
20049 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
20050 </para>
20051 </section>
20052 <section id="SECTsupobssmt">
20053 <title>Support for the obsolete SSMTP (or SMTPS) protocol</title>
20054 <para>
20055 <indexterm role="concept">
20056 <primary>ssmtp protocol</primary>
20057 </indexterm>
20058 <indexterm role="concept">
20059 <primary>smtps protocol</primary>
20060 </indexterm>
20061 <indexterm role="concept">
20062 <primary>SMTP</primary>
20063 <secondary>ssmtp protocol</secondary>
20064 </indexterm>
20065 <indexterm role="concept">
20066 <primary>SMTP</primary>
20067 <secondary>smtps protocol</secondary>
20068 </indexterm>
20069 Exim supports the obsolete SSMTP protocol (also known as SMTPS) that was used
20070 before the STARTTLS command was standardized for SMTP. Some legacy clients
20071 still use this protocol. If the <option>tls_on_connect_ports</option> option is set to a
20072 list of port numbers or service names,
20073 connections to those ports must use SSMTP. The most
20074 common use of this option is expected to be
20075 </para>
20076 <literallayout class="monospaced">
20077 tls_on_connect_ports = 465
20078 </literallayout>
20079 <para>
20080 because 465 is the usual port number used by the legacy clients. There is also
20081 a command line option <option>-tls-on-connect</option>, which forces all ports to behave in
20082 this way when a daemon is started.
20083 </para>
20084 <para>
20085 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
20086 daemon to listen on those ports. You must still specify them in
20087 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
20088 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
20089 connections via the daemon.)
20090 </para>
20091 </section>
20092 <section id="SECID92">
20093 <title>IPv6 address scopes</title>
20094 <para>
20095 <indexterm role="concept">
20096 <primary>IPv6</primary>
20097 <secondary>address scopes</secondary>
20098 </indexterm>
20099 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
20100 can, in principle, have the same link-local IPv6 address on different
20101 interfaces. Thus, additional information is needed, over and above the IP
20102 address, to distinguish individual interfaces. A convention of using a
20103 percent sign followed by something (often the interface name) has been
20104 adopted in some cases, leading to addresses like this:
20105 </para>
20106 <literallayout class="monospaced">
20107 fe80::202:b3ff:fe03:45c1%eth0
20108 </literallayout>
20109 <para>
20110 To accommodate this usage, a percent sign followed by an arbitrary string is
20111 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
20112 to convert a textual IPv6 address for actual use. This function recognizes the
20113 percent convention in operating systems that support it, and it processes the
20114 address appropriately. Unfortunately, some older libraries have problems with
20115 <function>getaddrinfo()</function>. If
20116 </para>
20117 <literallayout class="monospaced">
20118 IPV6_USE_INET_PTON=yes
20119 </literallayout>
20120 <para>
20121 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
20122 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
20123 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
20124 function.) Of course, this means that the additional functionality of
20125 <function>getaddrinfo()</function> &ndash; recognizing scoped addresses &ndash; is lost.
20126 </para>
20127 </section>
20128 <section id="SECID93">
20129 <title>Disabling IPv6</title>
20130 <para>
20131 <indexterm role="concept">
20132 <primary>IPv6</primary>
20133 <secondary>disabling</secondary>
20134 </indexterm>
20135 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
20136 run on a host whose kernel does not support IPv6. The binary will fall back to
20137 using IPv4, but it may waste resources looking up AAAA records, and trying to
20138 connect to IPv6 addresses, causing delays to mail delivery. If you set the
20139 <indexterm role="option">
20140 <primary><option>disable_ipv6</option></primary>
20141 </indexterm>
20142 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
20143 activities take place. AAAA records are never looked up, and any IPv6 addresses
20144 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
20145 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
20146 to handle IPv6 literal addresses.
20147 </para>
20148 <para>
20149 On the other hand, when IPv6 is in use, there may be times when you want to
20150 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
20151 option to globally suppress the lookup of AAAA records for specified domains,
20152 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
20153 IPv6 addresses in an individual router.
20154 </para>
20155 </section>
20156 <section id="SECID94">
20157 <title>Examples of starting a listening daemon</title>
20158 <para>
20159 The default case in an IPv6 environment is
20160 </para>
20161 <literallayout class="monospaced">
20162 daemon_smtp_ports = smtp
20163 local_interfaces = &lt;; ::0 ; 0.0.0.0
20164 </literallayout>
20165 <para>
20166 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
20167 Either one or two sockets may be used, depending on the characteristics of
20168 the TCP/IP stack. (This is complicated and messy; for more information,
20169 read the comments in the <filename>daemon.c</filename> source file.)
20170 </para>
20171 <para>
20172 To specify listening on ports 25 and 26 on all interfaces:
20173 </para>
20174 <literallayout class="monospaced">
20175 daemon_smtp_ports = 25 : 26
20176 </literallayout>
20177 <para>
20178 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
20179 </para>
20180 <literallayout class="monospaced">
20181 local_interfaces = &lt;; ::0.25     ; ::0.26 \
20182                       0.0.0.0.25 ; 0.0.0.0.26
20183 </literallayout>
20184 <para>
20185 To listen on the default port on all IPv4 interfaces, and on port 26 on the
20186 IPv4 loopback address only:
20187 </para>
20188 <literallayout class="monospaced">
20189 local_interfaces = 0.0.0.0 : 127.0.0.1.26
20190 </literallayout>
20191 <para>
20192 To specify listening on the default port on specific interfaces only:
20193 </para>
20194 <literallayout class="monospaced">
20195 local_interfaces = 10.0.0.67 : 192.168.34.67
20196 </literallayout>
20197 <para>
20198 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
20199 </para>
20200 </section>
20201 <section id="SECTreclocipadd">
20202 <title>Recognizing the local host</title>
20203 <para>
20204 The <option>local_interfaces</option> option is also used when Exim needs to determine
20205 whether or not an IP address refers to the local host. That is, the IP
20206 addresses of all the interfaces on which a daemon is listening are always
20207 treated as local.
20208 </para>
20209 <para>
20210 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
20211 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
20212 available interfaces from the operating system, and extracts the relevant
20213 (that is, IPv4 or IPv6) addresses to use for checking.
20214 </para>
20215 <para>
20216 Some systems set up large numbers of virtual interfaces in order to provide
20217 many virtual web servers. In this situation, you may want to listen for
20218 email on only a few of the available interfaces, but nevertheless treat all
20219 interfaces as local when routing. You can do this by setting
20220 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
20221 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
20222 used for listening. Consider this example:
20223 </para>
20224 <literallayout class="monospaced">
20225 local_interfaces = &lt;; 127.0.0.1 ; ::1 ; \
20226                       192.168.53.235 ; \
20227                       3ffe:2101:12:1:a00:20ff:fe86:a061
20228
20229 extra_local_interfaces = &lt;; ::0 ; 0.0.0.0
20230 </literallayout>
20231 <para>
20232 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
20233 address, but all available interface addresses are treated as local when
20234 Exim is routing.
20235 </para>
20236 <para>
20237 In some environments the local host name may be in an MX list, but with an IP
20238 address that is not assigned to any local interface. In other cases it may be
20239 desirable to treat other host names as if they referred to the local host. Both
20240 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
20241 This contains host names rather than IP addresses. When a host is referenced
20242 during routing, either via an MX record or directly, it is treated as the local
20243 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
20244 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
20245 </para>
20246 </section>
20247 <section id="SECID95">
20248 <title>Delivering to a remote host</title>
20249 <para>
20250 Delivery to a remote host is handled by the smtp transport. By default, it
20251 allows the system&#x2019;s TCP/IP functions to choose which interface to use (if
20252 there is more than one) when connecting to a remote host. However, the
20253 <option>interface</option> option can be set to specify which interface is used. See the
20254 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
20255 details.
20256 </para>
20257 </section>
20258 </chapter>
20259
20260 <chapter id="CHAPmainconfig">
20261 <title>Main configuration</title>
20262 <para>
20263 <indexterm role="concept" id="IIDconfima" class="startofrange">
20264 <primary>configuration file</primary>
20265 <secondary>main section</secondary>
20266 </indexterm>
20267 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
20268 <primary>main configuration</primary>
20269 </indexterm>
20270 The first part of the run time configuration file contains three types of item:
20271 </para>
20272 <itemizedlist>
20273 <listitem>
20274 <para>
20275 Macro definitions: These lines start with an upper case letter. See section
20276 <xref linkend="SECTmacrodefs"/> for details of macro processing.
20277 </para>
20278 </listitem>
20279 <listitem>
20280 <para>
20281 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
20282 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
20283 section <xref linkend="SECTnamedlists"/>.
20284 </para>
20285 </listitem>
20286 <listitem>
20287 <para>
20288 Main configuration settings: Each setting occupies one line of the file
20289 (with possible continuations). If any setting is preceded by the word
20290 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
20291 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
20292 settings.
20293 </para>
20294 </listitem>
20295 </itemizedlist>
20296 <para>
20297 This chapter specifies all the main configuration options, along with their
20298 types and default values. For ease of finding a particular option, they appear
20299 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
20300 are now so many options, they are first listed briefly in functional groups, as
20301 an aid to finding the name of the option you are looking for. Some options are
20302 listed in more than one group.
20303 </para>
20304 <section id="SECID96">
20305 <title>Miscellaneous</title>
20306 <informaltable frame="none">
20307 <tgroup cols="2" colsep="0" rowsep="0">
20308 <colspec colwidth="196pt" align="left"/>
20309 <colspec colwidth="254pt" align="left"/>
20310 <tbody>
20311 <row>
20312 <entry><option>bi_command</option></entry>
20313 <entry>to run for <option>-bi</option> command line option</entry>
20314 </row>
20315 <row>
20316 <entry><option>disable_ipv6</option></entry>
20317 <entry>do no IPv6 processing</entry>
20318 </row>
20319 <row>
20320 <entry><option>keep_malformed</option></entry>
20321 <entry>for broken files &ndash; should not happen</entry>
20322 </row>
20323 <row>
20324 <entry><option>localhost_number</option></entry>
20325 <entry>for unique message ids in clusters</entry>
20326 </row>
20327 <row>
20328 <entry><option>message_body_newlines</option></entry>
20329 <entry>retain newlines in <varname>$message_body</varname></entry>
20330 </row>
20331 <row>
20332 <entry><option>message_body_visible</option></entry>
20333 <entry>how much to show in <varname>$message_body</varname></entry>
20334 </row>
20335 <row>
20336 <entry><option>mua_wrapper</option></entry>
20337 <entry>run in <quote>MUA wrapper</quote> mode</entry>
20338 </row>
20339 <row>
20340 <entry><option>print_topbitchars</option></entry>
20341 <entry>top-bit characters are printing</entry>
20342 </row>
20343 <row>
20344 <entry><option>timezone</option></entry>
20345 <entry>force time zone</entry>
20346 </row>
20347 </tbody>
20348 </tgroup>
20349 </informaltable>
20350 </section>
20351 <section id="SECID97">
20352 <title>Exim parameters</title>
20353 <informaltable frame="none">
20354 <tgroup cols="2" colsep="0" rowsep="0">
20355 <colspec colwidth="196pt" align="left"/>
20356 <colspec colwidth="254pt" align="left"/>
20357 <tbody>
20358 <row>
20359 <entry><option>exim_group</option></entry>
20360 <entry>override compiled-in value</entry>
20361 </row>
20362 <row>
20363 <entry><option>exim_path</option></entry>
20364 <entry>override compiled-in value</entry>
20365 </row>
20366 <row>
20367 <entry><option>exim_user</option></entry>
20368 <entry>override compiled-in value</entry>
20369 </row>
20370 <row>
20371 <entry><option>primary_hostname</option></entry>
20372 <entry>default from <function>uname()</function></entry>
20373 </row>
20374 <row>
20375 <entry><option>split_spool_directory</option></entry>
20376 <entry>use multiple directories</entry>
20377 </row>
20378 <row>
20379 <entry><option>spool_directory</option></entry>
20380 <entry>override compiled-in value</entry>
20381 </row>
20382 </tbody>
20383 </tgroup>
20384 </informaltable>
20385 </section>
20386 <section id="SECID98">
20387 <title>Privilege controls</title>
20388 <informaltable frame="none">
20389 <tgroup cols="2" colsep="0" rowsep="0">
20390 <colspec colwidth="196pt" align="left"/>
20391 <colspec colwidth="254pt" align="left"/>
20392 <tbody>
20393 <row>
20394 <entry><option>admin_groups</option></entry>
20395 <entry>groups that are Exim admin users</entry>
20396 </row>
20397 <row>
20398 <entry><option>deliver_drop_privilege</option></entry>
20399 <entry>drop root for delivery processes</entry>
20400 </row>
20401 <row>
20402 <entry><option>local_from_check</option></entry>
20403 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
20404 </row>
20405 <row>
20406 <entry><option>local_from_prefix</option></entry>
20407 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
20408 </row>
20409 <row>
20410 <entry><option>local_from_suffix</option></entry>
20411 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
20412 </row>
20413 <row>
20414 <entry><option>local_sender_retain</option></entry>
20415 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
20416 </row>
20417 <row>
20418 <entry><option>never_users</option></entry>
20419 <entry>do not run deliveries as these</entry>
20420 </row>
20421 <row>
20422 <entry><option>prod_requires_admin</option></entry>
20423 <entry>forced delivery requires admin user</entry>
20424 </row>
20425 <row>
20426 <entry><option>queue_list_requires_admin</option></entry>
20427 <entry>queue listing requires admin user</entry>
20428 </row>
20429 <row>
20430 <entry><option>trusted_groups</option></entry>
20431 <entry>groups that are trusted</entry>
20432 </row>
20433 <row>
20434 <entry><option>trusted_users</option></entry>
20435 <entry>users that are trusted</entry>
20436 </row>
20437 </tbody>
20438 </tgroup>
20439 </informaltable>
20440 </section>
20441 <section id="SECID99">
20442 <title>Logging</title>
20443 <informaltable frame="none">
20444 <tgroup cols="2" colsep="0" rowsep="0">
20445 <colspec colwidth="196pt" align="left"/>
20446 <colspec colwidth="254pt" align="left"/>
20447 <tbody>
20448 <row>
20449 <entry><option>hosts_connection_nolog</option></entry>
20450 <entry>exemption from connect logging</entry>
20451 </row>
20452 <row>
20453 <entry><option>log_file_path</option></entry>
20454 <entry>override compiled-in value</entry>
20455 </row>
20456 <row>
20457 <entry><option>log_selector</option></entry>
20458 <entry>set/unset optional logging</entry>
20459 </row>
20460 <row>
20461 <entry><option>log_timezone</option></entry>
20462 <entry>add timezone to log lines</entry>
20463 </row>
20464 <row>
20465 <entry><option>message_logs</option></entry>
20466 <entry>create per-message logs</entry>
20467 </row>
20468 <row>
20469 <entry><option>preserve_message_logs</option></entry>
20470 <entry>after message completion</entry>
20471 </row>
20472 <row>
20473 <entry><option>process_log_path</option></entry>
20474 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
20475 </row>
20476 <row>
20477 <entry><option>syslog_duplication</option></entry>
20478 <entry>controls duplicate log lines on syslog</entry>
20479 </row>
20480 <row>
20481 <entry><option>syslog_facility</option></entry>
20482 <entry>set syslog <quote>facility</quote> field</entry>
20483 </row>
20484 <row>
20485 <entry><option>syslog_processname</option></entry>
20486 <entry>set syslog <quote>ident</quote> field</entry>
20487 </row>
20488 <row>
20489 <entry><option>syslog_timestamp</option></entry>
20490 <entry>timestamp syslog lines</entry>
20491 </row>
20492 <row>
20493 <entry><option>write_rejectlog</option></entry>
20494 <entry>control use of message log</entry>
20495 </row>
20496 </tbody>
20497 </tgroup>
20498 </informaltable>
20499 </section>
20500 <section id="SECID100">
20501 <title>Frozen messages</title>
20502 <informaltable frame="none">
20503 <tgroup cols="2" colsep="0" rowsep="0">
20504 <colspec colwidth="196pt" align="left"/>
20505 <colspec colwidth="254pt" align="left"/>
20506 <tbody>
20507 <row>
20508 <entry><option>auto_thaw</option></entry>
20509 <entry>sets time for retrying frozen messages</entry>
20510 </row>
20511 <row>
20512 <entry><option>freeze_tell</option></entry>
20513 <entry>send message when freezing</entry>
20514 </row>
20515 <row>
20516 <entry><option>move_frozen_messages</option></entry>
20517 <entry>to another directory</entry>
20518 </row>
20519 <row>
20520 <entry><option>timeout_frozen_after</option></entry>
20521 <entry>keep frozen messages only so long</entry>
20522 </row>
20523 </tbody>
20524 </tgroup>
20525 </informaltable>
20526 </section>
20527 <section id="SECID101">
20528 <title>Data lookups</title>
20529 <informaltable frame="none">
20530 <tgroup cols="2" colsep="0" rowsep="0">
20531 <colspec colwidth="196pt" align="left"/>
20532 <colspec colwidth="254pt" align="left"/>
20533 <tbody>
20534 <row>
20535 <entry><option>ibase_servers</option></entry>
20536 <entry>InterBase servers</entry>
20537 </row>
20538 <row>
20539 <entry><option>ldap_ca_cert_dir</option></entry>
20540 <entry>dir of CA certs to verify LDAP server&#x2019;s</entry>
20541 </row>
20542 <row>
20543 <entry><option>ldap_ca_cert_file</option></entry>
20544 <entry>file of CA certs to verify LDAP server&#x2019;s</entry>
20545 </row>
20546 <row>
20547 <entry><option>ldap_cert_file</option></entry>
20548 <entry>client cert file for LDAP</entry>
20549 </row>
20550 <row>
20551 <entry><option>ldap_cert_key</option></entry>
20552 <entry>client key file for LDAP</entry>
20553 </row>
20554 <row>
20555 <entry><option>ldap_cipher_suite</option></entry>
20556 <entry>TLS negotiation preference control</entry>
20557 </row>
20558 <row>
20559 <entry><option>ldap_default_servers</option></entry>
20560 <entry>used if no server in query</entry>
20561 </row>
20562 <row>
20563 <entry><option>ldap_require_cert</option></entry>
20564 <entry>action to take without LDAP server cert</entry>
20565 </row>
20566 <row>
20567 <entry><option>ldap_start_tls</option></entry>
20568 <entry>require TLS within LDAP</entry>
20569 </row>
20570 <row>
20571 <entry><option>ldap_version</option></entry>
20572 <entry>set protocol version</entry>
20573 </row>
20574 <row>
20575 <entry><option>lookup_open_max</option></entry>
20576 <entry>lookup files held open</entry>
20577 </row>
20578 <row>
20579 <entry><option>mysql_servers</option></entry>
20580 <entry>default MySQL servers</entry>
20581 </row>
20582 <row>
20583 <entry><option>oracle_servers</option></entry>
20584 <entry>Oracle servers</entry>
20585 </row>
20586 <row>
20587 <entry><option>pgsql_servers</option></entry>
20588 <entry>default PostgreSQL servers</entry>
20589 </row>
20590 <row>
20591 <entry><option>sqlite_lock_timeout</option></entry>
20592 <entry>as it says</entry>
20593 </row>
20594 </tbody>
20595 </tgroup>
20596 </informaltable>
20597 </section>
20598 <section id="SECID102">
20599 <title>Message ids</title>
20600 <informaltable frame="none">
20601 <tgroup cols="2" colsep="0" rowsep="0">
20602 <colspec colwidth="196pt" align="left"/>
20603 <colspec colwidth="254pt" align="left"/>
20604 <tbody>
20605 <row>
20606 <entry><option>message_id_header_domain</option></entry>
20607 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
20608 </row>
20609 <row>
20610 <entry><option>message_id_header_text</option></entry>
20611 <entry>ditto</entry>
20612 </row>
20613 </tbody>
20614 </tgroup>
20615 </informaltable>
20616 </section>
20617 <section id="SECID103">
20618 <title>Embedded Perl Startup</title>
20619 <informaltable frame="none">
20620 <tgroup cols="2" colsep="0" rowsep="0">
20621 <colspec colwidth="196pt" align="left"/>
20622 <colspec colwidth="254pt" align="left"/>
20623 <tbody>
20624 <row>
20625 <entry><option>perl_at_start</option></entry>
20626 <entry>always start the interpreter</entry>
20627 </row>
20628 <row>
20629 <entry><option>perl_startup</option></entry>
20630 <entry>code to obey when starting Perl</entry>
20631 </row>
20632 </tbody>
20633 </tgroup>
20634 </informaltable>
20635 </section>
20636 <section id="SECID104">
20637 <title>Daemon</title>
20638 <informaltable frame="none">
20639 <tgroup cols="2" colsep="0" rowsep="0">
20640 <colspec colwidth="196pt" align="left"/>
20641 <colspec colwidth="254pt" align="left"/>
20642 <tbody>
20643 <row>
20644 <entry><option>daemon_smtp_ports</option></entry>
20645 <entry>default ports</entry>
20646 </row>
20647 <row>
20648 <entry><option>daemon_startup_retries</option></entry>
20649 <entry>number of times to retry</entry>
20650 </row>
20651 <row>
20652 <entry><option>daemon_startup_sleep</option></entry>
20653 <entry>time to sleep between tries</entry>
20654 </row>
20655 <row>
20656 <entry><option>extra_local_interfaces</option></entry>
20657 <entry>not necessarily listened on</entry>
20658 </row>
20659 <row>
20660 <entry><option>local_interfaces</option></entry>
20661 <entry>on which to listen, with optional ports</entry>
20662 </row>
20663 <row>
20664 <entry><option>pid_file_path</option></entry>
20665 <entry>override compiled-in value</entry>
20666 </row>
20667 <row>
20668 <entry><option>queue_run_max</option></entry>
20669 <entry>maximum simultaneous queue runners</entry>
20670 </row>
20671 </tbody>
20672 </tgroup>
20673 </informaltable>
20674 </section>
20675 <section id="SECID105">
20676 <title>Resource control</title>
20677 <informaltable frame="none">
20678 <tgroup cols="2" colsep="0" rowsep="0">
20679 <colspec colwidth="196pt" align="left"/>
20680 <colspec colwidth="254pt" align="left"/>
20681 <tbody>
20682 <row>
20683 <entry><option>check_log_inodes</option></entry>
20684 <entry>before accepting a message</entry>
20685 </row>
20686 <row>
20687 <entry><option>check_log_space</option></entry>
20688 <entry>before accepting a message</entry>
20689 </row>
20690 <row>
20691 <entry><option>check_spool_inodes</option></entry>
20692 <entry>before accepting a message</entry>
20693 </row>
20694 <row>
20695 <entry><option>check_spool_space</option></entry>
20696 <entry>before accepting a message</entry>
20697 </row>
20698 <row>
20699 <entry><option>deliver_queue_load_max</option></entry>
20700 <entry>no queue deliveries if load high</entry>
20701 </row>
20702 <row>
20703 <entry><option>queue_only_load</option></entry>
20704 <entry>queue incoming if load high</entry>
20705 </row>
20706 <row>
20707 <entry><option>queue_only_load_latch</option></entry>
20708 <entry>don&#x2019;t re-evaluate load for each message</entry>
20709 </row>
20710 <row>
20711 <entry><option>queue_run_max</option></entry>
20712 <entry>maximum simultaneous queue runners</entry>
20713 </row>
20714 <row>
20715 <entry><option>remote_max_parallel</option></entry>
20716 <entry>parallel SMTP delivery per message</entry>
20717 </row>
20718 <row>
20719 <entry><option>smtp_accept_max</option></entry>
20720 <entry>simultaneous incoming connections</entry>
20721 </row>
20722 <row>
20723 <entry><option>smtp_accept_max_nonmail</option></entry>
20724 <entry>non-mail commands</entry>
20725 </row>
20726 <row>
20727 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
20728 <entry>hosts to which the limit applies</entry>
20729 </row>
20730 <row>
20731 <entry><option>smtp_accept_max_per_connection</option></entry>
20732 <entry>messages per connection</entry>
20733 </row>
20734 <row>
20735 <entry><option>smtp_accept_max_per_host</option></entry>
20736 <entry>connections from one host</entry>
20737 </row>
20738 <row>
20739 <entry><option>smtp_accept_queue</option></entry>
20740 <entry>queue mail if more connections</entry>
20741 </row>
20742 <row>
20743 <entry><option>smtp_accept_queue_per_connection</option></entry>
20744 <entry>queue if more messages per connection</entry>
20745 </row>
20746 <row>
20747 <entry><option>smtp_accept_reserve</option></entry>
20748 <entry>only reserve hosts if more connections</entry>
20749 </row>
20750 <row>
20751 <entry><option>smtp_check_spool_space</option></entry>
20752 <entry>from SIZE on MAIL command</entry>
20753 </row>
20754 <row>
20755 <entry><option>smtp_connect_backlog</option></entry>
20756 <entry>passed to TCP/IP stack</entry>
20757 </row>
20758 <row>
20759 <entry><option>smtp_load_reserve</option></entry>
20760 <entry>SMTP from reserved hosts if load high</entry>
20761 </row>
20762 <row>
20763 <entry><option>smtp_reserve_hosts</option></entry>
20764 <entry>these are the reserve hosts</entry>
20765 </row>
20766 </tbody>
20767 </tgroup>
20768 </informaltable>
20769 </section>
20770 <section id="SECID106">
20771 <title>Policy controls</title>
20772 <informaltable frame="none">
20773 <tgroup cols="2" colsep="0" rowsep="0">
20774 <colspec colwidth="196pt" align="left"/>
20775 <colspec colwidth="254pt" align="left"/>
20776 <tbody>
20777 <row>
20778 <entry><option>acl_not_smtp</option></entry>
20779 <entry>ACL for non-SMTP messages</entry>
20780 </row>
20781 <row>
20782 <entry><option>acl_not_smtp_mime</option></entry>
20783 <entry>ACL for non-SMTP MIME parts</entry>
20784 </row>
20785 <row>
20786 <entry><option>acl_not_smtp_start</option></entry>
20787 <entry>ACL for start of non-SMTP message</entry>
20788 </row>
20789 <row>
20790 <entry><option>acl_smtp_auth</option></entry>
20791 <entry>ACL for AUTH</entry>
20792 </row>
20793 <row>
20794 <entry><option>acl_smtp_connect</option></entry>
20795 <entry>ACL for connection</entry>
20796 </row>
20797 <row>
20798 <entry><option>acl_smtp_data</option></entry>
20799 <entry>ACL for DATA</entry>
20800 </row>
20801 <row>
20802 <entry><option>acl_smtp_data_prdr</option></entry>
20803 <entry>ACL for DATA, per-recipient</entry>
20804 </row>
20805 <row>
20806 <entry><option>acl_smtp_dkim</option></entry>
20807 <entry>ACL for DKIM verification</entry>
20808 </row>
20809 <row>
20810 <entry><option>acl_smtp_etrn</option></entry>
20811 <entry>ACL for ETRN</entry>
20812 </row>
20813 <row>
20814 <entry><option>acl_smtp_expn</option></entry>
20815 <entry>ACL for EXPN</entry>
20816 </row>
20817 <row>
20818 <entry><option>acl_smtp_helo</option></entry>
20819 <entry>ACL for EHLO or HELO</entry>
20820 </row>
20821 <row>
20822 <entry><option>acl_smtp_mail</option></entry>
20823 <entry>ACL for MAIL</entry>
20824 </row>
20825 <row>
20826 <entry><option>acl_smtp_mailauth</option></entry>
20827 <entry>ACL for AUTH on MAIL command</entry>
20828 </row>
20829 <row>
20830 <entry><option>acl_smtp_mime</option></entry>
20831 <entry>ACL for MIME parts</entry>
20832 </row>
20833 <row>
20834 <entry><option>acl_smtp_predata</option></entry>
20835 <entry>ACL for start of data</entry>
20836 </row>
20837 <row>
20838 <entry><option>acl_smtp_quit</option></entry>
20839 <entry>ACL for QUIT</entry>
20840 </row>
20841 <row>
20842 <entry><option>acl_smtp_rcpt</option></entry>
20843 <entry>ACL for RCPT</entry>
20844 </row>
20845 <row>
20846 <entry><option>acl_smtp_starttls</option></entry>
20847 <entry>ACL for STARTTLS</entry>
20848 </row>
20849 <row>
20850 <entry><option>acl_smtp_vrfy</option></entry>
20851 <entry>ACL for VRFY</entry>
20852 </row>
20853 <row>
20854 <entry><option>av_scanner</option></entry>
20855 <entry>specify virus scanner</entry>
20856 </row>
20857 <row>
20858 <entry><option>check_rfc2047_length</option></entry>
20859 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
20860 </row>
20861 <row>
20862 <entry><option>dns_csa_search_limit</option></entry>
20863 <entry>control CSA parent search depth</entry>
20864 </row>
20865 <row>
20866 <entry><option>dns_csa_use_reverse</option></entry>
20867 <entry>en/disable CSA IP reverse search</entry>
20868 </row>
20869 <row>
20870 <entry><option>header_maxsize</option></entry>
20871 <entry>total size of message header</entry>
20872 </row>
20873 <row>
20874 <entry><option>header_line_maxsize</option></entry>
20875 <entry>individual header line limit</entry>
20876 </row>
20877 <row>
20878 <entry><option>helo_accept_junk_hosts</option></entry>
20879 <entry>allow syntactic junk from these hosts</entry>
20880 </row>
20881 <row>
20882 <entry><option>helo_allow_chars</option></entry>
20883 <entry>allow illegal chars in HELO names</entry>
20884 </row>
20885 <row>
20886 <entry><option>helo_lookup_domains</option></entry>
20887 <entry>lookup hostname for these HELO names</entry>
20888 </row>
20889 <row>
20890 <entry><option>helo_try_verify_hosts</option></entry>
20891 <entry>HELO soft-checked for these hosts</entry>
20892 </row>
20893 <row>
20894 <entry><option>helo_verify_hosts</option></entry>
20895 <entry>HELO hard-checked for these hosts</entry>
20896 </row>
20897 <row>
20898 <entry><option>host_lookup</option></entry>
20899 <entry>host name looked up for these hosts</entry>
20900 </row>
20901 <row>
20902 <entry><option>host_lookup_order</option></entry>
20903 <entry>order of DNS and local name lookups</entry>
20904 </row>
20905 <row>
20906 <entry><option>host_reject_connection</option></entry>
20907 <entry>reject connection from these hosts</entry>
20908 </row>
20909 <row>
20910 <entry><option>hosts_treat_as_local</option></entry>
20911 <entry>useful in some cluster configurations</entry>
20912 </row>
20913 <row>
20914 <entry><option>local_scan_timeout</option></entry>
20915 <entry>timeout for <function>local_scan()</function></entry>
20916 </row>
20917 <row>
20918 <entry><option>message_size_limit</option></entry>
20919 <entry>for all messages</entry>
20920 </row>
20921 <row>
20922 <entry><option>percent_hack_domains</option></entry>
20923 <entry>recognize %-hack for these domains</entry>
20924 </row>
20925 <row>
20926 <entry><option>spamd_address</option></entry>
20927 <entry>set interface to SpamAssassin</entry>
20928 </row>
20929 <row>
20930 <entry><option>strict_acl_vars</option></entry>
20931 <entry>object to unset ACL variables</entry>
20932 </row>
20933 </tbody>
20934 </tgroup>
20935 </informaltable>
20936 </section>
20937 <section id="SECID107">
20938 <title>Callout cache</title>
20939 <informaltable frame="none">
20940 <tgroup cols="2" colsep="0" rowsep="0">
20941 <colspec colwidth="196pt" align="left"/>
20942 <colspec colwidth="254pt" align="left"/>
20943 <tbody>
20944 <row>
20945 <entry><option>callout_domain_negative_expire</option></entry>
20946 <entry>timeout for negative domain cache item</entry>
20947 </row>
20948 <row>
20949 <entry><option>callout_domain_positive_expire</option></entry>
20950 <entry>timeout for positive domain cache item</entry>
20951 </row>
20952 <row>
20953 <entry><option>callout_negative_expire</option></entry>
20954 <entry>timeout for negative address cache item</entry>
20955 </row>
20956 <row>
20957 <entry><option>callout_positive_expire</option></entry>
20958 <entry>timeout for positive address cache item</entry>
20959 </row>
20960 <row>
20961 <entry><option>callout_random_local_part</option></entry>
20962 <entry>string to use for <quote>random</quote> testing</entry>
20963 </row>
20964 </tbody>
20965 </tgroup>
20966 </informaltable>
20967 </section>
20968 <section id="SECID108">
20969 <title>TLS</title>
20970 <informaltable frame="none">
20971 <tgroup cols="2" colsep="0" rowsep="0">
20972 <colspec colwidth="196pt" align="left"/>
20973 <colspec colwidth="254pt" align="left"/>
20974 <tbody>
20975 <row>
20976 <entry><option>gnutls_compat_mode</option></entry>
20977 <entry>use GnuTLS compatibility mode</entry>
20978 </row>
20979 <row>
20980 <entry><option>gnutls_allow_auto_pkcs11</option></entry>
20981 <entry>allow GnuTLS to autoload PKCS11 modules</entry>
20982 </row>
20983 <row>
20984 <entry><option>openssl_options</option></entry>
20985 <entry>adjust OpenSSL compatibility options</entry>
20986 </row>
20987 <row>
20988 <entry><option>tls_advertise_hosts</option></entry>
20989 <entry>advertise TLS to these hosts</entry>
20990 </row>
20991 <row>
20992 <entry><option>tls_certificate</option></entry>
20993 <entry>location of server certificate</entry>
20994 </row>
20995 <row>
20996 <entry><option>tls_crl</option></entry>
20997 <entry>certificate revocation list</entry>
20998 </row>
20999 <row>
21000 <entry><option>tls_dh_max_bits</option></entry>
21001 <entry>clamp D-H bit count suggestion</entry>
21002 </row>
21003 <row>
21004 <entry><option>tls_dhparam</option></entry>
21005 <entry>DH parameters for server</entry>
21006 </row>
21007 <row>
21008 <entry><option>tls_ocsp_file</option></entry>
21009 <entry>location of server certificate status proof</entry>
21010 </row>
21011 <row>
21012 <entry><option>tls_on_connect_ports</option></entry>
21013 <entry>specify SSMTP (SMTPS) ports</entry>
21014 </row>
21015 <row>
21016 <entry><option>tls_privatekey</option></entry>
21017 <entry>location of server private key</entry>
21018 </row>
21019 <row>
21020 <entry><option>tls_remember_esmtp</option></entry>
21021 <entry>don&#x2019;t reset after starting TLS</entry>
21022 </row>
21023 <row>
21024 <entry><option>tls_require_ciphers</option></entry>
21025 <entry>specify acceptable ciphers</entry>
21026 </row>
21027 <row>
21028 <entry><option>tls_try_verify_hosts</option></entry>
21029 <entry>try to verify client certificate</entry>
21030 </row>
21031 <row>
21032 <entry><option>tls_verify_certificates</option></entry>
21033 <entry>expected client certificates</entry>
21034 </row>
21035 <row>
21036 <entry><option>tls_verify_hosts</option></entry>
21037 <entry>insist on client certificate verify</entry>
21038 </row>
21039 </tbody>
21040 </tgroup>
21041 </informaltable>
21042 </section>
21043 <section id="SECID109">
21044 <title>Local user handling</title>
21045 <informaltable frame="none">
21046 <tgroup cols="2" colsep="0" rowsep="0">
21047 <colspec colwidth="196pt" align="left"/>
21048 <colspec colwidth="254pt" align="left"/>
21049 <tbody>
21050 <row>
21051 <entry><option>finduser_retries</option></entry>
21052 <entry>useful in NIS environments</entry>
21053 </row>
21054 <row>
21055 <entry><option>gecos_name</option></entry>
21056 <entry>used when creating <emphasis>Sender:</emphasis></entry>
21057 </row>
21058 <row>
21059 <entry><option>gecos_pattern</option></entry>
21060 <entry>ditto</entry>
21061 </row>
21062 <row>
21063 <entry><option>max_username_length</option></entry>
21064 <entry>for systems that truncate</entry>
21065 </row>
21066 <row>
21067 <entry><option>unknown_login</option></entry>
21068 <entry>used when no login name found</entry>
21069 </row>
21070 <row>
21071 <entry><option>unknown_username</option></entry>
21072 <entry>ditto</entry>
21073 </row>
21074 <row>
21075 <entry><option>uucp_from_pattern</option></entry>
21076 <entry>for recognizing <quote>From </quote> lines</entry>
21077 </row>
21078 <row>
21079 <entry><option>uucp_from_sender</option></entry>
21080 <entry>ditto</entry>
21081 </row>
21082 </tbody>
21083 </tgroup>
21084 </informaltable>
21085 </section>
21086 <section id="SECID110">
21087 <title>All incoming messages (SMTP and non-SMTP)</title>
21088 <informaltable frame="none">
21089 <tgroup cols="2" colsep="0" rowsep="0">
21090 <colspec colwidth="196pt" align="left"/>
21091 <colspec colwidth="254pt" align="left"/>
21092 <tbody>
21093 <row>
21094 <entry><option>header_maxsize</option></entry>
21095 <entry>total size of message header</entry>
21096 </row>
21097 <row>
21098 <entry><option>header_line_maxsize</option></entry>
21099 <entry>individual header line limit</entry>
21100 </row>
21101 <row>
21102 <entry><option>message_size_limit</option></entry>
21103 <entry>applies to all messages</entry>
21104 </row>
21105 <row>
21106 <entry><option>percent_hack_domains</option></entry>
21107 <entry>recognize %-hack for these domains</entry>
21108 </row>
21109 <row>
21110 <entry><option>received_header_text</option></entry>
21111 <entry>expanded to make <emphasis>Received:</emphasis></entry>
21112 </row>
21113 <row>
21114 <entry><option>received_headers_max</option></entry>
21115 <entry>for mail loop detection</entry>
21116 </row>
21117 <row>
21118 <entry><option>recipients_max</option></entry>
21119 <entry>limit per message</entry>
21120 </row>
21121 <row>
21122 <entry><option>recipients_max_reject</option></entry>
21123 <entry>permanently reject excess recipients</entry>
21124 </row>
21125 </tbody>
21126 </tgroup>
21127 </informaltable>
21128 </section>
21129 <section id="SECID111">
21130 <title>Non-SMTP incoming messages</title>
21131 <informaltable frame="none">
21132 <tgroup cols="2" colsep="0" rowsep="0">
21133 <colspec colwidth="196pt" align="left"/>
21134 <colspec colwidth="254pt" align="left"/>
21135 <tbody>
21136 <row>
21137 <entry><option>receive_timeout</option></entry>
21138 <entry>for non-SMTP messages</entry>
21139 </row>
21140 </tbody>
21141 </tgroup>
21142 </informaltable>
21143 </section>
21144 <section id="SECID112">
21145 <title>Incoming SMTP messages</title>
21146 <para>
21147 See also the <emphasis>Policy controls</emphasis> section above.
21148 </para>
21149 <informaltable frame="none">
21150 <tgroup cols="2" colsep="0" rowsep="0">
21151 <colspec colwidth="196pt" align="left"/>
21152 <colspec colwidth="254pt" align="left"/>
21153 <tbody>
21154 <row>
21155 <entry><option>host_lookup</option></entry>
21156 <entry>host name looked up for these hosts</entry>
21157 </row>
21158 <row>
21159 <entry><option>host_lookup_order</option></entry>
21160 <entry>order of DNS and local name lookups</entry>
21161 </row>
21162 <row>
21163 <entry><option>recipient_unqualified_hosts</option></entry>
21164 <entry>may send unqualified recipients</entry>
21165 </row>
21166 <row>
21167 <entry><option>rfc1413_hosts</option></entry>
21168 <entry>make ident calls to these hosts</entry>
21169 </row>
21170 <row>
21171 <entry><option>rfc1413_query_timeout</option></entry>
21172 <entry>zero disables ident calls</entry>
21173 </row>
21174 <row>
21175 <entry><option>sender_unqualified_hosts</option></entry>
21176 <entry>may send unqualified senders</entry>
21177 </row>
21178 <row>
21179 <entry><option>smtp_accept_keepalive</option></entry>
21180 <entry>some TCP/IP magic</entry>
21181 </row>
21182 <row>
21183 <entry><option>smtp_accept_max</option></entry>
21184 <entry>simultaneous incoming connections</entry>
21185 </row>
21186 <row>
21187 <entry><option>smtp_accept_max_nonmail</option></entry>
21188 <entry>non-mail commands</entry>
21189 </row>
21190 <row>
21191 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
21192 <entry>hosts to which the limit applies</entry>
21193 </row>
21194 <row>
21195 <entry><option>smtp_accept_max_per_connection</option></entry>
21196 <entry>messages per connection</entry>
21197 </row>
21198 <row>
21199 <entry><option>smtp_accept_max_per_host</option></entry>
21200 <entry>connections from one host</entry>
21201 </row>
21202 <row>
21203 <entry><option>smtp_accept_queue</option></entry>
21204 <entry>queue mail if more connections</entry>
21205 </row>
21206 <row>
21207 <entry><option>smtp_accept_queue_per_connection</option></entry>
21208 <entry>queue if more messages per connection</entry>
21209 </row>
21210 <row>
21211 <entry><option>smtp_accept_reserve</option></entry>
21212 <entry>only reserve hosts if more connections</entry>
21213 </row>
21214 <row>
21215 <entry><option>smtp_active_hostname</option></entry>
21216 <entry>host name to use in messages</entry>
21217 </row>
21218 <row>
21219 <entry><option>smtp_banner</option></entry>
21220 <entry>text for welcome banner</entry>
21221 </row>
21222 <row>
21223 <entry><option>smtp_check_spool_space</option></entry>
21224 <entry>from SIZE on MAIL command</entry>
21225 </row>
21226 <row>
21227 <entry><option>smtp_connect_backlog</option></entry>
21228 <entry>passed to TCP/IP stack</entry>
21229 </row>
21230 <row>
21231 <entry><option>smtp_enforce_sync</option></entry>
21232 <entry>of SMTP command/responses</entry>
21233 </row>
21234 <row>
21235 <entry><option>smtp_etrn_command</option></entry>
21236 <entry>what to run for ETRN</entry>
21237 </row>
21238 <row>
21239 <entry><option>smtp_etrn_serialize</option></entry>
21240 <entry>only one at once</entry>
21241 </row>
21242 <row>
21243 <entry><option>smtp_load_reserve</option></entry>
21244 <entry>only reserve hosts if this load</entry>
21245 </row>
21246 <row>
21247 <entry><option>smtp_max_unknown_commands</option></entry>
21248 <entry>before dropping connection</entry>
21249 </row>
21250 <row>
21251 <entry><option>smtp_ratelimit_hosts</option></entry>
21252 <entry>apply ratelimiting to these hosts</entry>
21253 </row>
21254 <row>
21255 <entry><option>smtp_ratelimit_mail</option></entry>
21256 <entry>ratelimit for MAIL commands</entry>
21257 </row>
21258 <row>
21259 <entry><option>smtp_ratelimit_rcpt</option></entry>
21260 <entry>ratelimit for RCPT commands</entry>
21261 </row>
21262 <row>
21263 <entry><option>smtp_receive_timeout</option></entry>
21264 <entry>per command or data line</entry>
21265 </row>
21266 <row>
21267 <entry><option>smtp_reserve_hosts</option></entry>
21268 <entry>these are the reserve hosts</entry>
21269 </row>
21270 <row>
21271 <entry><option>smtp_return_error_details</option></entry>
21272 <entry>give detail on rejections</entry>
21273 </row>
21274 </tbody>
21275 </tgroup>
21276 </informaltable>
21277 </section>
21278 <section id="SECID113">
21279 <title>SMTP extensions</title>
21280 <informaltable frame="none">
21281 <tgroup cols="2" colsep="0" rowsep="0">
21282 <colspec colwidth="196pt" align="left"/>
21283 <colspec colwidth="254pt" align="left"/>
21284 <tbody>
21285 <row>
21286 <entry><option>accept_8bitmime</option></entry>
21287 <entry>advertise 8BITMIME</entry>
21288 </row>
21289 <row>
21290 <entry><option>auth_advertise_hosts</option></entry>
21291 <entry>advertise AUTH to these hosts</entry>
21292 </row>
21293 <row>
21294 <entry><option>ignore_fromline_hosts</option></entry>
21295 <entry>allow <quote>From </quote> from these hosts</entry>
21296 </row>
21297 <row>
21298 <entry><option>ignore_fromline_local</option></entry>
21299 <entry>allow <quote>From </quote> from local SMTP</entry>
21300 </row>
21301 <row>
21302 <entry><option>pipelining_advertise_hosts</option></entry>
21303 <entry>advertise pipelining to these hosts</entry>
21304 </row>
21305 <row>
21306 <entry><option>prdr_enable</option></entry>
21307 <entry>advertise PRDR to all hosts</entry>
21308 </row>
21309 <row>
21310 <entry><option>tls_advertise_hosts</option></entry>
21311 <entry>advertise TLS to these hosts</entry>
21312 </row>
21313 </tbody>
21314 </tgroup>
21315 </informaltable>
21316 </section>
21317 <section id="SECID114">
21318 <title>Processing messages</title>
21319 <informaltable frame="none">
21320 <tgroup cols="2" colsep="0" rowsep="0">
21321 <colspec colwidth="196pt" align="left"/>
21322 <colspec colwidth="254pt" align="left"/>
21323 <tbody>
21324 <row>
21325 <entry><option>allow_domain_literals</option></entry>
21326 <entry>recognize domain literal syntax</entry>
21327 </row>
21328 <row>
21329 <entry><option>allow_mx_to_ip</option></entry>
21330 <entry>allow MX to point to IP address</entry>
21331 </row>
21332 <row>
21333 <entry><option>allow_utf8_domains</option></entry>
21334 <entry>in addresses</entry>
21335 </row>
21336 <row>
21337 <entry><option>check_rfc2047_length</option></entry>
21338 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
21339 </row>
21340 <row>
21341 <entry><option>delivery_date_remove</option></entry>
21342 <entry>from incoming messages</entry>
21343 </row>
21344 <row>
21345 <entry><option>envelope_to_remove</option></entry>
21346 <entry>from incoming messages</entry>
21347 </row>
21348 <row>
21349 <entry><option>extract_addresses_remove_arguments</option></entry>
21350 <entry>affects <option>-t</option> processing</entry>
21351 </row>
21352 <row>
21353 <entry><option>headers_charset</option></entry>
21354 <entry>default for translations</entry>
21355 </row>
21356 <row>
21357 <entry><option>qualify_domain</option></entry>
21358 <entry>default for senders</entry>
21359 </row>
21360 <row>
21361 <entry><option>qualify_recipient</option></entry>
21362 <entry>default for recipients</entry>
21363 </row>
21364 <row>
21365 <entry><option>return_path_remove</option></entry>
21366 <entry>from incoming messages</entry>
21367 </row>
21368 <row>
21369 <entry><option>strip_excess_angle_brackets</option></entry>
21370 <entry>in addresses</entry>
21371 </row>
21372 <row>
21373 <entry><option>strip_trailing_dot</option></entry>
21374 <entry>at end of addresses</entry>
21375 </row>
21376 <row>
21377 <entry><option>untrusted_set_sender</option></entry>
21378 <entry>untrusted can set envelope sender</entry>
21379 </row>
21380 </tbody>
21381 </tgroup>
21382 </informaltable>
21383 </section>
21384 <section id="SECID115">
21385 <title>System filter</title>
21386 <informaltable frame="none">
21387 <tgroup cols="2" colsep="0" rowsep="0">
21388 <colspec colwidth="196pt" align="left"/>
21389 <colspec colwidth="254pt" align="left"/>
21390 <tbody>
21391 <row>
21392 <entry><option>system_filter</option></entry>
21393 <entry>locate system filter</entry>
21394 </row>
21395 <row>
21396 <entry><option>system_filter_directory_transport</option></entry>
21397 <entry>transport for delivery to a directory</entry>
21398 </row>
21399 <row>
21400 <entry><option>system_filter_file_transport</option></entry>
21401 <entry>transport for delivery to a file</entry>
21402 </row>
21403 <row>
21404 <entry><option>system_filter_group</option></entry>
21405 <entry>group for filter running</entry>
21406 </row>
21407 <row>
21408 <entry><option>system_filter_pipe_transport</option></entry>
21409 <entry>transport for delivery to a pipe</entry>
21410 </row>
21411 <row>
21412 <entry><option>system_filter_reply_transport</option></entry>
21413 <entry>transport for autoreply delivery</entry>
21414 </row>
21415 <row>
21416 <entry><option>system_filter_user</option></entry>
21417 <entry>user for filter running</entry>
21418 </row>
21419 </tbody>
21420 </tgroup>
21421 </informaltable>
21422 </section>
21423 <section id="SECID116">
21424 <title>Routing and delivery</title>
21425 <informaltable frame="none">
21426 <tgroup cols="2" colsep="0" rowsep="0">
21427 <colspec colwidth="196pt" align="left"/>
21428 <colspec colwidth="254pt" align="left"/>
21429 <tbody>
21430 <row>
21431 <entry><option>disable_ipv6</option></entry>
21432 <entry>do no IPv6 processing</entry>
21433 </row>
21434 <row>
21435 <entry><option>dns_again_means_nonexist</option></entry>
21436 <entry>for broken domains</entry>
21437 </row>
21438 <row>
21439 <entry><option>dns_check_names_pattern</option></entry>
21440 <entry>pre-DNS syntax check</entry>
21441 </row>
21442 <row>
21443 <entry><option>dns_dnssec_ok</option></entry>
21444 <entry>parameter for resolver</entry>
21445 </row>
21446 <row>
21447 <entry><option>dns_ipv4_lookup</option></entry>
21448 <entry>only v4 lookup for these domains</entry>
21449 </row>
21450 <row>
21451 <entry><option>dns_retrans</option></entry>
21452 <entry>parameter for resolver</entry>
21453 </row>
21454 <row>
21455 <entry><option>dns_retry</option></entry>
21456 <entry>parameter for resolver</entry>
21457 </row>
21458 <row>
21459 <entry><option>dns_use_edns0</option></entry>
21460 <entry>parameter for resolver</entry>
21461 </row>
21462 <row>
21463 <entry><option>hold_domains</option></entry>
21464 <entry>hold delivery for these domains</entry>
21465 </row>
21466 <row>
21467 <entry><option>local_interfaces</option></entry>
21468 <entry>for routing checks</entry>
21469 </row>
21470 <row>
21471 <entry><option>queue_domains</option></entry>
21472 <entry>no immediate delivery for these</entry>
21473 </row>
21474 <row>
21475 <entry><option>queue_only</option></entry>
21476 <entry>no immediate delivery at all</entry>
21477 </row>
21478 <row>
21479 <entry><option>queue_only_file</option></entry>
21480 <entry>no immediate delivery if file exists</entry>
21481 </row>
21482 <row>
21483 <entry><option>queue_only_load</option></entry>
21484 <entry>no immediate delivery if load is high</entry>
21485 </row>
21486 <row>
21487 <entry><option>queue_only_load_latch</option></entry>
21488 <entry>don&#x2019;t re-evaluate load for each message</entry>
21489 </row>
21490 <row>
21491 <entry><option>queue_only_override</option></entry>
21492 <entry>allow command line to override</entry>
21493 </row>
21494 <row>
21495 <entry><option>queue_run_in_order</option></entry>
21496 <entry>order of arrival</entry>
21497 </row>
21498 <row>
21499 <entry><option>queue_run_max</option></entry>
21500 <entry>of simultaneous queue runners</entry>
21501 </row>
21502 <row>
21503 <entry><option>queue_smtp_domains</option></entry>
21504 <entry>no immediate SMTP delivery for these</entry>
21505 </row>
21506 <row>
21507 <entry><option>remote_max_parallel</option></entry>
21508 <entry>parallel SMTP delivery per message</entry>
21509 </row>
21510 <row>
21511 <entry><option>remote_sort_domains</option></entry>
21512 <entry>order of remote deliveries</entry>
21513 </row>
21514 <row>
21515 <entry><option>retry_data_expire</option></entry>
21516 <entry>timeout for retry data</entry>
21517 </row>
21518 <row>
21519 <entry><option>retry_interval_max</option></entry>
21520 <entry>safety net for retry rules</entry>
21521 </row>
21522 </tbody>
21523 </tgroup>
21524 </informaltable>
21525 </section>
21526 <section id="SECID117">
21527 <title>Bounce and warning messages</title>
21528 <informaltable frame="none">
21529 <tgroup cols="2" colsep="0" rowsep="0">
21530 <colspec colwidth="196pt" align="left"/>
21531 <colspec colwidth="254pt" align="left"/>
21532 <tbody>
21533 <row>
21534 <entry><option>bounce_message_file</option></entry>
21535 <entry>content of bounce</entry>
21536 </row>
21537 <row>
21538 <entry><option>bounce_message_text</option></entry>
21539 <entry>content of bounce</entry>
21540 </row>
21541 <row>
21542 <entry><option>bounce_return_body</option></entry>
21543 <entry>include body if returning message</entry>
21544 </row>
21545 <row>
21546 <entry><option>bounce_return_message</option></entry>
21547 <entry>include original message in bounce</entry>
21548 </row>
21549 <row>
21550 <entry><option>bounce_return_size_limit</option></entry>
21551 <entry>limit on returned message</entry>
21552 </row>
21553 <row>
21554 <entry><option>bounce_sender_authentication</option></entry>
21555 <entry>send authenticated sender with bounce</entry>
21556 </row>
21557 <row>
21558 <entry><option>dsn_from</option></entry>
21559 <entry>set <emphasis>From:</emphasis> contents in bounces</entry>
21560 </row>
21561 <row>
21562 <entry><option>errors_copy</option></entry>
21563 <entry>copy bounce messages</entry>
21564 </row>
21565 <row>
21566 <entry><option>errors_reply_to</option></entry>
21567 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
21568 </row>
21569 <row>
21570 <entry><option>delay_warning</option></entry>
21571 <entry>time schedule</entry>
21572 </row>
21573 <row>
21574 <entry><option>delay_warning_condition</option></entry>
21575 <entry>condition for warning messages</entry>
21576 </row>
21577 <row>
21578 <entry><option>ignore_bounce_errors_after</option></entry>
21579 <entry>discard undeliverable bounces</entry>
21580 </row>
21581 <row>
21582 <entry><option>smtp_return_error_details</option></entry>
21583 <entry>give detail on rejections</entry>
21584 </row>
21585 <row>
21586 <entry><option>warn_message_file</option></entry>
21587 <entry>content of warning message</entry>
21588 </row>
21589 </tbody>
21590 </tgroup>
21591 </informaltable>
21592 </section>
21593 <section id="SECTalomo">
21594 <title>Alphabetical list of main options</title>
21595 <para>
21596 Those options that undergo string expansion before use are marked with
21597 &dagger;.
21598 </para>
21599 <para>
21600 <indexterm role="option">
21601 <primary><option>accept_8bitmime</option></primary>
21602 </indexterm>
21603 </para>
21604 <informaltable frame="all">
21605 <tgroup cols="4" colsep="0" rowsep="0">
21606 <colspec colwidth="8*" align="left"/>
21607 <colspec colwidth="6*" align="center"/>
21608 <colspec colwidth="6*" align="center"/>
21609 <colspec colwidth="6*" align="right"/>
21610 <tbody>
21611 <row>
21612 <entry><option>accept_8bitmime</option></entry>
21613 <entry>Use: <emphasis>main</emphasis></entry>
21614 <entry>Type: <emphasis>boolean</emphasis></entry>
21615 <entry>Default: <emphasis>true</emphasis></entry>
21616 </row>
21617 </tbody>
21618 </tgroup>
21619 </informaltable>
21620 <para>
21621 <indexterm role="concept">
21622 <primary>8BITMIME</primary>
21623 </indexterm>
21624 <indexterm role="concept">
21625 <primary>8-bit characters</primary>
21626 </indexterm>
21627 <indexterm role="concept">
21628 <primary>log</primary>
21629 <secondary>selectors</secondary>
21630 </indexterm>
21631 <indexterm role="concept">
21632 <primary>log</primary>
21633 <secondary>8BITMIME</secondary>
21634 </indexterm>
21635 This option causes Exim to send 8BITMIME in its response to an SMTP
21636 EHLO command, and to accept the BODY= parameter on MAIL commands.
21637 However, though Exim is 8-bit clean, it is not a protocol converter, and it
21638 takes no steps to do anything special with messages received by this route.
21639 </para>
21640 <para>
21641 Historically Exim kept this option off by default, but the maintainers
21642 feel that in today&#x2019;s Internet, this causes more problems than it solves.
21643 It now defaults to true.
21644 A more detailed analysis of the issues is provided by Dan Bernstein:
21645 </para>
21646 <literallayout>
21647 <emphasis role="bold"><ulink url="http://cr.yp.to/smtp/8bitmime.html">http://cr.yp.to/smtp/8bitmime.html</ulink></emphasis>
21648 </literallayout>
21649 <para>
21650 To log received 8BITMIME status use
21651 </para>
21652 <literallayout class="monospaced">
21653 log_selector = +8bitmime
21654 </literallayout>
21655 <para>
21656 <indexterm role="option">
21657 <primary><option>acl_not_smtp</option></primary>
21658 </indexterm>
21659 </para>
21660 <informaltable frame="all">
21661 <tgroup cols="4" colsep="0" rowsep="0">
21662 <colspec colwidth="8*" align="left"/>
21663 <colspec colwidth="6*" align="center"/>
21664 <colspec colwidth="6*" align="center"/>
21665 <colspec colwidth="6*" align="right"/>
21666 <tbody>
21667 <row>
21668 <entry><option>acl_not_smtp</option></entry>
21669 <entry>Use: <emphasis>main</emphasis></entry>
21670 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21671 <entry>Default: <emphasis>unset</emphasis></entry>
21672 </row>
21673 </tbody>
21674 </tgroup>
21675 </informaltable>
21676 <para>
21677 <indexterm role="concept">
21678 <primary>access control lists (ACLs)</primary>
21679 <secondary>for non-SMTP messages</secondary>
21680 </indexterm>
21681 <indexterm role="concept">
21682 <primary>non-SMTP messages</primary>
21683 <secondary>ACLs for</secondary>
21684 </indexterm>
21685 This option defines the ACL that is run when a non-SMTP message has been
21686 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
21687 further details.
21688 </para>
21689 <para>
21690 <indexterm role="option">
21691 <primary><option>acl_not_smtp_mime</option></primary>
21692 </indexterm>
21693 </para>
21694 <informaltable frame="all">
21695 <tgroup cols="4" colsep="0" rowsep="0">
21696 <colspec colwidth="8*" align="left"/>
21697 <colspec colwidth="6*" align="center"/>
21698 <colspec colwidth="6*" align="center"/>
21699 <colspec colwidth="6*" align="right"/>
21700 <tbody>
21701 <row>
21702 <entry><option>acl_not_smtp_mime</option></entry>
21703 <entry>Use: <emphasis>main</emphasis></entry>
21704 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21705 <entry>Default: <emphasis>unset</emphasis></entry>
21706 </row>
21707 </tbody>
21708 </tgroup>
21709 </informaltable>
21710 <para>
21711 This option defines the ACL that is run for individual MIME parts of non-SMTP
21712 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
21713 SMTP messages.
21714 </para>
21715 <para>
21716 <indexterm role="option">
21717 <primary><option>acl_not_smtp_start</option></primary>
21718 </indexterm>
21719 </para>
21720 <informaltable frame="all">
21721 <tgroup cols="4" colsep="0" rowsep="0">
21722 <colspec colwidth="8*" align="left"/>
21723 <colspec colwidth="6*" align="center"/>
21724 <colspec colwidth="6*" align="center"/>
21725 <colspec colwidth="6*" align="right"/>
21726 <tbody>
21727 <row>
21728 <entry><option>acl_not_smtp_start</option></entry>
21729 <entry>Use: <emphasis>main</emphasis></entry>
21730 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21731 <entry>Default: <emphasis>unset</emphasis></entry>
21732 </row>
21733 </tbody>
21734 </tgroup>
21735 </informaltable>
21736 <para>
21737 <indexterm role="concept">
21738 <primary>access control lists (ACLs)</primary>
21739 <secondary>at start of non-SMTP message</secondary>
21740 </indexterm>
21741 <indexterm role="concept">
21742 <primary>non-SMTP messages</primary>
21743 <secondary>ACLs for</secondary>
21744 </indexterm>
21745 This option defines the ACL that is run before Exim starts reading a
21746 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
21747 </para>
21748 <para>
21749 <indexterm role="option">
21750 <primary><option>acl_smtp_auth</option></primary>
21751 </indexterm>
21752 </para>
21753 <informaltable frame="all">
21754 <tgroup cols="4" colsep="0" rowsep="0">
21755 <colspec colwidth="8*" align="left"/>
21756 <colspec colwidth="6*" align="center"/>
21757 <colspec colwidth="6*" align="center"/>
21758 <colspec colwidth="6*" align="right"/>
21759 <tbody>
21760 <row>
21761 <entry><option>acl_smtp_auth</option></entry>
21762 <entry>Use: <emphasis>main</emphasis></entry>
21763 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21764 <entry>Default: <emphasis>unset</emphasis></entry>
21765 </row>
21766 </tbody>
21767 </tgroup>
21768 </informaltable>
21769 <para>
21770 <indexterm role="concept">
21771 <primary>access control lists (ACLs)</primary>
21772 <secondary>setting up for SMTP commands</secondary>
21773 </indexterm>
21774 <indexterm role="concept">
21775 <primary>AUTH</primary>
21776 <secondary>ACL for</secondary>
21777 </indexterm>
21778 This option defines the ACL that is run when an SMTP AUTH command is
21779 received. See chapter <xref linkend="CHAPACL"/> for further details.
21780 </para>
21781 <para>
21782 <indexterm role="option">
21783 <primary><option>acl_smtp_connect</option></primary>
21784 </indexterm>
21785 </para>
21786 <informaltable frame="all">
21787 <tgroup cols="4" colsep="0" rowsep="0">
21788 <colspec colwidth="8*" align="left"/>
21789 <colspec colwidth="6*" align="center"/>
21790 <colspec colwidth="6*" align="center"/>
21791 <colspec colwidth="6*" align="right"/>
21792 <tbody>
21793 <row>
21794 <entry><option>acl_smtp_connect</option></entry>
21795 <entry>Use: <emphasis>main</emphasis></entry>
21796 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21797 <entry>Default: <emphasis>unset</emphasis></entry>
21798 </row>
21799 </tbody>
21800 </tgroup>
21801 </informaltable>
21802 <para>
21803 <indexterm role="concept">
21804 <primary>access control lists (ACLs)</primary>
21805 <secondary>on SMTP connection</secondary>
21806 </indexterm>
21807 This option defines the ACL that is run when an SMTP connection is received.
21808 See chapter <xref linkend="CHAPACL"/> for further details.
21809 </para>
21810 <para>
21811 <indexterm role="option">
21812 <primary><option>acl_smtp_data</option></primary>
21813 </indexterm>
21814 </para>
21815 <informaltable frame="all">
21816 <tgroup cols="4" colsep="0" rowsep="0">
21817 <colspec colwidth="8*" align="left"/>
21818 <colspec colwidth="6*" align="center"/>
21819 <colspec colwidth="6*" align="center"/>
21820 <colspec colwidth="6*" align="right"/>
21821 <tbody>
21822 <row>
21823 <entry><option>acl_smtp_data</option></entry>
21824 <entry>Use: <emphasis>main</emphasis></entry>
21825 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21826 <entry>Default: <emphasis>unset</emphasis></entry>
21827 </row>
21828 </tbody>
21829 </tgroup>
21830 </informaltable>
21831 <para>
21832 <indexterm role="concept">
21833 <primary>DATA</primary>
21834 <secondary>ACL for</secondary>
21835 </indexterm>
21836 This option defines the ACL that is run after an SMTP DATA command has been
21837 processed and the message itself has been received, but before the final
21838 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
21839 </para>
21840 <para>
21841 <indexterm role="option">
21842 <primary><option>acl_smtp_data_prdr</option></primary>
21843 </indexterm>
21844 </para>
21845 <informaltable frame="all">
21846 <tgroup cols="4" colsep="0" rowsep="0">
21847 <colspec colwidth="8*" align="left"/>
21848 <colspec colwidth="6*" align="center"/>
21849 <colspec colwidth="6*" align="center"/>
21850 <colspec colwidth="6*" align="right"/>
21851 <tbody>
21852 <row>
21853 <entry><option>acl_smtp_data_prdr</option></entry>
21854 <entry>Use: <emphasis>main</emphasis></entry>
21855 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21856 <entry>Default: <emphasis>unset</emphasis></entry>
21857 </row>
21858 </tbody>
21859 </tgroup>
21860 </informaltable>
21861 <para>
21862 <indexterm role="concept">
21863 <primary>DATA</primary>
21864 <secondary>ACL for</secondary>
21865 </indexterm>
21866 <indexterm role="concept">
21867 <primary>access control lists (ACLs)</primary>
21868 <secondary>PRDR-related</secondary>
21869 </indexterm>
21870 <indexterm role="concept">
21871 <primary>access control lists (ACLs)</primary>
21872 <secondary>per-user data processing</secondary>
21873 </indexterm>
21874 This option defines the ACL that,
21875 if the PRDR feature has been negotiated,
21876 is run for each recipient after an SMTP DATA command has been
21877 processed and the message itself has been received, but before the
21878 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
21879 </para>
21880 <para>
21881 <indexterm role="option">
21882 <primary><option>acl_smtp_etrn</option></primary>
21883 </indexterm>
21884 </para>
21885 <informaltable frame="all">
21886 <tgroup cols="4" colsep="0" rowsep="0">
21887 <colspec colwidth="8*" align="left"/>
21888 <colspec colwidth="6*" align="center"/>
21889 <colspec colwidth="6*" align="center"/>
21890 <colspec colwidth="6*" align="right"/>
21891 <tbody>
21892 <row>
21893 <entry><option>acl_smtp_etrn</option></entry>
21894 <entry>Use: <emphasis>main</emphasis></entry>
21895 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21896 <entry>Default: <emphasis>unset</emphasis></entry>
21897 </row>
21898 </tbody>
21899 </tgroup>
21900 </informaltable>
21901 <para>
21902 <indexterm role="concept">
21903 <primary>ETRN</primary>
21904 <secondary>ACL for</secondary>
21905 </indexterm>
21906 This option defines the ACL that is run when an SMTP ETRN command is
21907 received. See chapter <xref linkend="CHAPACL"/> for further details.
21908 </para>
21909 <para>
21910 <indexterm role="option">
21911 <primary><option>acl_smtp_expn</option></primary>
21912 </indexterm>
21913 </para>
21914 <informaltable frame="all">
21915 <tgroup cols="4" colsep="0" rowsep="0">
21916 <colspec colwidth="8*" align="left"/>
21917 <colspec colwidth="6*" align="center"/>
21918 <colspec colwidth="6*" align="center"/>
21919 <colspec colwidth="6*" align="right"/>
21920 <tbody>
21921 <row>
21922 <entry><option>acl_smtp_expn</option></entry>
21923 <entry>Use: <emphasis>main</emphasis></entry>
21924 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21925 <entry>Default: <emphasis>unset</emphasis></entry>
21926 </row>
21927 </tbody>
21928 </tgroup>
21929 </informaltable>
21930 <para>
21931 <indexterm role="concept">
21932 <primary>EXPN</primary>
21933 <secondary>ACL for</secondary>
21934 </indexterm>
21935 This option defines the ACL that is run when an SMTP EXPN command is
21936 received. See chapter <xref linkend="CHAPACL"/> for further details.
21937 </para>
21938 <para>
21939 <indexterm role="option">
21940 <primary><option>acl_smtp_helo</option></primary>
21941 </indexterm>
21942 </para>
21943 <informaltable frame="all">
21944 <tgroup cols="4" colsep="0" rowsep="0">
21945 <colspec colwidth="8*" align="left"/>
21946 <colspec colwidth="6*" align="center"/>
21947 <colspec colwidth="6*" align="center"/>
21948 <colspec colwidth="6*" align="right"/>
21949 <tbody>
21950 <row>
21951 <entry><option>acl_smtp_helo</option></entry>
21952 <entry>Use: <emphasis>main</emphasis></entry>
21953 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21954 <entry>Default: <emphasis>unset</emphasis></entry>
21955 </row>
21956 </tbody>
21957 </tgroup>
21958 </informaltable>
21959 <para>
21960 <indexterm role="concept">
21961 <primary>EHLO</primary>
21962 <secondary>ACL for</secondary>
21963 </indexterm>
21964 <indexterm role="concept">
21965 <primary>HELO</primary>
21966 <secondary>ACL for</secondary>
21967 </indexterm>
21968 This option defines the ACL that is run when an SMTP EHLO or HELO
21969 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
21970 </para>
21971 <para>
21972 <indexterm role="option">
21973 <primary><option>acl_smtp_mail</option></primary>
21974 </indexterm>
21975 </para>
21976 <informaltable frame="all">
21977 <tgroup cols="4" colsep="0" rowsep="0">
21978 <colspec colwidth="8*" align="left"/>
21979 <colspec colwidth="6*" align="center"/>
21980 <colspec colwidth="6*" align="center"/>
21981 <colspec colwidth="6*" align="right"/>
21982 <tbody>
21983 <row>
21984 <entry><option>acl_smtp_mail</option></entry>
21985 <entry>Use: <emphasis>main</emphasis></entry>
21986 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21987 <entry>Default: <emphasis>unset</emphasis></entry>
21988 </row>
21989 </tbody>
21990 </tgroup>
21991 </informaltable>
21992 <para>
21993 <indexterm role="concept">
21994 <primary>MAIL</primary>
21995 <secondary>ACL for</secondary>
21996 </indexterm>
21997 This option defines the ACL that is run when an SMTP MAIL command is
21998 received. See chapter <xref linkend="CHAPACL"/> for further details.
21999 </para>
22000 <para>
22001 <indexterm role="option">
22002 <primary><option>acl_smtp_mailauth</option></primary>
22003 </indexterm>
22004 </para>
22005 <informaltable frame="all">
22006 <tgroup cols="4" colsep="0" rowsep="0">
22007 <colspec colwidth="8*" align="left"/>
22008 <colspec colwidth="6*" align="center"/>
22009 <colspec colwidth="6*" align="center"/>
22010 <colspec colwidth="6*" align="right"/>
22011 <tbody>
22012 <row>
22013 <entry><option>acl_smtp_mailauth</option></entry>
22014 <entry>Use: <emphasis>main</emphasis></entry>
22015 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22016 <entry>Default: <emphasis>unset</emphasis></entry>
22017 </row>
22018 </tbody>
22019 </tgroup>
22020 </informaltable>
22021 <para>
22022 <indexterm role="concept">
22023 <primary>AUTH</primary>
22024 <secondary>on MAIL command</secondary>
22025 </indexterm>
22026 This option defines the ACL that is run when there is an AUTH parameter on
22027 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
22028 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
22029 </para>
22030 <para>
22031 <indexterm role="option">
22032 <primary><option>acl_smtp_mime</option></primary>
22033 </indexterm>
22034 </para>
22035 <informaltable frame="all">
22036 <tgroup cols="4" colsep="0" rowsep="0">
22037 <colspec colwidth="8*" align="left"/>
22038 <colspec colwidth="6*" align="center"/>
22039 <colspec colwidth="6*" align="center"/>
22040 <colspec colwidth="6*" align="right"/>
22041 <tbody>
22042 <row>
22043 <entry><option>acl_smtp_mime</option></entry>
22044 <entry>Use: <emphasis>main</emphasis></entry>
22045 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22046 <entry>Default: <emphasis>unset</emphasis></entry>
22047 </row>
22048 </tbody>
22049 </tgroup>
22050 </informaltable>
22051 <para>
22052 <indexterm role="concept">
22053 <primary>MIME content scanning</primary>
22054 <secondary>ACL for</secondary>
22055 </indexterm>
22056 This option is available when Exim is built with the content-scanning
22057 extension. It defines the ACL that is run for each MIME part in a message. See
22058 section <xref linkend="SECTscanmimepart"/> for details.
22059 </para>
22060 <para>
22061 <indexterm role="option">
22062 <primary><option>acl_smtp_predata</option></primary>
22063 </indexterm>
22064 </para>
22065 <informaltable frame="all">
22066 <tgroup cols="4" colsep="0" rowsep="0">
22067 <colspec colwidth="8*" align="left"/>
22068 <colspec colwidth="6*" align="center"/>
22069 <colspec colwidth="6*" align="center"/>
22070 <colspec colwidth="6*" align="right"/>
22071 <tbody>
22072 <row>
22073 <entry><option>acl_smtp_predata</option></entry>
22074 <entry>Use: <emphasis>main</emphasis></entry>
22075 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22076 <entry>Default: <emphasis>unset</emphasis></entry>
22077 </row>
22078 </tbody>
22079 </tgroup>
22080 </informaltable>
22081 <para>
22082 This option defines the ACL that is run when an SMTP DATA command is
22083 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
22084 further details.
22085 </para>
22086 <para>
22087 <indexterm role="option">
22088 <primary><option>acl_smtp_quit</option></primary>
22089 </indexterm>
22090 </para>
22091 <informaltable frame="all">
22092 <tgroup cols="4" colsep="0" rowsep="0">
22093 <colspec colwidth="8*" align="left"/>
22094 <colspec colwidth="6*" align="center"/>
22095 <colspec colwidth="6*" align="center"/>
22096 <colspec colwidth="6*" align="right"/>
22097 <tbody>
22098 <row>
22099 <entry><option>acl_smtp_quit</option></entry>
22100 <entry>Use: <emphasis>main</emphasis></entry>
22101 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22102 <entry>Default: <emphasis>unset</emphasis></entry>
22103 </row>
22104 </tbody>
22105 </tgroup>
22106 </informaltable>
22107 <para>
22108 <indexterm role="concept">
22109 <primary>QUIT, ACL for</primary>
22110 </indexterm>
22111 This option defines the ACL that is run when an SMTP QUIT command is
22112 received. See chapter <xref linkend="CHAPACL"/> for further details.
22113 </para>
22114 <para>
22115 <indexterm role="option">
22116 <primary><option>acl_smtp_rcpt</option></primary>
22117 </indexterm>
22118 </para>
22119 <informaltable frame="all">
22120 <tgroup cols="4" colsep="0" rowsep="0">
22121 <colspec colwidth="8*" align="left"/>
22122 <colspec colwidth="6*" align="center"/>
22123 <colspec colwidth="6*" align="center"/>
22124 <colspec colwidth="6*" align="right"/>
22125 <tbody>
22126 <row>
22127 <entry><option>acl_smtp_rcpt</option></entry>
22128 <entry>Use: <emphasis>main</emphasis></entry>
22129 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22130 <entry>Default: <emphasis>unset</emphasis></entry>
22131 </row>
22132 </tbody>
22133 </tgroup>
22134 </informaltable>
22135 <para>
22136 <indexterm role="concept">
22137 <primary>RCPT</primary>
22138 <secondary>ACL for</secondary>
22139 </indexterm>
22140 This option defines the ACL that is run when an SMTP RCPT command is
22141 received. See chapter <xref linkend="CHAPACL"/> for further details.
22142 </para>
22143 <para>
22144 <indexterm role="option">
22145 <primary><option>acl_smtp_starttls</option></primary>
22146 </indexterm>
22147 </para>
22148 <informaltable frame="all">
22149 <tgroup cols="4" colsep="0" rowsep="0">
22150 <colspec colwidth="8*" align="left"/>
22151 <colspec colwidth="6*" align="center"/>
22152 <colspec colwidth="6*" align="center"/>
22153 <colspec colwidth="6*" align="right"/>
22154 <tbody>
22155 <row>
22156 <entry><option>acl_smtp_starttls</option></entry>
22157 <entry>Use: <emphasis>main</emphasis></entry>
22158 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22159 <entry>Default: <emphasis>unset</emphasis></entry>
22160 </row>
22161 </tbody>
22162 </tgroup>
22163 </informaltable>
22164 <para>
22165 <indexterm role="concept">
22166 <primary>STARTTLS, ACL for</primary>
22167 </indexterm>
22168 This option defines the ACL that is run when an SMTP STARTTLS command is
22169 received. See chapter <xref linkend="CHAPACL"/> for further details.
22170 </para>
22171 <para>
22172 <indexterm role="option">
22173 <primary><option>acl_smtp_vrfy</option></primary>
22174 </indexterm>
22175 </para>
22176 <informaltable frame="all">
22177 <tgroup cols="4" colsep="0" rowsep="0">
22178 <colspec colwidth="8*" align="left"/>
22179 <colspec colwidth="6*" align="center"/>
22180 <colspec colwidth="6*" align="center"/>
22181 <colspec colwidth="6*" align="right"/>
22182 <tbody>
22183 <row>
22184 <entry><option>acl_smtp_vrfy</option></entry>
22185 <entry>Use: <emphasis>main</emphasis></entry>
22186 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22187 <entry>Default: <emphasis>unset</emphasis></entry>
22188 </row>
22189 </tbody>
22190 </tgroup>
22191 </informaltable>
22192 <para>
22193 <indexterm role="concept">
22194 <primary>VRFY</primary>
22195 <secondary>ACL for</secondary>
22196 </indexterm>
22197 This option defines the ACL that is run when an SMTP VRFY command is
22198 received. See chapter <xref linkend="CHAPACL"/> for further details.
22199 </para>
22200 <para revisionflag="changed">
22201 <indexterm role="option">
22202 <primary><option>add_environment</option></primary>
22203 </indexterm>
22204 </para>
22205 <informaltable frame="all" revisionflag="changed">
22206 <tgroup cols="4" colsep="0" rowsep="0">
22207 <colspec colwidth="8*" align="left"/>
22208 <colspec colwidth="6*" align="center"/>
22209 <colspec colwidth="6*" align="center"/>
22210 <colspec colwidth="6*" align="right"/>
22211 <tbody>
22212 <row>
22213 <entry><option>add_environment</option></entry>
22214 <entry>Use: <emphasis>main</emphasis></entry>
22215 <entry>Type: <emphasis>string list</emphasis></entry>
22216 <entry>Default: <emphasis>empty</emphasis></entry>
22217 </row>
22218 </tbody>
22219 </tgroup>
22220 </informaltable>
22221 <para revisionflag="changed">
22222 <indexterm role="concept">
22223 <primary>environment</primary>
22224 <secondary>inherited</secondary>
22225 </indexterm>
22226 This option allows to set individual environment variables that the
22227 currently linked libraries and programs in child processes use. The
22228 default list is empty,
22229 </para>
22230 <para>
22231 <indexterm role="option">
22232 <primary><option>admin_groups</option></primary>
22233 </indexterm>
22234 </para>
22235 <informaltable frame="all">
22236 <tgroup cols="4" colsep="0" rowsep="0">
22237 <colspec colwidth="8*" align="left"/>
22238 <colspec colwidth="6*" align="center"/>
22239 <colspec colwidth="6*" align="center"/>
22240 <colspec colwidth="6*" align="right"/>
22241 <tbody>
22242 <row>
22243 <entry><option>admin_groups</option></entry>
22244 <entry>Use: <emphasis>main</emphasis></entry>
22245 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
22246 <entry>Default: <emphasis>unset</emphasis></entry>
22247 </row>
22248 </tbody>
22249 </tgroup>
22250 </informaltable>
22251 <para>
22252 <indexterm role="concept">
22253 <primary>admin user</primary>
22254 </indexterm>
22255 This option is expanded just once, at the start of Exim&#x2019;s processing. If the
22256 current group or any of the supplementary groups of an Exim caller is in this
22257 colon-separated list, the caller has admin privileges. If all your system
22258 programmers are in a specific group, for example, you can give them all Exim
22259 admin privileges by putting that group in <option>admin_groups</option>. However, this does
22260 not permit them to read Exim&#x2019;s spool files (whose group owner is the Exim gid).
22261 To permit this, you have to add individuals to the Exim group.
22262 </para>
22263 <para>
22264 <indexterm role="option">
22265 <primary><option>allow_domain_literals</option></primary>
22266 </indexterm>
22267 </para>
22268 <informaltable frame="all">
22269 <tgroup cols="4" colsep="0" rowsep="0">
22270 <colspec colwidth="8*" align="left"/>
22271 <colspec colwidth="6*" align="center"/>
22272 <colspec colwidth="6*" align="center"/>
22273 <colspec colwidth="6*" align="right"/>
22274 <tbody>
22275 <row>
22276 <entry><option>allow_domain_literals</option></entry>
22277 <entry>Use: <emphasis>main</emphasis></entry>
22278 <entry>Type: <emphasis>boolean</emphasis></entry>
22279 <entry>Default: <emphasis>false</emphasis></entry>
22280 </row>
22281 </tbody>
22282 </tgroup>
22283 </informaltable>
22284 <para>
22285 <indexterm role="concept">
22286 <primary>domain literal</primary>
22287 </indexterm>
22288 If this option is set, the RFC 2822 domain literal format is permitted in
22289 email addresses. The option is not set by default, because the domain literal
22290 format is not normally required these days, and few people know about it. It
22291 has, however, been exploited by mail abusers.
22292 </para>
22293 <para>
22294 Unfortunately, it seems that some DNS black list maintainers are using this
22295 format to report black listing to postmasters. If you want to accept messages
22296 addressed to your hosts by IP address, you need to set
22297 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
22298 domains (defined in the named domain list <option>local_domains</option> in the default
22299 configuration). This <quote>magic string</quote> matches the domain literal form of all
22300 the local host&#x2019;s IP addresses.
22301 </para>
22302 <para>
22303 <indexterm role="option">
22304 <primary><option>allow_mx_to_ip</option></primary>
22305 </indexterm>
22306 </para>
22307 <informaltable frame="all">
22308 <tgroup cols="4" colsep="0" rowsep="0">
22309 <colspec colwidth="8*" align="left"/>
22310 <colspec colwidth="6*" align="center"/>
22311 <colspec colwidth="6*" align="center"/>
22312 <colspec colwidth="6*" align="right"/>
22313 <tbody>
22314 <row>
22315 <entry><option>allow_mx_to_ip</option></entry>
22316 <entry>Use: <emphasis>main</emphasis></entry>
22317 <entry>Type: <emphasis>boolean</emphasis></entry>
22318 <entry>Default: <emphasis>false</emphasis></entry>
22319 </row>
22320 </tbody>
22321 </tgroup>
22322 </informaltable>
22323 <para>
22324 <indexterm role="concept">
22325 <primary>MX record</primary>
22326 <secondary>pointing to IP address</secondary>
22327 </indexterm>
22328 It appears that more and more DNS zone administrators are breaking the rules
22329 and putting domain names that look like IP addresses on the right hand side of
22330 MX records. Exim follows the rules and rejects this, giving an error message
22331 that explains the mis-configuration. However, some other MTAs support this
22332 practice, so to avoid <quote>Why can&#x2019;t Exim do this?</quote> complaints,
22333 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
22334 recommended, except when you have no other choice.
22335 </para>
22336 <para>
22337 <indexterm role="option">
22338 <primary><option>allow_utf8_domains</option></primary>
22339 </indexterm>
22340 </para>
22341 <informaltable frame="all">
22342 <tgroup cols="4" colsep="0" rowsep="0">
22343 <colspec colwidth="8*" align="left"/>
22344 <colspec colwidth="6*" align="center"/>
22345 <colspec colwidth="6*" align="center"/>
22346 <colspec colwidth="6*" align="right"/>
22347 <tbody>
22348 <row>
22349 <entry><option>allow_utf8_domains</option></entry>
22350 <entry>Use: <emphasis>main</emphasis></entry>
22351 <entry>Type: <emphasis>boolean</emphasis></entry>
22352 <entry>Default: <emphasis>false</emphasis></entry>
22353 </row>
22354 </tbody>
22355 </tgroup>
22356 </informaltable>
22357 <para>
22358 <indexterm role="concept">
22359 <primary>domain</primary>
22360 <secondary>UTF-8 characters in</secondary>
22361 </indexterm>
22362 <indexterm role="concept">
22363 <primary>UTF-8</primary>
22364 <secondary>in domain name</secondary>
22365 </indexterm>
22366 Lots of discussion is going on about internationalized domain names. One
22367 camp is strongly in favour of just using UTF-8 characters, and it seems
22368 that at least two other MTAs permit this. This option allows Exim users to
22369 experiment if they wish.
22370 </para>
22371 <para>
22372 If it is set true, Exim&#x2019;s domain parsing function allows valid
22373 UTF-8 multicharacters to appear in domain name components, in addition to
22374 letters, digits, and hyphens. However, just setting this option is not
22375 enough; if you want to look up these domain names in the DNS, you must also
22376 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
22377 suitable setting is:
22378 </para>
22379 <literallayout class="monospaced">
22380 dns_check_names_pattern = (?i)^(?&gt;(?(1)\.|())[a-z0-9\xc0-\xff]\
22381   (?&gt;[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
22382 </literallayout>
22383 <para>
22384 Alternatively, you can just disable this feature by setting
22385 </para>
22386 <literallayout class="monospaced">
22387 dns_check_names_pattern =
22388 </literallayout>
22389 <para>
22390 That is, set the option to an empty string so that no check is done.
22391 </para>
22392 <para>
22393 <indexterm role="option">
22394 <primary><option>auth_advertise_hosts</option></primary>
22395 </indexterm>
22396 </para>
22397 <informaltable frame="all">
22398 <tgroup cols="4" colsep="0" rowsep="0">
22399 <colspec colwidth="8*" align="left"/>
22400 <colspec colwidth="6*" align="center"/>
22401 <colspec colwidth="6*" align="center"/>
22402 <colspec colwidth="6*" align="right"/>
22403 <tbody>
22404 <row>
22405 <entry><option>auth_advertise_hosts</option></entry>
22406 <entry>Use: <emphasis>main</emphasis></entry>
22407 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
22408 <entry>Default: <emphasis>*</emphasis></entry>
22409 </row>
22410 </tbody>
22411 </tgroup>
22412 </informaltable>
22413 <para>
22414 <indexterm role="concept">
22415 <primary>authentication</primary>
22416 <secondary>advertising</secondary>
22417 </indexterm>
22418 <indexterm role="concept">
22419 <primary>AUTH</primary>
22420 <secondary>advertising</secondary>
22421 </indexterm>
22422 If any server authentication mechanisms are configured, Exim advertises them in
22423 response to an EHLO command only if the calling host matches this list.
22424 Otherwise, Exim does not advertise AUTH.
22425 Exim does not accept AUTH commands from clients to which it has not
22426 advertised the availability of AUTH. The advertising of individual
22427 authentication mechanisms can be controlled by the use of the
22428 <option>server_advertise_condition</option> generic authenticator option on the individual
22429 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
22430 </para>
22431 <para>
22432 Certain mail clients (for example, Netscape) require the user to provide a name
22433 and password for authentication if AUTH is advertised, even though it may
22434 not be needed (the host may accept messages from hosts on its local LAN without
22435 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
22436 to make these clients more friendly by excluding them from the set of hosts to
22437 which Exim advertises AUTH.
22438 </para>
22439 <para>
22440 <indexterm role="concept">
22441 <primary>AUTH</primary>
22442 <secondary>advertising when encrypted</secondary>
22443 </indexterm>
22444 If you want to advertise the availability of AUTH only when the connection
22445 is encrypted using TLS, you can make use of the fact that the value of this
22446 option is expanded, with a setting like this:
22447 </para>
22448 <literallayout class="monospaced">
22449 auth_advertise_hosts = ${if eq{$tls_in_cipher}{}{}{*}}
22450 </literallayout>
22451 <para>
22452 <indexterm role="variable">
22453 <primary><varname>$tls_in_cipher</varname></primary>
22454 </indexterm>
22455 If <varname>$tls_in_cipher</varname> is empty, the session is not encrypted, and the result of
22456 the expansion is empty, thus matching no hosts. Otherwise, the result of the
22457 expansion is *, which matches all hosts.
22458 </para>
22459 <para>
22460 <indexterm role="option">
22461 <primary><option>auto_thaw</option></primary>
22462 </indexterm>
22463 </para>
22464 <informaltable frame="all">
22465 <tgroup cols="4" colsep="0" rowsep="0">
22466 <colspec colwidth="8*" align="left"/>
22467 <colspec colwidth="6*" align="center"/>
22468 <colspec colwidth="6*" align="center"/>
22469 <colspec colwidth="6*" align="right"/>
22470 <tbody>
22471 <row>
22472 <entry><option>auto_thaw</option></entry>
22473 <entry>Use: <emphasis>main</emphasis></entry>
22474 <entry>Type: <emphasis>time</emphasis></entry>
22475 <entry>Default: <emphasis>0s</emphasis></entry>
22476 </row>
22477 </tbody>
22478 </tgroup>
22479 </informaltable>
22480 <para>
22481 <indexterm role="concept">
22482 <primary>thawing messages</primary>
22483 </indexterm>
22484 <indexterm role="concept">
22485 <primary>unfreezing messages</primary>
22486 </indexterm>
22487 If this option is set to a time greater than zero, a queue runner will try a
22488 new delivery attempt on any frozen message, other than a bounce message, if
22489 this much time has passed since it was frozen. This may result in the message
22490 being re-frozen if nothing has changed since the last attempt. It is a way of
22491 saying <quote>keep on trying, even though there are big problems</quote>.
22492 </para>
22493 <para>
22494 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
22495 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
22496 thought to be very useful any more, and its use should probably be avoided.
22497 </para>
22498 <para>
22499 <indexterm role="option">
22500 <primary><option>av_scanner</option></primary>
22501 </indexterm>
22502 </para>
22503 <informaltable frame="all">
22504 <tgroup cols="4" colsep="0" rowsep="0">
22505 <colspec colwidth="8*" align="left"/>
22506 <colspec colwidth="6*" align="center"/>
22507 <colspec colwidth="6*" align="center"/>
22508 <colspec colwidth="6*" align="right"/>
22509 <tbody>
22510 <row>
22511 <entry><option>av_scanner</option></entry>
22512 <entry>Use: <emphasis>main</emphasis></entry>
22513 <entry>Type: <emphasis>string</emphasis></entry>
22514 <entry>Default: <emphasis>see below</emphasis></entry>
22515 </row>
22516 </tbody>
22517 </tgroup>
22518 </informaltable>
22519 <para>
22520 This option is available if Exim is built with the content-scanning extension.
22521 It specifies which anti-virus scanner to use. The default value is:
22522 </para>
22523 <literallayout class="monospaced">
22524 sophie:/var/run/sophie
22525 </literallayout>
22526 <para>
22527 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
22528 before use. See section <xref linkend="SECTscanvirus"/> for further details.
22529 </para>
22530 <para>
22531 <indexterm role="option">
22532 <primary><option>bi_command</option></primary>
22533 </indexterm>
22534 </para>
22535 <informaltable frame="all">
22536 <tgroup cols="4" colsep="0" rowsep="0">
22537 <colspec colwidth="8*" align="left"/>
22538 <colspec colwidth="6*" align="center"/>
22539 <colspec colwidth="6*" align="center"/>
22540 <colspec colwidth="6*" align="right"/>
22541 <tbody>
22542 <row>
22543 <entry><option>bi_command</option></entry>
22544 <entry>Use: <emphasis>main</emphasis></entry>
22545 <entry>Type: <emphasis>string</emphasis></entry>
22546 <entry>Default: <emphasis>unset</emphasis></entry>
22547 </row>
22548 </tbody>
22549 </tgroup>
22550 </informaltable>
22551 <para>
22552 <indexterm role="option">
22553 <primary><option>-bi</option></primary>
22554 </indexterm>
22555 This option supplies the name of a command that is run when Exim is called with
22556 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
22557 just the command name, it is not a complete command line. If an argument is
22558 required, it must come from the <option>-oA</option> command line option.
22559 </para>
22560 <para>
22561 <indexterm role="option">
22562 <primary><option>bounce_message_file</option></primary>
22563 </indexterm>
22564 </para>
22565 <informaltable frame="all">
22566 <tgroup cols="4" colsep="0" rowsep="0">
22567 <colspec colwidth="8*" align="left"/>
22568 <colspec colwidth="6*" align="center"/>
22569 <colspec colwidth="6*" align="center"/>
22570 <colspec colwidth="6*" align="right"/>
22571 <tbody>
22572 <row>
22573 <entry><option>bounce_message_file</option></entry>
22574 <entry>Use: <emphasis>main</emphasis></entry>
22575 <entry>Type: <emphasis>string</emphasis></entry>
22576 <entry>Default: <emphasis>unset</emphasis></entry>
22577 </row>
22578 </tbody>
22579 </tgroup>
22580 </informaltable>
22581 <para>
22582 <indexterm role="concept">
22583 <primary>bounce message</primary>
22584 <secondary>customizing</secondary>
22585 </indexterm>
22586 <indexterm role="concept">
22587 <primary>customizing</primary>
22588 <secondary>bounce message</secondary>
22589 </indexterm>
22590 This option defines a template file containing paragraphs of text to be used
22591 for constructing bounce messages.  Details of the file&#x2019;s contents are given in
22592 chapter <xref linkend="CHAPemsgcust"/>. See also <option>warn_message_file</option>.
22593 </para>
22594 <para>
22595 <indexterm role="option">
22596 <primary><option>bounce_message_text</option></primary>
22597 </indexterm>
22598 </para>
22599 <informaltable frame="all">
22600 <tgroup cols="4" colsep="0" rowsep="0">
22601 <colspec colwidth="8*" align="left"/>
22602 <colspec colwidth="6*" align="center"/>
22603 <colspec colwidth="6*" align="center"/>
22604 <colspec colwidth="6*" align="right"/>
22605 <tbody>
22606 <row>
22607 <entry><option>bounce_message_text</option></entry>
22608 <entry>Use: <emphasis>main</emphasis></entry>
22609 <entry>Type: <emphasis>string</emphasis></entry>
22610 <entry>Default: <emphasis>unset</emphasis></entry>
22611 </row>
22612 </tbody>
22613 </tgroup>
22614 </informaltable>
22615 <para>
22616 When this option is set, its contents are included in the default bounce
22617 message immediately after <quote>This message was created automatically by mail
22618 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
22619 </para>
22620 <para>
22621 <indexterm role="option">
22622 <primary><option>bounce_return_body</option></primary>
22623 </indexterm>
22624 </para>
22625 <informaltable frame="all">
22626 <tgroup cols="4" colsep="0" rowsep="0">
22627 <colspec colwidth="8*" align="left"/>
22628 <colspec colwidth="6*" align="center"/>
22629 <colspec colwidth="6*" align="center"/>
22630 <colspec colwidth="6*" align="right"/>
22631 <tbody>
22632 <row>
22633 <entry><option>bounce_return_body</option></entry>
22634 <entry>Use: <emphasis>main</emphasis></entry>
22635 <entry>Type: <emphasis>boolean</emphasis></entry>
22636 <entry>Default: <emphasis>true</emphasis></entry>
22637 </row>
22638 </tbody>
22639 </tgroup>
22640 </informaltable>
22641 <para>
22642 <indexterm role="concept">
22643 <primary>bounce message</primary>
22644 <secondary>including body</secondary>
22645 </indexterm>
22646 This option controls whether the body of an incoming message is included in a
22647 bounce message when <option>bounce_return_message</option> is true. The default setting
22648 causes the entire message, both header and body, to be returned (subject to the
22649 value of <option>bounce_return_size_limit</option>). If this option is false, only the
22650 message header is included. In the case of a non-SMTP message containing an
22651 error that is detected during reception, only those header lines preceding the
22652 point at which the error was detected are returned.
22653 <indexterm role="concept">
22654 <primary>bounce message</primary>
22655 <secondary>including original</secondary>
22656 </indexterm>
22657 </para>
22658 <para>
22659 <indexterm role="option">
22660 <primary><option>bounce_return_message</option></primary>
22661 </indexterm>
22662 </para>
22663 <informaltable frame="all">
22664 <tgroup cols="4" colsep="0" rowsep="0">
22665 <colspec colwidth="8*" align="left"/>
22666 <colspec colwidth="6*" align="center"/>
22667 <colspec colwidth="6*" align="center"/>
22668 <colspec colwidth="6*" align="right"/>
22669 <tbody>
22670 <row>
22671 <entry><option>bounce_return_message</option></entry>
22672 <entry>Use: <emphasis>main</emphasis></entry>
22673 <entry>Type: <emphasis>boolean</emphasis></entry>
22674 <entry>Default: <emphasis>true</emphasis></entry>
22675 </row>
22676 </tbody>
22677 </tgroup>
22678 </informaltable>
22679 <para>
22680 If this option is set false, none of the original message is included in
22681 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
22682 <option>bounce_return_body</option>.
22683 </para>
22684 <para>
22685 <indexterm role="option">
22686 <primary><option>bounce_return_size_limit</option></primary>
22687 </indexterm>
22688 </para>
22689 <informaltable frame="all">
22690 <tgroup cols="4" colsep="0" rowsep="0">
22691 <colspec colwidth="8*" align="left"/>
22692 <colspec colwidth="6*" align="center"/>
22693 <colspec colwidth="6*" align="center"/>
22694 <colspec colwidth="6*" align="right"/>
22695 <tbody>
22696 <row>
22697 <entry><option>bounce_return_size_limit</option></entry>
22698 <entry>Use: <emphasis>main</emphasis></entry>
22699 <entry>Type: <emphasis>integer</emphasis></entry>
22700 <entry>Default: <emphasis>100K</emphasis></entry>
22701 </row>
22702 </tbody>
22703 </tgroup>
22704 </informaltable>
22705 <para>
22706 <indexterm role="concept">
22707 <primary>size</primary>
22708 <secondary>of bounce, limit</secondary>
22709 </indexterm>
22710 <indexterm role="concept">
22711 <primary>bounce message</primary>
22712 <secondary>size limit</secondary>
22713 </indexterm>
22714 <indexterm role="concept">
22715 <primary>limit</primary>
22716 <secondary>bounce message size</secondary>
22717 </indexterm>
22718 This option sets a limit in bytes on the size of messages that are returned to
22719 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
22720 limit should be less than the value of the global <option>message_size_limit</option> and of
22721 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
22722 that Exim generates. If this option is set to zero there is no limit.
22723 </para>
22724 <para>
22725 When the body of any message that is to be included in a bounce message is
22726 greater than the limit, it is truncated, and a comment pointing this out is
22727 added at the top. The actual cutoff may be greater than the value given, owing
22728 to the use of buffering for transferring the message in chunks (typically 8K in
22729 size). The idea is to save bandwidth on those undeliverable 15-megabyte
22730 messages.
22731 </para>
22732 <para>
22733 <indexterm role="option">
22734 <primary><option>bounce_sender_authentication</option></primary>
22735 </indexterm>
22736 </para>
22737 <informaltable frame="all">
22738 <tgroup cols="4" colsep="0" rowsep="0">
22739 <colspec colwidth="8*" align="left"/>
22740 <colspec colwidth="6*" align="center"/>
22741 <colspec colwidth="6*" align="center"/>
22742 <colspec colwidth="6*" align="right"/>
22743 <tbody>
22744 <row>
22745 <entry><option>bounce_sender_authentication</option></entry>
22746 <entry>Use: <emphasis>main</emphasis></entry>
22747 <entry>Type: <emphasis>string</emphasis></entry>
22748 <entry>Default: <emphasis>unset</emphasis></entry>
22749 </row>
22750 </tbody>
22751 </tgroup>
22752 </informaltable>
22753 <para>
22754 <indexterm role="concept">
22755 <primary>bounce message</primary>
22756 <secondary>sender authentication</secondary>
22757 </indexterm>
22758 <indexterm role="concept">
22759 <primary>authentication</primary>
22760 <secondary>bounce message</secondary>
22761 </indexterm>
22762 <indexterm role="concept">
22763 <primary>AUTH</primary>
22764 <secondary>on bounce message</secondary>
22765 </indexterm>
22766 This option provides an authenticated sender address that is sent with any
22767 bounce messages generated by Exim that are sent over an authenticated SMTP
22768 connection. A typical setting might be:
22769 </para>
22770 <literallayout class="monospaced">
22771 bounce_sender_authentication = mailer-daemon@my.domain.example
22772 </literallayout>
22773 <para>
22774 which would cause bounce messages to be sent using the SMTP command:
22775 </para>
22776 <literallayout class="monospaced">
22777 MAIL FROM:&lt;&gt; AUTH=mailer-daemon@my.domain.example
22778 </literallayout>
22779 <para>
22780 The value of <option>bounce_sender_authentication</option> must always be a complete email
22781 address.
22782 </para>
22783 <para>
22784 <indexterm role="option">
22785 <primary><option>callout_domain_negative_expire</option></primary>
22786 </indexterm>
22787 </para>
22788 <informaltable frame="all">
22789 <tgroup cols="4" colsep="0" rowsep="0">
22790 <colspec colwidth="8*" align="left"/>
22791 <colspec colwidth="6*" align="center"/>
22792 <colspec colwidth="6*" align="center"/>
22793 <colspec colwidth="6*" align="right"/>
22794 <tbody>
22795 <row>
22796 <entry><option>callout_domain_negative_expire</option></entry>
22797 <entry>Use: <emphasis>main</emphasis></entry>
22798 <entry>Type: <emphasis>time</emphasis></entry>
22799 <entry>Default: <emphasis>3h</emphasis></entry>
22800 </row>
22801 </tbody>
22802 </tgroup>
22803 </informaltable>
22804 <para>
22805 <indexterm role="concept">
22806 <primary>caching</primary>
22807 <secondary>callout timeouts</secondary>
22808 </indexterm>
22809 <indexterm role="concept">
22810 <primary>callout</primary>
22811 <secondary>caching timeouts</secondary>
22812 </indexterm>
22813 This option specifies the expiry time for negative callout cache data for a
22814 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
22815 section <xref linkend="SECTcallvercache"/> for details of the caching.
22816 </para>
22817 <para>
22818 <indexterm role="option">
22819 <primary><option>callout_domain_positive_expire</option></primary>
22820 </indexterm>
22821 </para>
22822 <informaltable frame="all">
22823 <tgroup cols="4" colsep="0" rowsep="0">
22824 <colspec colwidth="8*" align="left"/>
22825 <colspec colwidth="6*" align="center"/>
22826 <colspec colwidth="6*" align="center"/>
22827 <colspec colwidth="6*" align="right"/>
22828 <tbody>
22829 <row>
22830 <entry><option>callout_domain_positive_expire</option></entry>
22831 <entry>Use: <emphasis>main</emphasis></entry>
22832 <entry>Type: <emphasis>time</emphasis></entry>
22833 <entry>Default: <emphasis>7d</emphasis></entry>
22834 </row>
22835 </tbody>
22836 </tgroup>
22837 </informaltable>
22838 <para>
22839 This option specifies the expiry time for positive callout cache data for a
22840 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
22841 section <xref linkend="SECTcallvercache"/> for details of the caching.
22842 </para>
22843 <para>
22844 <indexterm role="option">
22845 <primary><option>callout_negative_expire</option></primary>
22846 </indexterm>
22847 </para>
22848 <informaltable frame="all">
22849 <tgroup cols="4" colsep="0" rowsep="0">
22850 <colspec colwidth="8*" align="left"/>
22851 <colspec colwidth="6*" align="center"/>
22852 <colspec colwidth="6*" align="center"/>
22853 <colspec colwidth="6*" align="right"/>
22854 <tbody>
22855 <row>
22856 <entry><option>callout_negative_expire</option></entry>
22857 <entry>Use: <emphasis>main</emphasis></entry>
22858 <entry>Type: <emphasis>time</emphasis></entry>
22859 <entry>Default: <emphasis>2h</emphasis></entry>
22860 </row>
22861 </tbody>
22862 </tgroup>
22863 </informaltable>
22864 <para>
22865 This option specifies the expiry time for negative callout cache data for an
22866 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
22867 section <xref linkend="SECTcallvercache"/> for details of the caching.
22868 </para>
22869 <para>
22870 <indexterm role="option">
22871 <primary><option>callout_positive_expire</option></primary>
22872 </indexterm>
22873 </para>
22874 <informaltable frame="all">
22875 <tgroup cols="4" colsep="0" rowsep="0">
22876 <colspec colwidth="8*" align="left"/>
22877 <colspec colwidth="6*" align="center"/>
22878 <colspec colwidth="6*" align="center"/>
22879 <colspec colwidth="6*" align="right"/>
22880 <tbody>
22881 <row>
22882 <entry><option>callout_positive_expire</option></entry>
22883 <entry>Use: <emphasis>main</emphasis></entry>
22884 <entry>Type: <emphasis>time</emphasis></entry>
22885 <entry>Default: <emphasis>24h</emphasis></entry>
22886 </row>
22887 </tbody>
22888 </tgroup>
22889 </informaltable>
22890 <para>
22891 This option specifies the expiry time for positive callout cache data for an
22892 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
22893 section <xref linkend="SECTcallvercache"/> for details of the caching.
22894 </para>
22895 <para>
22896 <indexterm role="option">
22897 <primary><option>callout_random_local_part</option></primary>
22898 </indexterm>
22899 </para>
22900 <informaltable frame="all">
22901 <tgroup cols="4" colsep="0" rowsep="0">
22902 <colspec colwidth="8*" align="left"/>
22903 <colspec colwidth="6*" align="center"/>
22904 <colspec colwidth="6*" align="center"/>
22905 <colspec colwidth="6*" align="right"/>
22906 <tbody>
22907 <row>
22908 <entry><option>callout_random_local_part</option></entry>
22909 <entry>Use: <emphasis>main</emphasis></entry>
22910 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22911 <entry>Default: <emphasis>see below</emphasis></entry>
22912 </row>
22913 </tbody>
22914 </tgroup>
22915 </informaltable>
22916 <para>
22917 This option defines the <quote>random</quote> local part that can be used as part of
22918 callout verification. The default value is
22919 </para>
22920 <literallayout class="monospaced">
22921 $primary_hostname-$tod_epoch-testing
22922 </literallayout>
22923 <para>
22924 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
22925 </para>
22926 <para>
22927 <indexterm role="option">
22928 <primary><option>check_log_inodes</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>check_log_inodes</option></entry>
22940 <entry>Use: <emphasis>main</emphasis></entry>
22941 <entry>Type: <emphasis>integer</emphasis></entry>
22942 <entry>Default: <emphasis>0</emphasis></entry>
22943 </row>
22944 </tbody>
22945 </tgroup>
22946 </informaltable>
22947 <para>
22948 See <option>check_spool_space</option> below.
22949 </para>
22950 <para>
22951 <indexterm role="option">
22952 <primary><option>check_log_space</option></primary>
22953 </indexterm>
22954 </para>
22955 <informaltable frame="all">
22956 <tgroup cols="4" colsep="0" rowsep="0">
22957 <colspec colwidth="8*" align="left"/>
22958 <colspec colwidth="6*" align="center"/>
22959 <colspec colwidth="6*" align="center"/>
22960 <colspec colwidth="6*" align="right"/>
22961 <tbody>
22962 <row>
22963 <entry><option>check_log_space</option></entry>
22964 <entry>Use: <emphasis>main</emphasis></entry>
22965 <entry>Type: <emphasis>integer</emphasis></entry>
22966 <entry>Default: <emphasis>0</emphasis></entry>
22967 </row>
22968 </tbody>
22969 </tgroup>
22970 </informaltable>
22971 <para>
22972 See <option>check_spool_space</option> below.
22973 </para>
22974 <para>
22975 <indexterm role="option">
22976 <primary><option>check_rfc2047_length</option></primary>
22977 </indexterm>
22978 <indexterm role="concept">
22979 <primary>RFC 2047</primary>
22980 <secondary>disabling length check</secondary>
22981 </indexterm>
22982 <indexterm role="option">
22983 <primary><option>check_rfc2047_length</option></primary>
22984 </indexterm>
22985 </para>
22986 <informaltable frame="all">
22987 <tgroup cols="4" colsep="0" rowsep="0">
22988 <colspec colwidth="8*" align="left"/>
22989 <colspec colwidth="6*" align="center"/>
22990 <colspec colwidth="6*" align="center"/>
22991 <colspec colwidth="6*" align="right"/>
22992 <tbody>
22993 <row>
22994 <entry><option>check_rfc2047_length</option></entry>
22995 <entry>Use: <emphasis>main</emphasis></entry>
22996 <entry>Type: <emphasis>boolean</emphasis></entry>
22997 <entry>Default: <emphasis>true</emphasis></entry>
22998 </row>
22999 </tbody>
23000 </tgroup>
23001 </informaltable>
23002 <para>
23003 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
23004 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
23005 word; strings to be encoded that exceed this length are supposed to use
23006 multiple encoded words. By default, Exim does not recognize encoded words that
23007 exceed the maximum length. However, it seems that some software, in violation
23008 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
23009 set false, Exim recognizes encoded words of any length.
23010 </para>
23011 <para>
23012 <indexterm role="option">
23013 <primary><option>check_spool_inodes</option></primary>
23014 </indexterm>
23015 </para>
23016 <informaltable frame="all">
23017 <tgroup cols="4" colsep="0" rowsep="0">
23018 <colspec colwidth="8*" align="left"/>
23019 <colspec colwidth="6*" align="center"/>
23020 <colspec colwidth="6*" align="center"/>
23021 <colspec colwidth="6*" align="right"/>
23022 <tbody>
23023 <row>
23024 <entry><option>check_spool_inodes</option></entry>
23025 <entry>Use: <emphasis>main</emphasis></entry>
23026 <entry>Type: <emphasis>integer</emphasis></entry>
23027 <entry>Default: <emphasis>0</emphasis></entry>
23028 </row>
23029 </tbody>
23030 </tgroup>
23031 </informaltable>
23032 <para>
23033 See <option>check_spool_space</option> below.
23034 </para>
23035 <para>
23036 <indexterm role="option">
23037 <primary><option>check_spool_space</option></primary>
23038 </indexterm>
23039 </para>
23040 <informaltable frame="all">
23041 <tgroup cols="4" colsep="0" rowsep="0">
23042 <colspec colwidth="8*" align="left"/>
23043 <colspec colwidth="6*" align="center"/>
23044 <colspec colwidth="6*" align="center"/>
23045 <colspec colwidth="6*" align="right"/>
23046 <tbody>
23047 <row>
23048 <entry><option>check_spool_space</option></entry>
23049 <entry>Use: <emphasis>main</emphasis></entry>
23050 <entry>Type: <emphasis>integer</emphasis></entry>
23051 <entry>Default: <emphasis>0</emphasis></entry>
23052 </row>
23053 </tbody>
23054 </tgroup>
23055 </informaltable>
23056 <para>
23057 <indexterm role="concept">
23058 <primary>checking disk space</primary>
23059 </indexterm>
23060 <indexterm role="concept">
23061 <primary>disk space, checking</primary>
23062 </indexterm>
23063 <indexterm role="concept">
23064 <primary>spool directory</primary>
23065 <secondary>checking space</secondary>
23066 </indexterm>
23067 The four <option>check_...</option> options allow for checking of disk resources before a
23068 message is accepted.
23069 </para>
23070 <para>
23071 <indexterm role="variable">
23072 <primary><varname>$log_inodes</varname></primary>
23073 </indexterm>
23074 <indexterm role="variable">
23075 <primary><varname>$log_space</varname></primary>
23076 </indexterm>
23077 <indexterm role="variable">
23078 <primary><varname>$spool_inodes</varname></primary>
23079 </indexterm>
23080 <indexterm role="variable">
23081 <primary><varname>$spool_space</varname></primary>
23082 </indexterm>
23083 When any of these options are set, they apply to all incoming messages. If you
23084 want to apply different checks to different kinds of message, you can do so by
23085 testing the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
23086 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
23087 </para>
23088 <para>
23089 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
23090 either value is greater than zero, for example:
23091 </para>
23092 <literallayout class="monospaced">
23093 check_spool_space = 10M
23094 check_spool_inodes = 100
23095 </literallayout>
23096 <para>
23097 The spool partition is the one that contains the directory defined by
23098 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
23099 transit.
23100 </para>
23101 <para>
23102 <option>check_log_space</option> and <option>check_log_inodes</option>  check the partition in which log
23103 files are written if either is greater than zero. These should be set only if
23104 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
23105 </para>
23106 <para>
23107 If there is less space or fewer inodes than requested, Exim refuses to accept
23108 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
23109 error response to the MAIL command. If ESMTP is in use and there was a
23110 SIZE parameter on the MAIL command, its value is added to the
23111 <option>check_spool_space</option> value, and the check is performed even if
23112 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
23113 </para>
23114 <para>
23115 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
23116 number of kilobytes. If a non-multiple of 1024 is specified, it is rounded up.
23117 </para>
23118 <para>
23119 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
23120 failure a message is written to stderr and Exim exits with a non-zero code, as
23121 it obviously cannot send an error message of any kind.
23122 </para>
23123 <para>
23124 <indexterm role="option">
23125 <primary><option>daemon_smtp_ports</option></primary>
23126 </indexterm>
23127 </para>
23128 <informaltable frame="all">
23129 <tgroup cols="4" colsep="0" rowsep="0">
23130 <colspec colwidth="8*" align="left"/>
23131 <colspec colwidth="6*" align="center"/>
23132 <colspec colwidth="6*" align="center"/>
23133 <colspec colwidth="6*" align="right"/>
23134 <tbody>
23135 <row>
23136 <entry><option>daemon_smtp_ports</option></entry>
23137 <entry>Use: <emphasis>main</emphasis></entry>
23138 <entry>Type: <emphasis>string</emphasis></entry>
23139 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
23140 </row>
23141 </tbody>
23142 </tgroup>
23143 </informaltable>
23144 <para>
23145 <indexterm role="concept">
23146 <primary>port</primary>
23147 <secondary>for daemon</secondary>
23148 </indexterm>
23149 <indexterm role="concept">
23150 <primary>TCP/IP</primary>
23151 <secondary>setting listening ports</secondary>
23152 </indexterm>
23153 This option specifies one or more default SMTP ports on which the Exim daemon
23154 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
23155 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
23156 </para>
23157 <para>
23158 <indexterm role="option">
23159 <primary><option>daemon_startup_retries</option></primary>
23160 </indexterm>
23161 </para>
23162 <informaltable frame="all">
23163 <tgroup cols="4" colsep="0" rowsep="0">
23164 <colspec colwidth="8*" align="left"/>
23165 <colspec colwidth="6*" align="center"/>
23166 <colspec colwidth="6*" align="center"/>
23167 <colspec colwidth="6*" align="right"/>
23168 <tbody>
23169 <row>
23170 <entry><option>daemon_startup_retries</option></entry>
23171 <entry>Use: <emphasis>main</emphasis></entry>
23172 <entry>Type: <emphasis>integer</emphasis></entry>
23173 <entry>Default: <emphasis>9</emphasis></entry>
23174 </row>
23175 </tbody>
23176 </tgroup>
23177 </informaltable>
23178 <para>
23179 <indexterm role="concept">
23180 <primary>daemon startup, retrying</primary>
23181 </indexterm>
23182 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
23183 the daemon at startup when it cannot immediately bind a listening socket
23184 (typically because the socket is already in use): <option>daemon_startup_retries</option>
23185 defines the number of retries after the first failure, and
23186 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
23187 </para>
23188 <para>
23189 <indexterm role="option">
23190 <primary><option>daemon_startup_sleep</option></primary>
23191 </indexterm>
23192 </para>
23193 <informaltable frame="all">
23194 <tgroup cols="4" colsep="0" rowsep="0">
23195 <colspec colwidth="8*" align="left"/>
23196 <colspec colwidth="6*" align="center"/>
23197 <colspec colwidth="6*" align="center"/>
23198 <colspec colwidth="6*" align="right"/>
23199 <tbody>
23200 <row>
23201 <entry><option>daemon_startup_sleep</option></entry>
23202 <entry>Use: <emphasis>main</emphasis></entry>
23203 <entry>Type: <emphasis>time</emphasis></entry>
23204 <entry>Default: <emphasis>30s</emphasis></entry>
23205 </row>
23206 </tbody>
23207 </tgroup>
23208 </informaltable>
23209 <para>
23210 See <option>daemon_startup_retries</option>.
23211 </para>
23212 <para>
23213 <indexterm role="option">
23214 <primary><option>delay_warning</option></primary>
23215 </indexterm>
23216 </para>
23217 <informaltable frame="all">
23218 <tgroup cols="4" colsep="0" rowsep="0">
23219 <colspec colwidth="8*" align="left"/>
23220 <colspec colwidth="6*" align="center"/>
23221 <colspec colwidth="6*" align="center"/>
23222 <colspec colwidth="6*" align="right"/>
23223 <tbody>
23224 <row>
23225 <entry><option>delay_warning</option></entry>
23226 <entry>Use: <emphasis>main</emphasis></entry>
23227 <entry>Type: <emphasis>time list</emphasis></entry>
23228 <entry>Default: <emphasis>24h</emphasis></entry>
23229 </row>
23230 </tbody>
23231 </tgroup>
23232 </informaltable>
23233 <para>
23234 <indexterm role="concept">
23235 <primary>warning of delay</primary>
23236 </indexterm>
23237 <indexterm role="concept">
23238 <primary>delay warning, specifying</primary>
23239 </indexterm>
23240 When a message is delayed, Exim sends a warning message to the sender at
23241 intervals specified by this option. The data is a colon-separated list of times
23242 after which to send warning messages. If the value of the option is an empty
23243 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
23244 message has been on the queue for longer than the last time, the last interval
23245 between the times is used to compute subsequent warning times. For example,
23246 with
23247 </para>
23248 <literallayout class="monospaced">
23249 delay_warning = 4h:8h:24h
23250 </literallayout>
23251 <para>
23252 the first message is sent after 4 hours, the second after 8 hours, and
23253 the third one after 24 hours. After that, messages are sent every 16 hours,
23254 because that is the interval between the last two times on the list. If you set
23255 just one time, it specifies the repeat interval. For example, with:
23256 </para>
23257 <literallayout class="monospaced">
23258 delay_warning = 6h
23259 </literallayout>
23260 <para>
23261 messages are repeated every six hours. To stop warnings after a given time, set
23262 a very large time at the end of the list. For example:
23263 </para>
23264 <literallayout class="monospaced">
23265 delay_warning = 2h:12h:99d
23266 </literallayout>
23267 <para>
23268 Note that the option is only evaluated at the time a delivery attempt fails,
23269 which depends on retry and queue-runner configuration.
23270 Typically retries will be configured more frequently than warning messages.
23271 </para>
23272 <para>
23273 <indexterm role="option">
23274 <primary><option>delay_warning_condition</option></primary>
23275 </indexterm>
23276 </para>
23277 <informaltable frame="all">
23278 <tgroup cols="4" colsep="0" rowsep="0">
23279 <colspec colwidth="8*" align="left"/>
23280 <colspec colwidth="6*" align="center"/>
23281 <colspec colwidth="6*" align="center"/>
23282 <colspec colwidth="6*" align="right"/>
23283 <tbody>
23284 <row>
23285 <entry><option>delay_warning_condition</option></entry>
23286 <entry>Use: <emphasis>main</emphasis></entry>
23287 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23288 <entry>Default: <emphasis>see below</emphasis></entry>
23289 </row>
23290 </tbody>
23291 </tgroup>
23292 </informaltable>
23293 <para>
23294 <indexterm role="variable">
23295 <primary><varname>$domain</varname></primary>
23296 </indexterm>
23297 The string is expanded at the time a warning message might be sent. If all the
23298 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
23299 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
23300 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
23301 <quote>false</quote> (the comparison being done caselessly) then the warning message is
23302 not sent. The default is:
23303 </para>
23304 <literallayout class="monospaced">
23305 delay_warning_condition = ${if or {\
23306   { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
23307   { match{$h_precedence:}{(?i)bulk|list|junk} }\
23308   { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
23309   } {no}{yes}}
23310 </literallayout>
23311 <para>
23312 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
23313 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
23314 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
23315 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
23316 </para>
23317 <para>
23318 <indexterm role="option">
23319 <primary><option>deliver_drop_privilege</option></primary>
23320 </indexterm>
23321 </para>
23322 <informaltable frame="all">
23323 <tgroup cols="4" colsep="0" rowsep="0">
23324 <colspec colwidth="8*" align="left"/>
23325 <colspec colwidth="6*" align="center"/>
23326 <colspec colwidth="6*" align="center"/>
23327 <colspec colwidth="6*" align="right"/>
23328 <tbody>
23329 <row>
23330 <entry><option>deliver_drop_privilege</option></entry>
23331 <entry>Use: <emphasis>main</emphasis></entry>
23332 <entry>Type: <emphasis>boolean</emphasis></entry>
23333 <entry>Default: <emphasis>false</emphasis></entry>
23334 </row>
23335 </tbody>
23336 </tgroup>
23337 </informaltable>
23338 <para>
23339 <indexterm role="concept">
23340 <primary>unprivileged delivery</primary>
23341 </indexterm>
23342 <indexterm role="concept">
23343 <primary>delivery</primary>
23344 <secondary>unprivileged</secondary>
23345 </indexterm>
23346 If this option is set true, Exim drops its root privilege at the start of a
23347 delivery process, and runs as the Exim user throughout. This severely restricts
23348 the kinds of local delivery that are possible, but is viable in certain types
23349 of configuration. There is a discussion about the use of root privilege in
23350 chapter <xref linkend="CHAPsecurity"/>.
23351 </para>
23352 <para>
23353 <indexterm role="option">
23354 <primary><option>deliver_queue_load_max</option></primary>
23355 </indexterm>
23356 </para>
23357 <informaltable frame="all">
23358 <tgroup cols="4" colsep="0" rowsep="0">
23359 <colspec colwidth="8*" align="left"/>
23360 <colspec colwidth="6*" align="center"/>
23361 <colspec colwidth="6*" align="center"/>
23362 <colspec colwidth="6*" align="right"/>
23363 <tbody>
23364 <row>
23365 <entry><option>deliver_queue_load_max</option></entry>
23366 <entry>Use: <emphasis>main</emphasis></entry>
23367 <entry>Type: <emphasis>fixed-point</emphasis></entry>
23368 <entry>Default: <emphasis>unset</emphasis></entry>
23369 </row>
23370 </tbody>
23371 </tgroup>
23372 </informaltable>
23373 <para>
23374 <indexterm role="concept">
23375 <primary>load average</primary>
23376 </indexterm>
23377 <indexterm role="concept">
23378 <primary>queue runner</primary>
23379 <secondary>abandoning</secondary>
23380 </indexterm>
23381 When this option is set, a queue run is abandoned if the system load average
23382 becomes greater than the value of the option. The option has no effect on
23383 ancient operating systems on which Exim cannot determine the load average.
23384 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
23385 </para>
23386 <para>
23387 <indexterm role="option">
23388 <primary><option>delivery_date_remove</option></primary>
23389 </indexterm>
23390 </para>
23391 <informaltable frame="all">
23392 <tgroup cols="4" colsep="0" rowsep="0">
23393 <colspec colwidth="8*" align="left"/>
23394 <colspec colwidth="6*" align="center"/>
23395 <colspec colwidth="6*" align="center"/>
23396 <colspec colwidth="6*" align="right"/>
23397 <tbody>
23398 <row>
23399 <entry><option>delivery_date_remove</option></entry>
23400 <entry>Use: <emphasis>main</emphasis></entry>
23401 <entry>Type: <emphasis>boolean</emphasis></entry>
23402 <entry>Default: <emphasis>true</emphasis></entry>
23403 </row>
23404 </tbody>
23405 </tgroup>
23406 </informaltable>
23407 <para>
23408 <indexterm role="concept">
23409 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
23410 </indexterm>
23411 Exim&#x2019;s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
23412 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
23413 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
23414 should not be present in incoming messages, and this option causes them to be
23415 removed at the time the message is received, to avoid any problems that might
23416 occur when a delivered message is subsequently sent on to some other recipient.
23417 </para>
23418 <para>
23419 <indexterm role="option">
23420 <primary><option>disable_fsync</option></primary>
23421 </indexterm>
23422 </para>
23423 <informaltable frame="all">
23424 <tgroup cols="4" colsep="0" rowsep="0">
23425 <colspec colwidth="8*" align="left"/>
23426 <colspec colwidth="6*" align="center"/>
23427 <colspec colwidth="6*" align="center"/>
23428 <colspec colwidth="6*" align="right"/>
23429 <tbody>
23430 <row>
23431 <entry><option>disable_fsync</option></entry>
23432 <entry>Use: <emphasis>main</emphasis></entry>
23433 <entry>Type: <emphasis>boolean</emphasis></entry>
23434 <entry>Default: <emphasis>false</emphasis></entry>
23435 </row>
23436 </tbody>
23437 </tgroup>
23438 </informaltable>
23439 <para>
23440 <indexterm role="concept">
23441 <primary><function>fsync()</function>, disabling</primary>
23442 </indexterm>
23443 This option is available only if Exim was built with the compile-time option
23444 ENABLE_DISABLE_FSYNC. When this is not set, a reference to <option>disable_fsync</option> in
23445 a runtime configuration generates an <quote>unknown option</quote> error. You should not
23446 build Exim with ENABLE_DISABLE_FSYNC or set <option>disable_fsync</option> unless you
23447 really, really, really understand what you are doing. <emphasis>No pre-compiled
23448 distributions of Exim should ever make this option available.</emphasis>
23449 </para>
23450 <para>
23451 When <option>disable_fsync</option> is set true, Exim no longer calls <function>fsync()</function> to force
23452 updated files&#x2019; data to be written to disc before continuing. Unexpected events
23453 such as crashes and power outages may cause data to be lost or scrambled.
23454 Here be Dragons. <emphasis role="bold">Beware.</emphasis>
23455 </para>
23456 <para>
23457 <indexterm role="option">
23458 <primary><option>disable_ipv6</option></primary>
23459 </indexterm>
23460 </para>
23461 <informaltable frame="all">
23462 <tgroup cols="4" colsep="0" rowsep="0">
23463 <colspec colwidth="8*" align="left"/>
23464 <colspec colwidth="6*" align="center"/>
23465 <colspec colwidth="6*" align="center"/>
23466 <colspec colwidth="6*" align="right"/>
23467 <tbody>
23468 <row>
23469 <entry><option>disable_ipv6</option></entry>
23470 <entry>Use: <emphasis>main</emphasis></entry>
23471 <entry>Type: <emphasis>boolean</emphasis></entry>
23472 <entry>Default: <emphasis>false</emphasis></entry>
23473 </row>
23474 </tbody>
23475 </tgroup>
23476 </informaltable>
23477 <para>
23478 <indexterm role="concept">
23479 <primary>IPv6</primary>
23480 <secondary>disabling</secondary>
23481 </indexterm>
23482 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
23483 activities take place. AAAA records are never looked up, and any IPv6 addresses
23484 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
23485 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
23486 to handle IPv6 literal addresses.
23487 </para>
23488 <para>
23489 <indexterm role="option">
23490 <primary><option>dns_again_means_nonexist</option></primary>
23491 </indexterm>
23492 </para>
23493 <informaltable frame="all">
23494 <tgroup cols="4" colsep="0" rowsep="0">
23495 <colspec colwidth="8*" align="left"/>
23496 <colspec colwidth="6*" align="center"/>
23497 <colspec colwidth="6*" align="center"/>
23498 <colspec colwidth="6*" align="right"/>
23499 <tbody>
23500 <row>
23501 <entry><option>dns_again_means_nonexist</option></entry>
23502 <entry>Use: <emphasis>main</emphasis></entry>
23503 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23504 <entry>Default: <emphasis>unset</emphasis></entry>
23505 </row>
23506 </tbody>
23507 </tgroup>
23508 </informaltable>
23509 <para>
23510 <indexterm role="concept">
23511 <primary>DNS</primary>
23512 <secondary><quote>try again</quote> response; overriding</secondary>
23513 </indexterm>
23514 DNS lookups give a <quote>try again</quote> response for the DNS errors
23515 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
23516 keep trying to deliver a message, or to give repeated temporary errors to
23517 incoming mail. Sometimes the effect is caused by a badly set up name server and
23518 may persist for a long time. If a domain which exhibits this problem matches
23519 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
23520 This option should be used with care. You can make it apply to reverse lookups
23521 by a setting such as this:
23522 </para>
23523 <literallayout class="monospaced">
23524 dns_again_means_nonexist = *.in-addr.arpa
23525 </literallayout>
23526 <para>
23527 This option applies to all DNS lookups that Exim does. It also applies when the
23528 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
23529 since these are most likely to be caused by DNS lookup problems. The
23530 <command>dnslookup</command> router has some options of its own for controlling what happens
23531 when lookups for MX or SRV records give temporary errors. These more specific
23532 options are applied after this global option.
23533 </para>
23534 <para>
23535 <indexterm role="option">
23536 <primary><option>dns_check_names_pattern</option></primary>
23537 </indexterm>
23538 </para>
23539 <informaltable frame="all">
23540 <tgroup cols="4" colsep="0" rowsep="0">
23541 <colspec colwidth="8*" align="left"/>
23542 <colspec colwidth="6*" align="center"/>
23543 <colspec colwidth="6*" align="center"/>
23544 <colspec colwidth="6*" align="right"/>
23545 <tbody>
23546 <row>
23547 <entry><option>dns_check_names_pattern</option></entry>
23548 <entry>Use: <emphasis>main</emphasis></entry>
23549 <entry>Type: <emphasis>string</emphasis></entry>
23550 <entry>Default: <emphasis>see below</emphasis></entry>
23551 </row>
23552 </tbody>
23553 </tgroup>
23554 </informaltable>
23555 <para>
23556 <indexterm role="concept">
23557 <primary>DNS</primary>
23558 <secondary>pre-check of name syntax</secondary>
23559 </indexterm>
23560 When this option is set to a non-empty string, it causes Exim to check domain
23561 names for characters that are not allowed in host names before handing them to
23562 the DNS resolver, because some resolvers give temporary errors for names that
23563 contain unusual characters. If a domain name contains any unwanted characters,
23564 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
23565 done by matching the domain name against a regular expression, which is the
23566 value of this option. The default pattern is
23567 </para>
23568 <literallayout class="monospaced">
23569 dns_check_names_pattern = \
23570   (?i)^(?&gt;(?(1)\.|())[^\W_](?&gt;[a-z0-9/-]*[^\W_])?)+$
23571 </literallayout>
23572 <para>
23573 which permits only letters, digits, slashes, and hyphens in components, but
23574 they must start and end with a letter or digit. Slashes are not, in fact,
23575 permitted in host names, but they are found in certain NS records (which can be
23576 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
23577 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
23578 empty string.
23579 </para>
23580 <para>
23581 <indexterm role="option">
23582 <primary><option>dns_csa_search_limit</option></primary>
23583 </indexterm>
23584 </para>
23585 <informaltable frame="all">
23586 <tgroup cols="4" colsep="0" rowsep="0">
23587 <colspec colwidth="8*" align="left"/>
23588 <colspec colwidth="6*" align="center"/>
23589 <colspec colwidth="6*" align="center"/>
23590 <colspec colwidth="6*" align="right"/>
23591 <tbody>
23592 <row>
23593 <entry><option>dns_csa_search_limit</option></entry>
23594 <entry>Use: <emphasis>main</emphasis></entry>
23595 <entry>Type: <emphasis>integer</emphasis></entry>
23596 <entry>Default: <emphasis>5</emphasis></entry>
23597 </row>
23598 </tbody>
23599 </tgroup>
23600 </informaltable>
23601 <para>
23602 This option controls the depth of parental searching for CSA SRV records in the
23603 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
23604 </para>
23605 <para>
23606 <indexterm role="option">
23607 <primary><option>dns_csa_use_reverse</option></primary>
23608 </indexterm>
23609 </para>
23610 <informaltable frame="all">
23611 <tgroup cols="4" colsep="0" rowsep="0">
23612 <colspec colwidth="8*" align="left"/>
23613 <colspec colwidth="6*" align="center"/>
23614 <colspec colwidth="6*" align="center"/>
23615 <colspec colwidth="6*" align="right"/>
23616 <tbody>
23617 <row>
23618 <entry><option>dns_csa_use_reverse</option></entry>
23619 <entry>Use: <emphasis>main</emphasis></entry>
23620 <entry>Type: <emphasis>boolean</emphasis></entry>
23621 <entry>Default: <emphasis>true</emphasis></entry>
23622 </row>
23623 </tbody>
23624 </tgroup>
23625 </informaltable>
23626 <para>
23627 This option controls whether or not an IP address, given as a CSA domain, is
23628 reversed and looked up in the reverse DNS, as described in more detail in
23629 section <xref linkend="SECTverifyCSA"/>.
23630 </para>
23631 <para>
23632 <indexterm role="option">
23633 <primary><option>dns_dnssec_ok</option></primary>
23634 </indexterm>
23635 </para>
23636 <informaltable frame="all">
23637 <tgroup cols="4" colsep="0" rowsep="0">
23638 <colspec colwidth="8*" align="left"/>
23639 <colspec colwidth="6*" align="center"/>
23640 <colspec colwidth="6*" align="center"/>
23641 <colspec colwidth="6*" align="right"/>
23642 <tbody>
23643 <row>
23644 <entry><option>dns_dnssec_ok</option></entry>
23645 <entry>Use: <emphasis>main</emphasis></entry>
23646 <entry>Type: <emphasis>integer</emphasis></entry>
23647 <entry>Default: <emphasis>-1</emphasis></entry>
23648 </row>
23649 </tbody>
23650 </tgroup>
23651 </informaltable>
23652 <para>
23653 <indexterm role="concept">
23654 <primary>DNS</primary>
23655 <secondary>resolver options</secondary>
23656 </indexterm>
23657 <indexterm role="concept">
23658 <primary>DNS</primary>
23659 <secondary>DNSSEC</secondary>
23660 </indexterm>
23661 If this option is set to a non-negative number then Exim will initialise the
23662 DNS resolver library to either use or not use DNSSEC, overriding the system
23663 default. A value of 0 coerces DNSSEC off, a value of 1 coerces DNSSEC on.
23664 </para>
23665 <para>
23666 If the resolver library does not support DNSSEC then this option has no effect.
23667 </para>
23668 <para>
23669 <indexterm role="option">
23670 <primary><option>dns_ipv4_lookup</option></primary>
23671 </indexterm>
23672 </para>
23673 <informaltable frame="all">
23674 <tgroup cols="4" colsep="0" rowsep="0">
23675 <colspec colwidth="8*" align="left"/>
23676 <colspec colwidth="6*" align="center"/>
23677 <colspec colwidth="6*" align="center"/>
23678 <colspec colwidth="6*" align="right"/>
23679 <tbody>
23680 <row>
23681 <entry><option>dns_ipv4_lookup</option></entry>
23682 <entry>Use: <emphasis>main</emphasis></entry>
23683 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23684 <entry>Default: <emphasis>unset</emphasis></entry>
23685 </row>
23686 </tbody>
23687 </tgroup>
23688 </informaltable>
23689 <para>
23690 <indexterm role="concept">
23691 <primary>IPv6</primary>
23692 <secondary>DNS lookup for AAAA records</secondary>
23693 </indexterm>
23694 <indexterm role="concept">
23695 <primary>DNS</primary>
23696 <secondary>IPv6 lookup for AAAA records</secondary>
23697 </indexterm>
23698 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
23699 looks for IPv6 address records (AAAA records) as well as IPv4 address records
23700 (A records) when trying to find IP addresses for hosts, unless the host&#x2019;s
23701 domain matches this list.
23702 </para>
23703 <para>
23704 This is a fudge to help with name servers that give big delays or otherwise do
23705 not work for the AAAA record type. In due course, when the world&#x2019;s name
23706 servers have all been upgraded, there should be no need for this option.
23707 </para>
23708 <para>
23709 <indexterm role="option">
23710 <primary><option>dns_retrans</option></primary>
23711 </indexterm>
23712 </para>
23713 <informaltable frame="all">
23714 <tgroup cols="4" colsep="0" rowsep="0">
23715 <colspec colwidth="8*" align="left"/>
23716 <colspec colwidth="6*" align="center"/>
23717 <colspec colwidth="6*" align="center"/>
23718 <colspec colwidth="6*" align="right"/>
23719 <tbody>
23720 <row>
23721 <entry><option>dns_retrans</option></entry>
23722 <entry>Use: <emphasis>main</emphasis></entry>
23723 <entry>Type: <emphasis>time</emphasis></entry>
23724 <entry>Default: <emphasis>0s</emphasis></entry>
23725 </row>
23726 </tbody>
23727 </tgroup>
23728 </informaltable>
23729 <para>
23730 <indexterm role="concept">
23731 <primary>DNS</primary>
23732 <secondary>resolver options</secondary>
23733 </indexterm>
23734 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
23735 retransmission and retry parameters for DNS lookups. Values of zero (the
23736 defaults) leave the system default settings unchanged. The first value is the
23737 time between retries, and the second is the number of retries. It isn&#x2019;t
23738 totally clear exactly how these settings affect the total time a DNS lookup may
23739 take. I haven&#x2019;t found any documentation about timeouts on DNS lookups; these
23740 parameter values are available in the external resolver interface structure,
23741 but nowhere does it seem to describe how they are used or what you might want
23742 to set in them.
23743 </para>
23744 <para>
23745 <indexterm role="option">
23746 <primary><option>dns_retry</option></primary>
23747 </indexterm>
23748 </para>
23749 <informaltable frame="all">
23750 <tgroup cols="4" colsep="0" rowsep="0">
23751 <colspec colwidth="8*" align="left"/>
23752 <colspec colwidth="6*" align="center"/>
23753 <colspec colwidth="6*" align="center"/>
23754 <colspec colwidth="6*" align="right"/>
23755 <tbody>
23756 <row>
23757 <entry><option>dns_retry</option></entry>
23758 <entry>Use: <emphasis>main</emphasis></entry>
23759 <entry>Type: <emphasis>integer</emphasis></entry>
23760 <entry>Default: <emphasis>0</emphasis></entry>
23761 </row>
23762 </tbody>
23763 </tgroup>
23764 </informaltable>
23765 <para>
23766 See <option>dns_retrans</option> above.
23767 </para>
23768 <para>
23769 <indexterm role="option">
23770 <primary><option>dns_use_edns0</option></primary>
23771 </indexterm>
23772 </para>
23773 <informaltable frame="all">
23774 <tgroup cols="4" colsep="0" rowsep="0">
23775 <colspec colwidth="8*" align="left"/>
23776 <colspec colwidth="6*" align="center"/>
23777 <colspec colwidth="6*" align="center"/>
23778 <colspec colwidth="6*" align="right"/>
23779 <tbody>
23780 <row>
23781 <entry><option>dns_use_edns0</option></entry>
23782 <entry>Use: <emphasis>main</emphasis></entry>
23783 <entry>Type: <emphasis>integer</emphasis></entry>
23784 <entry>Default: <emphasis>-1</emphasis></entry>
23785 </row>
23786 </tbody>
23787 </tgroup>
23788 </informaltable>
23789 <para>
23790 <indexterm role="concept">
23791 <primary>DNS</primary>
23792 <secondary>resolver options</secondary>
23793 </indexterm>
23794 <indexterm role="concept">
23795 <primary>DNS</primary>
23796 <secondary>EDNS0</secondary>
23797 </indexterm>
23798 If this option is set to a non-negative number then Exim will initialise the
23799 DNS resolver library to either use or not use EDNS0 extensions, overriding
23800 the system default. A value of 0 coerces EDNS0 off, a value of 1 coerces EDNS0
23801 on.
23802 </para>
23803 <para>
23804 If the resolver library does not support EDNS0 then this option has no effect.
23805 </para>
23806 <para>
23807 <indexterm role="option">
23808 <primary><option>drop_cr</option></primary>
23809 </indexterm>
23810 </para>
23811 <informaltable frame="all">
23812 <tgroup cols="4" colsep="0" rowsep="0">
23813 <colspec colwidth="8*" align="left"/>
23814 <colspec colwidth="6*" align="center"/>
23815 <colspec colwidth="6*" align="center"/>
23816 <colspec colwidth="6*" align="right"/>
23817 <tbody>
23818 <row>
23819 <entry><option>drop_cr</option></entry>
23820 <entry>Use: <emphasis>main</emphasis></entry>
23821 <entry>Type: <emphasis>boolean</emphasis></entry>
23822 <entry>Default: <emphasis>false</emphasis></entry>
23823 </row>
23824 </tbody>
23825 </tgroup>
23826 </informaltable>
23827 <para>
23828 This is an obsolete option that is now a no-op. It used to affect the way Exim
23829 handled CR and LF characters in incoming messages. What happens now is
23830 described in section <xref linkend="SECTlineendings"/>.
23831 </para>
23832 <para>
23833 <indexterm role="option">
23834 <primary><option>dsn_from</option></primary>
23835 </indexterm>
23836 </para>
23837 <informaltable frame="all">
23838 <tgroup cols="4" colsep="0" rowsep="0">
23839 <colspec colwidth="8*" align="left"/>
23840 <colspec colwidth="6*" align="center"/>
23841 <colspec colwidth="6*" align="center"/>
23842 <colspec colwidth="6*" align="right"/>
23843 <tbody>
23844 <row>
23845 <entry><option>dsn_from</option></entry>
23846 <entry>Use: <emphasis>main</emphasis></entry>
23847 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23848 <entry>Default: <emphasis>see below</emphasis></entry>
23849 </row>
23850 </tbody>
23851 </tgroup>
23852 </informaltable>
23853 <para>
23854 <indexterm role="concept">
23855 <primary><emphasis>From:</emphasis> header line</primary>
23856 <secondary>in bounces</secondary>
23857 </indexterm>
23858 <indexterm role="concept">
23859 <primary>bounce messages</primary>
23860 <secondary><emphasis>From:</emphasis> line, specifying</secondary>
23861 </indexterm>
23862 This option can be used to vary the contents of <emphasis>From:</emphasis> header lines in
23863 bounces and other automatically generated messages (<quote>Delivery Status
23864 Notifications</quote> &ndash; hence the name of the option). The default setting is:
23865 </para>
23866 <literallayout class="monospaced">
23867 dsn_from = Mail Delivery System &lt;Mailer-Daemon@$qualify_domain&gt;
23868 </literallayout>
23869 <para>
23870 The value is expanded every time it is needed. If the expansion fails, a
23871 panic is logged, and the default value is used.
23872 </para>
23873 <para>
23874 <indexterm role="option">
23875 <primary><option>envelope_to_remove</option></primary>
23876 </indexterm>
23877 </para>
23878 <informaltable frame="all">
23879 <tgroup cols="4" colsep="0" rowsep="0">
23880 <colspec colwidth="8*" align="left"/>
23881 <colspec colwidth="6*" align="center"/>
23882 <colspec colwidth="6*" align="center"/>
23883 <colspec colwidth="6*" align="right"/>
23884 <tbody>
23885 <row>
23886 <entry><option>envelope_to_remove</option></entry>
23887 <entry>Use: <emphasis>main</emphasis></entry>
23888 <entry>Type: <emphasis>boolean</emphasis></entry>
23889 <entry>Default: <emphasis>true</emphasis></entry>
23890 </row>
23891 </tbody>
23892 </tgroup>
23893 </informaltable>
23894 <para>
23895 <indexterm role="concept">
23896 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
23897 </indexterm>
23898 Exim&#x2019;s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
23899 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
23900 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
23901 messages&#x2019;s envelope that caused the delivery to happen. Such headers should not
23902 be present in incoming messages, and this option causes them to be removed at
23903 the time the message is received, to avoid any problems that might occur when a
23904 delivered message is subsequently sent on to some other recipient.
23905 </para>
23906 <para>
23907 <indexterm role="option">
23908 <primary><option>errors_copy</option></primary>
23909 </indexterm>
23910 </para>
23911 <informaltable frame="all">
23912 <tgroup cols="4" colsep="0" rowsep="0">
23913 <colspec colwidth="8*" align="left"/>
23914 <colspec colwidth="6*" align="center"/>
23915 <colspec colwidth="6*" align="center"/>
23916 <colspec colwidth="6*" align="right"/>
23917 <tbody>
23918 <row>
23919 <entry><option>errors_copy</option></entry>
23920 <entry>Use: <emphasis>main</emphasis></entry>
23921 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
23922 <entry>Default: <emphasis>unset</emphasis></entry>
23923 </row>
23924 </tbody>
23925 </tgroup>
23926 </informaltable>
23927 <para>
23928 <indexterm role="concept">
23929 <primary>bounce message</primary>
23930 <secondary>copy to other address</secondary>
23931 </indexterm>
23932 <indexterm role="concept">
23933 <primary>copy of bounce message</primary>
23934 </indexterm>
23935 Setting this option causes Exim to send bcc copies of bounce messages that it
23936 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
23937 coming from elsewhere. The value of the option is a colon-separated list of
23938 items. Each item consists of a pattern, terminated by white space, followed by
23939 a comma-separated list of email addresses. If a pattern contains spaces, it
23940 must be enclosed in double quotes.
23941 </para>
23942 <para>
23943 Each pattern is processed in the same way as a single item in an address list
23944 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
23945 the bounce message, the message is copied to the addresses on the list. The
23946 items are scanned in order, and once a matching one is found, no further items
23947 are examined. For example:
23948 </para>
23949 <literallayout class="monospaced">
23950 errors_copy = spqr@mydomain   postmaster@mydomain.example :\
23951               rqps@mydomain   hostmaster@mydomain.example,\
23952                               postmaster@mydomain.example
23953 </literallayout>
23954 <para>
23955 <indexterm role="variable">
23956 <primary><varname>$domain</varname></primary>
23957 </indexterm>
23958 <indexterm role="variable">
23959 <primary><varname>$local_part</varname></primary>
23960 </indexterm>
23961 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
23962 and <varname>$domain</varname> are set from the original recipient of the error message, and if
23963 there was any wildcard matching in the pattern, the expansion
23964 <indexterm role="concept">
23965 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
23966 <secondary>in <option>errors_copy</option></secondary>
23967 </indexterm>
23968 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
23969 </para>
23970 <para>
23971 <indexterm role="option">
23972 <primary><option>errors_reply_to</option></primary>
23973 </indexterm>
23974 </para>
23975 <informaltable frame="all">
23976 <tgroup cols="4" colsep="0" rowsep="0">
23977 <colspec colwidth="8*" align="left"/>
23978 <colspec colwidth="6*" align="center"/>
23979 <colspec colwidth="6*" align="center"/>
23980 <colspec colwidth="6*" align="right"/>
23981 <tbody>
23982 <row>
23983 <entry><option>errors_reply_to</option></entry>
23984 <entry>Use: <emphasis>main</emphasis></entry>
23985 <entry>Type: <emphasis>string</emphasis></entry>
23986 <entry>Default: <emphasis>unset</emphasis></entry>
23987 </row>
23988 </tbody>
23989 </tgroup>
23990 </informaltable>
23991 <para>
23992 <indexterm role="concept">
23993 <primary>bounce message</primary>
23994 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
23995 </indexterm>
23996 By default, Exim&#x2019;s bounce and delivery warning messages contain the header line
23997 </para>
23998 <literallayout>
23999 <literal>From: Mail Delivery System &lt;Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>&gt;</literal>
24000 </literallayout>
24001 <para>
24002 <indexterm role="option">
24003 <primary><option>quota_warn_message</option></primary>
24004 </indexterm>
24005 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
24006 A warning message that is generated by the <option>quota_warn_message</option> option in an
24007 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
24008 overrides the default.
24009 </para>
24010 <para>
24011 Experience shows that people reply to bounce messages. If the
24012 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
24013 and warning messages. For example:
24014 </para>
24015 <literallayout class="monospaced">
24016 errors_reply_to = postmaster@my.domain.example
24017 </literallayout>
24018 <para>
24019 The value of the option is not expanded. It must specify a valid RFC 2822
24020 address. However, if a warning message that is generated by the
24021 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
24022 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
24023 not used.
24024 </para>
24025 <para>
24026 <indexterm role="option">
24027 <primary><option>exim_group</option></primary>
24028 </indexterm>
24029 </para>
24030 <informaltable frame="all">
24031 <tgroup cols="4" colsep="0" rowsep="0">
24032 <colspec colwidth="8*" align="left"/>
24033 <colspec colwidth="6*" align="center"/>
24034 <colspec colwidth="6*" align="center"/>
24035 <colspec colwidth="6*" align="right"/>
24036 <tbody>
24037 <row>
24038 <entry><option>exim_group</option></entry>
24039 <entry>Use: <emphasis>main</emphasis></entry>
24040 <entry>Type: <emphasis>string</emphasis></entry>
24041 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
24042 </row>
24043 </tbody>
24044 </tgroup>
24045 </informaltable>
24046 <para>
24047 <indexterm role="concept">
24048 <primary>gid (group id)</primary>
24049 <secondary>Exim&#x2019;s own</secondary>
24050 </indexterm>
24051 <indexterm role="concept">
24052 <primary>Exim group</primary>
24053 </indexterm>
24054 This option changes the gid under which Exim runs when it gives up root
24055 privilege. The default value is compiled into the binary. The value of this
24056 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
24057 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
24058 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
24059 security issues.
24060 </para>
24061 <para>
24062 <indexterm role="option">
24063 <primary><option>exim_path</option></primary>
24064 </indexterm>
24065 </para>
24066 <informaltable frame="all">
24067 <tgroup cols="4" colsep="0" rowsep="0">
24068 <colspec colwidth="8*" align="left"/>
24069 <colspec colwidth="6*" align="center"/>
24070 <colspec colwidth="6*" align="center"/>
24071 <colspec colwidth="6*" align="right"/>
24072 <tbody>
24073 <row>
24074 <entry><option>exim_path</option></entry>
24075 <entry>Use: <emphasis>main</emphasis></entry>
24076 <entry>Type: <emphasis>string</emphasis></entry>
24077 <entry>Default: <emphasis>see below</emphasis></entry>
24078 </row>
24079 </tbody>
24080 </tgroup>
24081 </informaltable>
24082 <para>
24083 <indexterm role="concept">
24084 <primary>Exim binary, path name</primary>
24085 </indexterm>
24086 This option specifies the path name of the Exim binary, which is used when Exim
24087 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
24088 the directory configured at compile time by the BIN_DIRECTORY setting. It
24089 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
24090 other place.
24091 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
24092 you will break those Exim utilities that scan the configuration file to find
24093 where the binary is. (They then use the <option>-bP</option> option to extract option
24094 settings such as the value of <option>spool_directory</option>.)
24095 </para>
24096 <para>
24097 <indexterm role="option">
24098 <primary><option>exim_user</option></primary>
24099 </indexterm>
24100 </para>
24101 <informaltable frame="all">
24102 <tgroup cols="4" colsep="0" rowsep="0">
24103 <colspec colwidth="8*" align="left"/>
24104 <colspec colwidth="6*" align="center"/>
24105 <colspec colwidth="6*" align="center"/>
24106 <colspec colwidth="6*" align="right"/>
24107 <tbody>
24108 <row>
24109 <entry><option>exim_user</option></entry>
24110 <entry>Use: <emphasis>main</emphasis></entry>
24111 <entry>Type: <emphasis>string</emphasis></entry>
24112 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
24113 </row>
24114 </tbody>
24115 </tgroup>
24116 </informaltable>
24117 <para>
24118 <indexterm role="concept">
24119 <primary>uid (user id)</primary>
24120 <secondary>Exim&#x2019;s own</secondary>
24121 </indexterm>
24122 <indexterm role="concept">
24123 <primary>Exim user</primary>
24124 </indexterm>
24125 This option changes the uid under which Exim runs when it gives up root
24126 privilege. The default value is compiled into the binary. Ownership of the run
24127 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
24128 options is checked against the values in the binary, not what is set here.
24129 </para>
24130 <para>
24131 Unless it consists entirely of digits, the string is looked up using
24132 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
24133 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
24134 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
24135 </para>
24136 <para>
24137 <indexterm role="option">
24138 <primary><option>extra_local_interfaces</option></primary>
24139 </indexterm>
24140 </para>
24141 <informaltable frame="all">
24142 <tgroup cols="4" colsep="0" rowsep="0">
24143 <colspec colwidth="8*" align="left"/>
24144 <colspec colwidth="6*" align="center"/>
24145 <colspec colwidth="6*" align="center"/>
24146 <colspec colwidth="6*" align="right"/>
24147 <tbody>
24148 <row>
24149 <entry><option>extra_local_interfaces</option></entry>
24150 <entry>Use: <emphasis>main</emphasis></entry>
24151 <entry>Type: <emphasis>string list</emphasis></entry>
24152 <entry>Default: <emphasis>unset</emphasis></entry>
24153 </row>
24154 </tbody>
24155 </tgroup>
24156 </informaltable>
24157 <para>
24158 This option defines network interfaces that are to be considered local when
24159 routing, but which are not used for listening by the daemon. See section
24160 <xref linkend="SECTreclocipadd"/> for details.
24161 </para>
24162 <para>
24163 <indexterm role="option">
24164 <primary><option>extract_addresses_remove_arguments</option></primary>
24165 </indexterm>
24166 </para>
24167 <informaltable frame="all">
24168 <tgroup cols="4" colsep="0" rowsep="0">
24169 <colspec colwidth="8*" align="left"/>
24170 <colspec colwidth="6*" align="center"/>
24171 <colspec colwidth="6*" align="center"/>
24172 <colspec colwidth="6*" align="right"/>
24173 <tbody>
24174 <row>
24175 <entry><option>extract_addresses_remove_ &nbsp;&nbsp;arguments</option></entry>
24176 <entry>Use: <emphasis>main</emphasis></entry>
24177 <entry>Type: <emphasis>boolean</emphasis></entry>
24178 <entry>Default: <emphasis>true</emphasis></entry>
24179 </row>
24180 </tbody>
24181 </tgroup>
24182 </informaltable>
24183 <para>
24184 <indexterm role="option">
24185 <primary><option>-t</option></primary>
24186 </indexterm>
24187 <indexterm role="concept">
24188 <primary>command line</primary>
24189 <secondary>addresses with <option>-t</option></secondary>
24190 </indexterm>
24191 <indexterm role="concept">
24192 <primary>Sendmail compatibility</primary>
24193 <secondary><option>-t</option> option</secondary>
24194 </indexterm>
24195 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
24196 are present on the command line when the <option>-t</option> option is used to build an
24197 envelope from a message&#x2019;s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
24198 line addresses are removed from the recipients list. This is also how Smail
24199 behaves. However, other Sendmail documentation (the O&#x2019;Reilly book) states that
24200 command line addresses are added to those obtained from the header lines. When
24201 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
24202 argument headers. If it is set false, Exim adds rather than removes argument
24203 addresses.
24204 </para>
24205 <para>
24206 <indexterm role="option">
24207 <primary><option>finduser_retries</option></primary>
24208 </indexterm>
24209 </para>
24210 <informaltable frame="all">
24211 <tgroup cols="4" colsep="0" rowsep="0">
24212 <colspec colwidth="8*" align="left"/>
24213 <colspec colwidth="6*" align="center"/>
24214 <colspec colwidth="6*" align="center"/>
24215 <colspec colwidth="6*" align="right"/>
24216 <tbody>
24217 <row>
24218 <entry><option>finduser_retries</option></entry>
24219 <entry>Use: <emphasis>main</emphasis></entry>
24220 <entry>Type: <emphasis>integer</emphasis></entry>
24221 <entry>Default: <emphasis>0</emphasis></entry>
24222 </row>
24223 </tbody>
24224 </tgroup>
24225 </informaltable>
24226 <para>
24227 <indexterm role="concept">
24228 <primary>NIS, retrying user lookups</primary>
24229 </indexterm>
24230 On systems running NIS or other schemes in which user and group information is
24231 distributed from a remote system, there can be times when <function>getpwnam()</function> and
24232 related functions fail, even when given valid data, because things time out.
24233 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
24234 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
24235 many extra times to find a user or a group, waiting for one second between
24236 retries.
24237 </para>
24238 <para>
24239 <indexterm role="concept">
24240 <primary><filename>/etc/passwd</filename></primary>
24241 <secondary>multiple reading of</secondary>
24242 </indexterm>
24243 You should not set this option greater than zero if your user information is in
24244 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
24245 search the file multiple times for non-existent users, and also cause delay.
24246 </para>
24247 <para>
24248 <indexterm role="option">
24249 <primary><option>freeze_tell</option></primary>
24250 </indexterm>
24251 </para>
24252 <informaltable frame="all">
24253 <tgroup cols="4" colsep="0" rowsep="0">
24254 <colspec colwidth="8*" align="left"/>
24255 <colspec colwidth="6*" align="center"/>
24256 <colspec colwidth="6*" align="center"/>
24257 <colspec colwidth="6*" align="right"/>
24258 <tbody>
24259 <row>
24260 <entry><option>freeze_tell</option></entry>
24261 <entry>Use: <emphasis>main</emphasis></entry>
24262 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
24263 <entry>Default: <emphasis>unset</emphasis></entry>
24264 </row>
24265 </tbody>
24266 </tgroup>
24267 </informaltable>
24268 <para>
24269 <indexterm role="concept">
24270 <primary>freezing messages</primary>
24271 <secondary>sending a message when freezing</secondary>
24272 </indexterm>
24273 On encountering certain errors, or when configured to do so in a system filter,
24274 ACL, or special router, Exim freezes a message. This means that no further
24275 delivery attempts take place until an administrator thaws the message, or the
24276 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
24277 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
24278 warning message whenever it freezes something, unless the message it is
24279 freezing is a locally-generated bounce message. (Without this exception there
24280 is the possibility of looping.) The warning message is sent to the addresses
24281 supplied as the comma-separated value of this option. If several of the
24282 message&#x2019;s addresses cause freezing, only a single message is sent. If the
24283 freezing was automatic, the reason(s) for freezing can be found in the message
24284 log. If you configure freezing in a filter or ACL, you must arrange for any
24285 logging that you require.
24286 </para>
24287 <para>
24288 <indexterm role="option">
24289 <primary><option>gecos_name</option></primary>
24290 </indexterm>
24291 </para>
24292 <informaltable frame="all">
24293 <tgroup cols="4" colsep="0" rowsep="0">
24294 <colspec colwidth="8*" align="left"/>
24295 <colspec colwidth="6*" align="center"/>
24296 <colspec colwidth="6*" align="center"/>
24297 <colspec colwidth="6*" align="right"/>
24298 <tbody>
24299 <row>
24300 <entry><option>gecos_name</option></entry>
24301 <entry>Use: <emphasis>main</emphasis></entry>
24302 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24303 <entry>Default: <emphasis>unset</emphasis></entry>
24304 </row>
24305 </tbody>
24306 </tgroup>
24307 </informaltable>
24308 <para>
24309 <indexterm role="concept">
24310 <primary>HP-UX</primary>
24311 </indexterm>
24312 <indexterm role="concept">
24313 <primary><quote>gecos</quote> field, parsing</primary>
24314 </indexterm>
24315 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
24316 password file to hold other information in addition to users&#x2019; real names. Exim
24317 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
24318 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
24319 of the field are used unchanged, except that, if an ampersand is encountered,
24320 it is replaced by the user&#x2019;s login name with the first character forced to
24321 upper case, since this is a convention that is observed on many systems.
24322 </para>
24323 <para>
24324 When these options are set, <option>gecos_pattern</option> is treated as a regular
24325 expression that is to be applied to the field (again with &amp; replaced by the
24326 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
24327 user&#x2019;s name.
24328 </para>
24329 <para>
24330 <indexterm role="concept">
24331 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
24332 <secondary>in <option>gecos_name</option></secondary>
24333 </indexterm>
24334 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
24335 pick up sub-fields that were matched by the pattern. In HP-UX, where the user&#x2019;s
24336 name terminates at the first comma, the following can be used:
24337 </para>
24338 <literallayout class="monospaced">
24339 gecos_pattern = ([^,]*)
24340 gecos_name = $1
24341 </literallayout>
24342 <para>
24343 <indexterm role="option">
24344 <primary><option>gecos_pattern</option></primary>
24345 </indexterm>
24346 </para>
24347 <informaltable frame="all">
24348 <tgroup cols="4" colsep="0" rowsep="0">
24349 <colspec colwidth="8*" align="left"/>
24350 <colspec colwidth="6*" align="center"/>
24351 <colspec colwidth="6*" align="center"/>
24352 <colspec colwidth="6*" align="right"/>
24353 <tbody>
24354 <row>
24355 <entry><option>gecos_pattern</option></entry>
24356 <entry>Use: <emphasis>main</emphasis></entry>
24357 <entry>Type: <emphasis>string</emphasis></entry>
24358 <entry>Default: <emphasis>unset</emphasis></entry>
24359 </row>
24360 </tbody>
24361 </tgroup>
24362 </informaltable>
24363 <para>
24364 See <option>gecos_name</option> above.
24365 </para>
24366 <para>
24367 <indexterm role="option">
24368 <primary><option>gnutls_compat_mode</option></primary>
24369 </indexterm>
24370 </para>
24371 <informaltable frame="all">
24372 <tgroup cols="4" colsep="0" rowsep="0">
24373 <colspec colwidth="8*" align="left"/>
24374 <colspec colwidth="6*" align="center"/>
24375 <colspec colwidth="6*" align="center"/>
24376 <colspec colwidth="6*" align="right"/>
24377 <tbody>
24378 <row>
24379 <entry><option>gnutls_compat_mode</option></entry>
24380 <entry>Use: <emphasis>main</emphasis></entry>
24381 <entry>Type: <emphasis>boolean</emphasis></entry>
24382 <entry>Default: <emphasis>unset</emphasis></entry>
24383 </row>
24384 </tbody>
24385 </tgroup>
24386 </informaltable>
24387 <para>
24388 This option controls whether GnuTLS is used in compatibility mode in an Exim
24389 server. This reduces security slightly, but improves interworking with older
24390 implementations of TLS.
24391 </para>
24392 <para>
24393 option gnutls_allow_auto_pkcs11 main boolean unset
24394 This option will let GnuTLS (2.12.0 or later) autoload PKCS11 modules with
24395 the p11-kit configuration files in <filename>/etc/pkcs11/modules/</filename>.
24396 </para>
24397 <para>
24398 See
24399 <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>
24400 for documentation.
24401 </para>
24402 <para>
24403 <indexterm role="option">
24404 <primary><option>headers_charset</option></primary>
24405 </indexterm>
24406 </para>
24407 <informaltable frame="all">
24408 <tgroup cols="4" colsep="0" rowsep="0">
24409 <colspec colwidth="8*" align="left"/>
24410 <colspec colwidth="6*" align="center"/>
24411 <colspec colwidth="6*" align="center"/>
24412 <colspec colwidth="6*" align="right"/>
24413 <tbody>
24414 <row>
24415 <entry><option>headers_charset</option></entry>
24416 <entry>Use: <emphasis>main</emphasis></entry>
24417 <entry>Type: <emphasis>string</emphasis></entry>
24418 <entry>Default: <emphasis>see below</emphasis></entry>
24419 </row>
24420 </tbody>
24421 </tgroup>
24422 </informaltable>
24423 <para>
24424 This option sets a default character set for translating from encoded MIME
24425 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
24426 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
24427 ultimate default is ISO-8859-1. For more details see the description of header
24428 insertions in section <xref linkend="SECTexpansionitems"/>.
24429 </para>
24430 <para>
24431 <indexterm role="option">
24432 <primary><option>header_maxsize</option></primary>
24433 </indexterm>
24434 </para>
24435 <informaltable frame="all">
24436 <tgroup cols="4" colsep="0" rowsep="0">
24437 <colspec colwidth="8*" align="left"/>
24438 <colspec colwidth="6*" align="center"/>
24439 <colspec colwidth="6*" align="center"/>
24440 <colspec colwidth="6*" align="right"/>
24441 <tbody>
24442 <row>
24443 <entry><option>header_maxsize</option></entry>
24444 <entry>Use: <emphasis>main</emphasis></entry>
24445 <entry>Type: <emphasis>integer</emphasis></entry>
24446 <entry>Default: <emphasis>see below</emphasis></entry>
24447 </row>
24448 </tbody>
24449 </tgroup>
24450 </informaltable>
24451 <para>
24452 <indexterm role="concept">
24453 <primary>header section</primary>
24454 <secondary>maximum size of</secondary>
24455 </indexterm>
24456 <indexterm role="concept">
24457 <primary>limit</primary>
24458 <secondary>size of message header section</secondary>
24459 </indexterm>
24460 This option controls the overall maximum size of a message&#x2019;s header
24461 section. The default is the value of HEADER_MAXSIZE in
24462 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
24463 sections are rejected.
24464 </para>
24465 <para>
24466 <indexterm role="option">
24467 <primary><option>header_line_maxsize</option></primary>
24468 </indexterm>
24469 </para>
24470 <informaltable frame="all">
24471 <tgroup cols="4" colsep="0" rowsep="0">
24472 <colspec colwidth="8*" align="left"/>
24473 <colspec colwidth="6*" align="center"/>
24474 <colspec colwidth="6*" align="center"/>
24475 <colspec colwidth="6*" align="right"/>
24476 <tbody>
24477 <row>
24478 <entry><option>header_line_maxsize</option></entry>
24479 <entry>Use: <emphasis>main</emphasis></entry>
24480 <entry>Type: <emphasis>integer</emphasis></entry>
24481 <entry>Default: <emphasis>0</emphasis></entry>
24482 </row>
24483 </tbody>
24484 </tgroup>
24485 </informaltable>
24486 <para>
24487 <indexterm role="concept">
24488 <primary>header lines</primary>
24489 <secondary>maximum size of</secondary>
24490 </indexterm>
24491 <indexterm role="concept">
24492 <primary>limit</primary>
24493 <secondary>size of one header line</secondary>
24494 </indexterm>
24495 This option limits the length of any individual header line in a message, after
24496 all the continuations have been joined together. Messages with individual
24497 header lines that are longer than the limit are rejected. The default value of
24498 zero means <quote>no limit</quote>.
24499 </para>
24500 <para>
24501 <indexterm role="option">
24502 <primary><option>helo_accept_junk_hosts</option></primary>
24503 </indexterm>
24504 </para>
24505 <informaltable frame="all">
24506 <tgroup cols="4" colsep="0" rowsep="0">
24507 <colspec colwidth="8*" align="left"/>
24508 <colspec colwidth="6*" align="center"/>
24509 <colspec colwidth="6*" align="center"/>
24510 <colspec colwidth="6*" align="right"/>
24511 <tbody>
24512 <row>
24513 <entry><option>helo_accept_junk_hosts</option></entry>
24514 <entry>Use: <emphasis>main</emphasis></entry>
24515 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24516 <entry>Default: <emphasis>unset</emphasis></entry>
24517 </row>
24518 </tbody>
24519 </tgroup>
24520 </informaltable>
24521 <para>
24522 <indexterm role="concept">
24523 <primary>HELO</primary>
24524 <secondary>accepting junk data</secondary>
24525 </indexterm>
24526 <indexterm role="concept">
24527 <primary>EHLO</primary>
24528 <secondary>accepting junk data</secondary>
24529 </indexterm>
24530 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
24531 mail, and gives an error response for invalid data. Unfortunately, there are
24532 some SMTP clients that send syntactic junk. They can be accommodated by setting
24533 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
24534 if you want to do semantic checking.
24535 See also <option>helo_allow_chars</option> for a way of extending the permitted character
24536 set.
24537 </para>
24538 <para>
24539 <indexterm role="option">
24540 <primary><option>helo_allow_chars</option></primary>
24541 </indexterm>
24542 </para>
24543 <informaltable frame="all">
24544 <tgroup cols="4" colsep="0" rowsep="0">
24545 <colspec colwidth="8*" align="left"/>
24546 <colspec colwidth="6*" align="center"/>
24547 <colspec colwidth="6*" align="center"/>
24548 <colspec colwidth="6*" align="right"/>
24549 <tbody>
24550 <row>
24551 <entry><option>helo_allow_chars</option></entry>
24552 <entry>Use: <emphasis>main</emphasis></entry>
24553 <entry>Type: <emphasis>string</emphasis></entry>
24554 <entry>Default: <emphasis>unset</emphasis></entry>
24555 </row>
24556 </tbody>
24557 </tgroup>
24558 </informaltable>
24559 <para>
24560 <indexterm role="concept">
24561 <primary>HELO</primary>
24562 <secondary>underscores in</secondary>
24563 </indexterm>
24564 <indexterm role="concept">
24565 <primary>EHLO</primary>
24566 <secondary>underscores in</secondary>
24567 </indexterm>
24568 <indexterm role="concept">
24569 <primary>underscore in EHLO/HELO</primary>
24570 </indexterm>
24571 This option can be set to a string of rogue characters that are permitted in
24572 all EHLO and HELO names in addition to the standard letters, digits,
24573 hyphens, and dots. If you really must allow underscores, you can set
24574 </para>
24575 <literallayout class="monospaced">
24576 helo_allow_chars = _
24577 </literallayout>
24578 <para>
24579 Note that the value is one string, not a list.
24580 </para>
24581 <para>
24582 <indexterm role="option">
24583 <primary><option>helo_lookup_domains</option></primary>
24584 </indexterm>
24585 </para>
24586 <informaltable frame="all">
24587 <tgroup cols="4" colsep="0" rowsep="0">
24588 <colspec colwidth="8*" align="left"/>
24589 <colspec colwidth="6*" align="center"/>
24590 <colspec colwidth="6*" align="center"/>
24591 <colspec colwidth="6*" align="right"/>
24592 <tbody>
24593 <row>
24594 <entry><option>helo_lookup_domains</option></entry>
24595 <entry>Use: <emphasis>main</emphasis></entry>
24596 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24597 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
24598 </row>
24599 </tbody>
24600 </tgroup>
24601 </informaltable>
24602 <para>
24603 <indexterm role="concept">
24604 <primary>HELO</primary>
24605 <secondary>forcing reverse lookup</secondary>
24606 </indexterm>
24607 <indexterm role="concept">
24608 <primary>EHLO</primary>
24609 <secondary>forcing reverse lookup</secondary>
24610 </indexterm>
24611 If the domain given by a client in a HELO or EHLO command matches this
24612 list, a reverse lookup is done in order to establish the host&#x2019;s true name. The
24613 default forces a lookup if the client host gives the server&#x2019;s name or any of
24614 its IP addresses (in brackets), something that broken clients have been seen to
24615 do.
24616 </para>
24617 <para>
24618 <indexterm role="option">
24619 <primary><option>helo_try_verify_hosts</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>helo_try_verify_hosts</option></entry>
24631 <entry>Use: <emphasis>main</emphasis></entry>
24632 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24633 <entry>Default: <emphasis>unset</emphasis></entry>
24634 </row>
24635 </tbody>
24636 </tgroup>
24637 </informaltable>
24638 <para>
24639 <indexterm role="concept">
24640 <primary>HELO verifying</primary>
24641 <secondary>optional</secondary>
24642 </indexterm>
24643 <indexterm role="concept">
24644 <primary>EHLO</primary>
24645 <secondary>verifying, optional</secondary>
24646 </indexterm>
24647 By default, Exim just checks the syntax of HELO and EHLO commands (see
24648 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
24649 to do more extensive checking of the data supplied by these commands. The ACL
24650 condition <literal>verify = helo</literal> is provided to make this possible.
24651 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
24652 to force the check to occur. From release 4.53 onwards, this is no longer
24653 necessary. If the check has not been done before <literal>verify = helo</literal> is
24654 encountered, it is done at that time. Consequently, this option is obsolete.
24655 Its specification is retained here for backwards compatibility.
24656 </para>
24657 <para>
24658 When an EHLO or HELO command is received, if the calling host matches
24659 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
24660 EHLO command either:
24661 </para>
24662 <itemizedlist>
24663 <listitem>
24664 <para>
24665 is an IP literal matching the calling address of the host, or
24666 </para>
24667 </listitem>
24668 <listitem>
24669 <para>
24670 <indexterm role="concept">
24671 <primary>DNS</primary>
24672 <secondary>reverse lookup</secondary>
24673 </indexterm>
24674 <indexterm role="concept">
24675 <primary>reverse DNS lookup</primary>
24676 </indexterm>
24677 matches the host name that Exim obtains by doing a reverse lookup of the
24678 calling host address, or
24679 </para>
24680 </listitem>
24681 <listitem>
24682 <para>
24683 when looked up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when
24684 available) yields the calling host address.
24685 </para>
24686 </listitem>
24687 </itemizedlist>
24688 <para>
24689 However, the EHLO or HELO command is not rejected if any of the checks
24690 fail. Processing continues, but the result of the check is remembered, and can
24691 be detected later in an ACL by the <literal>verify = helo</literal> condition.
24692 </para>
24693 <para>
24694 <indexterm role="option">
24695 <primary><option>helo_verify_hosts</option></primary>
24696 </indexterm>
24697 </para>
24698 <informaltable frame="all">
24699 <tgroup cols="4" colsep="0" rowsep="0">
24700 <colspec colwidth="8*" align="left"/>
24701 <colspec colwidth="6*" align="center"/>
24702 <colspec colwidth="6*" align="center"/>
24703 <colspec colwidth="6*" align="right"/>
24704 <tbody>
24705 <row>
24706 <entry><option>helo_verify_hosts</option></entry>
24707 <entry>Use: <emphasis>main</emphasis></entry>
24708 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24709 <entry>Default: <emphasis>unset</emphasis></entry>
24710 </row>
24711 </tbody>
24712 </tgroup>
24713 </informaltable>
24714 <para>
24715 <indexterm role="concept">
24716 <primary>HELO verifying</primary>
24717 <secondary>mandatory</secondary>
24718 </indexterm>
24719 <indexterm role="concept">
24720 <primary>EHLO</primary>
24721 <secondary>verifying, mandatory</secondary>
24722 </indexterm>
24723 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
24724 backwards compatibility. For hosts that match this option, Exim checks the host
24725 name given in the HELO or EHLO in the same way as for
24726 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
24727 rejected with a 550 error, and entries are written to the main and reject logs.
24728 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
24729 error.
24730 </para>
24731 <para>
24732 <indexterm role="option">
24733 <primary><option>hold_domains</option></primary>
24734 </indexterm>
24735 </para>
24736 <informaltable frame="all">
24737 <tgroup cols="4" colsep="0" rowsep="0">
24738 <colspec colwidth="8*" align="left"/>
24739 <colspec colwidth="6*" align="center"/>
24740 <colspec colwidth="6*" align="center"/>
24741 <colspec colwidth="6*" align="right"/>
24742 <tbody>
24743 <row>
24744 <entry><option>hold_domains</option></entry>
24745 <entry>Use: <emphasis>main</emphasis></entry>
24746 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24747 <entry>Default: <emphasis>unset</emphasis></entry>
24748 </row>
24749 </tbody>
24750 </tgroup>
24751 </informaltable>
24752 <para>
24753 <indexterm role="concept">
24754 <primary>domain</primary>
24755 <secondary>delaying delivery</secondary>
24756 </indexterm>
24757 <indexterm role="concept">
24758 <primary>delivery</primary>
24759 <secondary>delaying certain domains</secondary>
24760 </indexterm>
24761 This option allows mail for particular domains to be held on the queue
24762 manually. The option is overridden if a message delivery is forced with the
24763 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
24764 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
24765 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
24766 it is deferred every time the message is looked at.
24767 </para>
24768 <para>
24769 This option is intended as a temporary operational measure for delaying the
24770 delivery of mail while some problem is being sorted out, or some new
24771 configuration tested. If you just want to delay the processing of some
24772 domains until a queue run occurs, you should use <option>queue_domains</option> or
24773 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
24774 </para>
24775 <para>
24776 A setting of <option>hold_domains</option> does not override Exim&#x2019;s code for removing
24777 messages from the queue if they have been there longer than the longest retry
24778 time in any retry rule. If you want to hold messages for longer than the normal
24779 retry times, insert a dummy retry rule with a long retry time.
24780 </para>
24781 <para>
24782 <indexterm role="option">
24783 <primary><option>host_lookup</option></primary>
24784 </indexterm>
24785 </para>
24786 <informaltable frame="all">
24787 <tgroup cols="4" colsep="0" rowsep="0">
24788 <colspec colwidth="8*" align="left"/>
24789 <colspec colwidth="6*" align="center"/>
24790 <colspec colwidth="6*" align="center"/>
24791 <colspec colwidth="6*" align="right"/>
24792 <tbody>
24793 <row>
24794 <entry><option>host_lookup</option></entry>
24795 <entry>Use: <emphasis>main</emphasis></entry>
24796 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24797 <entry>Default: <emphasis>unset</emphasis></entry>
24798 </row>
24799 </tbody>
24800 </tgroup>
24801 </informaltable>
24802 <para>
24803 <indexterm role="concept">
24804 <primary>host name</primary>
24805 <secondary>lookup, forcing</secondary>
24806 </indexterm>
24807 Exim does not look up the name of a calling host from its IP address unless it
24808 is required to compare against some host list, or the host matches
24809 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
24810 option (which normally contains IP addresses rather than host names). The
24811 default configuration file contains
24812 </para>
24813 <literallayout class="monospaced">
24814 host_lookup = *
24815 </literallayout>
24816 <para>
24817 which causes a lookup to happen for all hosts. If the expense of these lookups
24818 is felt to be too great, the setting can be changed or removed.
24819 </para>
24820 <para>
24821 After a successful reverse lookup, Exim does a forward lookup on the name it
24822 has obtained, to verify that it yields the IP address that it started with. If
24823 this check fails, Exim behaves as if the name lookup failed.
24824 </para>
24825 <para>
24826 <indexterm role="variable">
24827 <primary><varname>$host_lookup_failed</varname></primary>
24828 </indexterm>
24829 <indexterm role="variable">
24830 <primary><varname>$sender_host_name</varname></primary>
24831 </indexterm>
24832 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
24833 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
24834 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and
24835 <literal>verify = reverse_host_lookup</literal> in ACLs.
24836 </para>
24837 <para>
24838 <indexterm role="option">
24839 <primary><option>host_lookup_order</option></primary>
24840 </indexterm>
24841 </para>
24842 <informaltable frame="all">
24843 <tgroup cols="4" colsep="0" rowsep="0">
24844 <colspec colwidth="8*" align="left"/>
24845 <colspec colwidth="6*" align="center"/>
24846 <colspec colwidth="6*" align="center"/>
24847 <colspec colwidth="6*" align="right"/>
24848 <tbody>
24849 <row>
24850 <entry><option>host_lookup_order</option></entry>
24851 <entry>Use: <emphasis>main</emphasis></entry>
24852 <entry>Type: <emphasis>string list</emphasis></entry>
24853 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
24854 </row>
24855 </tbody>
24856 </tgroup>
24857 </informaltable>
24858 <para>
24859 This option specifies the order of different lookup methods when Exim is trying
24860 to find a host name from an IP address. The default is to do a DNS lookup
24861 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
24862 if that fails. You can change the order of these lookups, or omit one entirely,
24863 if you want.
24864 </para>
24865 <para>
24866 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
24867 multiple PTR records in the DNS and the IP address is not listed in
24868 <filename>/etc/hosts</filename>. Different operating systems give different results in this
24869 case. That is why the default tries a DNS lookup first.
24870 </para>
24871 <para>
24872 <indexterm role="option">
24873 <primary><option>host_reject_connection</option></primary>
24874 </indexterm>
24875 </para>
24876 <informaltable frame="all">
24877 <tgroup cols="4" colsep="0" rowsep="0">
24878 <colspec colwidth="8*" align="left"/>
24879 <colspec colwidth="6*" align="center"/>
24880 <colspec colwidth="6*" align="center"/>
24881 <colspec colwidth="6*" align="right"/>
24882 <tbody>
24883 <row>
24884 <entry><option>host_reject_connection</option></entry>
24885 <entry>Use: <emphasis>main</emphasis></entry>
24886 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24887 <entry>Default: <emphasis>unset</emphasis></entry>
24888 </row>
24889 </tbody>
24890 </tgroup>
24891 </informaltable>
24892 <para>
24893 <indexterm role="concept">
24894 <primary>host</primary>
24895 <secondary>rejecting connections from</secondary>
24896 </indexterm>
24897 If this option is set, incoming SMTP calls from the hosts listed are rejected
24898 as soon as the connection is made.
24899 This option is obsolete, and retained only for backward compatibility, because
24900 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
24901 connections immediately.
24902 </para>
24903 <para>
24904 The ability to give an immediate rejection (either by this option or using an
24905 ACL) is provided for use in unusual cases. Many hosts will just try again,
24906 sometimes without much delay. Normally, it is better to use an ACL to reject
24907 incoming messages at a later stage, such as after RCPT commands. See
24908 chapter <xref linkend="CHAPACL"/>.
24909 </para>
24910 <para>
24911 <indexterm role="option">
24912 <primary><option>hosts_connection_nolog</option></primary>
24913 </indexterm>
24914 </para>
24915 <informaltable frame="all">
24916 <tgroup cols="4" colsep="0" rowsep="0">
24917 <colspec colwidth="8*" align="left"/>
24918 <colspec colwidth="6*" align="center"/>
24919 <colspec colwidth="6*" align="center"/>
24920 <colspec colwidth="6*" align="right"/>
24921 <tbody>
24922 <row>
24923 <entry><option>hosts_connection_nolog</option></entry>
24924 <entry>Use: <emphasis>main</emphasis></entry>
24925 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24926 <entry>Default: <emphasis>unset</emphasis></entry>
24927 </row>
24928 </tbody>
24929 </tgroup>
24930 </informaltable>
24931 <para>
24932 <indexterm role="concept">
24933 <primary>host</primary>
24934 <secondary>not logging connections from</secondary>
24935 </indexterm>
24936 This option defines a list of hosts for which connection logging does not
24937 happen, even though the <option>smtp_connection</option> log selector is set. For example,
24938 you might want not to log SMTP connections from local processes, or from
24939 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
24940 the daemon; you should therefore strive to restrict its value to a short inline
24941 list of IP addresses and networks. To disable logging SMTP connections from
24942 local processes, you must create a host list with an empty item. For example:
24943 </para>
24944 <literallayout class="monospaced">
24945 hosts_connection_nolog = :
24946 </literallayout>
24947 <para>
24948 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
24949 </para>
24950 <para>
24951 <indexterm role="option">
24952 <primary><option>hosts_treat_as_local</option></primary>
24953 </indexterm>
24954 </para>
24955 <informaltable frame="all">
24956 <tgroup cols="4" colsep="0" rowsep="0">
24957 <colspec colwidth="8*" align="left"/>
24958 <colspec colwidth="6*" align="center"/>
24959 <colspec colwidth="6*" align="center"/>
24960 <colspec colwidth="6*" align="right"/>
24961 <tbody>
24962 <row>
24963 <entry><option>hosts_treat_as_local</option></entry>
24964 <entry>Use: <emphasis>main</emphasis></entry>
24965 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24966 <entry>Default: <emphasis>unset</emphasis></entry>
24967 </row>
24968 </tbody>
24969 </tgroup>
24970 </informaltable>
24971 <para>
24972 <indexterm role="concept">
24973 <primary>local host</primary>
24974 <secondary>domains treated as</secondary>
24975 </indexterm>
24976 <indexterm role="concept">
24977 <primary>host</primary>
24978 <secondary>treated as local</secondary>
24979 </indexterm>
24980 If this option is set, any host names that match the domain list are treated as
24981 if they were the local host when Exim is scanning host lists obtained from MX
24982 records
24983 or other sources. Note that the value of this option is a domain list, not a
24984 host list, because it is always used to check host names, not IP addresses.
24985 </para>
24986 <para>
24987 This option also applies when Exim is matching the special items
24988 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
24989 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
24990 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
24991 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
24992 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
24993 interfaces and recognizing the local host.
24994 </para>
24995 <para>
24996 <indexterm role="option">
24997 <primary><option>ibase_servers</option></primary>
24998 </indexterm>
24999 </para>
25000 <informaltable frame="all">
25001 <tgroup cols="4" colsep="0" rowsep="0">
25002 <colspec colwidth="8*" align="left"/>
25003 <colspec colwidth="6*" align="center"/>
25004 <colspec colwidth="6*" align="center"/>
25005 <colspec colwidth="6*" align="right"/>
25006 <tbody>
25007 <row>
25008 <entry><option>ibase_servers</option></entry>
25009 <entry>Use: <emphasis>main</emphasis></entry>
25010 <entry>Type: <emphasis>string list</emphasis></entry>
25011 <entry>Default: <emphasis>unset</emphasis></entry>
25012 </row>
25013 </tbody>
25014 </tgroup>
25015 </informaltable>
25016 <para>
25017 <indexterm role="concept">
25018 <primary>InterBase</primary>
25019 <secondary>server list</secondary>
25020 </indexterm>
25021 This option provides a list of InterBase servers and associated connection data,
25022 to be used in conjunction with <command>ibase</command> lookups (see section <xref linkend="SECID72"/>).
25023 The option is available only if Exim has been built with InterBase support.
25024 </para>
25025 <para>
25026 <indexterm role="option">
25027 <primary><option>ignore_bounce_errors_after</option></primary>
25028 </indexterm>
25029 </para>
25030 <informaltable frame="all">
25031 <tgroup cols="4" colsep="0" rowsep="0">
25032 <colspec colwidth="8*" align="left"/>
25033 <colspec colwidth="6*" align="center"/>
25034 <colspec colwidth="6*" align="center"/>
25035 <colspec colwidth="6*" align="right"/>
25036 <tbody>
25037 <row>
25038 <entry><option>ignore_bounce_errors_after</option></entry>
25039 <entry>Use: <emphasis>main</emphasis></entry>
25040 <entry>Type: <emphasis>time</emphasis></entry>
25041 <entry>Default: <emphasis>10w</emphasis></entry>
25042 </row>
25043 </tbody>
25044 </tgroup>
25045 </informaltable>
25046 <para>
25047 <indexterm role="concept">
25048 <primary>bounce message</primary>
25049 <secondary>discarding</secondary>
25050 </indexterm>
25051 <indexterm role="concept">
25052 <primary>discarding bounce message</primary>
25053 </indexterm>
25054 This option affects the processing of bounce messages that cannot be delivered,
25055 that is, those that suffer a permanent delivery failure. (Bounce messages that
25056 suffer temporary delivery failures are of course retried in the usual way.)
25057 </para>
25058 <para>
25059 After a permanent delivery failure, bounce messages are frozen,
25060 because there is no sender to whom they can be returned. When a frozen bounce
25061 message has been on the queue for more than the given time, it is unfrozen at
25062 the next queue run, and a further delivery is attempted. If delivery fails
25063 again, the bounce message is discarded. This makes it possible to keep failed
25064 bounce messages around for a shorter time than the normal maximum retry time
25065 for frozen messages. For example,
25066 </para>
25067 <literallayout class="monospaced">
25068 ignore_bounce_errors_after = 12h
25069 </literallayout>
25070 <para>
25071 retries failed bounce message deliveries after 12 hours, discarding any further
25072 failures. If the value of this option is set to a zero time period, bounce
25073 failures are discarded immediately. Setting a very long time (as in the default
25074 value) has the effect of disabling this option. For ways of automatically
25075 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
25076 <option>timeout_frozen_after</option>.
25077 </para>
25078 <para>
25079 <indexterm role="option">
25080 <primary><option>ignore_fromline_hosts</option></primary>
25081 </indexterm>
25082 </para>
25083 <informaltable frame="all">
25084 <tgroup cols="4" colsep="0" rowsep="0">
25085 <colspec colwidth="8*" align="left"/>
25086 <colspec colwidth="6*" align="center"/>
25087 <colspec colwidth="6*" align="center"/>
25088 <colspec colwidth="6*" align="right"/>
25089 <tbody>
25090 <row>
25091 <entry><option>ignore_fromline_hosts</option></entry>
25092 <entry>Use: <emphasis>main</emphasis></entry>
25093 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25094 <entry>Default: <emphasis>unset</emphasis></entry>
25095 </row>
25096 </tbody>
25097 </tgroup>
25098 </informaltable>
25099 <para>
25100 <indexterm role="concept">
25101 <primary><quote>From</quote> line</primary>
25102 </indexterm>
25103 <indexterm role="concept">
25104 <primary>UUCP</primary>
25105 <secondary><quote>From</quote> line</secondary>
25106 </indexterm>
25107 Some broken SMTP clients insist on sending a UUCP-like <quote>From&nbsp;</quote> line before
25108 the headers of a message. By default this is treated as the start of the
25109 message&#x2019;s body, which means that any following headers are not recognized as
25110 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
25111 match those hosts that insist on sending it. If the sender is actually a local
25112 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
25113 <option>ignore_fromline_local</option> must be set to achieve this effect.
25114 </para>
25115 <para>
25116 <indexterm role="option">
25117 <primary><option>ignore_fromline_local</option></primary>
25118 </indexterm>
25119 </para>
25120 <informaltable frame="all">
25121 <tgroup cols="4" colsep="0" rowsep="0">
25122 <colspec colwidth="8*" align="left"/>
25123 <colspec colwidth="6*" align="center"/>
25124 <colspec colwidth="6*" align="center"/>
25125 <colspec colwidth="6*" align="right"/>
25126 <tbody>
25127 <row>
25128 <entry><option>ignore_fromline_local</option></entry>
25129 <entry>Use: <emphasis>main</emphasis></entry>
25130 <entry>Type: <emphasis>boolean</emphasis></entry>
25131 <entry>Default: <emphasis>false</emphasis></entry>
25132 </row>
25133 </tbody>
25134 </tgroup>
25135 </informaltable>
25136 <para>
25137 See <option>ignore_fromline_hosts</option> above.
25138 </para>
25139 <para revisionflag="changed">
25140 <indexterm role="option">
25141 <primary><option>keep_environment</option></primary>
25142 </indexterm>
25143 </para>
25144 <informaltable frame="all" revisionflag="changed">
25145 <tgroup cols="4" colsep="0" rowsep="0">
25146 <colspec colwidth="8*" align="left"/>
25147 <colspec colwidth="6*" align="center"/>
25148 <colspec colwidth="6*" align="center"/>
25149 <colspec colwidth="6*" align="right"/>
25150 <tbody>
25151 <row>
25152 <entry><option>keep_environment</option></entry>
25153 <entry>Use: <emphasis>main</emphasis></entry>
25154 <entry>Type: <emphasis>string list</emphasis></entry>
25155 <entry>Default: <emphasis>unset</emphasis></entry>
25156 </row>
25157 </tbody>
25158 </tgroup>
25159 </informaltable>
25160 <para revisionflag="changed">
25161 <indexterm role="concept">
25162 <primary>environment</primary>
25163 <secondary>inherited</secondary>
25164 </indexterm>
25165 This option contains a string list of environment variables to keep.
25166 You have to trust these variables or you have to be sure that
25167 these variables do not impose any security risk. Keep in mind that
25168 during the startup phase Exim is running with an effective UID 0 in most
25169 installations. As the default value is an empty list, the default
25170 environment for using libraries, running embedded Perl code, or running
25171 external binaries is empty, and does not not even contain PATH or HOME.
25172 </para>
25173 <para revisionflag="changed">
25174 Actually the list is interpreted as a list of patterns
25175 (<xref linkend="SECTlistexpand"/>), except that it is not expanded first.
25176 </para>
25177 <para revisionflag="changed">
25178 WARNING: Macro substitution is still done first, so having a macro
25179 FOO and having FOO_HOME in your <option>keep_environment</option> option may have
25180 unexpected results. You may work around this using a regular expression
25181 that does not match the macro name: ^[F]OO_HOME$.
25182 </para>
25183 <para revisionflag="changed">
25184 Current versions of Exim issue a warning during startupif you do not mention
25185 <option>keep_environment</option> or <option>add_environment</option> in your runtime configuration
25186 file.
25187 </para>
25188 <para>
25189 <indexterm role="option">
25190 <primary><option>keep_malformed</option></primary>
25191 </indexterm>
25192 </para>
25193 <informaltable frame="all">
25194 <tgroup cols="4" colsep="0" rowsep="0">
25195 <colspec colwidth="8*" align="left"/>
25196 <colspec colwidth="6*" align="center"/>
25197 <colspec colwidth="6*" align="center"/>
25198 <colspec colwidth="6*" align="right"/>
25199 <tbody>
25200 <row>
25201 <entry><option>keep_malformed</option></entry>
25202 <entry>Use: <emphasis>main</emphasis></entry>
25203 <entry>Type: <emphasis>time</emphasis></entry>
25204 <entry>Default: <emphasis>4d</emphasis></entry>
25205 </row>
25206 </tbody>
25207 </tgroup>
25208 </informaltable>
25209 <para>
25210 This option specifies the length of time to keep messages whose spool files
25211 have been corrupted in some way. This should, of course, never happen. At the
25212 next attempt to deliver such a message, it gets removed. The incident is
25213 logged.
25214 </para>
25215 <para>
25216 <indexterm role="option">
25217 <primary><option>ldap_ca_cert_dir</option></primary>
25218 </indexterm>
25219 </para>
25220 <informaltable frame="all">
25221 <tgroup cols="4" colsep="0" rowsep="0">
25222 <colspec colwidth="8*" align="left"/>
25223 <colspec colwidth="6*" align="center"/>
25224 <colspec colwidth="6*" align="center"/>
25225 <colspec colwidth="6*" align="right"/>
25226 <tbody>
25227 <row>
25228 <entry><option>ldap_ca_cert_dir</option></entry>
25229 <entry>Use: <emphasis>main</emphasis></entry>
25230 <entry>Type: <emphasis>string</emphasis></entry>
25231 <entry>Default: <emphasis>unset</emphasis></entry>
25232 </row>
25233 </tbody>
25234 </tgroup>
25235 </informaltable>
25236 <para>
25237 <indexterm role="concept">
25238 <primary>LDAP</primary>
25239 <secondary>,</secondary>
25240 </indexterm>
25241 This option indicates which directory contains CA certificates for verifying
25242 a TLS certificate presented by an LDAP server.
25243 While Exim does not provide a default value, your SSL library may.
25244 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
25245 and constrained to be a directory.
25246 </para>
25247 <para>
25248 <indexterm role="option">
25249 <primary><option>ldap_ca_cert_file</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>ldap_ca_cert_file</option></entry>
25261 <entry>Use: <emphasis>main</emphasis></entry>
25262 <entry>Type: <emphasis>string</emphasis></entry>
25263 <entry>Default: <emphasis>unset</emphasis></entry>
25264 </row>
25265 </tbody>
25266 </tgroup>
25267 </informaltable>
25268 <para>
25269 <indexterm role="concept">
25270 <primary>LDAP</primary>
25271 <secondary>,</secondary>
25272 </indexterm>
25273 This option indicates which file contains CA certificates for verifying
25274 a TLS certificate presented by an LDAP server.
25275 While Exim does not provide a default value, your SSL library may.
25276 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
25277 and constrained to be a file.
25278 </para>
25279 <para>
25280 <indexterm role="option">
25281 <primary><option>ldap_cert_file</option></primary>
25282 </indexterm>
25283 </para>
25284 <informaltable frame="all">
25285 <tgroup cols="4" colsep="0" rowsep="0">
25286 <colspec colwidth="8*" align="left"/>
25287 <colspec colwidth="6*" align="center"/>
25288 <colspec colwidth="6*" align="center"/>
25289 <colspec colwidth="6*" align="right"/>
25290 <tbody>
25291 <row>
25292 <entry><option>ldap_cert_file</option></entry>
25293 <entry>Use: <emphasis>main</emphasis></entry>
25294 <entry>Type: <emphasis>string</emphasis></entry>
25295 <entry>Default: <emphasis>unset</emphasis></entry>
25296 </row>
25297 </tbody>
25298 </tgroup>
25299 </informaltable>
25300 <para>
25301 <indexterm role="concept">
25302 <primary>LDAP</primary>
25303 <secondary>TLS client certificate file</secondary>
25304 </indexterm>
25305 This option indicates which file contains an TLS client certificate which
25306 Exim should present to the LDAP server during TLS negotiation.
25307 Should be used together with <option>ldap_cert_key</option>.
25308 </para>
25309 <para>
25310 <indexterm role="option">
25311 <primary><option>ldap_cert_key</option></primary>
25312 </indexterm>
25313 </para>
25314 <informaltable frame="all">
25315 <tgroup cols="4" colsep="0" rowsep="0">
25316 <colspec colwidth="8*" align="left"/>
25317 <colspec colwidth="6*" align="center"/>
25318 <colspec colwidth="6*" align="center"/>
25319 <colspec colwidth="6*" align="right"/>
25320 <tbody>
25321 <row>
25322 <entry><option>ldap_cert_key</option></entry>
25323 <entry>Use: <emphasis>main</emphasis></entry>
25324 <entry>Type: <emphasis>string</emphasis></entry>
25325 <entry>Default: <emphasis>unset</emphasis></entry>
25326 </row>
25327 </tbody>
25328 </tgroup>
25329 </informaltable>
25330 <para>
25331 <indexterm role="concept">
25332 <primary>LDAP</primary>
25333 <secondary>TLS client key file</secondary>
25334 </indexterm>
25335 This option indicates which file contains the secret/private key to use
25336 to prove identity to the LDAP server during TLS negotiation.
25337 Should be used together with <option>ldap_cert_file</option>, which contains the
25338 identity to be proven.
25339 </para>
25340 <para>
25341 <indexterm role="option">
25342 <primary><option>ldap_cipher_suite</option></primary>
25343 </indexterm>
25344 </para>
25345 <informaltable frame="all">
25346 <tgroup cols="4" colsep="0" rowsep="0">
25347 <colspec colwidth="8*" align="left"/>
25348 <colspec colwidth="6*" align="center"/>
25349 <colspec colwidth="6*" align="center"/>
25350 <colspec colwidth="6*" align="right"/>
25351 <tbody>
25352 <row>
25353 <entry><option>ldap_cipher_suite</option></entry>
25354 <entry>Use: <emphasis>main</emphasis></entry>
25355 <entry>Type: <emphasis>string</emphasis></entry>
25356 <entry>Default: <emphasis>unset</emphasis></entry>
25357 </row>
25358 </tbody>
25359 </tgroup>
25360 </informaltable>
25361 <para>
25362 <indexterm role="concept">
25363 <primary>LDAP</primary>
25364 <secondary>TLS cipher suite</secondary>
25365 </indexterm>
25366 This controls the TLS cipher-suite negotiation during TLS negotiation with
25367 the LDAP server.  See <xref linkend="SECTreqciphssl"/> for more details of the format of
25368 cipher-suite options with OpenSSL (as used by LDAP client libraries).
25369 </para>
25370 <para>
25371 <indexterm role="option">
25372 <primary><option>ldap_default_servers</option></primary>
25373 </indexterm>
25374 </para>
25375 <informaltable frame="all">
25376 <tgroup cols="4" colsep="0" rowsep="0">
25377 <colspec colwidth="8*" align="left"/>
25378 <colspec colwidth="6*" align="center"/>
25379 <colspec colwidth="6*" align="center"/>
25380 <colspec colwidth="6*" align="right"/>
25381 <tbody>
25382 <row>
25383 <entry><option>ldap_default_servers</option></entry>
25384 <entry>Use: <emphasis>main</emphasis></entry>
25385 <entry>Type: <emphasis>string list</emphasis></entry>
25386 <entry>Default: <emphasis>unset</emphasis></entry>
25387 </row>
25388 </tbody>
25389 </tgroup>
25390 </informaltable>
25391 <para>
25392 <indexterm role="concept">
25393 <primary>LDAP</primary>
25394 <secondary>default servers</secondary>
25395 </indexterm>
25396 This option provides a list of LDAP servers which are tried in turn when an
25397 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
25398 details of LDAP queries. This option is available only when Exim has been built
25399 with LDAP support.
25400 </para>
25401 <para>
25402 <indexterm role="option">
25403 <primary><option>ldap_require_cert</option></primary>
25404 </indexterm>
25405 </para>
25406 <informaltable frame="all">
25407 <tgroup cols="4" colsep="0" rowsep="0">
25408 <colspec colwidth="8*" align="left"/>
25409 <colspec colwidth="6*" align="center"/>
25410 <colspec colwidth="6*" align="center"/>
25411 <colspec colwidth="6*" align="right"/>
25412 <tbody>
25413 <row>
25414 <entry><option>ldap_require_cert</option></entry>
25415 <entry>Use: <emphasis>main</emphasis></entry>
25416 <entry>Type: <emphasis>string</emphasis></entry>
25417 <entry>Default: <emphasis>unset.</emphasis></entry>
25418 </row>
25419 </tbody>
25420 </tgroup>
25421 </informaltable>
25422 <para>
25423 <indexterm role="concept">
25424 <primary>LDAP</primary>
25425 <secondary>policy for LDAP server TLS cert presentation</secondary>
25426 </indexterm>
25427 This should be one of the values "hard", "demand", "allow", "try" or "never".
25428 A value other than one of these is interpreted as "never".
25429 See the entry "TLS_REQCERT" in your system man page for ldap.conf(5).
25430 Although Exim does not set a default, the LDAP library probably defaults
25431 to hard/demand.
25432 </para>
25433 <para>
25434 <indexterm role="option">
25435 <primary><option>ldap_start_tls</option></primary>
25436 </indexterm>
25437 </para>
25438 <informaltable frame="all">
25439 <tgroup cols="4" colsep="0" rowsep="0">
25440 <colspec colwidth="8*" align="left"/>
25441 <colspec colwidth="6*" align="center"/>
25442 <colspec colwidth="6*" align="center"/>
25443 <colspec colwidth="6*" align="right"/>
25444 <tbody>
25445 <row>
25446 <entry><option>ldap_start_tls</option></entry>
25447 <entry>Use: <emphasis>main</emphasis></entry>
25448 <entry>Type: <emphasis>boolean</emphasis></entry>
25449 <entry>Default: <emphasis>false</emphasis></entry>
25450 </row>
25451 </tbody>
25452 </tgroup>
25453 </informaltable>
25454 <para>
25455 <indexterm role="concept">
25456 <primary>LDAP</primary>
25457 <secondary>whether or not to negotiate TLS</secondary>
25458 </indexterm>
25459 If set, Exim will attempt to negotiate TLS with the LDAP server when
25460 connecting on a regular LDAP port.  This is the LDAP equivalent of SMTP&#x2019;s
25461 "STARTTLS".  This is distinct from using "ldaps", which is the LDAP form
25462 of SSL-on-connect.
25463 In the event of failure to negotiate TLS, the action taken is controlled
25464 by <option>ldap_require_cert</option>.
25465 </para>
25466 <para>
25467 <indexterm role="option">
25468 <primary><option>ldap_version</option></primary>
25469 </indexterm>
25470 </para>
25471 <informaltable frame="all">
25472 <tgroup cols="4" colsep="0" rowsep="0">
25473 <colspec colwidth="8*" align="left"/>
25474 <colspec colwidth="6*" align="center"/>
25475 <colspec colwidth="6*" align="center"/>
25476 <colspec colwidth="6*" align="right"/>
25477 <tbody>
25478 <row>
25479 <entry><option>ldap_version</option></entry>
25480 <entry>Use: <emphasis>main</emphasis></entry>
25481 <entry>Type: <emphasis>integer</emphasis></entry>
25482 <entry>Default: <emphasis>unset</emphasis></entry>
25483 </row>
25484 </tbody>
25485 </tgroup>
25486 </informaltable>
25487 <para>
25488 <indexterm role="concept">
25489 <primary>LDAP</primary>
25490 <secondary>protocol version, forcing</secondary>
25491 </indexterm>
25492 This option can be used to force Exim to set a specific protocol version for
25493 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
25494 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
25495 the LDAP headers; otherwise it is 2. This option is available only when Exim
25496 has been built with LDAP support.
25497 </para>
25498 <para>
25499 <indexterm role="option">
25500 <primary><option>local_from_check</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>local_from_check</option></entry>
25512 <entry>Use: <emphasis>main</emphasis></entry>
25513 <entry>Type: <emphasis>boolean</emphasis></entry>
25514 <entry>Default: <emphasis>true</emphasis></entry>
25515 </row>
25516 </tbody>
25517 </tgroup>
25518 </informaltable>
25519 <para>
25520 <indexterm role="concept">
25521 <primary><emphasis>Sender:</emphasis> header line</primary>
25522 <secondary>disabling addition of</secondary>
25523 </indexterm>
25524 <indexterm role="concept">
25525 <primary><emphasis>From:</emphasis> header line</primary>
25526 <secondary>disabling checking of</secondary>
25527 </indexterm>
25528 When a message is submitted locally (that is, not over a TCP/IP connection) by
25529 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
25530 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
25531 the domain specified by <option>qualify_domain</option>.
25532 </para>
25533 <para>
25534 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
25535 locally submitted message is automatically qualified by Exim, unless the
25536 <option>-bnq</option> command line option is used.
25537 </para>
25538 <para>
25539 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
25540 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
25541 <emphasis>Sender:</emphasis> header with an address constructed from the calling user&#x2019;s login
25542 and the default qualify domain.
25543 </para>
25544 <para>
25545 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
25546 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
25547 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
25548 <option>local_sender_retain</option> to be true.
25549 </para>
25550 <para>
25551 <indexterm role="concept">
25552 <primary>envelope sender</primary>
25553 </indexterm>
25554 These options affect only the header lines in the message. The envelope sender
25555 is still forced to be the login id at the qualify domain unless
25556 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
25557 </para>
25558 <para>
25559 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
25560 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
25561 has more details about <emphasis>Sender:</emphasis> processing.
25562 </para>
25563 <para>
25564 <indexterm role="option">
25565 <primary><option>local_from_prefix</option></primary>
25566 </indexterm>
25567 </para>
25568 <informaltable frame="all">
25569 <tgroup cols="4" colsep="0" rowsep="0">
25570 <colspec colwidth="8*" align="left"/>
25571 <colspec colwidth="6*" align="center"/>
25572 <colspec colwidth="6*" align="center"/>
25573 <colspec colwidth="6*" align="right"/>
25574 <tbody>
25575 <row>
25576 <entry><option>local_from_prefix</option></entry>
25577 <entry>Use: <emphasis>main</emphasis></entry>
25578 <entry>Type: <emphasis>string</emphasis></entry>
25579 <entry>Default: <emphasis>unset</emphasis></entry>
25580 </row>
25581 </tbody>
25582 </tgroup>
25583 </informaltable>
25584 <para>
25585 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
25586 matching the login id (see <option>local_from_check</option> above), it can be configured to
25587 ignore certain prefixes and suffixes in the local part of the address. This is
25588 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
25589 appropriate lists, in the same form as the <option>local_part_prefix</option> and
25590 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
25591 example, if
25592 </para>
25593 <literallayout class="monospaced">
25594 local_from_prefix = *-
25595 </literallayout>
25596 <para>
25597 is set, a <emphasis>From:</emphasis> line containing
25598 </para>
25599 <literallayout class="monospaced">
25600 From: anything-user@your.domain.example
25601 </literallayout>
25602 <para>
25603 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
25604 matches the actual sender address that is constructed from the login name and
25605 qualify domain.
25606 </para>
25607 <para>
25608 <indexterm role="option">
25609 <primary><option>local_from_suffix</option></primary>
25610 </indexterm>
25611 </para>
25612 <informaltable frame="all">
25613 <tgroup cols="4" colsep="0" rowsep="0">
25614 <colspec colwidth="8*" align="left"/>
25615 <colspec colwidth="6*" align="center"/>
25616 <colspec colwidth="6*" align="center"/>
25617 <colspec colwidth="6*" align="right"/>
25618 <tbody>
25619 <row>
25620 <entry><option>local_from_suffix</option></entry>
25621 <entry>Use: <emphasis>main</emphasis></entry>
25622 <entry>Type: <emphasis>string</emphasis></entry>
25623 <entry>Default: <emphasis>unset</emphasis></entry>
25624 </row>
25625 </tbody>
25626 </tgroup>
25627 </informaltable>
25628 <para>
25629 See <option>local_from_prefix</option> above.
25630 </para>
25631 <para>
25632 <indexterm role="option">
25633 <primary><option>local_interfaces</option></primary>
25634 </indexterm>
25635 </para>
25636 <informaltable frame="all">
25637 <tgroup cols="4" colsep="0" rowsep="0">
25638 <colspec colwidth="8*" align="left"/>
25639 <colspec colwidth="6*" align="center"/>
25640 <colspec colwidth="6*" align="center"/>
25641 <colspec colwidth="6*" align="right"/>
25642 <tbody>
25643 <row>
25644 <entry><option>local_interfaces</option></entry>
25645 <entry>Use: <emphasis>main</emphasis></entry>
25646 <entry>Type: <emphasis>string list</emphasis></entry>
25647 <entry>Default: <emphasis>see below</emphasis></entry>
25648 </row>
25649 </tbody>
25650 </tgroup>
25651 </informaltable>
25652 <para>
25653 This option controls which network interfaces are used by the daemon for
25654 listening; they are also used to identify the local host when routing. Chapter
25655 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
25656 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
25657 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
25658 <option>local_interfaces</option> is
25659 </para>
25660 <literallayout class="monospaced">
25661 local_interfaces = 0.0.0.0
25662 </literallayout>
25663 <para>
25664 when Exim is built without IPv6 support; otherwise it is
25665 </para>
25666 <literallayout class="monospaced">
25667 local_interfaces = &lt;; ::0 ; 0.0.0.0
25668 </literallayout>
25669 <para>
25670 <indexterm role="option">
25671 <primary><option>local_scan_timeout</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>local_scan_timeout</option></entry>
25683 <entry>Use: <emphasis>main</emphasis></entry>
25684 <entry>Type: <emphasis>time</emphasis></entry>
25685 <entry>Default: <emphasis>5m</emphasis></entry>
25686 </row>
25687 </tbody>
25688 </tgroup>
25689 </informaltable>
25690 <para>
25691 <indexterm role="concept">
25692 <primary>timeout</primary>
25693 <secondary>for <function>local_scan()</function> function</secondary>
25694 </indexterm>
25695 <indexterm role="concept">
25696 <primary><function>local_scan()</function> function</primary>
25697 <secondary>timeout</secondary>
25698 </indexterm>
25699 This timeout applies to the <function>local_scan()</function> function (see chapter
25700 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
25701 the incoming message is rejected with a temporary error if it is an SMTP
25702 message. For a non-SMTP message, the message is dropped and Exim ends with a
25703 non-zero code. The incident is logged on the main and reject logs.
25704 </para>
25705 <para>
25706 <indexterm role="option">
25707 <primary><option>local_sender_retain</option></primary>
25708 </indexterm>
25709 </para>
25710 <informaltable frame="all">
25711 <tgroup cols="4" colsep="0" rowsep="0">
25712 <colspec colwidth="8*" align="left"/>
25713 <colspec colwidth="6*" align="center"/>
25714 <colspec colwidth="6*" align="center"/>
25715 <colspec colwidth="6*" align="right"/>
25716 <tbody>
25717 <row>
25718 <entry><option>local_sender_retain</option></entry>
25719 <entry>Use: <emphasis>main</emphasis></entry>
25720 <entry>Type: <emphasis>boolean</emphasis></entry>
25721 <entry>Default: <emphasis>false</emphasis></entry>
25722 </row>
25723 </tbody>
25724 </tgroup>
25725 </informaltable>
25726 <para>
25727 <indexterm role="concept">
25728 <primary><emphasis>Sender:</emphasis> header line</primary>
25729 <secondary>retaining from local submission</secondary>
25730 </indexterm>
25731 When a message is submitted locally (that is, not over a TCP/IP connection) by
25732 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
25733 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
25734 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
25735 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
25736 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
25737 </para>
25738 <para>
25739 <indexterm role="option">
25740 <primary><option>localhost_number</option></primary>
25741 </indexterm>
25742 </para>
25743 <informaltable frame="all">
25744 <tgroup cols="4" colsep="0" rowsep="0">
25745 <colspec colwidth="8*" align="left"/>
25746 <colspec colwidth="6*" align="center"/>
25747 <colspec colwidth="6*" align="center"/>
25748 <colspec colwidth="6*" align="right"/>
25749 <tbody>
25750 <row>
25751 <entry><option>localhost_number</option></entry>
25752 <entry>Use: <emphasis>main</emphasis></entry>
25753 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25754 <entry>Default: <emphasis>unset</emphasis></entry>
25755 </row>
25756 </tbody>
25757 </tgroup>
25758 </informaltable>
25759 <para>
25760 <indexterm role="concept">
25761 <primary>host</primary>
25762 <secondary>locally unique number for</secondary>
25763 </indexterm>
25764 <indexterm role="concept">
25765 <primary>message ids</primary>
25766 <secondary>with multiple hosts</secondary>
25767 </indexterm>
25768 <indexterm role="variable">
25769 <primary><varname>$localhost_number</varname></primary>
25770 </indexterm>
25771 Exim&#x2019;s message ids are normally unique only within the local host. If
25772 uniqueness among a set of hosts is required, each host must set a different
25773 value for the <option>localhost_number</option> option. The string is expanded immediately
25774 after reading the configuration file (so that a number can be computed from the
25775 host name, for example) and the result of the expansion must be a number in the
25776 range 0&ndash;16 (or 0&ndash;10 on operating systems with case-insensitive file
25777 systems). This is available in subsequent string expansions via the variable
25778 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
25779 characters of the message id, instead of just being a fractional part of the
25780 time, are computed from the time and the local host number as described in
25781 section <xref linkend="SECTmessiden"/>.
25782 </para>
25783 <para>
25784 <indexterm role="option">
25785 <primary><option>log_file_path</option></primary>
25786 </indexterm>
25787 </para>
25788 <informaltable frame="all">
25789 <tgroup cols="4" colsep="0" rowsep="0">
25790 <colspec colwidth="8*" align="left"/>
25791 <colspec colwidth="6*" align="center"/>
25792 <colspec colwidth="6*" align="center"/>
25793 <colspec colwidth="6*" align="right"/>
25794 <tbody>
25795 <row>
25796 <entry><option>log_file_path</option></entry>
25797 <entry>Use: <emphasis>main</emphasis></entry>
25798 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
25799 <entry>Default: <emphasis>set at compile time</emphasis></entry>
25800 </row>
25801 </tbody>
25802 </tgroup>
25803 </informaltable>
25804 <para>
25805 <indexterm role="concept">
25806 <primary>log</primary>
25807 <secondary>file path for</secondary>
25808 </indexterm>
25809 This option sets the path which is used to determine the names of Exim&#x2019;s log
25810 files, or indicates that logging is to be to syslog, or both. It is expanded
25811 when Exim is entered, so it can, for example, contain a reference to the host
25812 name. If no specific path is set for the log files at compile or run time, they
25813 are written in a sub-directory called <filename>log</filename> in Exim&#x2019;s spool directory.
25814 Chapter <xref linkend="CHAPlog"/> contains further details about Exim&#x2019;s logging, and
25815 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
25816 used. If this string is fixed at your installation (contains no expansion
25817 variables) it is recommended that you do not set this option in the
25818 configuration file, but instead supply the path using LOG_FILE_PATH in
25819 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
25820 early on &ndash; in particular, failure to read the configuration file.
25821 </para>
25822 <para>
25823 <indexterm role="option">
25824 <primary><option>log_selector</option></primary>
25825 </indexterm>
25826 </para>
25827 <informaltable frame="all">
25828 <tgroup cols="4" colsep="0" rowsep="0">
25829 <colspec colwidth="8*" align="left"/>
25830 <colspec colwidth="6*" align="center"/>
25831 <colspec colwidth="6*" align="center"/>
25832 <colspec colwidth="6*" align="right"/>
25833 <tbody>
25834 <row>
25835 <entry><option>log_selector</option></entry>
25836 <entry>Use: <emphasis>main</emphasis></entry>
25837 <entry>Type: <emphasis>string</emphasis></entry>
25838 <entry>Default: <emphasis>unset</emphasis></entry>
25839 </row>
25840 </tbody>
25841 </tgroup>
25842 </informaltable>
25843 <para>
25844 <indexterm role="concept">
25845 <primary>log</primary>
25846 <secondary>selectors</secondary>
25847 </indexterm>
25848 This option can be used to reduce or increase the number of things that Exim
25849 writes to its log files. Its argument is made up of names preceded by plus or
25850 minus characters. For example:
25851 </para>
25852 <literallayout class="monospaced">
25853 log_selector = +arguments -retry_defer
25854 </literallayout>
25855 <para>
25856 A list of possible names and what they control is given in the chapter on
25857 logging, in section <xref linkend="SECTlogselector"/>.
25858 </para>
25859 <para>
25860 <indexterm role="option">
25861 <primary><option>log_timezone</option></primary>
25862 </indexterm>
25863 </para>
25864 <informaltable frame="all">
25865 <tgroup cols="4" colsep="0" rowsep="0">
25866 <colspec colwidth="8*" align="left"/>
25867 <colspec colwidth="6*" align="center"/>
25868 <colspec colwidth="6*" align="center"/>
25869 <colspec colwidth="6*" align="right"/>
25870 <tbody>
25871 <row>
25872 <entry><option>log_timezone</option></entry>
25873 <entry>Use: <emphasis>main</emphasis></entry>
25874 <entry>Type: <emphasis>boolean</emphasis></entry>
25875 <entry>Default: <emphasis>false</emphasis></entry>
25876 </row>
25877 </tbody>
25878 </tgroup>
25879 </informaltable>
25880 <para>
25881 <indexterm role="concept">
25882 <primary>log</primary>
25883 <secondary>timezone for entries</secondary>
25884 </indexterm>
25885 <indexterm role="variable">
25886 <primary><varname>$tod_log</varname></primary>
25887 </indexterm>
25888 <indexterm role="variable">
25889 <primary><varname>$tod_zone</varname></primary>
25890 </indexterm>
25891 By default, the timestamps on log lines are in local time without the
25892 timezone. This means that if your timezone changes twice a year, the timestamps
25893 in log lines are ambiguous for an hour when the clocks go back. One way of
25894 avoiding this problem is to set the timezone to UTC. An alternative is to set
25895 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
25896 timestamps in log lines. Turning on this option can add quite a lot to the size
25897 of log files because each line is extended by 6 characters. Note that the
25898 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
25899 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
25900 </para>
25901 <para>
25902 <indexterm role="option">
25903 <primary><option>lookup_open_max</option></primary>
25904 </indexterm>
25905 </para>
25906 <informaltable frame="all">
25907 <tgroup cols="4" colsep="0" rowsep="0">
25908 <colspec colwidth="8*" align="left"/>
25909 <colspec colwidth="6*" align="center"/>
25910 <colspec colwidth="6*" align="center"/>
25911 <colspec colwidth="6*" align="right"/>
25912 <tbody>
25913 <row>
25914 <entry><option>lookup_open_max</option></entry>
25915 <entry>Use: <emphasis>main</emphasis></entry>
25916 <entry>Type: <emphasis>integer</emphasis></entry>
25917 <entry>Default: <emphasis>25</emphasis></entry>
25918 </row>
25919 </tbody>
25920 </tgroup>
25921 </informaltable>
25922 <para>
25923 <indexterm role="concept">
25924 <primary>too many open files</primary>
25925 </indexterm>
25926 <indexterm role="concept">
25927 <primary>open files, too many</primary>
25928 </indexterm>
25929 <indexterm role="concept">
25930 <primary>file</primary>
25931 <secondary>too many open</secondary>
25932 </indexterm>
25933 <indexterm role="concept">
25934 <primary>lookup</primary>
25935 <secondary>maximum open files</secondary>
25936 </indexterm>
25937 <indexterm role="concept">
25938 <primary>limit</primary>
25939 <secondary>open files for lookups</secondary>
25940 </indexterm>
25941 This option limits the number of simultaneously open files for single-key
25942 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
25943 Exim normally keeps these files open during routing, because often the same
25944 file is required several times. If the limit is reached, Exim closes the least
25945 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
25946 actually opens two files for each logical DBM database, though it still counts
25947 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
25948 open files</quote> errors with NDBM, you need to reduce the value of
25949 <option>lookup_open_max</option>.
25950 </para>
25951 <para>
25952 <indexterm role="option">
25953 <primary><option>max_username_length</option></primary>
25954 </indexterm>
25955 </para>
25956 <informaltable frame="all">
25957 <tgroup cols="4" colsep="0" rowsep="0">
25958 <colspec colwidth="8*" align="left"/>
25959 <colspec colwidth="6*" align="center"/>
25960 <colspec colwidth="6*" align="center"/>
25961 <colspec colwidth="6*" align="right"/>
25962 <tbody>
25963 <row>
25964 <entry><option>max_username_length</option></entry>
25965 <entry>Use: <emphasis>main</emphasis></entry>
25966 <entry>Type: <emphasis>integer</emphasis></entry>
25967 <entry>Default: <emphasis>0</emphasis></entry>
25968 </row>
25969 </tbody>
25970 </tgroup>
25971 </informaltable>
25972 <para>
25973 <indexterm role="concept">
25974 <primary>length of login name</primary>
25975 </indexterm>
25976 <indexterm role="concept">
25977 <primary>user name</primary>
25978 <secondary>maximum length</secondary>
25979 </indexterm>
25980 <indexterm role="concept">
25981 <primary>limit</primary>
25982 <secondary>user name length</secondary>
25983 </indexterm>
25984 Some operating systems are broken in that they truncate long arguments to
25985 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
25986 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
25987 an argument that is longer behaves as if <function>getpwnam()</function> failed.
25988 </para>
25989 <para>
25990 <indexterm role="option">
25991 <primary><option>message_body_newlines</option></primary>
25992 </indexterm>
25993 </para>
25994 <informaltable frame="all">
25995 <tgroup cols="4" colsep="0" rowsep="0">
25996 <colspec colwidth="8*" align="left"/>
25997 <colspec colwidth="6*" align="center"/>
25998 <colspec colwidth="6*" align="center"/>
25999 <colspec colwidth="6*" align="right"/>
26000 <tbody>
26001 <row>
26002 <entry><option>message_body_newlines</option></entry>
26003 <entry>Use: <emphasis>main</emphasis></entry>
26004 <entry>Type: <emphasis>bool</emphasis></entry>
26005 <entry>Default: <emphasis>false</emphasis></entry>
26006 </row>
26007 </tbody>
26008 </tgroup>
26009 </informaltable>
26010 <para>
26011 <indexterm role="concept">
26012 <primary>message body</primary>
26013 <secondary>newlines in variables</secondary>
26014 </indexterm>
26015 <indexterm role="concept">
26016 <primary>newline</primary>
26017 <secondary>in message body variables</secondary>
26018 </indexterm>
26019 <indexterm role="variable">
26020 <primary><varname>$message_body</varname></primary>
26021 </indexterm>
26022 <indexterm role="variable">
26023 <primary><varname>$message_body_end</varname></primary>
26024 </indexterm>
26025 By default, newlines in the message body are replaced by spaces when setting
26026 the <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables. If this
26027 option is set true, this no longer happens.
26028 </para>
26029 <para>
26030 <indexterm role="option">
26031 <primary><option>message_body_visible</option></primary>
26032 </indexterm>
26033 </para>
26034 <informaltable frame="all">
26035 <tgroup cols="4" colsep="0" rowsep="0">
26036 <colspec colwidth="8*" align="left"/>
26037 <colspec colwidth="6*" align="center"/>
26038 <colspec colwidth="6*" align="center"/>
26039 <colspec colwidth="6*" align="right"/>
26040 <tbody>
26041 <row>
26042 <entry><option>message_body_visible</option></entry>
26043 <entry>Use: <emphasis>main</emphasis></entry>
26044 <entry>Type: <emphasis>integer</emphasis></entry>
26045 <entry>Default: <emphasis>500</emphasis></entry>
26046 </row>
26047 </tbody>
26048 </tgroup>
26049 </informaltable>
26050 <para>
26051 <indexterm role="concept">
26052 <primary>body of message</primary>
26053 <secondary>visible size</secondary>
26054 </indexterm>
26055 <indexterm role="concept">
26056 <primary>message body</primary>
26057 <secondary>visible size</secondary>
26058 </indexterm>
26059 <indexterm role="variable">
26060 <primary><varname>$message_body</varname></primary>
26061 </indexterm>
26062 <indexterm role="variable">
26063 <primary><varname>$message_body_end</varname></primary>
26064 </indexterm>
26065 This option specifies how much of a message&#x2019;s body is to be included in the
26066 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
26067 </para>
26068 <para>
26069 <indexterm role="option">
26070 <primary><option>message_id_header_domain</option></primary>
26071 </indexterm>
26072 </para>
26073 <informaltable frame="all">
26074 <tgroup cols="4" colsep="0" rowsep="0">
26075 <colspec colwidth="8*" align="left"/>
26076 <colspec colwidth="6*" align="center"/>
26077 <colspec colwidth="6*" align="center"/>
26078 <colspec colwidth="6*" align="right"/>
26079 <tbody>
26080 <row>
26081 <entry><option>message_id_header_domain</option></entry>
26082 <entry>Use: <emphasis>main</emphasis></entry>
26083 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26084 <entry>Default: <emphasis>unset</emphasis></entry>
26085 </row>
26086 </tbody>
26087 </tgroup>
26088 </informaltable>
26089 <para>
26090 <indexterm role="concept">
26091 <primary><emphasis>Message-ID:</emphasis> header line</primary>
26092 </indexterm>
26093 If this option is set, the string is expanded and used as the right hand side
26094 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
26095 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
26096 means <quote>not received over TCP/IP.</quote>
26097 Otherwise, the primary host name is used.
26098 Only letters, digits, dot and hyphen are accepted; any other characters are
26099 replaced by hyphens. If the expansion is forced to fail, or if the result is an
26100 empty string, the option is ignored.
26101 </para>
26102 <para>
26103 <indexterm role="option">
26104 <primary><option>message_id_header_text</option></primary>
26105 </indexterm>
26106 </para>
26107 <informaltable frame="all">
26108 <tgroup cols="4" colsep="0" rowsep="0">
26109 <colspec colwidth="8*" align="left"/>
26110 <colspec colwidth="6*" align="center"/>
26111 <colspec colwidth="6*" align="center"/>
26112 <colspec colwidth="6*" align="right"/>
26113 <tbody>
26114 <row>
26115 <entry><option>message_id_header_text</option></entry>
26116 <entry>Use: <emphasis>main</emphasis></entry>
26117 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26118 <entry>Default: <emphasis>unset</emphasis></entry>
26119 </row>
26120 </tbody>
26121 </tgroup>
26122 </informaltable>
26123 <para>
26124 If this variable is set, the string is expanded and used to augment the text of
26125 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
26126 message does not have one. The text of this header is required by RFC 2822 to
26127 take the form of an address. By default, Exim uses its internal message id as
26128 the local part, and the primary host name as the domain. If this option is set,
26129 it is expanded, and provided the expansion is not forced to fail, and does not
26130 yield an empty string, the result is inserted into the header immediately
26131 before the @, separated from the internal message id by a dot. Any characters
26132 that are illegal in an address are automatically converted into hyphens. This
26133 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
26134 colons will become hyphens.
26135 </para>
26136 <para>
26137 <indexterm role="option">
26138 <primary><option>message_logs</option></primary>
26139 </indexterm>
26140 </para>
26141 <informaltable frame="all">
26142 <tgroup cols="4" colsep="0" rowsep="0">
26143 <colspec colwidth="8*" align="left"/>
26144 <colspec colwidth="6*" align="center"/>
26145 <colspec colwidth="6*" align="center"/>
26146 <colspec colwidth="6*" align="right"/>
26147 <tbody>
26148 <row>
26149 <entry><option>message_logs</option></entry>
26150 <entry>Use: <emphasis>main</emphasis></entry>
26151 <entry>Type: <emphasis>boolean</emphasis></entry>
26152 <entry>Default: <emphasis>true</emphasis></entry>
26153 </row>
26154 </tbody>
26155 </tgroup>
26156 </informaltable>
26157 <para>
26158 <indexterm role="concept">
26159 <primary>message logs</primary>
26160 <secondary>disabling</secondary>
26161 </indexterm>
26162 <indexterm role="concept">
26163 <primary>log</primary>
26164 <secondary>message log; disabling</secondary>
26165 </indexterm>
26166 If this option is turned off, per-message log files are not created in the
26167 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
26168 Exim, by reducing the number of files involved in handling a message from a
26169 minimum of four (header spool file, body spool file, delivery journal, and
26170 per-message log) to three. The other major I/O activity is Exim&#x2019;s main log,
26171 which is not affected by this option.
26172 </para>
26173 <para>
26174 <indexterm role="option">
26175 <primary><option>message_size_limit</option></primary>
26176 </indexterm>
26177 </para>
26178 <informaltable frame="all">
26179 <tgroup cols="4" colsep="0" rowsep="0">
26180 <colspec colwidth="8*" align="left"/>
26181 <colspec colwidth="6*" align="center"/>
26182 <colspec colwidth="6*" align="center"/>
26183 <colspec colwidth="6*" align="right"/>
26184 <tbody>
26185 <row>
26186 <entry><option>message_size_limit</option></entry>
26187 <entry>Use: <emphasis>main</emphasis></entry>
26188 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26189 <entry>Default: <emphasis>50M</emphasis></entry>
26190 </row>
26191 </tbody>
26192 </tgroup>
26193 </informaltable>
26194 <para>
26195 <indexterm role="concept">
26196 <primary>message</primary>
26197 <secondary>size limit</secondary>
26198 </indexterm>
26199 <indexterm role="concept">
26200 <primary>limit</primary>
26201 <secondary>message size</secondary>
26202 </indexterm>
26203 <indexterm role="concept">
26204 <primary>size</primary>
26205 <secondary>of message, limit</secondary>
26206 </indexterm>
26207 This option limits the maximum size of message that Exim will process. The
26208 value is expanded for each incoming connection so, for example, it can be made
26209 to depend on the IP address of the remote host for messages arriving via
26210 TCP/IP. After expansion, the value must be a sequence of decimal digits,
26211 optionally followed by K or M.
26212 </para>
26213 <para>
26214 <emphasis role="bold">Note</emphasis>: This limit cannot be made to depend on a message&#x2019;s sender or any
26215 other properties of an individual message, because it has to be advertised in
26216 the server&#x2019;s response to EHLO. String expansion failure causes a temporary
26217 error. A value of zero means no limit, but its use is not recommended. See also
26218 <option>bounce_return_size_limit</option>.
26219 </para>
26220 <para>
26221 Incoming SMTP messages are failed with a 552 error if the limit is
26222 exceeded; locally-generated messages either get a stderr message or a delivery
26223 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
26224 an oversized message is logged in both the main and the reject logs. See also
26225 the generic transport option <option>message_size_limit</option>, which limits the size of
26226 message that an individual transport can process.
26227 </para>
26228 <para>
26229 If you use a virus-scanner and set this option to to a value larger than the
26230 maximum size that your virus-scanner is configured to support, you may get
26231 failures triggered by large mails.  The right size to configure for the
26232 virus-scanner depends upon what data is passed and the options in use but it&#x2019;s
26233 probably safest to just set it to a little larger than this value.  Eg, with a
26234 default Exim message size of 50M and a default ClamAV StreamMaxLength of 10M,
26235 some problems may result.
26236 </para>
26237 <para>
26238 A value of 0 will disable size limit checking; Exim will still advertise the
26239 SIZE extension in an EHLO response, but without a limit, so as to permit
26240 SMTP clients to still indicate the message size along with the MAIL verb.
26241 </para>
26242 <para>
26243 <indexterm role="option">
26244 <primary><option>move_frozen_messages</option></primary>
26245 </indexterm>
26246 </para>
26247 <informaltable frame="all">
26248 <tgroup cols="4" colsep="0" rowsep="0">
26249 <colspec colwidth="8*" align="left"/>
26250 <colspec colwidth="6*" align="center"/>
26251 <colspec colwidth="6*" align="center"/>
26252 <colspec colwidth="6*" align="right"/>
26253 <tbody>
26254 <row>
26255 <entry><option>move_frozen_messages</option></entry>
26256 <entry>Use: <emphasis>main</emphasis></entry>
26257 <entry>Type: <emphasis>boolean</emphasis></entry>
26258 <entry>Default: <emphasis>false</emphasis></entry>
26259 </row>
26260 </tbody>
26261 </tgroup>
26262 </informaltable>
26263 <para>
26264 <indexterm role="concept">
26265 <primary>frozen messages</primary>
26266 <secondary>moving</secondary>
26267 </indexterm>
26268 This option, which is available only if Exim has been built with the setting
26269 </para>
26270 <literallayout class="monospaced">
26271 SUPPORT_MOVE_FROZEN_MESSAGES=yes
26272 </literallayout>
26273 <para>
26274 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
26275 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
26276 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
26277 standard utilities for handling such moved messages, and they do not show up in
26278 lists generated by <option>-bp</option> or by the Exim monitor.
26279 </para>
26280 <para>
26281 <indexterm role="option">
26282 <primary><option>mua_wrapper</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>mua_wrapper</option></entry>
26294 <entry>Use: <emphasis>main</emphasis></entry>
26295 <entry>Type: <emphasis>boolean</emphasis></entry>
26296 <entry>Default: <emphasis>false</emphasis></entry>
26297 </row>
26298 </tbody>
26299 </tgroup>
26300 </informaltable>
26301 <para>
26302 Setting this option true causes Exim to run in a very restrictive mode in which
26303 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
26304 contains a full description of this facility.
26305 </para>
26306 <para>
26307 <indexterm role="option">
26308 <primary><option>mysql_servers</option></primary>
26309 </indexterm>
26310 </para>
26311 <informaltable frame="all">
26312 <tgroup cols="4" colsep="0" rowsep="0">
26313 <colspec colwidth="8*" align="left"/>
26314 <colspec colwidth="6*" align="center"/>
26315 <colspec colwidth="6*" align="center"/>
26316 <colspec colwidth="6*" align="right"/>
26317 <tbody>
26318 <row>
26319 <entry><option>mysql_servers</option></entry>
26320 <entry>Use: <emphasis>main</emphasis></entry>
26321 <entry>Type: <emphasis>string list</emphasis></entry>
26322 <entry>Default: <emphasis>unset</emphasis></entry>
26323 </row>
26324 </tbody>
26325 </tgroup>
26326 </informaltable>
26327 <para>
26328 <indexterm role="concept">
26329 <primary>MySQL</primary>
26330 <secondary>server list</secondary>
26331 </indexterm>
26332 This option provides a list of MySQL servers and associated connection data, to
26333 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECID72"/>). The
26334 option is available only if Exim has been built with MySQL support.
26335 </para>
26336 <para>
26337 <indexterm role="option">
26338 <primary><option>never_users</option></primary>
26339 </indexterm>
26340 </para>
26341 <informaltable frame="all">
26342 <tgroup cols="4" colsep="0" rowsep="0">
26343 <colspec colwidth="8*" align="left"/>
26344 <colspec colwidth="6*" align="center"/>
26345 <colspec colwidth="6*" align="center"/>
26346 <colspec colwidth="6*" align="right"/>
26347 <tbody>
26348 <row>
26349 <entry><option>never_users</option></entry>
26350 <entry>Use: <emphasis>main</emphasis></entry>
26351 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
26352 <entry>Default: <emphasis>unset</emphasis></entry>
26353 </row>
26354 </tbody>
26355 </tgroup>
26356 </informaltable>
26357 <para>
26358 This option is expanded just once, at the start of Exim&#x2019;s processing. Local
26359 message deliveries are normally run in processes that are setuid to the
26360 recipient, and remote deliveries are normally run under Exim&#x2019;s own uid and gid.
26361 It is usually desirable to prevent any deliveries from running as root, as a
26362 safety precaution.
26363 </para>
26364 <para>
26365 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
26366 list of users that must not be used for local deliveries. This list is fixed in
26367 the binary and cannot be overridden by the configuration file. By default, it
26368 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
26369 can be used to add more users to the fixed list.
26370 </para>
26371 <para>
26372 If a message is to be delivered as one of the users on the fixed list or the
26373 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
26374 example is
26375 </para>
26376 <literallayout class="monospaced">
26377 never_users = root:daemon:bin
26378 </literallayout>
26379 <para>
26380 Including root is redundant if it is also on the fixed list, but it does no
26381 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
26382 transport driver.
26383 </para>
26384 <para>
26385 <indexterm role="option">
26386 <primary><option>openssl_options</option></primary>
26387 </indexterm>
26388 </para>
26389 <informaltable frame="all">
26390 <tgroup cols="4" colsep="0" rowsep="0">
26391 <colspec colwidth="8*" align="left"/>
26392 <colspec colwidth="6*" align="center"/>
26393 <colspec colwidth="6*" align="center"/>
26394 <colspec colwidth="6*" align="right"/>
26395 <tbody>
26396 <row>
26397 <entry><option>openssl_options</option></entry>
26398 <entry>Use: <emphasis>main</emphasis></entry>
26399 <entry>Type: <emphasis>string list</emphasis></entry>
26400 <entry>Default: <emphasis>+no_sslv2</emphasis></entry>
26401 </row>
26402 </tbody>
26403 </tgroup>
26404 </informaltable>
26405 <para>
26406 <indexterm role="concept">
26407 <primary>OpenSSL </primary>
26408 <secondary>compatibility</secondary>
26409 </indexterm>
26410 This option allows an administrator to adjust the SSL options applied
26411 by OpenSSL to connections.  It is given as a space-separated list of items,
26412 each one to be +added or -subtracted from the current value.
26413 </para>
26414 <para>
26415 This option is only available if Exim is built against OpenSSL.  The values
26416 available for this option vary according to the age of your OpenSSL install.
26417 The <quote>all</quote> value controls a subset of flags which are available, typically
26418 the bug workaround options.  The <emphasis>SSL_CTX_set_options</emphasis> man page will
26419 list the values known on your system and Exim should support all the
26420 <quote>bug workaround</quote> options and many of the <quote>modifying</quote> options.  The Exim
26421 names lose the leading <quote>SSL_OP_</quote> and are lower-cased.
26422 </para>
26423 <para>
26424 Note that adjusting the options can have severe impact upon the security of
26425 SSL as used by Exim.  It is possible to disable safety checks and shoot
26426 yourself in the foot in various unpleasant ways.  This option should not be
26427 adjusted lightly.  An unrecognised item will be detected at startup, by
26428 invoking Exim with the <option>-bV</option> flag.
26429 </para>
26430 <para>
26431 The option affects Exim operating both as a server and as a client.
26432 </para>
26433 <para>
26434 Historical note: prior to release 4.80, Exim defaulted this value to
26435 "+dont_insert_empty_fragments", which may still be needed for compatibility
26436 with some clients, but which lowers security by increasing exposure to
26437 some now infamous attacks.
26438 </para>
26439 <para>
26440 Examples:
26441 </para>
26442 <literallayout class="monospaced">
26443 # Make both old MS and old Eudora happy:
26444 openssl_options = -all +microsoft_big_sslv3_buffer \
26445                        +dont_insert_empty_fragments
26446
26447 # Disable older protocol versions:
26448 openssl_options = +no_sslv2 +no_sslv3
26449 </literallayout>
26450 <para>
26451 Possible options may include:
26452 </para>
26453 <itemizedlist>
26454 <listitem>
26455 <para>
26456 <literal>all</literal>
26457 </para>
26458 </listitem>
26459 <listitem>
26460 <para>
26461 <literal>allow_unsafe_legacy_renegotiation</literal>
26462 </para>
26463 </listitem>
26464 <listitem>
26465 <para>
26466 <literal>cipher_server_preference</literal>
26467 </para>
26468 </listitem>
26469 <listitem>
26470 <para>
26471 <literal>dont_insert_empty_fragments</literal>
26472 </para>
26473 </listitem>
26474 <listitem>
26475 <para>
26476 <literal>ephemeral_rsa</literal>
26477 </para>
26478 </listitem>
26479 <listitem>
26480 <para>
26481 <literal>legacy_server_connect</literal>
26482 </para>
26483 </listitem>
26484 <listitem>
26485 <para>
26486 <literal>microsoft_big_sslv3_buffer</literal>
26487 </para>
26488 </listitem>
26489 <listitem>
26490 <para>
26491 <literal>microsoft_sess_id_bug</literal>
26492 </para>
26493 </listitem>
26494 <listitem>
26495 <para>
26496 <literal>msie_sslv2_rsa_padding</literal>
26497 </para>
26498 </listitem>
26499 <listitem>
26500 <para>
26501 <literal>netscape_challenge_bug</literal>
26502 </para>
26503 </listitem>
26504 <listitem>
26505 <para>
26506 <literal>netscape_reuse_cipher_change_bug</literal>
26507 </para>
26508 </listitem>
26509 <listitem>
26510 <para>
26511 <literal>no_compression</literal>
26512 </para>
26513 </listitem>
26514 <listitem>
26515 <para>
26516 <literal>no_session_resumption_on_renegotiation</literal>
26517 </para>
26518 </listitem>
26519 <listitem>
26520 <para>
26521 <literal>no_sslv2</literal>
26522 </para>
26523 </listitem>
26524 <listitem>
26525 <para>
26526 <literal>no_sslv3</literal>
26527 </para>
26528 </listitem>
26529 <listitem>
26530 <para>
26531 <literal>no_ticket</literal>
26532 </para>
26533 </listitem>
26534 <listitem>
26535 <para>
26536 <literal>no_tlsv1</literal>
26537 </para>
26538 </listitem>
26539 <listitem>
26540 <para>
26541 <literal>no_tlsv1_1</literal>
26542 </para>
26543 </listitem>
26544 <listitem>
26545 <para>
26546 <literal>no_tlsv1_2</literal>
26547 </para>
26548 </listitem>
26549 <listitem>
26550 <para>
26551 <literal>safari_ecdhe_ecdsa_bug</literal>
26552 </para>
26553 </listitem>
26554 <listitem>
26555 <para>
26556 <literal>single_dh_use</literal>
26557 </para>
26558 </listitem>
26559 <listitem>
26560 <para>
26561 <literal>single_ecdh_use</literal>
26562 </para>
26563 </listitem>
26564 <listitem>
26565 <para>
26566 <literal>ssleay_080_client_dh_bug</literal>
26567 </para>
26568 </listitem>
26569 <listitem>
26570 <para>
26571 <literal>sslref2_reuse_cert_type_bug</literal>
26572 </para>
26573 </listitem>
26574 <listitem>
26575 <para>
26576 <literal>tls_block_padding_bug</literal>
26577 </para>
26578 </listitem>
26579 <listitem>
26580 <para>
26581 <literal>tls_d5_bug</literal>
26582 </para>
26583 </listitem>
26584 <listitem>
26585 <para>
26586 <literal>tls_rollback_bug</literal>
26587 </para>
26588 </listitem>
26589 </itemizedlist>
26590 <para>
26591 As an aside, the <literal>safari_ecdhe_ecdsa_bug</literal> item is a misnomer and affects
26592 all clients connecting using the MacOS SecureTransport TLS facility prior
26593 to MacOS 10.8.4, including email clients.  If you see old MacOS clients failing
26594 to negotiate TLS then this option value might help, provided that your OpenSSL
26595 release is new enough to contain this work-around.  This may be a situation
26596 where you have to upgrade OpenSSL to get buggy clients working.
26597 </para>
26598 <para>
26599 <indexterm role="option">
26600 <primary><option>oracle_servers</option></primary>
26601 </indexterm>
26602 </para>
26603 <informaltable frame="all">
26604 <tgroup cols="4" colsep="0" rowsep="0">
26605 <colspec colwidth="8*" align="left"/>
26606 <colspec colwidth="6*" align="center"/>
26607 <colspec colwidth="6*" align="center"/>
26608 <colspec colwidth="6*" align="right"/>
26609 <tbody>
26610 <row>
26611 <entry><option>oracle_servers</option></entry>
26612 <entry>Use: <emphasis>main</emphasis></entry>
26613 <entry>Type: <emphasis>string list</emphasis></entry>
26614 <entry>Default: <emphasis>unset</emphasis></entry>
26615 </row>
26616 </tbody>
26617 </tgroup>
26618 </informaltable>
26619 <para>
26620 <indexterm role="concept">
26621 <primary>Oracle</primary>
26622 <secondary>server list</secondary>
26623 </indexterm>
26624 This option provides a list of Oracle servers and associated connection data,
26625 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECID72"/>).
26626 The option is available only if Exim has been built with Oracle support.
26627 </para>
26628 <para>
26629 <indexterm role="option">
26630 <primary><option>percent_hack_domains</option></primary>
26631 </indexterm>
26632 </para>
26633 <informaltable frame="all">
26634 <tgroup cols="4" colsep="0" rowsep="0">
26635 <colspec colwidth="8*" align="left"/>
26636 <colspec colwidth="6*" align="center"/>
26637 <colspec colwidth="6*" align="center"/>
26638 <colspec colwidth="6*" align="right"/>
26639 <tbody>
26640 <row>
26641 <entry><option>percent_hack_domains</option></entry>
26642 <entry>Use: <emphasis>main</emphasis></entry>
26643 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
26644 <entry>Default: <emphasis>unset</emphasis></entry>
26645 </row>
26646 </tbody>
26647 </tgroup>
26648 </informaltable>
26649 <para>
26650 <indexterm role="concept">
26651 <primary><quote>percent hack</quote></primary>
26652 </indexterm>
26653 <indexterm role="concept">
26654 <primary>source routing</primary>
26655 <secondary>in email address</secondary>
26656 </indexterm>
26657 <indexterm role="concept">
26658 <primary>address</primary>
26659 <secondary>source-routed</secondary>
26660 </indexterm>
26661 The <quote>percent hack</quote> is the convention whereby a local part containing a
26662 percent sign is re-interpreted as a new email address, with the percent
26663 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
26664 also applied to RFC 2822 addresses that begin with an @ character. If this
26665 option is set, Exim implements the percent facility for those domains listed,
26666 but no others. This happens before an incoming SMTP address is tested against
26667 an ACL.
26668 </para>
26669 <para>
26670 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
26671 trying to get round relaying restrictions. For this reason, it is best avoided
26672 if at all possible. Unfortunately, a number of less security-conscious MTAs
26673 implement it unconditionally. If you are running Exim on a gateway host, and
26674 routing mail through to internal MTAs without processing the local parts, it is
26675 a good idea to reject recipient addresses with percent characters in their
26676 local parts. Exim&#x2019;s default configuration does this.
26677 </para>
26678 <para>
26679 <indexterm role="option">
26680 <primary><option>perl_at_start</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>perl_at_start</option></entry>
26692 <entry>Use: <emphasis>main</emphasis></entry>
26693 <entry>Type: <emphasis>boolean</emphasis></entry>
26694 <entry>Default: <emphasis>false</emphasis></entry>
26695 </row>
26696 </tbody>
26697 </tgroup>
26698 </informaltable>
26699 <para>
26700 This option is available only when Exim is built with an embedded Perl
26701 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
26702 </para>
26703 <para>
26704 <indexterm role="option">
26705 <primary><option>perl_startup</option></primary>
26706 </indexterm>
26707 </para>
26708 <informaltable frame="all">
26709 <tgroup cols="4" colsep="0" rowsep="0">
26710 <colspec colwidth="8*" align="left"/>
26711 <colspec colwidth="6*" align="center"/>
26712 <colspec colwidth="6*" align="center"/>
26713 <colspec colwidth="6*" align="right"/>
26714 <tbody>
26715 <row>
26716 <entry><option>perl_startup</option></entry>
26717 <entry>Use: <emphasis>main</emphasis></entry>
26718 <entry>Type: <emphasis>string</emphasis></entry>
26719 <entry>Default: <emphasis>unset</emphasis></entry>
26720 </row>
26721 </tbody>
26722 </tgroup>
26723 </informaltable>
26724 <para>
26725 This option is available only when Exim is built with an embedded Perl
26726 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
26727 </para>
26728 <para>
26729 <indexterm role="option">
26730 <primary><option>pgsql_servers</option></primary>
26731 </indexterm>
26732 </para>
26733 <informaltable frame="all">
26734 <tgroup cols="4" colsep="0" rowsep="0">
26735 <colspec colwidth="8*" align="left"/>
26736 <colspec colwidth="6*" align="center"/>
26737 <colspec colwidth="6*" align="center"/>
26738 <colspec colwidth="6*" align="right"/>
26739 <tbody>
26740 <row>
26741 <entry><option>pgsql_servers</option></entry>
26742 <entry>Use: <emphasis>main</emphasis></entry>
26743 <entry>Type: <emphasis>string list</emphasis></entry>
26744 <entry>Default: <emphasis>unset</emphasis></entry>
26745 </row>
26746 </tbody>
26747 </tgroup>
26748 </informaltable>
26749 <para>
26750 <indexterm role="concept">
26751 <primary>PostgreSQL lookup type</primary>
26752 <secondary>server list</secondary>
26753 </indexterm>
26754 This option provides a list of PostgreSQL servers and associated connection
26755 data, to be used in conjunction with <command>pgsql</command> lookups (see section
26756 <xref linkend="SECID72"/>). The option is available only if Exim has been built with
26757 PostgreSQL support.
26758 </para>
26759 <para>
26760 <indexterm role="option">
26761 <primary><option>pid_file_path</option></primary>
26762 </indexterm>
26763 </para>
26764 <informaltable frame="all">
26765 <tgroup cols="4" colsep="0" rowsep="0">
26766 <colspec colwidth="8*" align="left"/>
26767 <colspec colwidth="6*" align="center"/>
26768 <colspec colwidth="6*" align="center"/>
26769 <colspec colwidth="6*" align="right"/>
26770 <tbody>
26771 <row>
26772 <entry><option>pid_file_path</option></entry>
26773 <entry>Use: <emphasis>main</emphasis></entry>
26774 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26775 <entry>Default: <emphasis>set at compile time</emphasis></entry>
26776 </row>
26777 </tbody>
26778 </tgroup>
26779 </informaltable>
26780 <para>
26781 <indexterm role="concept">
26782 <primary>daemon</primary>
26783 <secondary>pid file path</secondary>
26784 </indexterm>
26785 <indexterm role="concept">
26786 <primary>pid file, path for</primary>
26787 </indexterm>
26788 This option sets the name of the file to which the Exim daemon writes its
26789 process id. The string is expanded, so it can contain, for example, references
26790 to the host name:
26791 </para>
26792 <literallayout class="monospaced">
26793 pid_file_path = /var/log/$primary_hostname/exim.pid
26794 </literallayout>
26795 <para>
26796 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim&#x2019;s
26797 spool directory.
26798 The value set by the option can be overridden by the <option>-oP</option> command line
26799 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
26800 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
26801 </para>
26802 <para>
26803 <indexterm role="option">
26804 <primary><option>pipelining_advertise_hosts</option></primary>
26805 </indexterm>
26806 </para>
26807 <informaltable frame="all">
26808 <tgroup cols="4" colsep="0" rowsep="0">
26809 <colspec colwidth="8*" align="left"/>
26810 <colspec colwidth="6*" align="center"/>
26811 <colspec colwidth="6*" align="center"/>
26812 <colspec colwidth="6*" align="right"/>
26813 <tbody>
26814 <row>
26815 <entry><option>pipelining_advertise_hosts</option></entry>
26816 <entry>Use: <emphasis>main</emphasis></entry>
26817 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26818 <entry>Default: <emphasis>*</emphasis></entry>
26819 </row>
26820 </tbody>
26821 </tgroup>
26822 </informaltable>
26823 <para>
26824 <indexterm role="concept">
26825 <primary>PIPELINING</primary>
26826 <secondary>suppressing advertising</secondary>
26827 </indexterm>
26828 This option can be used to suppress the advertisement of the SMTP
26829 PIPELINING extension to specific hosts. See also the <emphasis role="bold">no_pipelining</emphasis>
26830 control in section <xref linkend="SECTcontrols"/>. When PIPELINING is not advertised and
26831 <option>smtp_enforce_sync</option> is true, an Exim server enforces strict synchronization
26832 for each SMTP command and response. When PIPELINING is advertised, Exim assumes
26833 that clients will use it; <quote>out of order</quote> commands that are <quote>expected</quote> do
26834 not count as protocol errors (see <option>smtp_max_synprot_errors</option>).
26835 </para>
26836 <para>
26837 <indexterm role="option">
26838 <primary><option>prdr_enable</option></primary>
26839 </indexterm>
26840 </para>
26841 <informaltable frame="all">
26842 <tgroup cols="4" colsep="0" rowsep="0">
26843 <colspec colwidth="8*" align="left"/>
26844 <colspec colwidth="6*" align="center"/>
26845 <colspec colwidth="6*" align="center"/>
26846 <colspec colwidth="6*" align="right"/>
26847 <tbody>
26848 <row>
26849 <entry><option>prdr_enable</option></entry>
26850 <entry>Use: <emphasis>main</emphasis></entry>
26851 <entry>Type: <emphasis>boolean</emphasis></entry>
26852 <entry>Default: <emphasis>false</emphasis></entry>
26853 </row>
26854 </tbody>
26855 </tgroup>
26856 </informaltable>
26857 <para>
26858 <indexterm role="concept">
26859 <primary>PRDR</primary>
26860 <secondary>enabling on server</secondary>
26861 </indexterm>
26862 This option can be used to enable the Per-Recipient Data Response extension
26863 to SMTP, defined by Eric Hall.
26864 If the option is set, PRDR is advertised by Exim when operating as a server.
26865 If the client requests PRDR, and more than one recipient, for a message 
26866 an additional ACL is called for each recipient after the message content
26867 is recieved.  See section <xref linkend="SECTPRDRACL"/>.
26868 </para>
26869 <para>
26870 <indexterm role="option">
26871 <primary><option>preserve_message_logs</option></primary>
26872 </indexterm>
26873 </para>
26874 <informaltable frame="all">
26875 <tgroup cols="4" colsep="0" rowsep="0">
26876 <colspec colwidth="8*" align="left"/>
26877 <colspec colwidth="6*" align="center"/>
26878 <colspec colwidth="6*" align="center"/>
26879 <colspec colwidth="6*" align="right"/>
26880 <tbody>
26881 <row>
26882 <entry><option>preserve_message_logs</option></entry>
26883 <entry>Use: <emphasis>main</emphasis></entry>
26884 <entry>Type: <emphasis>boolean</emphasis></entry>
26885 <entry>Default: <emphasis>false</emphasis></entry>
26886 </row>
26887 </tbody>
26888 </tgroup>
26889 </informaltable>
26890 <para>
26891 <indexterm role="concept">
26892 <primary>message logs</primary>
26893 <secondary>preserving</secondary>
26894 </indexterm>
26895 If this option is set, message log files are not deleted when messages are
26896 completed. Instead, they are moved to a sub-directory of the spool directory
26897 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
26898 purposes. This is a dangerous option to set on systems with any appreciable
26899 volume of mail. Use with care!
26900 </para>
26901 <para>
26902 <indexterm role="option">
26903 <primary><option>primary_hostname</option></primary>
26904 </indexterm>
26905 </para>
26906 <informaltable frame="all">
26907 <tgroup cols="4" colsep="0" rowsep="0">
26908 <colspec colwidth="8*" align="left"/>
26909 <colspec colwidth="6*" align="center"/>
26910 <colspec colwidth="6*" align="center"/>
26911 <colspec colwidth="6*" align="right"/>
26912 <tbody>
26913 <row>
26914 <entry><option>primary_hostname</option></entry>
26915 <entry>Use: <emphasis>main</emphasis></entry>
26916 <entry>Type: <emphasis>string</emphasis></entry>
26917 <entry>Default: <emphasis>see below</emphasis></entry>
26918 </row>
26919 </tbody>
26920 </tgroup>
26921 </informaltable>
26922 <para>
26923 <indexterm role="concept">
26924 <primary>name</primary>
26925 <secondary>of local host</secondary>
26926 </indexterm>
26927 <indexterm role="concept">
26928 <primary>host</primary>
26929 <secondary>name of local</secondary>
26930 </indexterm>
26931 <indexterm role="concept">
26932 <primary>local host</primary>
26933 <secondary>name of</secondary>
26934 </indexterm>
26935 <indexterm role="variable">
26936 <primary><varname>$primary_hostname</varname></primary>
26937 </indexterm>
26938 This specifies the name of the current host. It is used in the default EHLO or
26939 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
26940 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
26941 The value is also used by default in some SMTP response messages from an Exim
26942 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
26943 </para>
26944 <para>
26945 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
26946 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
26947 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
26948 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
26949 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
26950 explicitly by this option, or defaulted.
26951 </para>
26952 <para>
26953 <indexterm role="option">
26954 <primary><option>print_topbitchars</option></primary>
26955 </indexterm>
26956 </para>
26957 <informaltable frame="all">
26958 <tgroup cols="4" colsep="0" rowsep="0">
26959 <colspec colwidth="8*" align="left"/>
26960 <colspec colwidth="6*" align="center"/>
26961 <colspec colwidth="6*" align="center"/>
26962 <colspec colwidth="6*" align="right"/>
26963 <tbody>
26964 <row>
26965 <entry><option>print_topbitchars</option></entry>
26966 <entry>Use: <emphasis>main</emphasis></entry>
26967 <entry>Type: <emphasis>boolean</emphasis></entry>
26968 <entry>Default: <emphasis>false</emphasis></entry>
26969 </row>
26970 </tbody>
26971 </tgroup>
26972 </informaltable>
26973 <para>
26974 <indexterm role="concept">
26975 <primary>printing characters</primary>
26976 </indexterm>
26977 <indexterm role="concept">
26978 <primary>8-bit characters</primary>
26979 </indexterm>
26980 By default, Exim considers only those characters whose codes lie in the range
26981 32&ndash;126 to be printing characters. In a number of circumstances (for example,
26982 when writing log entries) non-printing characters are converted into escape
26983 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
26984 is set, code values of 128 and above are also considered to be printing
26985 characters.
26986 </para>
26987 <para>
26988 This option also affects the header syntax checks performed by the
26989 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
26990 the user&#x2019;s full name when constructing From: and Sender: addresses (as
26991 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
26992 Exim to generate eight bit message headers that do not conform to the
26993 standards.
26994 </para>
26995 <para>
26996 <indexterm role="option">
26997 <primary><option>process_log_path</option></primary>
26998 </indexterm>
26999 </para>
27000 <informaltable frame="all">
27001 <tgroup cols="4" colsep="0" rowsep="0">
27002 <colspec colwidth="8*" align="left"/>
27003 <colspec colwidth="6*" align="center"/>
27004 <colspec colwidth="6*" align="center"/>
27005 <colspec colwidth="6*" align="right"/>
27006 <tbody>
27007 <row>
27008 <entry><option>process_log_path</option></entry>
27009 <entry>Use: <emphasis>main</emphasis></entry>
27010 <entry>Type: <emphasis>string</emphasis></entry>
27011 <entry>Default: <emphasis>unset</emphasis></entry>
27012 </row>
27013 </tbody>
27014 </tgroup>
27015 </informaltable>
27016 <para>
27017 <indexterm role="concept">
27018 <primary>process log path</primary>
27019 </indexterm>
27020 <indexterm role="concept">
27021 <primary>log</primary>
27022 <secondary>process log</secondary>
27023 </indexterm>
27024 <indexterm role="concept">
27025 <primary><emphasis>exiwhat</emphasis></primary>
27026 </indexterm>
27027 This option sets the name of the file to which an Exim process writes its
27028 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
27029 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
27030 in Exim&#x2019;s spool directory is used. The ability to specify the name explicitly
27031 can be useful in environments where two different Exims are running, using
27032 different spool directories.
27033 </para>
27034 <para>
27035 <indexterm role="option">
27036 <primary><option>prod_requires_admin</option></primary>
27037 </indexterm>
27038 </para>
27039 <informaltable frame="all">
27040 <tgroup cols="4" colsep="0" rowsep="0">
27041 <colspec colwidth="8*" align="left"/>
27042 <colspec colwidth="6*" align="center"/>
27043 <colspec colwidth="6*" align="center"/>
27044 <colspec colwidth="6*" align="right"/>
27045 <tbody>
27046 <row>
27047 <entry><option>prod_requires_admin</option></entry>
27048 <entry>Use: <emphasis>main</emphasis></entry>
27049 <entry>Type: <emphasis>boolean</emphasis></entry>
27050 <entry>Default: <emphasis>true</emphasis></entry>
27051 </row>
27052 </tbody>
27053 </tgroup>
27054 </informaltable>
27055 <para>
27056 <indexterm role="option">
27057 <primary><option>-M</option></primary>
27058 </indexterm>
27059 <indexterm role="option">
27060 <primary><option>-R</option></primary>
27061 </indexterm>
27062 <indexterm role="option">
27063 <primary><option>-q</option></primary>
27064 </indexterm>
27065 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
27066 admin user unless <option>prod_requires_admin</option> is set false. See also
27067 <option>queue_list_requires_admin</option>.
27068 </para>
27069 <para>
27070 <indexterm role="option">
27071 <primary><option>qualify_domain</option></primary>
27072 </indexterm>
27073 </para>
27074 <informaltable frame="all">
27075 <tgroup cols="4" colsep="0" rowsep="0">
27076 <colspec colwidth="8*" align="left"/>
27077 <colspec colwidth="6*" align="center"/>
27078 <colspec colwidth="6*" align="center"/>
27079 <colspec colwidth="6*" align="right"/>
27080 <tbody>
27081 <row>
27082 <entry><option>qualify_domain</option></entry>
27083 <entry>Use: <emphasis>main</emphasis></entry>
27084 <entry>Type: <emphasis>string</emphasis></entry>
27085 <entry>Default: <emphasis>see below</emphasis></entry>
27086 </row>
27087 </tbody>
27088 </tgroup>
27089 </informaltable>
27090 <para>
27091 <indexterm role="concept">
27092 <primary>domain</primary>
27093 <secondary>for qualifying addresses</secondary>
27094 </indexterm>
27095 <indexterm role="concept">
27096 <primary>address</primary>
27097 <secondary>qualification</secondary>
27098 </indexterm>
27099 This option specifies the domain name that is added to any envelope sender
27100 addresses that do not have a domain qualification. It also applies to
27101 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
27102 are accepted by default only for locally-generated messages. Qualification is
27103 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
27104 locally-generated messages, unless the <option>-bnq</option> command line option is used.
27105 </para>
27106 <para>
27107 Messages from external sources must always contain fully qualified addresses,
27108 unless the sending host matches <option>sender_unqualified_hosts</option> or
27109 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
27110 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
27111 necessary. Internally, Exim always works with fully qualified envelope
27112 addresses. If <option>qualify_domain</option> is not set, it defaults to the
27113 <option>primary_hostname</option> value.
27114 </para>
27115 <para>
27116 <indexterm role="option">
27117 <primary><option>qualify_recipient</option></primary>
27118 </indexterm>
27119 </para>
27120 <informaltable frame="all">
27121 <tgroup cols="4" colsep="0" rowsep="0">
27122 <colspec colwidth="8*" align="left"/>
27123 <colspec colwidth="6*" align="center"/>
27124 <colspec colwidth="6*" align="center"/>
27125 <colspec colwidth="6*" align="right"/>
27126 <tbody>
27127 <row>
27128 <entry><option>qualify_recipient</option></entry>
27129 <entry>Use: <emphasis>main</emphasis></entry>
27130 <entry>Type: <emphasis>string</emphasis></entry>
27131 <entry>Default: <emphasis>see below</emphasis></entry>
27132 </row>
27133 </tbody>
27134 </tgroup>
27135 </informaltable>
27136 <para>
27137 This option allows you to specify a different domain for qualifying recipient
27138 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
27139 </para>
27140 <para>
27141 <indexterm role="option">
27142 <primary><option>queue_domains</option></primary>
27143 </indexterm>
27144 </para>
27145 <informaltable frame="all">
27146 <tgroup cols="4" colsep="0" rowsep="0">
27147 <colspec colwidth="8*" align="left"/>
27148 <colspec colwidth="6*" align="center"/>
27149 <colspec colwidth="6*" align="center"/>
27150 <colspec colwidth="6*" align="right"/>
27151 <tbody>
27152 <row>
27153 <entry><option>queue_domains</option></entry>
27154 <entry>Use: <emphasis>main</emphasis></entry>
27155 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27156 <entry>Default: <emphasis>unset</emphasis></entry>
27157 </row>
27158 </tbody>
27159 </tgroup>
27160 </informaltable>
27161 <para>
27162 <indexterm role="concept">
27163 <primary>domain</primary>
27164 <secondary>specifying non-immediate delivery</secondary>
27165 </indexterm>
27166 <indexterm role="concept">
27167 <primary>queueing incoming messages</primary>
27168 </indexterm>
27169 <indexterm role="concept">
27170 <primary>message</primary>
27171 <secondary>queueing certain domains</secondary>
27172 </indexterm>
27173 This option lists domains for which immediate delivery is not required.
27174 A delivery process is started whenever a message is received, but only those
27175 domains that do not match are processed. All other deliveries wait until the
27176 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
27177 </para>
27178 <para>
27179 <indexterm role="option">
27180 <primary><option>queue_list_requires_admin</option></primary>
27181 </indexterm>
27182 </para>
27183 <informaltable frame="all">
27184 <tgroup cols="4" colsep="0" rowsep="0">
27185 <colspec colwidth="8*" align="left"/>
27186 <colspec colwidth="6*" align="center"/>
27187 <colspec colwidth="6*" align="center"/>
27188 <colspec colwidth="6*" align="right"/>
27189 <tbody>
27190 <row>
27191 <entry><option>queue_list_requires_admin</option></entry>
27192 <entry>Use: <emphasis>main</emphasis></entry>
27193 <entry>Type: <emphasis>boolean</emphasis></entry>
27194 <entry>Default: <emphasis>true</emphasis></entry>
27195 </row>
27196 </tbody>
27197 </tgroup>
27198 </informaltable>
27199 <para>
27200 <indexterm role="option">
27201 <primary><option>-bp</option></primary>
27202 </indexterm>
27203 The <option>-bp</option> command-line option, which lists the messages that are on the
27204 queue, requires the caller to be an admin user unless
27205 <option>queue_list_requires_admin</option> is set false. See also <option>prod_requires_admin</option>.
27206 </para>
27207 <para>
27208 <indexterm role="option">
27209 <primary><option>queue_only</option></primary>
27210 </indexterm>
27211 </para>
27212 <informaltable frame="all">
27213 <tgroup cols="4" colsep="0" rowsep="0">
27214 <colspec colwidth="8*" align="left"/>
27215 <colspec colwidth="6*" align="center"/>
27216 <colspec colwidth="6*" align="center"/>
27217 <colspec colwidth="6*" align="right"/>
27218 <tbody>
27219 <row>
27220 <entry><option>queue_only</option></entry>
27221 <entry>Use: <emphasis>main</emphasis></entry>
27222 <entry>Type: <emphasis>boolean</emphasis></entry>
27223 <entry>Default: <emphasis>false</emphasis></entry>
27224 </row>
27225 </tbody>
27226 </tgroup>
27227 </informaltable>
27228 <para>
27229 <indexterm role="concept">
27230 <primary>queueing incoming messages</primary>
27231 </indexterm>
27232 <indexterm role="concept">
27233 <primary>message</primary>
27234 <secondary>queueing unconditionally</secondary>
27235 </indexterm>
27236 If <option>queue_only</option> is set, a delivery process is not automatically started
27237 whenever a message is received. Instead, the message waits on the queue for the
27238 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
27239 delivered immediately when certain conditions (such as heavy load) occur.
27240 </para>
27241 <para>
27242 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
27243 and <option>-odi</option> command line options override <option>queue_only</option> unless
27244 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
27245 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
27246 </para>
27247 <para>
27248 <indexterm role="option">
27249 <primary><option>queue_only_file</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>queue_only_file</option></entry>
27261 <entry>Use: <emphasis>main</emphasis></entry>
27262 <entry>Type: <emphasis>string</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>queueing incoming messages</primary>
27271 </indexterm>
27272 <indexterm role="concept">
27273 <primary>message</primary>
27274 <secondary>queueing by file existence</secondary>
27275 </indexterm>
27276 This option can be set to a colon-separated list of absolute path names, each
27277 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
27278 it tests for the existence of each listed path using a call to <function>stat()</function>. For
27279 each path that exists, the corresponding queueing option is set.
27280 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
27281 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
27282 </para>
27283 <literallayout class="monospaced">
27284 queue_only_file = smtp/some/file
27285 </literallayout>
27286 <para>
27287 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
27288 <filename>/some/file</filename> exists.
27289 </para>
27290 <para>
27291 <indexterm role="option">
27292 <primary><option>queue_only_load</option></primary>
27293 </indexterm>
27294 </para>
27295 <informaltable frame="all">
27296 <tgroup cols="4" colsep="0" rowsep="0">
27297 <colspec colwidth="8*" align="left"/>
27298 <colspec colwidth="6*" align="center"/>
27299 <colspec colwidth="6*" align="center"/>
27300 <colspec colwidth="6*" align="right"/>
27301 <tbody>
27302 <row>
27303 <entry><option>queue_only_load</option></entry>
27304 <entry>Use: <emphasis>main</emphasis></entry>
27305 <entry>Type: <emphasis>fixed-point</emphasis></entry>
27306 <entry>Default: <emphasis>unset</emphasis></entry>
27307 </row>
27308 </tbody>
27309 </tgroup>
27310 </informaltable>
27311 <para>
27312 <indexterm role="concept">
27313 <primary>load average</primary>
27314 </indexterm>
27315 <indexterm role="concept">
27316 <primary>queueing incoming messages</primary>
27317 </indexterm>
27318 <indexterm role="concept">
27319 <primary>message</primary>
27320 <secondary>queueing by load</secondary>
27321 </indexterm>
27322 If the system load average is higher than this value, incoming messages from
27323 all sources are queued, and no automatic deliveries are started. If this
27324 happens during local or remote SMTP input, all subsequent messages received on
27325 the same SMTP connection are queued by default, whatever happens to the load in
27326 the meantime, but this can be changed by setting <option>queue_only_load_latch</option>
27327 false.
27328 </para>
27329 <para>
27330 Deliveries will subsequently be performed by queue runner processes. This
27331 option has no effect on ancient operating systems on which Exim cannot
27332 determine the load average. See also <option>deliver_queue_load_max</option> and
27333 <option>smtp_load_reserve</option>.
27334 </para>
27335 <para>
27336 <indexterm role="option">
27337 <primary><option>queue_only_load_latch</option></primary>
27338 </indexterm>
27339 </para>
27340 <informaltable frame="all">
27341 <tgroup cols="4" colsep="0" rowsep="0">
27342 <colspec colwidth="8*" align="left"/>
27343 <colspec colwidth="6*" align="center"/>
27344 <colspec colwidth="6*" align="center"/>
27345 <colspec colwidth="6*" align="right"/>
27346 <tbody>
27347 <row>
27348 <entry><option>queue_only_load_latch</option></entry>
27349 <entry>Use: <emphasis>main</emphasis></entry>
27350 <entry>Type: <emphasis>boolean</emphasis></entry>
27351 <entry>Default: <emphasis>true</emphasis></entry>
27352 </row>
27353 </tbody>
27354 </tgroup>
27355 </informaltable>
27356 <para>
27357 <indexterm role="concept">
27358 <primary>load average</primary>
27359 <secondary>re-evaluating per message</secondary>
27360 </indexterm>
27361 When this option is true (the default), once one message has been queued
27362 because the load average is higher than the value set by <option>queue_only_load</option>,
27363 all subsequent messages received on the same SMTP connection are also queued.
27364 This is a deliberate choice; even though the load average may fall below the
27365 threshold, it doesn&#x2019;t seem right to deliver later messages on the same
27366 connection when not delivering earlier ones. However, there are special
27367 circumstances such as very long-lived connections from scanning appliances
27368 where this is not the best strategy. In such cases, <option>queue_only_load_latch</option>
27369 should be set false. This causes the value of the load average to be
27370 re-evaluated for each message.
27371 </para>
27372 <para>
27373 <indexterm role="option">
27374 <primary><option>queue_only_override</option></primary>
27375 </indexterm>
27376 </para>
27377 <informaltable frame="all">
27378 <tgroup cols="4" colsep="0" rowsep="0">
27379 <colspec colwidth="8*" align="left"/>
27380 <colspec colwidth="6*" align="center"/>
27381 <colspec colwidth="6*" align="center"/>
27382 <colspec colwidth="6*" align="right"/>
27383 <tbody>
27384 <row>
27385 <entry><option>queue_only_override</option></entry>
27386 <entry>Use: <emphasis>main</emphasis></entry>
27387 <entry>Type: <emphasis>boolean</emphasis></entry>
27388 <entry>Default: <emphasis>true</emphasis></entry>
27389 </row>
27390 </tbody>
27391 </tgroup>
27392 </informaltable>
27393 <para>
27394 <indexterm role="concept">
27395 <primary>queueing incoming messages</primary>
27396 </indexterm>
27397 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
27398 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
27399 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
27400 to override; they are accepted, but ignored.
27401 </para>
27402 <para>
27403 <indexterm role="option">
27404 <primary><option>queue_run_in_order</option></primary>
27405 </indexterm>
27406 </para>
27407 <informaltable frame="all">
27408 <tgroup cols="4" colsep="0" rowsep="0">
27409 <colspec colwidth="8*" align="left"/>
27410 <colspec colwidth="6*" align="center"/>
27411 <colspec colwidth="6*" align="center"/>
27412 <colspec colwidth="6*" align="right"/>
27413 <tbody>
27414 <row>
27415 <entry><option>queue_run_in_order</option></entry>
27416 <entry>Use: <emphasis>main</emphasis></entry>
27417 <entry>Type: <emphasis>boolean</emphasis></entry>
27418 <entry>Default: <emphasis>false</emphasis></entry>
27419 </row>
27420 </tbody>
27421 </tgroup>
27422 </informaltable>
27423 <para>
27424 <indexterm role="concept">
27425 <primary>queue runner</primary>
27426 <secondary>processing messages in order</secondary>
27427 </indexterm>
27428 If this option is set, queue runs happen in order of message arrival instead of
27429 in an arbitrary order. For this to happen, a complete list of the entire queue
27430 must be set up before the deliveries start. When the queue is all held in a
27431 single directory (the default), a single list is created for both the ordered
27432 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
27433 single list is not created when <option>queue_run_in_order</option> is false. In this case,
27434 the sub-directories are processed one at a time (in a random order), and this
27435 avoids setting up one huge list for the whole queue. Thus, setting
27436 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
27437 when the queue is large, because of the extra work in setting up the single,
27438 large list. In most situations, <option>queue_run_in_order</option> should not be set.
27439 </para>
27440 <para>
27441 <indexterm role="option">
27442 <primary><option>queue_run_max</option></primary>
27443 </indexterm>
27444 </para>
27445 <informaltable frame="all">
27446 <tgroup cols="4" colsep="0" rowsep="0">
27447 <colspec colwidth="8*" align="left"/>
27448 <colspec colwidth="6*" align="center"/>
27449 <colspec colwidth="6*" align="center"/>
27450 <colspec colwidth="6*" align="right"/>
27451 <tbody>
27452 <row>
27453 <entry><option>queue_run_max</option></entry>
27454 <entry>Use: <emphasis>main</emphasis></entry>
27455 <entry>Type: <emphasis>integer</emphasis></entry>
27456 <entry>Default: <emphasis>5</emphasis></entry>
27457 </row>
27458 </tbody>
27459 </tgroup>
27460 </informaltable>
27461 <para>
27462 <indexterm role="concept">
27463 <primary>queue runner</primary>
27464 <secondary>maximum number of</secondary>
27465 </indexterm>
27466 This controls the maximum number of queue runner processes that an Exim daemon
27467 can run simultaneously. This does not mean that it starts them all at once,
27468 but rather that if the maximum number are still running when the time comes to
27469 start another one, it refrains from starting another one. This can happen with
27470 very large queues and/or very sluggish deliveries. This option does not,
27471 however, interlock with other processes, so additional queue runners can be
27472 started by other means, or by killing and restarting the daemon.
27473 </para>
27474 <para>
27475 Setting this option to zero does not suppress queue runs; rather, it disables
27476 the limit, allowing any number of simultaneous queue runner processes to be
27477 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
27478 the daemon&#x2019;s command line.
27479 </para>
27480 <para>
27481 <indexterm role="option">
27482 <primary><option>queue_smtp_domains</option></primary>
27483 </indexterm>
27484 </para>
27485 <informaltable frame="all">
27486 <tgroup cols="4" colsep="0" rowsep="0">
27487 <colspec colwidth="8*" align="left"/>
27488 <colspec colwidth="6*" align="center"/>
27489 <colspec colwidth="6*" align="center"/>
27490 <colspec colwidth="6*" align="right"/>
27491 <tbody>
27492 <row>
27493 <entry><option>queue_smtp_domains</option></entry>
27494 <entry>Use: <emphasis>main</emphasis></entry>
27495 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27496 <entry>Default: <emphasis>unset</emphasis></entry>
27497 </row>
27498 </tbody>
27499 </tgroup>
27500 </informaltable>
27501 <para>
27502 <indexterm role="concept">
27503 <primary>queueing incoming messages</primary>
27504 </indexterm>
27505 <indexterm role="concept">
27506 <primary>message</primary>
27507 <secondary>queueing remote deliveries</secondary>
27508 </indexterm>
27509 When this option is set, a delivery process is started whenever a message is
27510 received, routing is performed, and local deliveries take place.
27511 However, if any SMTP deliveries are required for domains that match
27512 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
27513 message waits on the queue for the next queue run. Since routing of the message
27514 has taken place, Exim knows to which remote hosts it must be delivered, and so
27515 when the queue run happens, multiple messages for the same host are delivered
27516 over a single SMTP connection. The <option>-odqs</option> command line option causes all
27517 SMTP deliveries to be queued in this way, and is equivalent to setting
27518 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
27519 <option>queue_domains</option>.
27520 </para>
27521 <para>
27522 <indexterm role="option">
27523 <primary><option>receive_timeout</option></primary>
27524 </indexterm>
27525 </para>
27526 <informaltable frame="all">
27527 <tgroup cols="4" colsep="0" rowsep="0">
27528 <colspec colwidth="8*" align="left"/>
27529 <colspec colwidth="6*" align="center"/>
27530 <colspec colwidth="6*" align="center"/>
27531 <colspec colwidth="6*" align="right"/>
27532 <tbody>
27533 <row>
27534 <entry><option>receive_timeout</option></entry>
27535 <entry>Use: <emphasis>main</emphasis></entry>
27536 <entry>Type: <emphasis>time</emphasis></entry>
27537 <entry>Default: <emphasis>0s</emphasis></entry>
27538 </row>
27539 </tbody>
27540 </tgroup>
27541 </informaltable>
27542 <para>
27543 <indexterm role="concept">
27544 <primary>timeout</primary>
27545 <secondary>for non-SMTP input</secondary>
27546 </indexterm>
27547 This option sets the timeout for accepting a non-SMTP message, that is, the
27548 maximum time that Exim waits when reading a message on the standard input. If
27549 the value is zero, it will wait for ever. This setting is overridden by the
27550 <option>-or</option> command line option. The timeout for incoming SMTP messages is
27551 controlled by <option>smtp_receive_timeout</option>.
27552 </para>
27553 <para>
27554 <indexterm role="option">
27555 <primary><option>received_header_text</option></primary>
27556 </indexterm>
27557 </para>
27558 <informaltable frame="all">
27559 <tgroup cols="4" colsep="0" rowsep="0">
27560 <colspec colwidth="8*" align="left"/>
27561 <colspec colwidth="6*" align="center"/>
27562 <colspec colwidth="6*" align="center"/>
27563 <colspec colwidth="6*" align="right"/>
27564 <tbody>
27565 <row>
27566 <entry><option>received_header_text</option></entry>
27567 <entry>Use: <emphasis>main</emphasis></entry>
27568 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27569 <entry>Default: <emphasis>see below</emphasis></entry>
27570 </row>
27571 </tbody>
27572 </tgroup>
27573 </informaltable>
27574 <para>
27575 <indexterm role="concept">
27576 <primary>customizing</primary>
27577 <secondary><emphasis>Received:</emphasis> header</secondary>
27578 </indexterm>
27579 <indexterm role="concept">
27580 <primary><emphasis>Received:</emphasis> header line</primary>
27581 <secondary>customizing</secondary>
27582 </indexterm>
27583 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
27584 added to each message, except for the timestamp, which is automatically added
27585 on at the end (preceded by a semicolon). The string is expanded each time it is
27586 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
27587 added to the message. Otherwise, the string should start with the text
27588 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
27589 header lines. The default setting is:
27590 </para>
27591 <literallayout class="monospaced">
27592 received_header_text = Received: \
27593   ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
27594   {${if def:sender_ident \
27595   {from ${quote_local_part:$sender_ident} }}\
27596   ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
27597   by $primary_hostname \
27598   ${if def:received_protocol {with $received_protocol}} \
27599   ${if def:tls_in_cipher {($tls_in_cipher)\n\t}}\
27600   (Exim $version_number)\n\t\
27601   ${if def:sender_address \
27602   {(envelope-from &lt;$sender_address&gt;)\n\t}}\
27603   id $message_exim_id\
27604   ${if def:received_for {\n\tfor $received_for}}
27605 </literallayout>
27606 <para>
27607 The reference to the TLS cipher is omitted when Exim is built without TLS
27608 support. The use of conditional expansions ensures that this works for both
27609 locally generated messages and messages received from remote hosts, giving
27610 header lines such as the following:
27611 </para>
27612 <literallayout class="monospaced">
27613 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
27614 by marley.carol.example with esmtp (Exim 4.00)
27615 (envelope-from &lt;bob@carol.example&gt;)
27616 id 16IOWa-00019l-00
27617 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
27618 Received: by scrooge.carol.example with local (Exim 4.00)
27619 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
27620 </literallayout>
27621 <para>
27622 Until the body of the message has been received, the timestamp is the time when
27623 the message started to be received. Once the body has arrived, and all policy
27624 checks have taken place, the timestamp is updated to the time at which the
27625 message was accepted.
27626 </para>
27627 <para>
27628 <indexterm role="option">
27629 <primary><option>received_headers_max</option></primary>
27630 </indexterm>
27631 </para>
27632 <informaltable frame="all">
27633 <tgroup cols="4" colsep="0" rowsep="0">
27634 <colspec colwidth="8*" align="left"/>
27635 <colspec colwidth="6*" align="center"/>
27636 <colspec colwidth="6*" align="center"/>
27637 <colspec colwidth="6*" align="right"/>
27638 <tbody>
27639 <row>
27640 <entry><option>received_headers_max</option></entry>
27641 <entry>Use: <emphasis>main</emphasis></entry>
27642 <entry>Type: <emphasis>integer</emphasis></entry>
27643 <entry>Default: <emphasis>30</emphasis></entry>
27644 </row>
27645 </tbody>
27646 </tgroup>
27647 </informaltable>
27648 <para>
27649 <indexterm role="concept">
27650 <primary>loop</primary>
27651 <secondary>prevention</secondary>
27652 </indexterm>
27653 <indexterm role="concept">
27654 <primary>mail loop prevention</primary>
27655 </indexterm>
27656 <indexterm role="concept">
27657 <primary><emphasis>Received:</emphasis> header line</primary>
27658 <secondary>counting</secondary>
27659 </indexterm>
27660 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
27661 counted, and if it is greater than this parameter, a mail loop is assumed to
27662 have occurred, the delivery is abandoned, and an error message is generated.
27663 This applies to both local and remote deliveries.
27664 </para>
27665 <para>
27666 <indexterm role="option">
27667 <primary><option>recipient_unqualified_hosts</option></primary>
27668 </indexterm>
27669 </para>
27670 <informaltable frame="all">
27671 <tgroup cols="4" colsep="0" rowsep="0">
27672 <colspec colwidth="8*" align="left"/>
27673 <colspec colwidth="6*" align="center"/>
27674 <colspec colwidth="6*" align="center"/>
27675 <colspec colwidth="6*" align="right"/>
27676 <tbody>
27677 <row>
27678 <entry><option>recipient_unqualified_hosts</option></entry>
27679 <entry>Use: <emphasis>main</emphasis></entry>
27680 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27681 <entry>Default: <emphasis>unset</emphasis></entry>
27682 </row>
27683 </tbody>
27684 </tgroup>
27685 </informaltable>
27686 <para>
27687 <indexterm role="concept">
27688 <primary>unqualified addresses</primary>
27689 </indexterm>
27690 <indexterm role="concept">
27691 <primary>host</primary>
27692 <secondary>unqualified addresses from</secondary>
27693 </indexterm>
27694 This option lists those hosts from which Exim is prepared to accept unqualified
27695 recipient addresses in message envelopes. The addresses are made fully
27696 qualified by the addition of the <option>qualify_recipient</option> value. This option also
27697 affects message header lines. Exim does not reject unqualified recipient
27698 addresses in headers, but it qualifies them only if the message came from a
27699 host that matches <option>recipient_unqualified_hosts</option>,
27700 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
27701 option was not set.
27702 </para>
27703 <para>
27704 <indexterm role="option">
27705 <primary><option>recipients_max</option></primary>
27706 </indexterm>
27707 </para>
27708 <informaltable frame="all">
27709 <tgroup cols="4" colsep="0" rowsep="0">
27710 <colspec colwidth="8*" align="left"/>
27711 <colspec colwidth="6*" align="center"/>
27712 <colspec colwidth="6*" align="center"/>
27713 <colspec colwidth="6*" align="right"/>
27714 <tbody>
27715 <row>
27716 <entry><option>recipients_max</option></entry>
27717 <entry>Use: <emphasis>main</emphasis></entry>
27718 <entry>Type: <emphasis>integer</emphasis></entry>
27719 <entry>Default: <emphasis>0</emphasis></entry>
27720 </row>
27721 </tbody>
27722 </tgroup>
27723 </informaltable>
27724 <para>
27725 <indexterm role="concept">
27726 <primary>limit</primary>
27727 <secondary>number of recipients</secondary>
27728 </indexterm>
27729 <indexterm role="concept">
27730 <primary>recipient</primary>
27731 <secondary>maximum number</secondary>
27732 </indexterm>
27733 If this option is set greater than zero, it specifies the maximum number of
27734 original recipients for any message. Additional recipients that are generated
27735 by aliasing or forwarding do not count. SMTP messages get a 452 response for
27736 all recipients over the limit; earlier recipients are delivered as normal.
27737 Non-SMTP messages with too many recipients are failed, and no deliveries are
27738 done.
27739 </para>
27740 <para>
27741 <indexterm role="concept">
27742 <primary>RCPT</primary>
27743 <secondary>maximum number of incoming</secondary>
27744 </indexterm>
27745 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
27746 RCPT commands in a single message.
27747 </para>
27748 <para>
27749 <indexterm role="option">
27750 <primary><option>recipients_max_reject</option></primary>
27751 </indexterm>
27752 </para>
27753 <informaltable frame="all">
27754 <tgroup cols="4" colsep="0" rowsep="0">
27755 <colspec colwidth="8*" align="left"/>
27756 <colspec colwidth="6*" align="center"/>
27757 <colspec colwidth="6*" align="center"/>
27758 <colspec colwidth="6*" align="right"/>
27759 <tbody>
27760 <row>
27761 <entry><option>recipients_max_reject</option></entry>
27762 <entry>Use: <emphasis>main</emphasis></entry>
27763 <entry>Type: <emphasis>boolean</emphasis></entry>
27764 <entry>Default: <emphasis>false</emphasis></entry>
27765 </row>
27766 </tbody>
27767 </tgroup>
27768 </informaltable>
27769 <para>
27770 If this option is set true, Exim rejects SMTP messages containing too many
27771 recipients by giving 552 errors to the surplus RCPT commands, and a 554
27772 error to the eventual DATA command. Otherwise (the default) it gives a 452
27773 error to the surplus RCPT commands and accepts the message on behalf of the
27774 initial set of recipients. The remote server should then re-send the message
27775 for the remaining recipients at a later time.
27776 </para>
27777 <para>
27778 <indexterm role="option">
27779 <primary><option>remote_max_parallel</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>remote_max_parallel</option></entry>
27791 <entry>Use: <emphasis>main</emphasis></entry>
27792 <entry>Type: <emphasis>integer</emphasis></entry>
27793 <entry>Default: <emphasis>2</emphasis></entry>
27794 </row>
27795 </tbody>
27796 </tgroup>
27797 </informaltable>
27798 <para>
27799 <indexterm role="concept">
27800 <primary>delivery</primary>
27801 <secondary>parallelism for remote</secondary>
27802 </indexterm>
27803 This option controls parallel delivery of one message to a number of remote
27804 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
27805 does all the remote deliveries for a message one by one. Otherwise, if a single
27806 message has to be delivered to more than one remote host, or if several copies
27807 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
27808 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
27809 deliveries are required, the maximum number of processes are started, and as
27810 each one finishes, another is begun. The order of starting processes is the
27811 same as if sequential delivery were being done, and can be controlled by the
27812 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
27813 with debugging turned on, the debugging output from each delivery process is
27814 tagged with its process id.
27815 </para>
27816 <para>
27817 This option controls only the maximum number of parallel deliveries for one
27818 message in one Exim delivery process. Because Exim has no central queue
27819 manager, there is no way of controlling the total number of simultaneous
27820 deliveries if the configuration allows a delivery attempt as soon as a message
27821 is received.
27822 </para>
27823 <para>
27824 <indexterm role="concept">
27825 <primary>number of deliveries</primary>
27826 </indexterm>
27827 <indexterm role="concept">
27828 <primary>delivery</primary>
27829 <secondary>maximum number of</secondary>
27830 </indexterm>
27831 If you want to control the total number of deliveries on the system, you
27832 need to set the <option>queue_only</option> option. This ensures that all incoming messages
27833 are added to the queue without starting a delivery process. Then set up an Exim
27834 daemon to start queue runner processes at appropriate intervals (probably
27835 fairly often, for example, every minute), and limit the total number of queue
27836 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
27837 delivers only one message at a time, the maximum number of deliveries that can
27838 then take place at once is <option>queue_run_max</option> multiplied by
27839 <option>remote_max_parallel</option>.
27840 </para>
27841 <para>
27842 If it is purely remote deliveries you want to control, use
27843 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
27844 doing the SMTP routing before queueing, so that several messages for the same
27845 host will eventually get delivered down the same connection.
27846 </para>
27847 <para>
27848 <indexterm role="option">
27849 <primary><option>remote_sort_domains</option></primary>
27850 </indexterm>
27851 </para>
27852 <informaltable frame="all">
27853 <tgroup cols="4" colsep="0" rowsep="0">
27854 <colspec colwidth="8*" align="left"/>
27855 <colspec colwidth="6*" align="center"/>
27856 <colspec colwidth="6*" align="center"/>
27857 <colspec colwidth="6*" align="right"/>
27858 <tbody>
27859 <row>
27860 <entry><option>remote_sort_domains</option></entry>
27861 <entry>Use: <emphasis>main</emphasis></entry>
27862 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27863 <entry>Default: <emphasis>unset</emphasis></entry>
27864 </row>
27865 </tbody>
27866 </tgroup>
27867 </informaltable>
27868 <para>
27869 <indexterm role="concept">
27870 <primary>sorting remote deliveries</primary>
27871 </indexterm>
27872 <indexterm role="concept">
27873 <primary>delivery</primary>
27874 <secondary>sorting remote</secondary>
27875 </indexterm>
27876 When there are a number of remote deliveries for a message, they are sorted by
27877 domain into the order given by this list. For example,
27878 </para>
27879 <literallayout class="monospaced">
27880 remote_sort_domains = *.cam.ac.uk:*.uk
27881 </literallayout>
27882 <para>
27883 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
27884 then to those in the <option>uk</option> domain, then to any others.
27885 </para>
27886 <para>
27887 <indexterm role="option">
27888 <primary><option>retry_data_expire</option></primary>
27889 </indexterm>
27890 </para>
27891 <informaltable frame="all">
27892 <tgroup cols="4" colsep="0" rowsep="0">
27893 <colspec colwidth="8*" align="left"/>
27894 <colspec colwidth="6*" align="center"/>
27895 <colspec colwidth="6*" align="center"/>
27896 <colspec colwidth="6*" align="right"/>
27897 <tbody>
27898 <row>
27899 <entry><option>retry_data_expire</option></entry>
27900 <entry>Use: <emphasis>main</emphasis></entry>
27901 <entry>Type: <emphasis>time</emphasis></entry>
27902 <entry>Default: <emphasis>7d</emphasis></entry>
27903 </row>
27904 </tbody>
27905 </tgroup>
27906 </informaltable>
27907 <para>
27908 <indexterm role="concept">
27909 <primary>hints database</primary>
27910 <secondary>data expiry</secondary>
27911 </indexterm>
27912 This option sets a <quote>use before</quote> time on retry information in Exim&#x2019;s hints
27913 database. Any older retry data is ignored. This means that, for example, once a
27914 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
27915 past failures.
27916 </para>
27917 <para>
27918 <indexterm role="option">
27919 <primary><option>retry_interval_max</option></primary>
27920 </indexterm>
27921 </para>
27922 <informaltable frame="all">
27923 <tgroup cols="4" colsep="0" rowsep="0">
27924 <colspec colwidth="8*" align="left"/>
27925 <colspec colwidth="6*" align="center"/>
27926 <colspec colwidth="6*" align="center"/>
27927 <colspec colwidth="6*" align="right"/>
27928 <tbody>
27929 <row>
27930 <entry><option>retry_interval_max</option></entry>
27931 <entry>Use: <emphasis>main</emphasis></entry>
27932 <entry>Type: <emphasis>time</emphasis></entry>
27933 <entry>Default: <emphasis>24h</emphasis></entry>
27934 </row>
27935 </tbody>
27936 </tgroup>
27937 </informaltable>
27938 <para>
27939 <indexterm role="concept">
27940 <primary>retry</primary>
27941 <secondary>limit on interval</secondary>
27942 </indexterm>
27943 <indexterm role="concept">
27944 <primary>limit</primary>
27945 <secondary>on retry interval</secondary>
27946 </indexterm>
27947 Chapter <xref linkend="CHAPretry"/> describes Exim&#x2019;s mechanisms for controlling the
27948 intervals between delivery attempts for messages that cannot be delivered
27949 straight away. This option sets an overall limit to the length of time between
27950 retries. It cannot be set greater than 24 hours; any attempt to do so forces
27951 the default value.
27952 </para>
27953 <para>
27954 <indexterm role="option">
27955 <primary><option>return_path_remove</option></primary>
27956 </indexterm>
27957 </para>
27958 <informaltable frame="all">
27959 <tgroup cols="4" colsep="0" rowsep="0">
27960 <colspec colwidth="8*" align="left"/>
27961 <colspec colwidth="6*" align="center"/>
27962 <colspec colwidth="6*" align="center"/>
27963 <colspec colwidth="6*" align="right"/>
27964 <tbody>
27965 <row>
27966 <entry><option>return_path_remove</option></entry>
27967 <entry>Use: <emphasis>main</emphasis></entry>
27968 <entry>Type: <emphasis>boolean</emphasis></entry>
27969 <entry>Default: <emphasis>true</emphasis></entry>
27970 </row>
27971 </tbody>
27972 </tgroup>
27973 </informaltable>
27974 <para>
27975 <indexterm role="concept">
27976 <primary><emphasis>Return-path:</emphasis> header line</primary>
27977 <secondary>removing</secondary>
27978 </indexterm>
27979 RFC 2821, section 4.4, states that an SMTP server must insert a
27980 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
27981 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
27982 MAIL command. This description implies that this header should not be present
27983 in an incoming message. If <option>return_path_remove</option> is true, any existing
27984 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
27985 received. Exim&#x2019;s transports have options for adding <emphasis>Return-path:</emphasis> headers at
27986 the time of delivery. They are normally used only for final local deliveries.
27987 </para>
27988 <para>
27989 <indexterm role="option">
27990 <primary><option>return_size_limit</option></primary>
27991 </indexterm>
27992 </para>
27993 <informaltable frame="all">
27994 <tgroup cols="4" colsep="0" rowsep="0">
27995 <colspec colwidth="8*" align="left"/>
27996 <colspec colwidth="6*" align="center"/>
27997 <colspec colwidth="6*" align="center"/>
27998 <colspec colwidth="6*" align="right"/>
27999 <tbody>
28000 <row>
28001 <entry><option>return_size_limit</option></entry>
28002 <entry>Use: <emphasis>main</emphasis></entry>
28003 <entry>Type: <emphasis>integer</emphasis></entry>
28004 <entry>Default: <emphasis>100K</emphasis></entry>
28005 </row>
28006 </tbody>
28007 </tgroup>
28008 </informaltable>
28009 <para>
28010 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
28011 </para>
28012 <para>
28013 <indexterm role="option">
28014 <primary><option>rfc1413_hosts</option></primary>
28015 </indexterm>
28016 </para>
28017 <informaltable frame="all">
28018 <tgroup cols="4" colsep="0" rowsep="0">
28019 <colspec colwidth="8*" align="left"/>
28020 <colspec colwidth="6*" align="center"/>
28021 <colspec colwidth="6*" align="center"/>
28022 <colspec colwidth="6*" align="right"/>
28023 <tbody>
28024 <row>
28025 <entry><option>rfc1413_hosts</option></entry>
28026 <entry>Use: <emphasis>main</emphasis></entry>
28027 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28028 <entry>Default: <emphasis>*</emphasis></entry>
28029 </row>
28030 </tbody>
28031 </tgroup>
28032 </informaltable>
28033 <para>
28034 <indexterm role="concept">
28035 <primary>RFC 1413</primary>
28036 </indexterm>
28037 <indexterm role="concept">
28038 <primary>host</primary>
28039 <secondary>for RFC 1413 calls</secondary>
28040 </indexterm>
28041 RFC 1413 identification calls are made to any client host which matches an item
28042 in the list.
28043 </para>
28044 <para>
28045 <indexterm role="option">
28046 <primary><option>rfc1413_query_timeout</option></primary>
28047 </indexterm>
28048 </para>
28049 <informaltable frame="all">
28050 <tgroup cols="4" colsep="0" rowsep="0">
28051 <colspec colwidth="8*" align="left"/>
28052 <colspec colwidth="6*" align="center"/>
28053 <colspec colwidth="6*" align="center"/>
28054 <colspec colwidth="6*" align="right"/>
28055 <tbody>
28056 <row>
28057 <entry><option>rfc1413_query_timeout</option></entry>
28058 <entry>Use: <emphasis>main</emphasis></entry>
28059 <entry>Type: <emphasis>time</emphasis></entry>
28060 <entry>Default: <emphasis>5s</emphasis></entry>
28061 </row>
28062 </tbody>
28063 </tgroup>
28064 </informaltable>
28065 <para>
28066 <indexterm role="concept">
28067 <primary>RFC 1413</primary>
28068 <secondary>query timeout</secondary>
28069 </indexterm>
28070 <indexterm role="concept">
28071 <primary>timeout</primary>
28072 <secondary>for RFC 1413 call</secondary>
28073 </indexterm>
28074 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
28075 no RFC 1413 calls are ever made.
28076 </para>
28077 <para>
28078 <indexterm role="option">
28079 <primary><option>sender_unqualified_hosts</option></primary>
28080 </indexterm>
28081 </para>
28082 <informaltable frame="all">
28083 <tgroup cols="4" colsep="0" rowsep="0">
28084 <colspec colwidth="8*" align="left"/>
28085 <colspec colwidth="6*" align="center"/>
28086 <colspec colwidth="6*" align="center"/>
28087 <colspec colwidth="6*" align="right"/>
28088 <tbody>
28089 <row>
28090 <entry><option>sender_unqualified_hosts</option></entry>
28091 <entry>Use: <emphasis>main</emphasis></entry>
28092 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28093 <entry>Default: <emphasis>unset</emphasis></entry>
28094 </row>
28095 </tbody>
28096 </tgroup>
28097 </informaltable>
28098 <para>
28099 <indexterm role="concept">
28100 <primary>unqualified addresses</primary>
28101 </indexterm>
28102 <indexterm role="concept">
28103 <primary>host</primary>
28104 <secondary>unqualified addresses from</secondary>
28105 </indexterm>
28106 This option lists those hosts from which Exim is prepared to accept unqualified
28107 sender addresses. The addresses are made fully qualified by the addition of
28108 <option>qualify_domain</option>. This option also affects message header lines. Exim does
28109 not reject unqualified addresses in headers that contain sender addresses, but
28110 it qualifies them only if the message came from a host that matches
28111 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
28112 using TCP/IP), and the <option>-bnq</option> option was not set.
28113 </para>
28114 <para>
28115 <indexterm role="option">
28116 <primary><option>set_environment</option></primary>
28117 </indexterm>
28118 </para>
28119 <informaltable frame="all">
28120 <tgroup cols="4" colsep="0" rowsep="0">
28121 <colspec colwidth="8*" align="left"/>
28122 <colspec colwidth="6*" align="center"/>
28123 <colspec colwidth="6*" align="center"/>
28124 <colspec colwidth="6*" align="right"/>
28125 <tbody>
28126 <row>
28127 <entry><option>set_environment</option></entry>
28128 <entry>Use: <emphasis>main</emphasis></entry>
28129 <entry>Type: <emphasis>string list</emphasis></entry>
28130 <entry>Default: <emphasis>empty</emphasis></entry>
28131 </row>
28132 </tbody>
28133 </tgroup>
28134 </informaltable>
28135 <para>
28136 <indexterm role="concept">
28137 <primary>environment</primary>
28138 </indexterm>
28139 This option allows to set individual environment variables that the
28140 currently linked libraries and programs in child processes use. The
28141 default list is empty,
28142 </para>
28143 <para>
28144 <indexterm role="option">
28145 <primary><option>smtp_accept_keepalive</option></primary>
28146 </indexterm>
28147 </para>
28148 <informaltable frame="all">
28149 <tgroup cols="4" colsep="0" rowsep="0">
28150 <colspec colwidth="8*" align="left"/>
28151 <colspec colwidth="6*" align="center"/>
28152 <colspec colwidth="6*" align="center"/>
28153 <colspec colwidth="6*" align="right"/>
28154 <tbody>
28155 <row>
28156 <entry><option>smtp_accept_keepalive</option></entry>
28157 <entry>Use: <emphasis>main</emphasis></entry>
28158 <entry>Type: <emphasis>boolean</emphasis></entry>
28159 <entry>Default: <emphasis>true</emphasis></entry>
28160 </row>
28161 </tbody>
28162 </tgroup>
28163 </informaltable>
28164 <para>
28165 <indexterm role="concept">
28166 <primary>keepalive</primary>
28167 <secondary>on incoming connection</secondary>
28168 </indexterm>
28169 This option controls the setting of the SO_KEEPALIVE option on incoming
28170 TCP/IP socket connections. When set, it causes the kernel to probe idle
28171 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
28172 other end of the connection should send an acknowledgment if the connection is
28173 still okay or a reset if the connection has been aborted. The reason for doing
28174 this is that it has the beneficial effect of freeing up certain types of
28175 connection that can get stuck when the remote host is disconnected without
28176 tidying up the TCP/IP call properly. The keepalive mechanism takes several
28177 hours to detect unreachable hosts.
28178 </para>
28179 <para>
28180 <indexterm role="option">
28181 <primary><option>smtp_accept_max</option></primary>
28182 </indexterm>
28183 </para>
28184 <informaltable frame="all">
28185 <tgroup cols="4" colsep="0" rowsep="0">
28186 <colspec colwidth="8*" align="left"/>
28187 <colspec colwidth="6*" align="center"/>
28188 <colspec colwidth="6*" align="center"/>
28189 <colspec colwidth="6*" align="right"/>
28190 <tbody>
28191 <row>
28192 <entry><option>smtp_accept_max</option></entry>
28193 <entry>Use: <emphasis>main</emphasis></entry>
28194 <entry>Type: <emphasis>integer</emphasis></entry>
28195 <entry>Default: <emphasis>20</emphasis></entry>
28196 </row>
28197 </tbody>
28198 </tgroup>
28199 </informaltable>
28200 <para>
28201 <indexterm role="concept">
28202 <primary>limit</primary>
28203 <secondary>incoming SMTP connections</secondary>
28204 </indexterm>
28205 <indexterm role="concept">
28206 <primary>SMTP</primary>
28207 <secondary>incoming connection count</secondary>
28208 </indexterm>
28209 <indexterm role="concept">
28210 <primary>inetd</primary>
28211 </indexterm>
28212 This option specifies the maximum number of simultaneous incoming SMTP calls
28213 that Exim will accept. It applies only to the listening daemon; there is no
28214 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
28215 value is set to zero, no limit is applied. However, it is required to be
28216 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
28217 set. See also <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option>.
28218 </para>
28219 <para>
28220 A new SMTP connection is immediately rejected if the <option>smtp_accept_max</option> limit
28221 has been reached. If not, Exim first checks <option>smtp_accept_max_per_host</option>. If
28222 that limit has not been reached for the client host, <option>smtp_accept_reserve</option>
28223 and <option>smtp_load_reserve</option> are then checked before accepting the connection.
28224 </para>
28225 <para>
28226 <indexterm role="option">
28227 <primary><option>smtp_accept_max_nonmail</option></primary>
28228 </indexterm>
28229 </para>
28230 <informaltable frame="all">
28231 <tgroup cols="4" colsep="0" rowsep="0">
28232 <colspec colwidth="8*" align="left"/>
28233 <colspec colwidth="6*" align="center"/>
28234 <colspec colwidth="6*" align="center"/>
28235 <colspec colwidth="6*" align="right"/>
28236 <tbody>
28237 <row>
28238 <entry><option>smtp_accept_max_nonmail</option></entry>
28239 <entry>Use: <emphasis>main</emphasis></entry>
28240 <entry>Type: <emphasis>integer</emphasis></entry>
28241 <entry>Default: <emphasis>10</emphasis></entry>
28242 </row>
28243 </tbody>
28244 </tgroup>
28245 </informaltable>
28246 <para>
28247 <indexterm role="concept">
28248 <primary>limit</primary>
28249 <secondary>non-mail SMTP commands</secondary>
28250 </indexterm>
28251 <indexterm role="concept">
28252 <primary>SMTP</primary>
28253 <secondary>limiting non-mail commands</secondary>
28254 </indexterm>
28255 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
28256 the connection if there are too many. This option defines <quote>too many</quote>. The
28257 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
28258 client looping sending EHLO, for example. The check is applied only if the
28259 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
28260 </para>
28261 <para>
28262 When a new message is expected, one occurrence of RSET is not counted. This
28263 allows a client to send one RSET between messages (this is not necessary,
28264 but some clients do it). Exim also allows one uncounted occurrence of HELO
28265 or EHLO, and one occurrence of STARTTLS between messages. After
28266 starting up a TLS session, another EHLO is expected, and so it too is not
28267 counted. The first occurrence of AUTH in a connection, or immediately
28268 following STARTTLS is not counted. Otherwise, all commands other than
28269 MAIL, RCPT, DATA, and QUIT are counted.
28270 </para>
28271 <para>
28272 <indexterm role="option">
28273 <primary><option>smtp_accept_max_nonmail_hosts</option></primary>
28274 </indexterm>
28275 </para>
28276 <informaltable frame="all">
28277 <tgroup cols="4" colsep="0" rowsep="0">
28278 <colspec colwidth="8*" align="left"/>
28279 <colspec colwidth="6*" align="center"/>
28280 <colspec colwidth="6*" align="center"/>
28281 <colspec colwidth="6*" align="right"/>
28282 <tbody>
28283 <row>
28284 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
28285 <entry>Use: <emphasis>main</emphasis></entry>
28286 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28287 <entry>Default: <emphasis>*</emphasis></entry>
28288 </row>
28289 </tbody>
28290 </tgroup>
28291 </informaltable>
28292 <para>
28293 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
28294 check by setting this option. The default value makes it apply to all hosts. By
28295 changing the value, you can exclude any badly-behaved hosts that you have to
28296 live with.
28297 </para>
28298 <para>
28299 <indexterm role="option">
28300 <primary><option>smtp_accept_max_per_connection</option></primary>
28301 </indexterm>
28302 </para>
28303 <informaltable frame="all">
28304 <tgroup cols="4" colsep="0" rowsep="0">
28305 <colspec colwidth="8*" align="left"/>
28306 <colspec colwidth="6*" align="center"/>
28307 <colspec colwidth="6*" align="center"/>
28308 <colspec colwidth="6*" align="right"/>
28309 <tbody>
28310 <row>
28311 <entry><option>smtp_accept_max_per_connection</option></entry>
28312 <entry>Use: <emphasis>main</emphasis></entry>
28313 <entry>Type: <emphasis>integer</emphasis></entry>
28314 <entry>Default: <emphasis>1000</emphasis></entry>
28315 </row>
28316 </tbody>
28317 </tgroup>
28318 </informaltable>
28319 <para>
28320 <indexterm role="concept">
28321 <primary>SMTP</primary>
28322 <secondary>limiting incoming message count</secondary>
28323 </indexterm>
28324 <indexterm role="concept">
28325 <primary>limit</primary>
28326 <secondary>messages per SMTP connection</secondary>
28327 </indexterm>
28328 The value of this option limits the number of MAIL commands that Exim is
28329 prepared to accept over a single SMTP connection, whether or not each command
28330 results in the transfer of a message. After the limit is reached, a 421
28331 response is given to subsequent MAIL commands. This limit is a safety
28332 precaution against a client that goes mad (incidents of this type have been
28333 seen).
28334 </para>
28335 <para>
28336 <indexterm role="option">
28337 <primary><option>smtp_accept_max_per_host</option></primary>
28338 </indexterm>
28339 </para>
28340 <informaltable frame="all">
28341 <tgroup cols="4" colsep="0" rowsep="0">
28342 <colspec colwidth="8*" align="left"/>
28343 <colspec colwidth="6*" align="center"/>
28344 <colspec colwidth="6*" align="center"/>
28345 <colspec colwidth="6*" align="right"/>
28346 <tbody>
28347 <row>
28348 <entry><option>smtp_accept_max_per_host</option></entry>
28349 <entry>Use: <emphasis>main</emphasis></entry>
28350 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28351 <entry>Default: <emphasis>unset</emphasis></entry>
28352 </row>
28353 </tbody>
28354 </tgroup>
28355 </informaltable>
28356 <para>
28357 <indexterm role="concept">
28358 <primary>limit</primary>
28359 <secondary>SMTP connections from one host</secondary>
28360 </indexterm>
28361 <indexterm role="concept">
28362 <primary>host</primary>
28363 <secondary>limiting SMTP connections from</secondary>
28364 </indexterm>
28365 This option restricts the number of simultaneous IP connections from a single
28366 host (strictly, from a single IP address) to the Exim daemon. The option is
28367 expanded, to enable different limits to be applied to different hosts by
28368 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
28369 connection attempts from the same host are rejected with error code 421. This
28370 is entirely independent of <option>smtp_accept_reserve</option>. The option&#x2019;s default value
28371 of zero imposes no limit. If this option is set greater than zero, it is
28372 required that <option>smtp_accept_max</option> be non-zero.
28373 </para>
28374 <para>
28375 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
28376 constructions that take an appreciable amount of time. The expansion and test
28377 happen in the main daemon loop, in order to reject additional connections
28378 without forking additional processes (otherwise a denial-of-service attack
28379 could cause a vast number or processes to be created). While the daemon is
28380 doing this processing, it cannot accept any other incoming connections.
28381 </para>
28382 <para>
28383 <indexterm role="option">
28384 <primary><option>smtp_accept_queue</option></primary>
28385 </indexterm>
28386 </para>
28387 <informaltable frame="all">
28388 <tgroup cols="4" colsep="0" rowsep="0">
28389 <colspec colwidth="8*" align="left"/>
28390 <colspec colwidth="6*" align="center"/>
28391 <colspec colwidth="6*" align="center"/>
28392 <colspec colwidth="6*" align="right"/>
28393 <tbody>
28394 <row>
28395 <entry><option>smtp_accept_queue</option></entry>
28396 <entry>Use: <emphasis>main</emphasis></entry>
28397 <entry>Type: <emphasis>integer</emphasis></entry>
28398 <entry>Default: <emphasis>0</emphasis></entry>
28399 </row>
28400 </tbody>
28401 </tgroup>
28402 </informaltable>
28403 <para>
28404 <indexterm role="concept">
28405 <primary>SMTP</primary>
28406 <secondary>incoming connection count</secondary>
28407 </indexterm>
28408 <indexterm role="concept">
28409 <primary>queueing incoming messages</primary>
28410 </indexterm>
28411 <indexterm role="concept">
28412 <primary>message</primary>
28413 <secondary>queueing by SMTP connection count</secondary>
28414 </indexterm>
28415 If the number of simultaneous incoming SMTP connections being handled via the
28416 listening daemon exceeds this value, messages received by SMTP are just placed
28417 on the queue; no delivery processes are started automatically. The count is
28418 fixed at the start of an SMTP connection. It cannot be updated in the
28419 subprocess that receives messages, and so the queueing or not queueing applies
28420 to all messages received in the same connection.
28421 </para>
28422 <para>
28423 A value of zero implies no limit, and clearly any non-zero value is useful only
28424 if it is less than the <option>smtp_accept_max</option> value (unless that is zero). See
28425 also <option>queue_only</option>, <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the
28426 various <option>-od</option><emphasis>x</emphasis> command line options.
28427 </para>
28428 <para>
28429 <indexterm role="option">
28430 <primary><option>smtp_accept_queue_per_connection</option></primary>
28431 </indexterm>
28432 </para>
28433 <informaltable frame="all">
28434 <tgroup cols="4" colsep="0" rowsep="0">
28435 <colspec colwidth="8*" align="left"/>
28436 <colspec colwidth="6*" align="center"/>
28437 <colspec colwidth="6*" align="center"/>
28438 <colspec colwidth="6*" align="right"/>
28439 <tbody>
28440 <row>
28441 <entry><option>smtp_accept_queue_per_connection</option></entry>
28442 <entry>Use: <emphasis>main</emphasis></entry>
28443 <entry>Type: <emphasis>integer</emphasis></entry>
28444 <entry>Default: <emphasis>10</emphasis></entry>
28445 </row>
28446 </tbody>
28447 </tgroup>
28448 </informaltable>
28449 <para>
28450 <indexterm role="concept">
28451 <primary>queueing incoming messages</primary>
28452 </indexterm>
28453 <indexterm role="concept">
28454 <primary>message</primary>
28455 <secondary>queueing by message count</secondary>
28456 </indexterm>
28457 This option limits the number of delivery processes that Exim starts
28458 automatically when receiving messages via SMTP, whether via the daemon or by
28459 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
28460 and the number of messages received in a single SMTP session exceeds this
28461 number, subsequent messages are placed on the queue, but no delivery processes
28462 are started. This helps to limit the number of Exim processes when a server
28463 restarts after downtime and there is a lot of mail waiting for it on other
28464 systems. On large systems, the default should probably be increased, and on
28465 dial-in client systems it should probably be set to zero (that is, disabled).
28466 </para>
28467 <para>
28468 <indexterm role="option">
28469 <primary><option>smtp_accept_reserve</option></primary>
28470 </indexterm>
28471 </para>
28472 <informaltable frame="all">
28473 <tgroup cols="4" colsep="0" rowsep="0">
28474 <colspec colwidth="8*" align="left"/>
28475 <colspec colwidth="6*" align="center"/>
28476 <colspec colwidth="6*" align="center"/>
28477 <colspec colwidth="6*" align="right"/>
28478 <tbody>
28479 <row>
28480 <entry><option>smtp_accept_reserve</option></entry>
28481 <entry>Use: <emphasis>main</emphasis></entry>
28482 <entry>Type: <emphasis>integer</emphasis></entry>
28483 <entry>Default: <emphasis>0</emphasis></entry>
28484 </row>
28485 </tbody>
28486 </tgroup>
28487 </informaltable>
28488 <para>
28489 <indexterm role="concept">
28490 <primary>SMTP</primary>
28491 <secondary>incoming call count</secondary>
28492 </indexterm>
28493 <indexterm role="concept">
28494 <primary>host</primary>
28495 <secondary>reserved</secondary>
28496 </indexterm>
28497 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
28498 number of SMTP connections that are reserved for connections from the hosts
28499 that are specified in <option>smtp_reserve_hosts</option>. The value set in
28500 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
28501 restricted to this number of connections; the option specifies a minimum number
28502 of connection slots for them, not a maximum. It is a guarantee that this group
28503 of hosts can always get at least <option>smtp_accept_reserve</option> connections. However,
28504 the limit specified by <option>smtp_accept_max_per_host</option> is still applied to each
28505 individual host.
28506 </para>
28507 <para>
28508 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
28509 set to 5, once there are 45 active connections (from any hosts), new
28510 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>,
28511 provided the other criteria for acceptance are met.
28512 </para>
28513 <para>
28514 <indexterm role="option">
28515 <primary><option>smtp_active_hostname</option></primary>
28516 </indexterm>
28517 </para>
28518 <informaltable frame="all">
28519 <tgroup cols="4" colsep="0" rowsep="0">
28520 <colspec colwidth="8*" align="left"/>
28521 <colspec colwidth="6*" align="center"/>
28522 <colspec colwidth="6*" align="center"/>
28523 <colspec colwidth="6*" align="right"/>
28524 <tbody>
28525 <row>
28526 <entry><option>smtp_active_hostname</option></entry>
28527 <entry>Use: <emphasis>main</emphasis></entry>
28528 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28529 <entry>Default: <emphasis>unset</emphasis></entry>
28530 </row>
28531 </tbody>
28532 </tgroup>
28533 </informaltable>
28534 <para>
28535 <indexterm role="concept">
28536 <primary>host</primary>
28537 <secondary>name in SMTP responses</secondary>
28538 </indexterm>
28539 <indexterm role="concept">
28540 <primary>SMTP</primary>
28541 <secondary>host name in responses</secondary>
28542 </indexterm>
28543 <indexterm role="variable">
28544 <primary><varname>$primary_hostname</varname></primary>
28545 </indexterm>
28546 This option is provided for multi-homed servers that want to masquerade as
28547 several different hosts. At the start of an incoming SMTP connection, its value
28548 is expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
28549 responses. For example, it is used as domain name in the response to an
28550 incoming HELO or EHLO command.
28551 </para>
28552 <para>
28553 <indexterm role="variable">
28554 <primary><varname>$smtp_active_hostname</varname></primary>
28555 </indexterm>
28556 The active hostname is placed in the <varname>$smtp_active_hostname</varname> variable, which
28557 is saved with any messages that are received. It is therefore available for use
28558 in routers and transports when the message is later delivered.
28559 </para>
28560 <para>
28561 If this option is unset, or if its expansion is forced to fail, or if the
28562 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
28563 used. Other expansion failures cause a message to be written to the main and
28564 panic logs, and the SMTP command receives a temporary error. Typically, the
28565 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
28566 For example:
28567 </para>
28568 <literallayout class="monospaced">
28569 smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\
28570   {cox.mydomain}{box.mydomain}}
28571 </literallayout>
28572 <para>
28573 Although <varname>$smtp_active_hostname</varname> is primarily concerned with incoming
28574 messages, it is also used as the default for HELO commands in callout
28575 verification if there is no remote transport from which to obtain a
28576 <option>helo_data</option> value.
28577 </para>
28578 <para>
28579 <indexterm role="option">
28580 <primary><option>smtp_banner</option></primary>
28581 </indexterm>
28582 </para>
28583 <informaltable frame="all">
28584 <tgroup cols="4" colsep="0" rowsep="0">
28585 <colspec colwidth="8*" align="left"/>
28586 <colspec colwidth="6*" align="center"/>
28587 <colspec colwidth="6*" align="center"/>
28588 <colspec colwidth="6*" align="right"/>
28589 <tbody>
28590 <row>
28591 <entry><option>smtp_banner</option></entry>
28592 <entry>Use: <emphasis>main</emphasis></entry>
28593 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28594 <entry>Default: <emphasis>see below</emphasis></entry>
28595 </row>
28596 </tbody>
28597 </tgroup>
28598 </informaltable>
28599 <para>
28600 <indexterm role="concept">
28601 <primary>SMTP</primary>
28602 <secondary>welcome banner</secondary>
28603 </indexterm>
28604 <indexterm role="concept">
28605 <primary>banner for SMTP</primary>
28606 </indexterm>
28607 <indexterm role="concept">
28608 <primary>welcome banner for SMTP</primary>
28609 </indexterm>
28610 <indexterm role="concept">
28611 <primary>customizing</primary>
28612 <secondary>SMTP banner</secondary>
28613 </indexterm>
28614 This string, which is expanded every time it is used, is output as the initial
28615 positive response to an SMTP connection. The default setting is:
28616 </para>
28617 <literallayout class="monospaced">
28618 smtp_banner = $smtp_active_hostname ESMTP Exim \
28619   $version_number $tod_full
28620 </literallayout>
28621 <para>
28622 Failure to expand the string causes a panic error. If you want to create a
28623 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
28624 appropriate points, but not at the end. Note that the 220 code is not included
28625 in this string. Exim adds it automatically (several times in the case of a
28626 multiline response).
28627 </para>
28628 <para>
28629 <indexterm role="option">
28630 <primary><option>smtp_check_spool_space</option></primary>
28631 </indexterm>
28632 </para>
28633 <informaltable frame="all">
28634 <tgroup cols="4" colsep="0" rowsep="0">
28635 <colspec colwidth="8*" align="left"/>
28636 <colspec colwidth="6*" align="center"/>
28637 <colspec colwidth="6*" align="center"/>
28638 <colspec colwidth="6*" align="right"/>
28639 <tbody>
28640 <row>
28641 <entry><option>smtp_check_spool_space</option></entry>
28642 <entry>Use: <emphasis>main</emphasis></entry>
28643 <entry>Type: <emphasis>boolean</emphasis></entry>
28644 <entry>Default: <emphasis>true</emphasis></entry>
28645 </row>
28646 </tbody>
28647 </tgroup>
28648 </informaltable>
28649 <para>
28650 <indexterm role="concept">
28651 <primary>checking disk space</primary>
28652 </indexterm>
28653 <indexterm role="concept">
28654 <primary>disk space, checking</primary>
28655 </indexterm>
28656 <indexterm role="concept">
28657 <primary>spool directory</primary>
28658 <secondary>checking space</secondary>
28659 </indexterm>
28660 When this option is set, if an incoming SMTP session encounters the SIZE
28661 option on a MAIL command, it checks that there is enough space in the
28662 spool directory&#x2019;s partition to accept a message of that size, while still
28663 leaving free the amount specified by <option>check_spool_space</option> (even if that value
28664 is zero). If there isn&#x2019;t enough space, a temporary error code is returned.
28665 </para>
28666 <para>
28667 <indexterm role="option">
28668 <primary><option>smtp_connect_backlog</option></primary>
28669 </indexterm>
28670 </para>
28671 <informaltable frame="all">
28672 <tgroup cols="4" colsep="0" rowsep="0">
28673 <colspec colwidth="8*" align="left"/>
28674 <colspec colwidth="6*" align="center"/>
28675 <colspec colwidth="6*" align="center"/>
28676 <colspec colwidth="6*" align="right"/>
28677 <tbody>
28678 <row>
28679 <entry><option>smtp_connect_backlog</option></entry>
28680 <entry>Use: <emphasis>main</emphasis></entry>
28681 <entry>Type: <emphasis>integer</emphasis></entry>
28682 <entry>Default: <emphasis>20</emphasis></entry>
28683 </row>
28684 </tbody>
28685 </tgroup>
28686 </informaltable>
28687 <para>
28688 <indexterm role="concept">
28689 <primary>connection backlog</primary>
28690 </indexterm>
28691 <indexterm role="concept">
28692 <primary>SMTP</primary>
28693 <secondary>connection backlog</secondary>
28694 </indexterm>
28695 <indexterm role="concept">
28696 <primary>backlog of connections</primary>
28697 </indexterm>
28698 This option specifies a maximum number of waiting SMTP connections. Exim passes
28699 this value to the TCP/IP system when it sets up its listener. Once this number
28700 of connections are waiting for the daemon&#x2019;s attention, subsequent connection
28701 attempts are refused at the TCP/IP level. At least, that is what the manuals
28702 say; in some circumstances such connection attempts have been observed to time
28703 out instead. For large systems it is probably a good idea to increase the
28704 value (to 50, say). It also gives some protection against denial-of-service
28705 attacks by SYN flooding.
28706 </para>
28707 <para>
28708 <indexterm role="option">
28709 <primary><option>smtp_enforce_sync</option></primary>
28710 </indexterm>
28711 </para>
28712 <informaltable frame="all">
28713 <tgroup cols="4" colsep="0" rowsep="0">
28714 <colspec colwidth="8*" align="left"/>
28715 <colspec colwidth="6*" align="center"/>
28716 <colspec colwidth="6*" align="center"/>
28717 <colspec colwidth="6*" align="right"/>
28718 <tbody>
28719 <row>
28720 <entry><option>smtp_enforce_sync</option></entry>
28721 <entry>Use: <emphasis>main</emphasis></entry>
28722 <entry>Type: <emphasis>boolean</emphasis></entry>
28723 <entry>Default: <emphasis>true</emphasis></entry>
28724 </row>
28725 </tbody>
28726 </tgroup>
28727 </informaltable>
28728 <para>
28729 <indexterm role="concept">
28730 <primary>SMTP</primary>
28731 <secondary>synchronization checking</secondary>
28732 </indexterm>
28733 <indexterm role="concept">
28734 <primary>synchronization checking in SMTP</primary>
28735 </indexterm>
28736 The SMTP protocol specification requires the client to wait for a response from
28737 the server at certain points in the dialogue. Without PIPELINING these
28738 synchronization points are after every command; with PIPELINING they are
28739 fewer, but they still exist.
28740 </para>
28741 <para>
28742 Some spamming sites send out a complete set of SMTP commands without waiting
28743 for any response. Exim protects against this by rejecting a message if the
28744 client has sent further input when it should not have. The error response <quote>554
28745 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
28746 for this error cannot be perfect because of transmission delays (unexpected
28747 input may be on its way but not yet received when Exim checks). However, it
28748 does detect many instances.
28749 </para>
28750 <para>
28751 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
28752 If you want to disable the check selectively (for example, only for certain
28753 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
28754 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
28755 </para>
28756 <para>
28757 <indexterm role="option">
28758 <primary><option>smtp_etrn_command</option></primary>
28759 </indexterm>
28760 </para>
28761 <informaltable frame="all">
28762 <tgroup cols="4" colsep="0" rowsep="0">
28763 <colspec colwidth="8*" align="left"/>
28764 <colspec colwidth="6*" align="center"/>
28765 <colspec colwidth="6*" align="center"/>
28766 <colspec colwidth="6*" align="right"/>
28767 <tbody>
28768 <row>
28769 <entry><option>smtp_etrn_command</option></entry>
28770 <entry>Use: <emphasis>main</emphasis></entry>
28771 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28772 <entry>Default: <emphasis>unset</emphasis></entry>
28773 </row>
28774 </tbody>
28775 </tgroup>
28776 </informaltable>
28777 <para>
28778 <indexterm role="concept">
28779 <primary>ETRN</primary>
28780 <secondary>command to be run</secondary>
28781 </indexterm>
28782 <indexterm role="variable">
28783 <primary><varname>$domain</varname></primary>
28784 </indexterm>
28785 If this option is set, the given command is run whenever an SMTP ETRN
28786 command is received from a host that is permitted to issue such commands (see
28787 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
28788 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
28789 argument of the ETRN command, and no syntax checking is done on it. For
28790 example:
28791 </para>
28792 <literallayout class="monospaced">
28793 smtp_etrn_command = /etc/etrn_command $domain \
28794                     $sender_host_address
28795 </literallayout>
28796 <para>
28797 A new process is created to run the command, but Exim does not wait for it to
28798 complete. Consequently, its status cannot be checked. If the command cannot be
28799 run, a line is written to the panic log, but the ETRN caller still receives
28800 a 250 success response. Exim is normally running under its own uid when
28801 receiving SMTP, so it is not possible for it to change the uid before running
28802 the command.
28803 </para>
28804 <para>
28805 <indexterm role="option">
28806 <primary><option>smtp_etrn_serialize</option></primary>
28807 </indexterm>
28808 </para>
28809 <informaltable frame="all">
28810 <tgroup cols="4" colsep="0" rowsep="0">
28811 <colspec colwidth="8*" align="left"/>
28812 <colspec colwidth="6*" align="center"/>
28813 <colspec colwidth="6*" align="center"/>
28814 <colspec colwidth="6*" align="right"/>
28815 <tbody>
28816 <row>
28817 <entry><option>smtp_etrn_serialize</option></entry>
28818 <entry>Use: <emphasis>main</emphasis></entry>
28819 <entry>Type: <emphasis>boolean</emphasis></entry>
28820 <entry>Default: <emphasis>true</emphasis></entry>
28821 </row>
28822 </tbody>
28823 </tgroup>
28824 </informaltable>
28825 <para>
28826 <indexterm role="concept">
28827 <primary>ETRN</primary>
28828 <secondary>serializing</secondary>
28829 </indexterm>
28830 When this option is set, it prevents the simultaneous execution of more than
28831 one identical command as a result of ETRN in an SMTP connection. See
28832 section <xref linkend="SECTETRN"/> for details.
28833 </para>
28834 <para>
28835 <indexterm role="option">
28836 <primary><option>smtp_load_reserve</option></primary>
28837 </indexterm>
28838 </para>
28839 <informaltable frame="all">
28840 <tgroup cols="4" colsep="0" rowsep="0">
28841 <colspec colwidth="8*" align="left"/>
28842 <colspec colwidth="6*" align="center"/>
28843 <colspec colwidth="6*" align="center"/>
28844 <colspec colwidth="6*" align="right"/>
28845 <tbody>
28846 <row>
28847 <entry><option>smtp_load_reserve</option></entry>
28848 <entry>Use: <emphasis>main</emphasis></entry>
28849 <entry>Type: <emphasis>fixed-point</emphasis></entry>
28850 <entry>Default: <emphasis>unset</emphasis></entry>
28851 </row>
28852 </tbody>
28853 </tgroup>
28854 </informaltable>
28855 <para>
28856 <indexterm role="concept">
28857 <primary>load average</primary>
28858 </indexterm>
28859 If the system load average ever gets higher than this, incoming SMTP calls are
28860 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
28861 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
28862 the load is over the limit. The option has no effect on ancient operating
28863 systems on which Exim cannot determine the load average. See also
28864 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
28865 </para>
28866 <para>
28867 <indexterm role="option">
28868 <primary><option>smtp_max_synprot_errors</option></primary>
28869 </indexterm>
28870 </para>
28871 <informaltable frame="all">
28872 <tgroup cols="4" colsep="0" rowsep="0">
28873 <colspec colwidth="8*" align="left"/>
28874 <colspec colwidth="6*" align="center"/>
28875 <colspec colwidth="6*" align="center"/>
28876 <colspec colwidth="6*" align="right"/>
28877 <tbody>
28878 <row>
28879 <entry><option>smtp_max_synprot_errors</option></entry>
28880 <entry>Use: <emphasis>main</emphasis></entry>
28881 <entry>Type: <emphasis>integer</emphasis></entry>
28882 <entry>Default: <emphasis>3</emphasis></entry>
28883 </row>
28884 </tbody>
28885 </tgroup>
28886 </informaltable>
28887 <para>
28888 <indexterm role="concept">
28889 <primary>SMTP</primary>
28890 <secondary>limiting syntax and protocol errors</secondary>
28891 </indexterm>
28892 <indexterm role="concept">
28893 <primary>limit</primary>
28894 <secondary>SMTP syntax and protocol errors</secondary>
28895 </indexterm>
28896 Exim rejects SMTP commands that contain syntax or protocol errors. In
28897 particular, a syntactically invalid email address, as in this command:
28898 </para>
28899 <literallayout class="monospaced">
28900 RCPT TO:&lt;abc xyz@a.b.c&gt;
28901 </literallayout>
28902 <para>
28903 causes immediate rejection of the command, before any other tests are done.
28904 (The ACL cannot be run if there is no valid address to set up for it.) An
28905 example of a protocol error is receiving RCPT before MAIL. If there are
28906 too many syntax or protocol errors in one SMTP session, the connection is
28907 dropped. The limit is set by this option.
28908 </para>
28909 <para>
28910 <indexterm role="concept">
28911 <primary>PIPELINING</primary>
28912 <secondary>expected errors</secondary>
28913 </indexterm>
28914 When the PIPELINING extension to SMTP is in use, some protocol errors are
28915 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
28916 Exim assumes that PIPELINING will be used if it advertises it (see
28917 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
28918 not count towards the limit.
28919 </para>
28920 <para>
28921 <indexterm role="option">
28922 <primary><option>smtp_max_unknown_commands</option></primary>
28923 </indexterm>
28924 </para>
28925 <informaltable frame="all">
28926 <tgroup cols="4" colsep="0" rowsep="0">
28927 <colspec colwidth="8*" align="left"/>
28928 <colspec colwidth="6*" align="center"/>
28929 <colspec colwidth="6*" align="center"/>
28930 <colspec colwidth="6*" align="right"/>
28931 <tbody>
28932 <row>
28933 <entry><option>smtp_max_unknown_commands</option></entry>
28934 <entry>Use: <emphasis>main</emphasis></entry>
28935 <entry>Type: <emphasis>integer</emphasis></entry>
28936 <entry>Default: <emphasis>3</emphasis></entry>
28937 </row>
28938 </tbody>
28939 </tgroup>
28940 </informaltable>
28941 <para>
28942 <indexterm role="concept">
28943 <primary>SMTP</primary>
28944 <secondary>limiting unknown commands</secondary>
28945 </indexterm>
28946 <indexterm role="concept">
28947 <primary>limit</primary>
28948 <secondary>unknown SMTP commands</secondary>
28949 </indexterm>
28950 If there are too many unrecognized commands in an incoming SMTP session, an
28951 Exim server drops the connection. This is a defence against some kinds of abuse
28952 that subvert web
28953 clients
28954 into making connections to SMTP ports; in these circumstances, a number of
28955 non-SMTP command lines are sent first.
28956 </para>
28957 <para>
28958 <indexterm role="option">
28959 <primary><option>smtp_ratelimit_hosts</option></primary>
28960 </indexterm>
28961 </para>
28962 <informaltable frame="all">
28963 <tgroup cols="4" colsep="0" rowsep="0">
28964 <colspec colwidth="8*" align="left"/>
28965 <colspec colwidth="6*" align="center"/>
28966 <colspec colwidth="6*" align="center"/>
28967 <colspec colwidth="6*" align="right"/>
28968 <tbody>
28969 <row>
28970 <entry><option>smtp_ratelimit_hosts</option></entry>
28971 <entry>Use: <emphasis>main</emphasis></entry>
28972 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28973 <entry>Default: <emphasis>unset</emphasis></entry>
28974 </row>
28975 </tbody>
28976 </tgroup>
28977 </informaltable>
28978 <para>
28979 <indexterm role="concept">
28980 <primary>SMTP</primary>
28981 <secondary>rate limiting</secondary>
28982 </indexterm>
28983 <indexterm role="concept">
28984 <primary>limit</primary>
28985 <secondary>rate of message arrival</secondary>
28986 </indexterm>
28987 <indexterm role="concept">
28988 <primary>RCPT</primary>
28989 <secondary>rate limiting</secondary>
28990 </indexterm>
28991 Some sites find it helpful to be able to limit the rate at which certain hosts
28992 can send them messages, and the rate at which an individual message can specify
28993 recipients.
28994 </para>
28995 <para>
28996 Exim has two rate-limiting facilities. This section describes the older
28997 facility, which can limit rates within a single connection. The newer
28998 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
28999 <xref linkend="SECTratelimiting"/> for details of the newer facility.
29000 </para>
29001 <para>
29002 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
29003 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
29004 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
29005 respectively. Each option, if set, must contain a set of four comma-separated
29006 values:
29007 </para>
29008 <itemizedlist>
29009 <listitem>
29010 <para>
29011 A threshold, before which there is no rate limiting.
29012 </para>
29013 </listitem>
29014 <listitem>
29015 <para>
29016 An initial time delay. Unlike other times in Exim, numbers with decimal
29017 fractional parts are allowed here.
29018 </para>
29019 </listitem>
29020 <listitem>
29021 <para>
29022 A factor by which to increase the delay each time.
29023 </para>
29024 </listitem>
29025 <listitem>
29026 <para>
29027 A maximum value for the delay. This should normally be less than 5 minutes,
29028 because after that time, the client is liable to timeout the SMTP command.
29029 </para>
29030 </listitem>
29031 </itemizedlist>
29032 <para>
29033 For example, these settings have been used successfully at the site which
29034 first suggested this feature, for controlling mail from their customers:
29035 </para>
29036 <literallayout class="monospaced">
29037 smtp_ratelimit_mail = 2,0.5s,1.05,4m
29038 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
29039 </literallayout>
29040 <para>
29041 The first setting specifies delays that are applied to MAIL commands after
29042 two have been received over a single connection. The initial delay is 0.5
29043 seconds, increasing by a factor of 1.05 each time. The second setting applies
29044 delays to RCPT commands when more than four occur in a single message.
29045 </para>
29046 <para>
29047 <indexterm role="option">
29048 <primary><option>smtp_ratelimit_mail</option></primary>
29049 </indexterm>
29050 </para>
29051 <informaltable frame="all">
29052 <tgroup cols="4" colsep="0" rowsep="0">
29053 <colspec colwidth="8*" align="left"/>
29054 <colspec colwidth="6*" align="center"/>
29055 <colspec colwidth="6*" align="center"/>
29056 <colspec colwidth="6*" align="right"/>
29057 <tbody>
29058 <row>
29059 <entry><option>smtp_ratelimit_mail</option></entry>
29060 <entry>Use: <emphasis>main</emphasis></entry>
29061 <entry>Type: <emphasis>string</emphasis></entry>
29062 <entry>Default: <emphasis>unset</emphasis></entry>
29063 </row>
29064 </tbody>
29065 </tgroup>
29066 </informaltable>
29067 <para>
29068 See <option>smtp_ratelimit_hosts</option> above.
29069 </para>
29070 <para>
29071 <indexterm role="option">
29072 <primary><option>smtp_ratelimit_rcpt</option></primary>
29073 </indexterm>
29074 </para>
29075 <informaltable frame="all">
29076 <tgroup cols="4" colsep="0" rowsep="0">
29077 <colspec colwidth="8*" align="left"/>
29078 <colspec colwidth="6*" align="center"/>
29079 <colspec colwidth="6*" align="center"/>
29080 <colspec colwidth="6*" align="right"/>
29081 <tbody>
29082 <row>
29083 <entry><option>smtp_ratelimit_rcpt</option></entry>
29084 <entry>Use: <emphasis>main</emphasis></entry>
29085 <entry>Type: <emphasis>string</emphasis></entry>
29086 <entry>Default: <emphasis>unset</emphasis></entry>
29087 </row>
29088 </tbody>
29089 </tgroup>
29090 </informaltable>
29091 <para>
29092 See <option>smtp_ratelimit_hosts</option> above.
29093 </para>
29094 <para>
29095 <indexterm role="option">
29096 <primary><option>smtp_receive_timeout</option></primary>
29097 </indexterm>
29098 </para>
29099 <informaltable frame="all">
29100 <tgroup cols="4" colsep="0" rowsep="0">
29101 <colspec colwidth="8*" align="left"/>
29102 <colspec colwidth="6*" align="center"/>
29103 <colspec colwidth="6*" align="center"/>
29104 <colspec colwidth="6*" align="right"/>
29105 <tbody>
29106 <row>
29107 <entry><option>smtp_receive_timeout</option></entry>
29108 <entry>Use: <emphasis>main</emphasis></entry>
29109 <entry>Type: <emphasis>time</emphasis></entry>
29110 <entry>Default: <emphasis>5m</emphasis></entry>
29111 </row>
29112 </tbody>
29113 </tgroup>
29114 </informaltable>
29115 <para>
29116 <indexterm role="concept">
29117 <primary>timeout</primary>
29118 <secondary>for SMTP input</secondary>
29119 </indexterm>
29120 <indexterm role="concept">
29121 <primary>SMTP</primary>
29122 <secondary>input timeout</secondary>
29123 </indexterm>
29124 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
29125 input, including batch SMTP. If a line of input (either an SMTP command or a
29126 data line) is not received within this time, the SMTP connection is dropped and
29127 the message is abandoned.
29128 A line is written to the log containing one of the following messages:
29129 </para>
29130 <literallayout class="monospaced">
29131 SMTP command timeout on connection from...
29132 SMTP data timeout on connection from...
29133 </literallayout>
29134 <para>
29135 The former means that Exim was expecting to read an SMTP command; the latter
29136 means that it was in the DATA phase, reading the contents of a message.
29137 </para>
29138 <para>
29139 <indexterm role="option">
29140 <primary><option>-os</option></primary>
29141 </indexterm>
29142 The value set by this option can be overridden by the
29143 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
29144 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
29145 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
29146 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
29147 </para>
29148 <para>
29149 <indexterm role="option">
29150 <primary><option>smtp_reserve_hosts</option></primary>
29151 </indexterm>
29152 </para>
29153 <informaltable frame="all">
29154 <tgroup cols="4" colsep="0" rowsep="0">
29155 <colspec colwidth="8*" align="left"/>
29156 <colspec colwidth="6*" align="center"/>
29157 <colspec colwidth="6*" align="center"/>
29158 <colspec colwidth="6*" align="right"/>
29159 <tbody>
29160 <row>
29161 <entry><option>smtp_reserve_hosts</option></entry>
29162 <entry>Use: <emphasis>main</emphasis></entry>
29163 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29164 <entry>Default: <emphasis>unset</emphasis></entry>
29165 </row>
29166 </tbody>
29167 </tgroup>
29168 </informaltable>
29169 <para>
29170 This option defines hosts for which SMTP connections are reserved; see
29171 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
29172 </para>
29173 <para>
29174 <indexterm role="option">
29175 <primary><option>smtp_return_error_details</option></primary>
29176 </indexterm>
29177 </para>
29178 <informaltable frame="all">
29179 <tgroup cols="4" colsep="0" rowsep="0">
29180 <colspec colwidth="8*" align="left"/>
29181 <colspec colwidth="6*" align="center"/>
29182 <colspec colwidth="6*" align="center"/>
29183 <colspec colwidth="6*" align="right"/>
29184 <tbody>
29185 <row>
29186 <entry><option>smtp_return_error_details</option></entry>
29187 <entry>Use: <emphasis>main</emphasis></entry>
29188 <entry>Type: <emphasis>boolean</emphasis></entry>
29189 <entry>Default: <emphasis>false</emphasis></entry>
29190 </row>
29191 </tbody>
29192 </tgroup>
29193 </informaltable>
29194 <para>
29195 <indexterm role="concept">
29196 <primary>SMTP</primary>
29197 <secondary>details policy failures</secondary>
29198 </indexterm>
29199 <indexterm role="concept">
29200 <primary>policy control</primary>
29201 <secondary>rejection, returning details</secondary>
29202 </indexterm>
29203 In the default state, Exim uses bland messages such as
29204 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
29205 reasons. Many sysadmins like this because it gives away little information
29206 to spammers. However, some other sysadmins who are applying strict checking
29207 policies want to give out much fuller information about failures. Setting
29208 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
29209 example, instead of <quote>Administrative prohibition</quote>, it might give:
29210 </para>
29211 <literallayout class="monospaced">
29212 550-Rejected after DATA: '&gt;' missing at end of address:
29213 550 failing address in "From" header is: &lt;user@dom.ain
29214 </literallayout>
29215 <para>
29216 <indexterm role="option">
29217 <primary><option>spamd_address</option></primary>
29218 </indexterm>
29219 </para>
29220 <informaltable frame="all">
29221 <tgroup cols="4" colsep="0" rowsep="0">
29222 <colspec colwidth="8*" align="left"/>
29223 <colspec colwidth="6*" align="center"/>
29224 <colspec colwidth="6*" align="center"/>
29225 <colspec colwidth="6*" align="right"/>
29226 <tbody>
29227 <row>
29228 <entry><option>spamd_address</option></entry>
29229 <entry>Use: <emphasis>main</emphasis></entry>
29230 <entry>Type: <emphasis>string</emphasis></entry>
29231 <entry>Default: <emphasis>see below</emphasis></entry>
29232 </row>
29233 </tbody>
29234 </tgroup>
29235 </informaltable>
29236 <para>
29237 This option is available when Exim is compiled with the content-scanning
29238 extension. It specifies how Exim connects to SpamAssassin&#x2019;s <option>spamd</option> daemon.
29239 The default value is
29240 </para>
29241 <literallayout class="monospaced">
29242 127.0.0.1 783
29243 </literallayout>
29244 <para>
29245 See section <xref linkend="SECTscanspamass"/> for more details.
29246 </para>
29247 <para>
29248 <indexterm role="option">
29249 <primary><option>split_spool_directory</option></primary>
29250 </indexterm>
29251 </para>
29252 <informaltable frame="all">
29253 <tgroup cols="4" colsep="0" rowsep="0">
29254 <colspec colwidth="8*" align="left"/>
29255 <colspec colwidth="6*" align="center"/>
29256 <colspec colwidth="6*" align="center"/>
29257 <colspec colwidth="6*" align="right"/>
29258 <tbody>
29259 <row>
29260 <entry><option>split_spool_directory</option></entry>
29261 <entry>Use: <emphasis>main</emphasis></entry>
29262 <entry>Type: <emphasis>boolean</emphasis></entry>
29263 <entry>Default: <emphasis>false</emphasis></entry>
29264 </row>
29265 </tbody>
29266 </tgroup>
29267 </informaltable>
29268 <para>
29269 <indexterm role="concept">
29270 <primary>multiple spool directories</primary>
29271 </indexterm>
29272 <indexterm role="concept">
29273 <primary>spool directory</primary>
29274 <secondary>split</secondary>
29275 </indexterm>
29276 <indexterm role="concept">
29277 <primary>directories, multiple</primary>
29278 </indexterm>
29279 If this option is set, it causes Exim to split its input directory into 62
29280 subdirectories, each with a single alphanumeric character as its name. The
29281 sixth character of the message id is used to allocate messages to
29282 subdirectories; this is the least significant base-62 digit of the time of
29283 arrival of the message.
29284 </para>
29285 <para>
29286 Splitting up the spool in this way may provide better performance on systems
29287 where there are long mail queues, by reducing the number of files in any one
29288 directory. The msglog directory is also split up in a similar way to the input
29289 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
29290 are still placed in the single directory <filename>msglog.OLD</filename>.
29291 </para>
29292 <para>
29293 It is not necessary to take any special action for existing messages when
29294 changing <option>split_spool_directory</option>. Exim notices messages that are in the
29295 <quote>wrong</quote> place, and continues to process them. If the option is turned off
29296 after a period of being on, the subdirectories will eventually empty and be
29297 automatically deleted.
29298 </para>
29299 <para>
29300 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
29301 changes. Instead of creating a list of all messages in the queue, and then
29302 trying to deliver each one in turn, it constructs a list of those in one
29303 sub-directory and tries to deliver them, before moving on to the next
29304 sub-directory. The sub-directories are processed in a random order. This
29305 spreads out the scanning of the input directories, and uses less memory. It is
29306 particularly beneficial when there are lots of messages on the queue. However,
29307 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
29308 entire queue has to be scanned and sorted before any deliveries can start.
29309 </para>
29310 <para>
29311 <indexterm role="option">
29312 <primary><option>spool_directory</option></primary>
29313 </indexterm>
29314 </para>
29315 <informaltable frame="all">
29316 <tgroup cols="4" colsep="0" rowsep="0">
29317 <colspec colwidth="8*" align="left"/>
29318 <colspec colwidth="6*" align="center"/>
29319 <colspec colwidth="6*" align="center"/>
29320 <colspec colwidth="6*" align="right"/>
29321 <tbody>
29322 <row>
29323 <entry><option>spool_directory</option></entry>
29324 <entry>Use: <emphasis>main</emphasis></entry>
29325 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29326 <entry>Default: <emphasis>set at compile time</emphasis></entry>
29327 </row>
29328 </tbody>
29329 </tgroup>
29330 </informaltable>
29331 <para>
29332 <indexterm role="concept">
29333 <primary>spool directory</primary>
29334 <secondary>path to</secondary>
29335 </indexterm>
29336 This defines the directory in which Exim keeps its spool, that is, the messages
29337 it is waiting to deliver. The default value is taken from the compile-time
29338 configuration setting, if there is one. If not, this option must be set. The
29339 string is expanded, so it can contain, for example, a reference to
29340 <varname>$primary_hostname</varname>.
29341 </para>
29342 <para>
29343 If the spool directory name is fixed on your installation, it is recommended
29344 that you set it at build time rather than from this option, particularly if the
29345 log files are being written to the spool directory (see <option>log_file_path</option>).
29346 Otherwise log files cannot be used for errors that are detected early on, such
29347 as failures in the configuration file.
29348 </para>
29349 <para>
29350 By using this option to override the compiled-in path, it is possible to run
29351 tests of Exim without using the standard spool.
29352 </para>
29353 <para>
29354 <indexterm role="option">
29355 <primary><option>sqlite_lock_timeout</option></primary>
29356 </indexterm>
29357 </para>
29358 <informaltable frame="all">
29359 <tgroup cols="4" colsep="0" rowsep="0">
29360 <colspec colwidth="8*" align="left"/>
29361 <colspec colwidth="6*" align="center"/>
29362 <colspec colwidth="6*" align="center"/>
29363 <colspec colwidth="6*" align="right"/>
29364 <tbody>
29365 <row>
29366 <entry><option>sqlite_lock_timeout</option></entry>
29367 <entry>Use: <emphasis>main</emphasis></entry>
29368 <entry>Type: <emphasis>time</emphasis></entry>
29369 <entry>Default: <emphasis>5s</emphasis></entry>
29370 </row>
29371 </tbody>
29372 </tgroup>
29373 </informaltable>
29374 <para>
29375 <indexterm role="concept">
29376 <primary>sqlite lookup type</primary>
29377 <secondary>lock timeout</secondary>
29378 </indexterm>
29379 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
29380 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
29381 </para>
29382 <para>
29383 <indexterm role="option">
29384 <primary><option>strict_acl_vars</option></primary>
29385 </indexterm>
29386 </para>
29387 <informaltable frame="all">
29388 <tgroup cols="4" colsep="0" rowsep="0">
29389 <colspec colwidth="8*" align="left"/>
29390 <colspec colwidth="6*" align="center"/>
29391 <colspec colwidth="6*" align="center"/>
29392 <colspec colwidth="6*" align="right"/>
29393 <tbody>
29394 <row>
29395 <entry><option>strict_acl_vars</option></entry>
29396 <entry>Use: <emphasis>main</emphasis></entry>
29397 <entry>Type: <emphasis>boolean</emphasis></entry>
29398 <entry>Default: <emphasis>false</emphasis></entry>
29399 </row>
29400 </tbody>
29401 </tgroup>
29402 </informaltable>
29403 <para>
29404 <indexterm role="concept">
29405 <primary>access control lists (ACLs)</primary>
29406 <secondary>variables, handling unset</secondary>
29407 </indexterm>
29408 This option controls what happens if a syntactically valid but undefined ACL
29409 variable is referenced. If it is false (the default), an empty string
29410 is substituted; if it is true, an error is generated. See section
29411 <xref linkend="SECTaclvariables"/> for details of ACL variables.
29412 </para>
29413 <para>
29414 <indexterm role="option">
29415 <primary><option>strip_excess_angle_brackets</option></primary>
29416 </indexterm>
29417 </para>
29418 <informaltable frame="all">
29419 <tgroup cols="4" colsep="0" rowsep="0">
29420 <colspec colwidth="8*" align="left"/>
29421 <colspec colwidth="6*" align="center"/>
29422 <colspec colwidth="6*" align="center"/>
29423 <colspec colwidth="6*" align="right"/>
29424 <tbody>
29425 <row>
29426 <entry><option>strip_excess_angle_brackets</option></entry>
29427 <entry>Use: <emphasis>main</emphasis></entry>
29428 <entry>Type: <emphasis>boolean</emphasis></entry>
29429 <entry>Default: <emphasis>false</emphasis></entry>
29430 </row>
29431 </tbody>
29432 </tgroup>
29433 </informaltable>
29434 <para>
29435 <indexterm role="concept">
29436 <primary>angle brackets, excess</primary>
29437 </indexterm>
29438 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
29439 items in addresses are stripped. For example, <emphasis>&lt;&lt;xxx@a.b.c.d&gt;&gt;</emphasis> is
29440 treated as <emphasis>&lt;xxx@a.b.c.d&gt;</emphasis>. If this is in the envelope and the message is
29441 passed on to another MTA, the excess angle brackets are not passed on. If this
29442 option is not set, multiple pairs of angle brackets cause a syntax error.
29443 </para>
29444 <para>
29445 <indexterm role="option">
29446 <primary><option>strip_trailing_dot</option></primary>
29447 </indexterm>
29448 </para>
29449 <informaltable frame="all">
29450 <tgroup cols="4" colsep="0" rowsep="0">
29451 <colspec colwidth="8*" align="left"/>
29452 <colspec colwidth="6*" align="center"/>
29453 <colspec colwidth="6*" align="center"/>
29454 <colspec colwidth="6*" align="right"/>
29455 <tbody>
29456 <row>
29457 <entry><option>strip_trailing_dot</option></entry>
29458 <entry>Use: <emphasis>main</emphasis></entry>
29459 <entry>Type: <emphasis>boolean</emphasis></entry>
29460 <entry>Default: <emphasis>false</emphasis></entry>
29461 </row>
29462 </tbody>
29463 </tgroup>
29464 </informaltable>
29465 <para>
29466 <indexterm role="concept">
29467 <primary>trailing dot on domain</primary>
29468 </indexterm>
29469 <indexterm role="concept">
29470 <primary>dot</primary>
29471 <secondary>trailing on domain</secondary>
29472 </indexterm>
29473 If this option is set, a trailing dot at the end of a domain in an address is
29474 ignored. If this is in the envelope and the message is passed on to another
29475 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
29476 domain causes a syntax error.
29477 However, addresses in header lines are checked only when an ACL requests header
29478 syntax checking.
29479 </para>
29480 <para>
29481 <indexterm role="option">
29482 <primary><option>syslog_duplication</option></primary>
29483 </indexterm>
29484 </para>
29485 <informaltable frame="all">
29486 <tgroup cols="4" colsep="0" rowsep="0">
29487 <colspec colwidth="8*" align="left"/>
29488 <colspec colwidth="6*" align="center"/>
29489 <colspec colwidth="6*" align="center"/>
29490 <colspec colwidth="6*" align="right"/>
29491 <tbody>
29492 <row>
29493 <entry><option>syslog_duplication</option></entry>
29494 <entry>Use: <emphasis>main</emphasis></entry>
29495 <entry>Type: <emphasis>boolean</emphasis></entry>
29496 <entry>Default: <emphasis>true</emphasis></entry>
29497 </row>
29498 </tbody>
29499 </tgroup>
29500 </informaltable>
29501 <para>
29502 <indexterm role="concept">
29503 <primary>syslog</primary>
29504 <secondary>duplicate log lines; suppressing</secondary>
29505 </indexterm>
29506 When Exim is logging to syslog, it writes the log lines for its three
29507 separate logs at different syslog priorities so that they can in principle
29508 be separated on the logging hosts. Some installations do not require this
29509 separation, and in those cases, the duplication of certain log lines is a
29510 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
29511 particular log line is written to syslog. For lines that normally go to
29512 both the main log and the reject log, the reject log version (possibly
29513 containing message header lines) is written, at LOG_NOTICE priority.
29514 Lines that normally go to both the main and the panic log are written at
29515 the LOG_ALERT priority.
29516 </para>
29517 <para>
29518 <indexterm role="option">
29519 <primary><option>syslog_facility</option></primary>
29520 </indexterm>
29521 </para>
29522 <informaltable frame="all">
29523 <tgroup cols="4" colsep="0" rowsep="0">
29524 <colspec colwidth="8*" align="left"/>
29525 <colspec colwidth="6*" align="center"/>
29526 <colspec colwidth="6*" align="center"/>
29527 <colspec colwidth="6*" align="right"/>
29528 <tbody>
29529 <row>
29530 <entry><option>syslog_facility</option></entry>
29531 <entry>Use: <emphasis>main</emphasis></entry>
29532 <entry>Type: <emphasis>string</emphasis></entry>
29533 <entry>Default: <emphasis>unset</emphasis></entry>
29534 </row>
29535 </tbody>
29536 </tgroup>
29537 </informaltable>
29538 <para>
29539 <indexterm role="concept">
29540 <primary>syslog</primary>
29541 <secondary>facility; setting</secondary>
29542 </indexterm>
29543 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
29544 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
29545 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
29546 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
29547 details of Exim&#x2019;s logging.
29548 </para>
29549 <para>
29550 <indexterm role="option">
29551 <primary><option>syslog_processname</option></primary>
29552 </indexterm>
29553 </para>
29554 <informaltable frame="all">
29555 <tgroup cols="4" colsep="0" rowsep="0">
29556 <colspec colwidth="8*" align="left"/>
29557 <colspec colwidth="6*" align="center"/>
29558 <colspec colwidth="6*" align="center"/>
29559 <colspec colwidth="6*" align="right"/>
29560 <tbody>
29561 <row>
29562 <entry><option>syslog_processname</option></entry>
29563 <entry>Use: <emphasis>main</emphasis></entry>
29564 <entry>Type: <emphasis>string</emphasis></entry>
29565 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
29566 </row>
29567 </tbody>
29568 </tgroup>
29569 </informaltable>
29570 <para>
29571 <indexterm role="concept">
29572 <primary>syslog</primary>
29573 <secondary>process name; setting</secondary>
29574 </indexterm>
29575 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
29576 syslog. The value must be no longer than 32 characters. See chapter
29577 <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
29578 </para>
29579 <para>
29580 <indexterm role="option">
29581 <primary><option>syslog_timestamp</option></primary>
29582 </indexterm>
29583 </para>
29584 <informaltable frame="all">
29585 <tgroup cols="4" colsep="0" rowsep="0">
29586 <colspec colwidth="8*" align="left"/>
29587 <colspec colwidth="6*" align="center"/>
29588 <colspec colwidth="6*" align="center"/>
29589 <colspec colwidth="6*" align="right"/>
29590 <tbody>
29591 <row>
29592 <entry><option>syslog_timestamp</option></entry>
29593 <entry>Use: <emphasis>main</emphasis></entry>
29594 <entry>Type: <emphasis>boolean</emphasis></entry>
29595 <entry>Default: <emphasis>true</emphasis></entry>
29596 </row>
29597 </tbody>
29598 </tgroup>
29599 </informaltable>
29600 <para>
29601 <indexterm role="concept">
29602 <primary>syslog</primary>
29603 <secondary>timestamps</secondary>
29604 </indexterm>
29605 If <option>syslog_timestamp</option> is set false, the timestamps on Exim&#x2019;s log lines are
29606 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
29607 details of Exim&#x2019;s logging.
29608 </para>
29609 <para>
29610 <indexterm role="option">
29611 <primary><option>system_filter</option></primary>
29612 </indexterm>
29613 </para>
29614 <informaltable frame="all">
29615 <tgroup cols="4" colsep="0" rowsep="0">
29616 <colspec colwidth="8*" align="left"/>
29617 <colspec colwidth="6*" align="center"/>
29618 <colspec colwidth="6*" align="center"/>
29619 <colspec colwidth="6*" align="right"/>
29620 <tbody>
29621 <row>
29622 <entry><option>system_filter</option></entry>
29623 <entry>Use: <emphasis>main</emphasis></entry>
29624 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29625 <entry>Default: <emphasis>unset</emphasis></entry>
29626 </row>
29627 </tbody>
29628 </tgroup>
29629 </informaltable>
29630 <para>
29631 <indexterm role="concept">
29632 <primary>filter</primary>
29633 <secondary>system filter</secondary>
29634 </indexterm>
29635 <indexterm role="concept">
29636 <primary>system filter</primary>
29637 <secondary>specifying</secondary>
29638 </indexterm>
29639 <indexterm role="concept">
29640 <primary>Sieve filter</primary>
29641 <secondary>not available for system filter</secondary>
29642 </indexterm>
29643 This option specifies an Exim filter file that is applied to all messages at
29644 the start of each delivery attempt, before any routing is done. System filters
29645 must be Exim filters; they cannot be Sieve filters. If the system filter
29646 generates any deliveries to files or pipes, or any new mail messages, the
29647 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
29648 which transports are to be used. Details of this facility are given in chapter
29649 <xref linkend="CHAPsystemfilter"/>.
29650 </para>
29651 <para>
29652 <indexterm role="option">
29653 <primary><option>system_filter_directory_transport</option></primary>
29654 </indexterm>
29655 </para>
29656 <informaltable frame="all">
29657 <tgroup cols="4" colsep="0" rowsep="0">
29658 <colspec colwidth="8*" align="left"/>
29659 <colspec colwidth="6*" align="center"/>
29660 <colspec colwidth="6*" align="center"/>
29661 <colspec colwidth="6*" align="right"/>
29662 <tbody>
29663 <row>
29664 <entry><option>system_filter_directory_transport</option></entry>
29665 <entry>Use: <emphasis>main</emphasis></entry>
29666 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29667 <entry>Default: <emphasis>unset</emphasis></entry>
29668 </row>
29669 </tbody>
29670 </tgroup>
29671 </informaltable>
29672 <para>
29673 <indexterm role="variable">
29674 <primary><varname>$address_file</varname></primary>
29675 </indexterm>
29676 This sets the name of the transport driver that is to be used when the
29677 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
29678 implying delivery of each message into a separate file in some directory.
29679 During the delivery, the variable <varname>$address_file</varname> contains the path name.
29680 </para>
29681 <para>
29682 <indexterm role="option">
29683 <primary><option>system_filter_file_transport</option></primary>
29684 </indexterm>
29685 </para>
29686 <informaltable frame="all">
29687 <tgroup cols="4" colsep="0" rowsep="0">
29688 <colspec colwidth="8*" align="left"/>
29689 <colspec colwidth="6*" align="center"/>
29690 <colspec colwidth="6*" align="center"/>
29691 <colspec colwidth="6*" align="right"/>
29692 <tbody>
29693 <row>
29694 <entry><option>system_filter_file_transport</option></entry>
29695 <entry>Use: <emphasis>main</emphasis></entry>
29696 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29697 <entry>Default: <emphasis>unset</emphasis></entry>
29698 </row>
29699 </tbody>
29700 </tgroup>
29701 </informaltable>
29702 <para>
29703 <indexterm role="concept">
29704 <primary>file</primary>
29705 <secondary>transport for system filter</secondary>
29706 </indexterm>
29707 This sets the name of the transport driver that is to be used when the <option>save</option>
29708 command in a system message filter specifies a path not ending in <quote>/</quote>. During
29709 the delivery, the variable <varname>$address_file</varname> contains the path name.
29710 </para>
29711 <para>
29712 <indexterm role="option">
29713 <primary><option>system_filter_group</option></primary>
29714 </indexterm>
29715 </para>
29716 <informaltable frame="all">
29717 <tgroup cols="4" colsep="0" rowsep="0">
29718 <colspec colwidth="8*" align="left"/>
29719 <colspec colwidth="6*" align="center"/>
29720 <colspec colwidth="6*" align="center"/>
29721 <colspec colwidth="6*" align="right"/>
29722 <tbody>
29723 <row>
29724 <entry><option>system_filter_group</option></entry>
29725 <entry>Use: <emphasis>main</emphasis></entry>
29726 <entry>Type: <emphasis>string</emphasis></entry>
29727 <entry>Default: <emphasis>unset</emphasis></entry>
29728 </row>
29729 </tbody>
29730 </tgroup>
29731 </informaltable>
29732 <para>
29733 <indexterm role="concept">
29734 <primary>gid (group id)</primary>
29735 <secondary>system filter</secondary>
29736 </indexterm>
29737 This option is used only when <option>system_filter_user</option> is also set. It sets the
29738 gid under which the system filter is run, overriding any gid that is associated
29739 with the user. The value may be numerical or symbolic.
29740 </para>
29741 <para>
29742 <indexterm role="option">
29743 <primary><option>system_filter_pipe_transport</option></primary>
29744 </indexterm>
29745 </para>
29746 <informaltable frame="all">
29747 <tgroup cols="4" colsep="0" rowsep="0">
29748 <colspec colwidth="8*" align="left"/>
29749 <colspec colwidth="6*" align="center"/>
29750 <colspec colwidth="6*" align="center"/>
29751 <colspec colwidth="6*" align="right"/>
29752 <tbody>
29753 <row>
29754 <entry><option>system_filter_pipe_transport</option></entry>
29755 <entry>Use: <emphasis>main</emphasis></entry>
29756 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29757 <entry>Default: <emphasis>unset</emphasis></entry>
29758 </row>
29759 </tbody>
29760 </tgroup>
29761 </informaltable>
29762 <para>
29763 <indexterm role="concept">
29764 <primary><command>pipe</command> transport</primary>
29765 <secondary>for system filter</secondary>
29766 </indexterm>
29767 <indexterm role="variable">
29768 <primary><varname>$address_pipe</varname></primary>
29769 </indexterm>
29770 This specifies the transport driver that is to be used when a <option>pipe</option> command
29771 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
29772 contains the pipe command.
29773 </para>
29774 <para>
29775 <indexterm role="option">
29776 <primary><option>system_filter_reply_transport</option></primary>
29777 </indexterm>
29778 </para>
29779 <informaltable frame="all">
29780 <tgroup cols="4" colsep="0" rowsep="0">
29781 <colspec colwidth="8*" align="left"/>
29782 <colspec colwidth="6*" align="center"/>
29783 <colspec colwidth="6*" align="center"/>
29784 <colspec colwidth="6*" align="right"/>
29785 <tbody>
29786 <row>
29787 <entry><option>system_filter_reply_transport</option></entry>
29788 <entry>Use: <emphasis>main</emphasis></entry>
29789 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29790 <entry>Default: <emphasis>unset</emphasis></entry>
29791 </row>
29792 </tbody>
29793 </tgroup>
29794 </informaltable>
29795 <para>
29796 <indexterm role="concept">
29797 <primary><command>autoreply</command> transport</primary>
29798 <secondary>for system filter</secondary>
29799 </indexterm>
29800 This specifies the transport driver that is to be used when a <option>mail</option> command
29801 is used in a system filter.
29802 </para>
29803 <para>
29804 <indexterm role="option">
29805 <primary><option>system_filter_user</option></primary>
29806 </indexterm>
29807 </para>
29808 <informaltable frame="all">
29809 <tgroup cols="4" colsep="0" rowsep="0">
29810 <colspec colwidth="8*" align="left"/>
29811 <colspec colwidth="6*" align="center"/>
29812 <colspec colwidth="6*" align="center"/>
29813 <colspec colwidth="6*" align="right"/>
29814 <tbody>
29815 <row>
29816 <entry><option>system_filter_user</option></entry>
29817 <entry>Use: <emphasis>main</emphasis></entry>
29818 <entry>Type: <emphasis>string</emphasis></entry>
29819 <entry>Default: <emphasis>unset</emphasis></entry>
29820 </row>
29821 </tbody>
29822 </tgroup>
29823 </informaltable>
29824 <para>
29825 <indexterm role="concept">
29826 <primary>uid (user id)</primary>
29827 <secondary>system filter</secondary>
29828 </indexterm>
29829 If this option is set to root, the system filter is run in the main Exim
29830 delivery process, as root.  Otherwise, the system filter runs in a separate
29831 process, as the given user, defaulting to the Exim run-time user.
29832 Unless the string consists entirely of digits, it
29833 is looked up in the password data. Failure to find the named user causes a
29834 configuration error. The gid is either taken from the password data, or
29835 specified by <option>system_filter_group</option>. When the uid is specified numerically,
29836 <option>system_filter_group</option> is required to be set.
29837 </para>
29838 <para>
29839 If the system filter generates any pipe, file, or reply deliveries, the uid
29840 under which the filter is run is used when transporting them, unless a
29841 transport option overrides.
29842 </para>
29843 <para>
29844 <indexterm role="option">
29845 <primary><option>tcp_nodelay</option></primary>
29846 </indexterm>
29847 </para>
29848 <informaltable frame="all">
29849 <tgroup cols="4" colsep="0" rowsep="0">
29850 <colspec colwidth="8*" align="left"/>
29851 <colspec colwidth="6*" align="center"/>
29852 <colspec colwidth="6*" align="center"/>
29853 <colspec colwidth="6*" align="right"/>
29854 <tbody>
29855 <row>
29856 <entry><option>tcp_nodelay</option></entry>
29857 <entry>Use: <emphasis>main</emphasis></entry>
29858 <entry>Type: <emphasis>boolean</emphasis></entry>
29859 <entry>Default: <emphasis>true</emphasis></entry>
29860 </row>
29861 </tbody>
29862 </tgroup>
29863 </informaltable>
29864 <para>
29865 <indexterm role="concept">
29866 <primary>daemon</primary>
29867 <secondary>TCP_NODELAY on sockets</secondary>
29868 </indexterm>
29869 <indexterm role="concept">
29870 <primary>Nagle algorithm</primary>
29871 </indexterm>
29872 <indexterm role="concept">
29873 <primary>TCP_NODELAY on listening sockets</primary>
29874 </indexterm>
29875 If this option is set false, it stops the Exim daemon setting the
29876 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
29877 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
29878 performance in interactive (character-by-character) situations. Turning it off
29879 should improve Exim&#x2019;s performance a bit, so that is what happens by default.
29880 However, it appears that some broken clients cannot cope, and time out. Hence
29881 this option. It affects only those sockets that are set up for listening by the
29882 daemon. Sockets created by the smtp transport for delivering mail always set
29883 TCP_NODELAY.
29884 </para>
29885 <para>
29886 <indexterm role="option">
29887 <primary><option>timeout_frozen_after</option></primary>
29888 </indexterm>
29889 </para>
29890 <informaltable frame="all">
29891 <tgroup cols="4" colsep="0" rowsep="0">
29892 <colspec colwidth="8*" align="left"/>
29893 <colspec colwidth="6*" align="center"/>
29894 <colspec colwidth="6*" align="center"/>
29895 <colspec colwidth="6*" align="right"/>
29896 <tbody>
29897 <row>
29898 <entry><option>timeout_frozen_after</option></entry>
29899 <entry>Use: <emphasis>main</emphasis></entry>
29900 <entry>Type: <emphasis>time</emphasis></entry>
29901 <entry>Default: <emphasis>0s</emphasis></entry>
29902 </row>
29903 </tbody>
29904 </tgroup>
29905 </informaltable>
29906 <para>
29907 <indexterm role="concept">
29908 <primary>frozen messages</primary>
29909 <secondary>timing out</secondary>
29910 </indexterm>
29911 <indexterm role="concept">
29912 <primary>timeout</primary>
29913 <secondary>frozen messages</secondary>
29914 </indexterm>
29915 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
29916 message of any kind that has been on the queue for longer than the given time
29917 is automatically cancelled at the next queue run. If the frozen message is a
29918 bounce message, it is just discarded; otherwise, a bounce is sent to the
29919 sender, in a similar manner to cancellation by the <option>-Mg</option> command line option.
29920 If you want to timeout frozen bounce messages earlier than other kinds of
29921 frozen message, see <option>ignore_bounce_errors_after</option>.
29922 </para>
29923 <para>
29924 <emphasis role="bold">Note:</emphasis> the default value of zero means no timeouts; with this setting,
29925 frozen messages remain on the queue forever (except for any frozen bounce
29926 messages that are released by <option>ignore_bounce_errors_after</option>).
29927 </para>
29928 <para>
29929 <indexterm role="option">
29930 <primary><option>timezone</option></primary>
29931 </indexterm>
29932 </para>
29933 <informaltable frame="all">
29934 <tgroup cols="4" colsep="0" rowsep="0">
29935 <colspec colwidth="8*" align="left"/>
29936 <colspec colwidth="6*" align="center"/>
29937 <colspec colwidth="6*" align="center"/>
29938 <colspec colwidth="6*" align="right"/>
29939 <tbody>
29940 <row>
29941 <entry><option>timezone</option></entry>
29942 <entry>Use: <emphasis>main</emphasis></entry>
29943 <entry>Type: <emphasis>string</emphasis></entry>
29944 <entry>Default: <emphasis>unset</emphasis></entry>
29945 </row>
29946 </tbody>
29947 </tgroup>
29948 </informaltable>
29949 <para>
29950 <indexterm role="concept">
29951 <primary>timezone, setting</primary>
29952 </indexterm>
29953 The value of <option>timezone</option> is used to set the environment variable TZ while
29954 running Exim (if it is different on entry). This ensures that all timestamps
29955 created by Exim are in the required timezone. If you want all your timestamps
29956 to be in UTC (aka GMT) you should set
29957 </para>
29958 <literallayout class="monospaced">
29959 timezone = UTC
29960 </literallayout>
29961 <para>
29962 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
29963 or, if that is not set, from the value of the TZ environment variable when Exim
29964 is built. If <option>timezone</option> is set to the empty string, either at build or run
29965 time, any existing TZ variable is removed from the environment when Exim
29966 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
29967 unfortunately not all, operating systems.
29968 </para>
29969 <para>
29970 <indexterm role="option">
29971 <primary><option>tls_advertise_hosts</option></primary>
29972 </indexterm>
29973 </para>
29974 <informaltable frame="all">
29975 <tgroup cols="4" colsep="0" rowsep="0">
29976 <colspec colwidth="8*" align="left"/>
29977 <colspec colwidth="6*" align="center"/>
29978 <colspec colwidth="6*" align="center"/>
29979 <colspec colwidth="6*" align="right"/>
29980 <tbody>
29981 <row>
29982 <entry><option>tls_advertise_hosts</option></entry>
29983 <entry>Use: <emphasis>main</emphasis></entry>
29984 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29985 <entry>Default: <emphasis>unset</emphasis></entry>
29986 </row>
29987 </tbody>
29988 </tgroup>
29989 </informaltable>
29990 <para>
29991 <indexterm role="concept">
29992 <primary>TLS</primary>
29993 <secondary>advertising</secondary>
29994 </indexterm>
29995 <indexterm role="concept">
29996 <primary>encryption</primary>
29997 <secondary>on SMTP connection</secondary>
29998 </indexterm>
29999 <indexterm role="concept">
30000 <primary>SMTP</primary>
30001 <secondary>encrypted connection</secondary>
30002 </indexterm>
30003 When Exim is built with support for TLS encrypted connections, the availability
30004 of the STARTTLS command to set up an encrypted session is advertised in
30005 response to EHLO only to those client hosts that match this option. See
30006 chapter <xref linkend="CHAPTLS"/> for details of Exim&#x2019;s support for TLS.
30007 </para>
30008 <para>
30009 <indexterm role="option">
30010 <primary><option>tls_certificate</option></primary>
30011 </indexterm>
30012 </para>
30013 <informaltable frame="all">
30014 <tgroup cols="4" colsep="0" rowsep="0">
30015 <colspec colwidth="8*" align="left"/>
30016 <colspec colwidth="6*" align="center"/>
30017 <colspec colwidth="6*" align="center"/>
30018 <colspec colwidth="6*" align="right"/>
30019 <tbody>
30020 <row>
30021 <entry><option>tls_certificate</option></entry>
30022 <entry>Use: <emphasis>main</emphasis></entry>
30023 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30024 <entry>Default: <emphasis>unset</emphasis></entry>
30025 </row>
30026 </tbody>
30027 </tgroup>
30028 </informaltable>
30029 <para>
30030 <indexterm role="concept">
30031 <primary>TLS</primary>
30032 <secondary>server certificate; location of</secondary>
30033 </indexterm>
30034 <indexterm role="concept">
30035 <primary>certificate</primary>
30036 <secondary>server, location of</secondary>
30037 </indexterm>
30038 The value of this option is expanded, and must then be the absolute path to a
30039 file which contains the server&#x2019;s certificates. The server&#x2019;s private key is also
30040 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
30041 <xref linkend="CHAPTLS"/> for further details.
30042 </para>
30043 <para>
30044 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
30045 receiving incoming messages as a server. If you want to supply certificates for
30046 use when sending messages as a client, you must set the <option>tls_certificate</option>
30047 option in the relevant <command>smtp</command> transport.
30048 </para>
30049 <para>
30050 If the option contains <varname>$tls_out_sni</varname> and Exim is built against OpenSSL, then
30051 if the OpenSSL build supports TLS extensions and the TLS client sends the
30052 Server Name Indication extension, then this option and others documented in
30053 <xref linkend="SECTtlssni"/> will be re-expanded.
30054 </para>
30055 <para>
30056 <indexterm role="option">
30057 <primary><option>tls_crl</option></primary>
30058 </indexterm>
30059 </para>
30060 <informaltable frame="all">
30061 <tgroup cols="4" colsep="0" rowsep="0">
30062 <colspec colwidth="8*" align="left"/>
30063 <colspec colwidth="6*" align="center"/>
30064 <colspec colwidth="6*" align="center"/>
30065 <colspec colwidth="6*" align="right"/>
30066 <tbody>
30067 <row>
30068 <entry><option>tls_crl</option></entry>
30069 <entry>Use: <emphasis>main</emphasis></entry>
30070 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30071 <entry>Default: <emphasis>unset</emphasis></entry>
30072 </row>
30073 </tbody>
30074 </tgroup>
30075 </informaltable>
30076 <para>
30077 <indexterm role="concept">
30078 <primary>TLS</primary>
30079 <secondary>server certificate revocation list</secondary>
30080 </indexterm>
30081 <indexterm role="concept">
30082 <primary>certificate</primary>
30083 <secondary>revocation list for server</secondary>
30084 </indexterm>
30085 This option specifies a certificate revocation list. The expanded value must
30086 be the name of a file that contains a CRL in PEM format.
30087 </para>
30088 <para>
30089 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
30090 </para>
30091 <para>
30092 <indexterm role="option">
30093 <primary><option>tls_dh_max_bits</option></primary>
30094 </indexterm>
30095 </para>
30096 <informaltable frame="all">
30097 <tgroup cols="4" colsep="0" rowsep="0">
30098 <colspec colwidth="8*" align="left"/>
30099 <colspec colwidth="6*" align="center"/>
30100 <colspec colwidth="6*" align="center"/>
30101 <colspec colwidth="6*" align="right"/>
30102 <tbody>
30103 <row>
30104 <entry><option>tls_dh_max_bits</option></entry>
30105 <entry>Use: <emphasis>main</emphasis></entry>
30106 <entry>Type: <emphasis>integer</emphasis></entry>
30107 <entry>Default: <emphasis>2236</emphasis></entry>
30108 </row>
30109 </tbody>
30110 </tgroup>
30111 </informaltable>
30112 <para>
30113 <indexterm role="concept">
30114 <primary>TLS</primary>
30115 <secondary>D-H bit count</secondary>
30116 </indexterm>
30117 The number of bits used for Diffie-Hellman key-exchange may be suggested by
30118 the chosen TLS library.  That value might prove to be too high for
30119 interoperability.  This option provides a maximum clamp on the value
30120 suggested, trading off security for interoperability.
30121 </para>
30122 <para>
30123 The value must be at least 1024.
30124 </para>
30125 <para>
30126 The value 2236 was chosen because, at time of adding the option, it was the
30127 hard-coded maximum value supported by the NSS cryptographic library, as used
30128 by Thunderbird, while GnuTLS was suggesting 2432 bits as normal.
30129 </para>
30130 <para>
30131 If you prefer more security and are willing to break some clients, raise this
30132 number.
30133 </para>
30134 <para>
30135 Note that the value passed to GnuTLS for *generating* a new prime may be a
30136 little less than this figure, because GnuTLS is inexact and may produce a
30137 larger prime than requested.
30138 </para>
30139 <para>
30140 <indexterm role="option">
30141 <primary><option>tls_dhparam</option></primary>
30142 </indexterm>
30143 </para>
30144 <informaltable frame="all">
30145 <tgroup cols="4" colsep="0" rowsep="0">
30146 <colspec colwidth="8*" align="left"/>
30147 <colspec colwidth="6*" align="center"/>
30148 <colspec colwidth="6*" align="center"/>
30149 <colspec colwidth="6*" align="right"/>
30150 <tbody>
30151 <row>
30152 <entry><option>tls_dhparam</option></entry>
30153 <entry>Use: <emphasis>main</emphasis></entry>
30154 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30155 <entry>Default: <emphasis>unset</emphasis></entry>
30156 </row>
30157 </tbody>
30158 </tgroup>
30159 </informaltable>
30160 <para>
30161 <indexterm role="concept">
30162 <primary>TLS</primary>
30163 <secondary>D-H parameters for server</secondary>
30164 </indexterm>
30165 The value of this option is expanded and indicates the source of DH parameters
30166 to be used by Exim.
30167 </para>
30168 <para>
30169 If it is a filename starting with a <literal>/</literal>, then it names a file from which DH
30170 parameters should be loaded.  If the file exists, it should hold a PEM-encoded
30171 PKCS#3 representation of the DH prime.  If the file does not exist, for
30172 OpenSSL it is an error.  For GnuTLS, Exim will attempt to create the file and
30173 fill it with a generated DH prime.  For OpenSSL, if the DH bit-count from
30174 loading the file is greater than <option>tls_dh_max_bits</option> then it will be ignored,
30175 and treated as though the <option>tls_dhparam</option> were set to "none".
30176 </para>
30177 <para>
30178 If this option expands to the string "none", then no DH parameters will be
30179 loaded by Exim.
30180 </para>
30181 <para>
30182 If this option expands to the string "historic" and Exim is using GnuTLS, then
30183 Exim will attempt to load a file from inside the spool directory.  If the file
30184 does not exist, Exim will attempt to create it.
30185 See section <xref linkend="SECTgnutlsparam"/> for further details.
30186 </para>
30187 <para>
30188 If Exim is using OpenSSL and this option is empty or unset, then Exim will load
30189 a default DH prime; the default is the 2048 bit prime described in section
30190 2.2 of RFC 5114, "2048-bit MODP Group with 224-bit Prime Order Subgroup", which
30191 in IKE is assigned number 23.
30192 </para>
30193 <para>
30194 Otherwise, the option must expand to the name used by Exim for any of a number
30195 of DH primes specified in RFC 2409, RFC 3526 and RFC 5114.  As names, Exim uses
30196 "ike" followed by the number used by IKE, of "default" which corresponds to
30197 "ike23".
30198 </para>
30199 <para>
30200 The available primes are:
30201 <literal>ike1</literal>, <literal>ike2</literal>, <literal>ike5</literal>,
30202 <literal>ike14</literal>, <literal>ike15</literal>, <literal>ike16</literal>, <literal>ike17</literal>, <literal>ike18</literal>,
30203 <literal>ike22</literal>, <literal>ike23</literal> (aka <literal>default</literal>) and <literal>ike24</literal>.
30204 </para>
30205 <para>
30206 Some of these will be too small to be accepted by clients.
30207 Some may be too large to be accepted by clients.
30208 </para>
30209 <para>
30210 The TLS protocol does not negotiate an acceptable size for this; clients tend
30211 to hard-drop connections if what is offered by the server is unacceptable,
30212 whether too large or too small, and there&#x2019;s no provision for the client to
30213 tell the server what these constraints are.  Thus, as a server operator, you
30214 need to make an educated guess as to what is most likely to work for your
30215 userbase.
30216 </para>
30217 <para>
30218 Some known size constraints suggest that a bit-size in the range 2048 to 2236
30219 is most likely to maximise interoperability.  The upper bound comes from
30220 applications using the Mozilla Network Security Services (NSS) library, which
30221 used to set its <literal>DH_MAX_P_BITS</literal> upper-bound to 2236.  This affects many
30222 mail user agents (MUAs). The lower bound comes from Debian installs of Exim4
30223 prior to the 4.80 release, as Debian used to patch Exim to raise the minimum
30224 acceptable bound from 1024 to 2048.
30225 </para>
30226 <para>
30227 <indexterm role="option">
30228 <primary><option>tls_ocsp_file</option></primary>
30229 </indexterm>
30230 </para>
30231 <informaltable frame="all">
30232 <tgroup cols="4" colsep="0" rowsep="0">
30233 <colspec colwidth="8*" align="left"/>
30234 <colspec colwidth="6*" align="center"/>
30235 <colspec colwidth="6*" align="center"/>
30236 <colspec colwidth="6*" align="right"/>
30237 <tbody>
30238 <row>
30239 <entry><option>tls_ocsp_file</option></entry>
30240 <entry>Use: <emphasis>main</emphasis></entry>
30241 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30242 <entry>Default: <emphasis>unset</emphasis></entry>
30243 </row>
30244 </tbody>
30245 </tgroup>
30246 </informaltable>
30247 <para>
30248 This option
30249 must if set expand to the absolute path to a file which contains a current
30250 status proof for the server&#x2019;s certificate, as obtained from the
30251 Certificate Authority.
30252 </para>
30253 <para>
30254 <indexterm role="option">
30255 <primary><option>tls_on_connect_ports</option></primary>
30256 </indexterm>
30257 </para>
30258 <informaltable frame="all">
30259 <tgroup cols="4" colsep="0" rowsep="0">
30260 <colspec colwidth="8*" align="left"/>
30261 <colspec colwidth="6*" align="center"/>
30262 <colspec colwidth="6*" align="center"/>
30263 <colspec colwidth="6*" align="right"/>
30264 <tbody>
30265 <row>
30266 <entry><option>tls_on_connect_ports</option></entry>
30267 <entry>Use: <emphasis>main</emphasis></entry>
30268 <entry>Type: <emphasis>string list</emphasis></entry>
30269 <entry>Default: <emphasis>unset</emphasis></entry>
30270 </row>
30271 </tbody>
30272 </tgroup>
30273 </informaltable>
30274 <para>
30275 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
30276 operate the obsolete SSMTP (SMTPS) protocol, where a TLS session is immediately
30277 set up without waiting for the client to issue a STARTTLS command. For
30278 further details, see section <xref linkend="SECTsupobssmt"/>.
30279 </para>
30280 <para>
30281 <indexterm role="option">
30282 <primary><option>tls_privatekey</option></primary>
30283 </indexterm>
30284 </para>
30285 <informaltable frame="all">
30286 <tgroup cols="4" colsep="0" rowsep="0">
30287 <colspec colwidth="8*" align="left"/>
30288 <colspec colwidth="6*" align="center"/>
30289 <colspec colwidth="6*" align="center"/>
30290 <colspec colwidth="6*" align="right"/>
30291 <tbody>
30292 <row>
30293 <entry><option>tls_privatekey</option></entry>
30294 <entry>Use: <emphasis>main</emphasis></entry>
30295 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30296 <entry>Default: <emphasis>unset</emphasis></entry>
30297 </row>
30298 </tbody>
30299 </tgroup>
30300 </informaltable>
30301 <para>
30302 <indexterm role="concept">
30303 <primary>TLS</primary>
30304 <secondary>server private key; location of</secondary>
30305 </indexterm>
30306 The value of this option is expanded, and must then be the absolute path to a
30307 file which contains the server&#x2019;s private key. If this option is unset, or if
30308 the expansion is forced to fail, or the result is an empty string, the private
30309 key is assumed to be in the same file as the server&#x2019;s certificates. See chapter
30310 <xref linkend="CHAPTLS"/> for further details.
30311 </para>
30312 <para>
30313 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
30314 </para>
30315 <para>
30316 <indexterm role="option">
30317 <primary><option>tls_remember_esmtp</option></primary>
30318 </indexterm>
30319 </para>
30320 <informaltable frame="all">
30321 <tgroup cols="4" colsep="0" rowsep="0">
30322 <colspec colwidth="8*" align="left"/>
30323 <colspec colwidth="6*" align="center"/>
30324 <colspec colwidth="6*" align="center"/>
30325 <colspec colwidth="6*" align="right"/>
30326 <tbody>
30327 <row>
30328 <entry><option>tls_remember_esmtp</option></entry>
30329 <entry>Use: <emphasis>main</emphasis></entry>
30330 <entry>Type: <emphasis>boolean</emphasis></entry>
30331 <entry>Default: <emphasis>false</emphasis></entry>
30332 </row>
30333 </tbody>
30334 </tgroup>
30335 </informaltable>
30336 <para>
30337 <indexterm role="concept">
30338 <primary>TLS</primary>
30339 <secondary>esmtp state; remembering</secondary>
30340 </indexterm>
30341 <indexterm role="concept">
30342 <primary>TLS</primary>
30343 <secondary>broken clients</secondary>
30344 </indexterm>
30345 If this option is set true, Exim violates the RFCs by remembering that it is in
30346 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
30347 support for broken clients that fail to send a new EHLO after starting a
30348 TLS session.
30349 </para>
30350 <para>
30351 <indexterm role="option">
30352 <primary><option>tls_require_ciphers</option></primary>
30353 </indexterm>
30354 </para>
30355 <informaltable frame="all">
30356 <tgroup cols="4" colsep="0" rowsep="0">
30357 <colspec colwidth="8*" align="left"/>
30358 <colspec colwidth="6*" align="center"/>
30359 <colspec colwidth="6*" align="center"/>
30360 <colspec colwidth="6*" align="right"/>
30361 <tbody>
30362 <row>
30363 <entry><option>tls_require_ciphers</option></entry>
30364 <entry>Use: <emphasis>main</emphasis></entry>
30365 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30366 <entry>Default: <emphasis>unset</emphasis></entry>
30367 </row>
30368 </tbody>
30369 </tgroup>
30370 </informaltable>
30371 <para>
30372 <indexterm role="concept">
30373 <primary>TLS</primary>
30374 <secondary>requiring specific ciphers</secondary>
30375 </indexterm>
30376 <indexterm role="concept">
30377 <primary>cipher</primary>
30378 <secondary>requiring specific</secondary>
30379 </indexterm>
30380 This option controls which ciphers can be used for incoming TLS connections.
30381 The <command>smtp</command> transport has an option of the same name for controlling outgoing
30382 connections. This option is expanded for each connection, so can be varied for
30383 different clients if required. The value of this option must be a list of
30384 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
30385 in somewhat different ways. If GnuTLS is being used, the client controls the
30386 preference order of the available ciphers. Details are given in sections
30387 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
30388 </para>
30389 <para>
30390 <indexterm role="option">
30391 <primary><option>tls_try_verify_hosts</option></primary>
30392 </indexterm>
30393 </para>
30394 <informaltable frame="all">
30395 <tgroup cols="4" colsep="0" rowsep="0">
30396 <colspec colwidth="8*" align="left"/>
30397 <colspec colwidth="6*" align="center"/>
30398 <colspec colwidth="6*" align="center"/>
30399 <colspec colwidth="6*" align="right"/>
30400 <tbody>
30401 <row>
30402 <entry><option>tls_try_verify_hosts</option></entry>
30403 <entry>Use: <emphasis>main</emphasis></entry>
30404 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30405 <entry>Default: <emphasis>unset</emphasis></entry>
30406 </row>
30407 </tbody>
30408 </tgroup>
30409 </informaltable>
30410 <para>
30411 <indexterm role="concept">
30412 <primary>TLS</primary>
30413 <secondary>client certificate verification</secondary>
30414 </indexterm>
30415 <indexterm role="concept">
30416 <primary>certificate</primary>
30417 <secondary>verification of client</secondary>
30418 </indexterm>
30419 See <option>tls_verify_hosts</option> below.
30420 </para>
30421 <para>
30422 <indexterm role="option">
30423 <primary><option>tls_verify_certificates</option></primary>
30424 </indexterm>
30425 </para>
30426 <informaltable frame="all">
30427 <tgroup cols="4" colsep="0" rowsep="0">
30428 <colspec colwidth="8*" align="left"/>
30429 <colspec colwidth="6*" align="center"/>
30430 <colspec colwidth="6*" align="center"/>
30431 <colspec colwidth="6*" align="right"/>
30432 <tbody>
30433 <row>
30434 <entry><option>tls_verify_certificates</option></entry>
30435 <entry>Use: <emphasis>main</emphasis></entry>
30436 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30437 <entry>Default: <emphasis>unset</emphasis></entry>
30438 </row>
30439 </tbody>
30440 </tgroup>
30441 </informaltable>
30442 <para>
30443 <indexterm role="concept">
30444 <primary>TLS</primary>
30445 <secondary>client certificate verification</secondary>
30446 </indexterm>
30447 <indexterm role="concept">
30448 <primary>certificate</primary>
30449 <secondary>verification of client</secondary>
30450 </indexterm>
30451 The value of this option is expanded, and must then be the absolute path to
30452 a file containing permitted certificates for clients that
30453 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>. Alternatively, if you
30454 are using either GnuTLS version 3.3.6 (or later) or OpenSSL,
30455 you can set <option>tls_verify_certificates</option> to the name of a
30456 directory containing certificate files.
30457 For earlier versions of GnuTLS
30458 the option must be set to the name of a single file.
30459 </para>
30460 <para>
30461 With OpenSSL the certificates specified
30462 explicitly
30463 either by file or directory
30464 are added to those given by the system default location.
30465 </para>
30466 <para>
30467 These certificates should be for the certificate authorities trusted, rather
30468 than the public cert of individual clients.  With both OpenSSL and GnuTLS, if
30469 the value is a file then the certificates are sent by Exim as a server to
30470 connecting clients, defining the list of accepted certificate authorities.
30471 Thus the values defined should be considered public data.  To avoid this,
30472 use the explicit directory version.
30473 </para>
30474 <para>
30475 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
30476 </para>
30477 <para>
30478 A forced expansion failure or setting to an empty string is equivalent to
30479 being unset.
30480 </para>
30481 <para>
30482 <indexterm role="option">
30483 <primary><option>tls_verify_hosts</option></primary>
30484 </indexterm>
30485 </para>
30486 <informaltable frame="all">
30487 <tgroup cols="4" colsep="0" rowsep="0">
30488 <colspec colwidth="8*" align="left"/>
30489 <colspec colwidth="6*" align="center"/>
30490 <colspec colwidth="6*" align="center"/>
30491 <colspec colwidth="6*" align="right"/>
30492 <tbody>
30493 <row>
30494 <entry><option>tls_verify_hosts</option></entry>
30495 <entry>Use: <emphasis>main</emphasis></entry>
30496 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30497 <entry>Default: <emphasis>unset</emphasis></entry>
30498 </row>
30499 </tbody>
30500 </tgroup>
30501 </informaltable>
30502 <para>
30503 <indexterm role="concept">
30504 <primary>TLS</primary>
30505 <secondary>client certificate verification</secondary>
30506 </indexterm>
30507 <indexterm role="concept">
30508 <primary>certificate</primary>
30509 <secondary>verification of client</secondary>
30510 </indexterm>
30511 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
30512 certificates from clients. The expected certificates are defined by
30513 <option>tls_verify_certificates</option>, which must be set. A configuration error occurs if
30514 either <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> is set and
30515 <option>tls_verify_certificates</option> is not set.
30516 </para>
30517 <para>
30518 Any client that matches <option>tls_verify_hosts</option> is constrained by
30519 <option>tls_verify_certificates</option>. When the client initiates a TLS session, it must
30520 present one of the listed certificates. If it does not, the connection is
30521 aborted. <emphasis role="bold">Warning</emphasis>: Including a host in <option>tls_verify_hosts</option> does not require
30522 the host to use TLS. It can still send SMTP commands through unencrypted
30523 connections. Forcing a client to use TLS has to be done separately using an
30524 ACL to reject inappropriate commands when the connection is not encrypted.
30525 </para>
30526 <para>
30527 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
30528 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
30529 certificate and checks it against <option>tls_verify_certificates</option>, but does not
30530 abort the connection if there is no certificate or if it does not match. This
30531 state can be detected in an ACL, which makes it possible to implement policies
30532 such as <quote>accept for relay only if a verified certificate has been received,
30533 but accept for local delivery if encrypted, even without a verified
30534 certificate</quote>.
30535 </para>
30536 <para>
30537 Client hosts that match neither of these lists are not asked to present
30538 certificates.
30539 </para>
30540 <para>
30541 <indexterm role="option">
30542 <primary><option>trusted_groups</option></primary>
30543 </indexterm>
30544 </para>
30545 <informaltable frame="all">
30546 <tgroup cols="4" colsep="0" rowsep="0">
30547 <colspec colwidth="8*" align="left"/>
30548 <colspec colwidth="6*" align="center"/>
30549 <colspec colwidth="6*" align="center"/>
30550 <colspec colwidth="6*" align="right"/>
30551 <tbody>
30552 <row>
30553 <entry><option>trusted_groups</option></entry>
30554 <entry>Use: <emphasis>main</emphasis></entry>
30555 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
30556 <entry>Default: <emphasis>unset</emphasis></entry>
30557 </row>
30558 </tbody>
30559 </tgroup>
30560 </informaltable>
30561 <para>
30562 <indexterm role="concept">
30563 <primary>trusted groups</primary>
30564 </indexterm>
30565 <indexterm role="concept">
30566 <primary>groups</primary>
30567 <secondary>trusted</secondary>
30568 </indexterm>
30569 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
30570 option is set, any process that is running in one of the listed groups, or
30571 which has one of them as a supplementary group, is trusted. The groups can be
30572 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
30573 details of what trusted callers are permitted to do. If neither
30574 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
30575 are trusted.
30576 </para>
30577 <para>
30578 <indexterm role="option">
30579 <primary><option>trusted_users</option></primary>
30580 </indexterm>
30581 </para>
30582 <informaltable frame="all">
30583 <tgroup cols="4" colsep="0" rowsep="0">
30584 <colspec colwidth="8*" align="left"/>
30585 <colspec colwidth="6*" align="center"/>
30586 <colspec colwidth="6*" align="center"/>
30587 <colspec colwidth="6*" align="right"/>
30588 <tbody>
30589 <row>
30590 <entry><option>trusted_users</option></entry>
30591 <entry>Use: <emphasis>main</emphasis></entry>
30592 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
30593 <entry>Default: <emphasis>unset</emphasis></entry>
30594 </row>
30595 </tbody>
30596 </tgroup>
30597 </informaltable>
30598 <para>
30599 <indexterm role="concept">
30600 <primary>trusted users</primary>
30601 </indexterm>
30602 <indexterm role="concept">
30603 <primary>user</primary>
30604 <secondary>trusted</secondary>
30605 </indexterm>
30606 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
30607 option is set, any process that is running as one of the listed users is
30608 trusted. The users can be specified numerically or by name. See section
30609 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
30610 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
30611 Exim user are trusted.
30612 </para>
30613 <para>
30614 <indexterm role="option">
30615 <primary><option>unknown_login</option></primary>
30616 </indexterm>
30617 </para>
30618 <informaltable frame="all">
30619 <tgroup cols="4" colsep="0" rowsep="0">
30620 <colspec colwidth="8*" align="left"/>
30621 <colspec colwidth="6*" align="center"/>
30622 <colspec colwidth="6*" align="center"/>
30623 <colspec colwidth="6*" align="right"/>
30624 <tbody>
30625 <row>
30626 <entry><option>unknown_login</option></entry>
30627 <entry>Use: <emphasis>main</emphasis></entry>
30628 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30629 <entry>Default: <emphasis>unset</emphasis></entry>
30630 </row>
30631 </tbody>
30632 </tgroup>
30633 </informaltable>
30634 <para>
30635 <indexterm role="concept">
30636 <primary>uid (user id)</primary>
30637 <secondary>unknown caller</secondary>
30638 </indexterm>
30639 <indexterm role="variable">
30640 <primary><varname>$caller_uid</varname></primary>
30641 </indexterm>
30642 This is a specialized feature for use in unusual configurations. By default, if
30643 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
30644 gives up. The <option>unknown_login</option> option can be used to set a login name to be
30645 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
30646 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
30647 is used for the user&#x2019;s real name (gecos field), unless this has been set by the
30648 <option>-F</option> option.
30649 </para>
30650 <para>
30651 <indexterm role="option">
30652 <primary><option>unknown_username</option></primary>
30653 </indexterm>
30654 </para>
30655 <informaltable frame="all">
30656 <tgroup cols="4" colsep="0" rowsep="0">
30657 <colspec colwidth="8*" align="left"/>
30658 <colspec colwidth="6*" align="center"/>
30659 <colspec colwidth="6*" align="center"/>
30660 <colspec colwidth="6*" align="right"/>
30661 <tbody>
30662 <row>
30663 <entry><option>unknown_username</option></entry>
30664 <entry>Use: <emphasis>main</emphasis></entry>
30665 <entry>Type: <emphasis>string</emphasis></entry>
30666 <entry>Default: <emphasis>unset</emphasis></entry>
30667 </row>
30668 </tbody>
30669 </tgroup>
30670 </informaltable>
30671 <para>
30672 See <option>unknown_login</option>.
30673 </para>
30674 <para>
30675 <indexterm role="option">
30676 <primary><option>untrusted_set_sender</option></primary>
30677 </indexterm>
30678 </para>
30679 <informaltable frame="all">
30680 <tgroup cols="4" colsep="0" rowsep="0">
30681 <colspec colwidth="8*" align="left"/>
30682 <colspec colwidth="6*" align="center"/>
30683 <colspec colwidth="6*" align="center"/>
30684 <colspec colwidth="6*" align="right"/>
30685 <tbody>
30686 <row>
30687 <entry><option>untrusted_set_sender</option></entry>
30688 <entry>Use: <emphasis>main</emphasis></entry>
30689 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
30690 <entry>Default: <emphasis>unset</emphasis></entry>
30691 </row>
30692 </tbody>
30693 </tgroup>
30694 </informaltable>
30695 <para>
30696 <indexterm role="concept">
30697 <primary>trusted users</primary>
30698 </indexterm>
30699 <indexterm role="concept">
30700 <primary>sender</primary>
30701 <secondary>setting by untrusted user</secondary>
30702 </indexterm>
30703 <indexterm role="concept">
30704 <primary>untrusted user setting sender</primary>
30705 </indexterm>
30706 <indexterm role="concept">
30707 <primary>user</primary>
30708 <secondary>untrusted setting sender</secondary>
30709 </indexterm>
30710 <indexterm role="concept">
30711 <primary>envelope sender</primary>
30712 </indexterm>
30713 When an untrusted user submits a message to Exim using the standard input, Exim
30714 normally creates an envelope sender address from the user&#x2019;s login and the
30715 default qualification domain. Data from the <option>-f</option> option (for setting envelope
30716 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
30717 is used) is ignored.
30718 </para>
30719 <para>
30720 However, untrusted users are permitted to set an empty envelope sender address,
30721 to declare that a message should never generate any bounces. For example:
30722 </para>
30723 <literallayout class="monospaced">
30724 exim -f '&lt;&gt;' user@domain.example
30725 </literallayout>
30726 <para>
30727 <indexterm role="variable">
30728 <primary><varname>$sender_ident</varname></primary>
30729 </indexterm>
30730 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
30731 other envelope sender addresses in a controlled way. When it is set, untrusted
30732 users are allowed to set envelope sender addresses that match any of the
30733 patterns in the list. Like all address lists, the string is expanded. The
30734 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
30735 users to setting senders that start with their login ids
30736 followed by a hyphen
30737 by a setting like this:
30738 </para>
30739 <literallayout class="monospaced">
30740 untrusted_set_sender = ^$sender_ident-
30741 </literallayout>
30742 <para>
30743 If you want to allow untrusted users to set envelope sender addresses without
30744 restriction, you can use
30745 </para>
30746 <literallayout class="monospaced">
30747 untrusted_set_sender = *
30748 </literallayout>
30749 <para>
30750 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
30751 only to the setting of the envelope sender. It does not permit untrusted users
30752 to use the other options which trusted user can use to override message
30753 parameters. Furthermore, it does not stop Exim from removing an existing
30754 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
30755 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
30756 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
30757 described in section <xref linkend="SECTthesenhea"/>.
30758 </para>
30759 <para>
30760 The log line for a message&#x2019;s arrival shows the envelope sender following
30761 <quote>&lt;=</quote>. For local messages, the user&#x2019;s login always follows, after <quote>U=</quote>. In
30762 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
30763 envelope sender address, the user&#x2019;s login is shown in parentheses after the
30764 sender address.
30765 </para>
30766 <para>
30767 <indexterm role="option">
30768 <primary><option>uucp_from_pattern</option></primary>
30769 </indexterm>
30770 </para>
30771 <informaltable frame="all">
30772 <tgroup cols="4" colsep="0" rowsep="0">
30773 <colspec colwidth="8*" align="left"/>
30774 <colspec colwidth="6*" align="center"/>
30775 <colspec colwidth="6*" align="center"/>
30776 <colspec colwidth="6*" align="right"/>
30777 <tbody>
30778 <row>
30779 <entry><option>uucp_from_pattern</option></entry>
30780 <entry>Use: <emphasis>main</emphasis></entry>
30781 <entry>Type: <emphasis>string</emphasis></entry>
30782 <entry>Default: <emphasis>see below</emphasis></entry>
30783 </row>
30784 </tbody>
30785 </tgroup>
30786 </informaltable>
30787 <para>
30788 <indexterm role="concept">
30789 <primary><quote>From</quote> line</primary>
30790 </indexterm>
30791 <indexterm role="concept">
30792 <primary>UUCP</primary>
30793 <secondary><quote>From</quote> line</secondary>
30794 </indexterm>
30795 Some applications that pass messages to an MTA via a command line interface use
30796 an initial line starting with <quote>From&nbsp;</quote> to pass the envelope sender. In
30797 particular, this is used by UUCP software. Exim recognizes such a line by means
30798 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
30799 matches, the sender address is constructed by expanding the contents of
30800 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
30801 default pattern recognizes lines in the following two forms:
30802 </para>
30803 <literallayout class="monospaced">
30804 From ph10 Fri Jan  5 12:35 GMT 1996
30805 From ph10 Fri, 7 Jan 97 14:00:00 GMT
30806 </literallayout>
30807 <para>
30808 The pattern can be seen by running
30809 </para>
30810 <literallayout class="monospaced">
30811 exim -bP uucp_from_pattern
30812 </literallayout>
30813 <para>
30814 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
30815 year in the second case. The first word after <quote>From&nbsp;</quote> is matched in the
30816 regular expression by a parenthesized subpattern. The default value for
30817 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
30818 (<quote>ph10</quote> in the example above) as the message&#x2019;s sender. See also
30819 <option>ignore_fromline_hosts</option>.
30820 </para>
30821 <para>
30822 <indexterm role="option">
30823 <primary><option>uucp_from_sender</option></primary>
30824 </indexterm>
30825 </para>
30826 <informaltable frame="all">
30827 <tgroup cols="4" colsep="0" rowsep="0">
30828 <colspec colwidth="8*" align="left"/>
30829 <colspec colwidth="6*" align="center"/>
30830 <colspec colwidth="6*" align="center"/>
30831 <colspec colwidth="6*" align="right"/>
30832 <tbody>
30833 <row>
30834 <entry><option>uucp_from_sender</option></entry>
30835 <entry>Use: <emphasis>main</emphasis></entry>
30836 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30837 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
30838 </row>
30839 </tbody>
30840 </tgroup>
30841 </informaltable>
30842 <para>
30843 See <option>uucp_from_pattern</option> above.
30844 </para>
30845 <para>
30846 <indexterm role="option">
30847 <primary><option>warn_message_file</option></primary>
30848 </indexterm>
30849 </para>
30850 <informaltable frame="all">
30851 <tgroup cols="4" colsep="0" rowsep="0">
30852 <colspec colwidth="8*" align="left"/>
30853 <colspec colwidth="6*" align="center"/>
30854 <colspec colwidth="6*" align="center"/>
30855 <colspec colwidth="6*" align="right"/>
30856 <tbody>
30857 <row>
30858 <entry><option>warn_message_file</option></entry>
30859 <entry>Use: <emphasis>main</emphasis></entry>
30860 <entry>Type: <emphasis>string</emphasis></entry>
30861 <entry>Default: <emphasis>unset</emphasis></entry>
30862 </row>
30863 </tbody>
30864 </tgroup>
30865 </informaltable>
30866 <para>
30867 <indexterm role="concept">
30868 <primary>warning of delay</primary>
30869 <secondary>customizing the message</secondary>
30870 </indexterm>
30871 <indexterm role="concept">
30872 <primary>customizing</primary>
30873 <secondary>warning message</secondary>
30874 </indexterm>
30875 This option defines a template file containing paragraphs of text to be used
30876 for constructing the warning message which is sent by Exim when a message has
30877 been on the queue for a specified amount of time, as specified by
30878 <option>delay_warning</option>. Details of the file&#x2019;s contents are given in chapter
30879 <xref linkend="CHAPemsgcust"/>. See also <option>bounce_message_file</option>.
30880 </para>
30881 <para>
30882 <indexterm role="option">
30883 <primary><option>write_rejectlog</option></primary>
30884 </indexterm>
30885 </para>
30886 <informaltable frame="all">
30887 <tgroup cols="4" colsep="0" rowsep="0">
30888 <colspec colwidth="8*" align="left"/>
30889 <colspec colwidth="6*" align="center"/>
30890 <colspec colwidth="6*" align="center"/>
30891 <colspec colwidth="6*" align="right"/>
30892 <tbody>
30893 <row>
30894 <entry><option>write_rejectlog</option></entry>
30895 <entry>Use: <emphasis>main</emphasis></entry>
30896 <entry>Type: <emphasis>boolean</emphasis></entry>
30897 <entry>Default: <emphasis>true</emphasis></entry>
30898 </row>
30899 </tbody>
30900 </tgroup>
30901 </informaltable>
30902 <para>
30903 <indexterm role="concept">
30904 <primary>reject log</primary>
30905 <secondary>disabling</secondary>
30906 </indexterm>
30907 If this option is set false, Exim no longer writes anything to the reject log.
30908 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
30909 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
30910 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
30911 </para>
30912 </section>
30913 </chapter>
30914
30915 <chapter id="CHAProutergeneric">
30916 <title>Generic options for routers</title>
30917 <para>
30918 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
30919 <primary>options</primary>
30920 <secondary>generic; for routers</secondary>
30921 </indexterm>
30922 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
30923 <primary>generic options</primary>
30924 <secondary>router</secondary>
30925 </indexterm>
30926 This chapter describes the generic options that apply to all routers.
30927 Those that are preconditions are marked with &Dagger; in the <quote>use</quote> field.
30928 </para>
30929 <para>
30930 For a general description of how a router operates, see sections
30931 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
30932 which the preconditions are tested. The order of expansion of the options that
30933 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
30934 <option>headers_remove</option>, <option>transport</option>.
30935 </para>
30936 <para>
30937 <indexterm role="option">
30938 <primary><option>address_data</option></primary>
30939 </indexterm>
30940 </para>
30941 <informaltable frame="all">
30942 <tgroup cols="4" colsep="0" rowsep="0">
30943 <colspec colwidth="8*" align="left"/>
30944 <colspec colwidth="6*" align="center"/>
30945 <colspec colwidth="6*" align="center"/>
30946 <colspec colwidth="6*" align="right"/>
30947 <tbody>
30948 <row>
30949 <entry><option>address_data</option></entry>
30950 <entry>Use: <emphasis>routers</emphasis></entry>
30951 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30952 <entry>Default: <emphasis>unset</emphasis></entry>
30953 </row>
30954 </tbody>
30955 </tgroup>
30956 </informaltable>
30957 <para>
30958 <indexterm role="concept">
30959 <primary>router</primary>
30960 <secondary>data attached to address</secondary>
30961 </indexterm>
30962 The string is expanded just before the router is run, that is, after all the
30963 precondition tests have succeeded. If the expansion is forced to fail, the
30964 router declines, the value of <option>address_data</option> remains unchanged, and the
30965 <option>more</option> option controls what happens next. Other expansion failures cause
30966 delivery of the address to be deferred.
30967 </para>
30968 <para>
30969 <indexterm role="variable">
30970 <primary><varname>$address_data</varname></primary>
30971 </indexterm>
30972 When the expansion succeeds, the value is retained with the address, and can be
30973 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
30974 routers, and the eventual transport.
30975 </para>
30976 <para>
30977 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
30978 that runs a user&#x2019;s filter file, the contents of <varname>$address_data</varname> are accessible
30979 in the filter. This is not normally a problem, because such data is usually
30980 either not confidential or it <quote>belongs</quote> to the current user, but if you do
30981 put confidential data into <varname>$address_data</varname> you need to remember this point.
30982 </para>
30983 <para>
30984 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
30985 with the address, though it can be changed by another <option>address_data</option> setting
30986 on a subsequent router. If a router generates child addresses, the value of
30987 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
30988 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
30989 </para>
30990 <para>
30991 The idea of <option>address_data</option> is that you can use it to look up a lot of data
30992 for the address once, and then pick out parts of the data later. For example,
30993 you could use a single LDAP lookup to return a string of the form
30994 </para>
30995 <literallayout class="monospaced">
30996 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
30997 </literallayout>
30998 <para>
30999 In the transport you could pick out the mailbox by a setting such as
31000 </para>
31001 <literallayout class="monospaced">
31002 file = ${extract{mailbox}{$address_data}}
31003 </literallayout>
31004 <para>
31005 This makes the configuration file less messy, and also reduces the number of
31006 lookups (though Exim does cache lookups).
31007 </para>
31008 <para>
31009 <indexterm role="variable">
31010 <primary><varname>$sender_address_data</varname></primary>
31011 </indexterm>
31012 <indexterm role="variable">
31013 <primary><varname>$address_data</varname></primary>
31014 </indexterm>
31015 The <option>address_data</option> facility is also useful as a means of passing information
31016 from one router to another, and from a router to a transport. In addition, if
31017 <varname>$address_data</varname> is set by a router when verifying a recipient address from an
31018 ACL, it remains available for use in the rest of the ACL statement. After
31019 verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
31020 </para>
31021 <para>
31022 <indexterm role="option">
31023 <primary><option>address_test</option></primary>
31024 </indexterm>
31025 </para>
31026 <informaltable frame="all">
31027 <tgroup cols="4" colsep="0" rowsep="0">
31028 <colspec colwidth="8*" align="left"/>
31029 <colspec colwidth="6*" align="center"/>
31030 <colspec colwidth="6*" align="center"/>
31031 <colspec colwidth="6*" align="right"/>
31032 <tbody>
31033 <row>
31034 <entry><option>address_test</option></entry>
31035 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31036 <entry>Type: <emphasis>boolean</emphasis></entry>
31037 <entry>Default: <emphasis>true</emphasis></entry>
31038 </row>
31039 </tbody>
31040 </tgroup>
31041 </informaltable>
31042 <para>
31043 <indexterm role="option">
31044 <primary><option>-bt</option></primary>
31045 </indexterm>
31046 <indexterm role="concept">
31047 <primary>router</primary>
31048 <secondary>skipping when address testing</secondary>
31049 </indexterm>
31050 If this option is set false, the router is skipped when routing is being tested
31051 by means of the <option>-bt</option> command line option. This can be a convenience when
31052 your first router sends messages to an external scanner, because it saves you
31053 having to set the <quote>already scanned</quote> indicator when testing real address
31054 routing.
31055 </para>
31056 <para>
31057 <indexterm role="option">
31058 <primary><option>cannot_route_message</option></primary>
31059 </indexterm>
31060 </para>
31061 <informaltable frame="all">
31062 <tgroup cols="4" colsep="0" rowsep="0">
31063 <colspec colwidth="8*" align="left"/>
31064 <colspec colwidth="6*" align="center"/>
31065 <colspec colwidth="6*" align="center"/>
31066 <colspec colwidth="6*" align="right"/>
31067 <tbody>
31068 <row>
31069 <entry><option>cannot_route_message</option></entry>
31070 <entry>Use: <emphasis>routers</emphasis></entry>
31071 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31072 <entry>Default: <emphasis>unset</emphasis></entry>
31073 </row>
31074 </tbody>
31075 </tgroup>
31076 </informaltable>
31077 <para>
31078 <indexterm role="concept">
31079 <primary>router</primary>
31080 <secondary>customizing <quote>cannot route</quote> message</secondary>
31081 </indexterm>
31082 <indexterm role="concept">
31083 <primary>customizing</primary>
31084 <secondary><quote>cannot route</quote> message</secondary>
31085 </indexterm>
31086 This option specifies a text message that is used when an address cannot be
31087 routed because Exim has run out of routers. The default message is
31088 <quote>Unrouteable address</quote>. This option is useful only on routers that have
31089 <option>more</option> set false, or on the very last router in a configuration, because the
31090 value that is used is taken from the last router that is considered. This
31091 includes a router that is skipped because its preconditions are not met, as
31092 well as a router that declines. For example, using the default configuration,
31093 you could put:
31094 </para>
31095 <literallayout class="monospaced">
31096 cannot_route_message = Remote domain not found in DNS
31097 </literallayout>
31098 <para>
31099 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
31100 and
31101 </para>
31102 <literallayout class="monospaced">
31103 cannot_route_message = Unknown local user
31104 </literallayout>
31105 <para>
31106 on the final router that checks for local users. If string expansion fails for
31107 this option, the default message is used. Unless the expansion failure was
31108 explicitly forced, a message about the failure is written to the main and panic
31109 logs, in addition to the normal message about the routing failure.
31110 </para>
31111 <para>
31112 <indexterm role="option">
31113 <primary><option>caseful_local_part</option></primary>
31114 </indexterm>
31115 </para>
31116 <informaltable frame="all">
31117 <tgroup cols="4" colsep="0" rowsep="0">
31118 <colspec colwidth="8*" align="left"/>
31119 <colspec colwidth="6*" align="center"/>
31120 <colspec colwidth="6*" align="center"/>
31121 <colspec colwidth="6*" align="right"/>
31122 <tbody>
31123 <row>
31124 <entry><option>caseful_local_part</option></entry>
31125 <entry>Use: <emphasis>routers</emphasis></entry>
31126 <entry>Type: <emphasis>boolean</emphasis></entry>
31127 <entry>Default: <emphasis>false</emphasis></entry>
31128 </row>
31129 </tbody>
31130 </tgroup>
31131 </informaltable>
31132 <para>
31133 <indexterm role="concept">
31134 <primary>case of local parts</primary>
31135 </indexterm>
31136 <indexterm role="concept">
31137 <primary>router</primary>
31138 <secondary>case of local parts</secondary>
31139 </indexterm>
31140 By default, routers handle the local parts of addresses in a case-insensitive
31141 manner, though the actual case is preserved for transmission with the message.
31142 If you want the case of letters to be significant in a router, you must set
31143 this option true. For individual router options that contain address or local
31144 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
31145 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
31146 more details.
31147 </para>
31148 <para>
31149 <indexterm role="variable">
31150 <primary><varname>$local_part</varname></primary>
31151 </indexterm>
31152 <indexterm role="variable">
31153 <primary><varname>$original_local_part</varname></primary>
31154 </indexterm>
31155 <indexterm role="variable">
31156 <primary><varname>$parent_local_part</varname></primary>
31157 </indexterm>
31158 The value of the <varname>$local_part</varname> variable is forced to lower case while a
31159 router is running unless <option>caseful_local_part</option> is set. When a router assigns
31160 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
31161 is the same as it was in the router. Similarly, when a router generates child
31162 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
31163 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
31164 </para>
31165 <para>
31166 This option applies to the processing of an address by a router. When a
31167 recipient address is being processed in an ACL, there is a separate <option>control</option>
31168 modifier that can be used to specify case-sensitive processing within the ACL
31169 (see section <xref linkend="SECTcontrols"/>).
31170 </para>
31171 <para>
31172 <indexterm role="option">
31173 <primary><option>check_local_user</option></primary>
31174 </indexterm>
31175 </para>
31176 <informaltable frame="all">
31177 <tgroup cols="4" colsep="0" rowsep="0">
31178 <colspec colwidth="8*" align="left"/>
31179 <colspec colwidth="6*" align="center"/>
31180 <colspec colwidth="6*" align="center"/>
31181 <colspec colwidth="6*" align="right"/>
31182 <tbody>
31183 <row>
31184 <entry><option>check_local_user</option></entry>
31185 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31186 <entry>Type: <emphasis>boolean</emphasis></entry>
31187 <entry>Default: <emphasis>false</emphasis></entry>
31188 </row>
31189 </tbody>
31190 </tgroup>
31191 </informaltable>
31192 <para>
31193 <indexterm role="concept">
31194 <primary>local user, checking in router</primary>
31195 </indexterm>
31196 <indexterm role="concept">
31197 <primary>router</primary>
31198 <secondary>checking for local user</secondary>
31199 </indexterm>
31200 <indexterm role="concept">
31201 <primary><filename>/etc/passwd</filename></primary>
31202 </indexterm>
31203 <indexterm role="variable">
31204 <primary><varname>$home</varname></primary>
31205 </indexterm>
31206 When this option is true, Exim checks that the local part of the recipient
31207 address (with affixes removed if relevant) is the name of an account on the
31208 local system. The check is done by calling the <function>getpwnam()</function> function rather
31209 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
31210 holding password data (such as NIS) are supported. If the local part is a local
31211 user, <varname>$home</varname> is set from the password data, and can be tested in other
31212 preconditions that are evaluated after this one (the order of evaluation is
31213 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
31214 overridden by <option>router_home_directory</option>. If the local part is not a local user,
31215 the router is skipped.
31216 </para>
31217 <para>
31218 If you want to check that the local part is either the name of a local user
31219 or matches something else, you cannot combine <option>check_local_user</option> with a
31220 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
31221 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
31222 setting to achieve this. For example:
31223 </para>
31224 <literallayout class="monospaced">
31225 local_parts = passwd;$local_part : lsearch;/etc/other/users
31226 </literallayout>
31227 <para>
31228 Note, however, that the side effects of <option>check_local_user</option> (such as setting
31229 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
31230 <option>local_parts</option> (or any other) precondition.
31231 </para>
31232 <para>
31233 <indexterm role="option">
31234 <primary><option>condition</option></primary>
31235 </indexterm>
31236 </para>
31237 <informaltable frame="all">
31238 <tgroup cols="4" colsep="0" rowsep="0">
31239 <colspec colwidth="8*" align="left"/>
31240 <colspec colwidth="6*" align="center"/>
31241 <colspec colwidth="6*" align="center"/>
31242 <colspec colwidth="6*" align="right"/>
31243 <tbody>
31244 <row>
31245 <entry><option>condition</option></entry>
31246 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31247 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31248 <entry>Default: <emphasis>unset</emphasis></entry>
31249 </row>
31250 </tbody>
31251 </tgroup>
31252 </informaltable>
31253 <para>
31254 <indexterm role="concept">
31255 <primary>router</primary>
31256 <secondary>customized precondition</secondary>
31257 </indexterm>
31258 This option specifies a general precondition test that has to succeed for the
31259 router to be called. The <option>condition</option> option is the last precondition to be
31260 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
31261 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
31262 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
31263 router is skipped, and the address is offered to the next one.
31264 </para>
31265 <para>
31266 If the result is any other value, the router is run (as this is the last
31267 precondition to be evaluated, all the other preconditions must be true).
31268 </para>
31269 <para>
31270 This option is unusual in that multiple <option>condition</option> options may be present.
31271 All <option>condition</option> options must succeed.
31272 </para>
31273 <para>
31274 The <option>condition</option> option provides a means of applying custom conditions to the
31275 running of routers. Note that in the case of a simple conditional expansion,
31276 the default expansion values are exactly what is wanted. For example:
31277 </para>
31278 <literallayout class="monospaced">
31279 condition = ${if &gt;{$message_age}{600}}
31280 </literallayout>
31281 <para>
31282 Because of the default behaviour of the string expansion, this is equivalent to
31283 </para>
31284 <literallayout class="monospaced">
31285 condition = ${if &gt;{$message_age}{600}{true}{}}
31286 </literallayout>
31287 <para>
31288 A multiple condition example, which succeeds:
31289 </para>
31290 <literallayout class="monospaced">
31291 condition = ${if &gt;{$message_age}{600}}
31292 condition = ${if !eq{${lc:$local_part}}{postmaster}}
31293 condition = foobar
31294 </literallayout>
31295 <para>
31296 If the expansion fails (other than forced failure) delivery is deferred. Some
31297 of the other precondition options are common special cases that could in fact
31298 be specified using <option>condition</option>.
31299 </para>
31300 <para revisionflag="changed">
31301 Historical note: We have <option>condition</option> on ACLs and on Routers.  Routers
31302 are far older, and use one set of semantics.  ACLs are newer and when
31303 they were created, the ACL <option>condition</option> process was given far stricter
31304 parse semantics.  The <option>bool{}</option> expansion condition uses the same rules as
31305 ACLs.  The <option>bool_lax{}</option> expansion condition uses the same rules as
31306 Routers.  More pointedly, the <option>bool_lax{}</option> was written to match the existing
31307 Router rules processing behavior.
31308 </para>
31309 <para revisionflag="changed">
31310 This is best illustrated in an example:
31311 </para>
31312 <literallayout class="monospaced" revisionflag="changed">
31313 # If used in an ACL condition will fail with a syntax error, but
31314 # in a router condition any extra characters are treated as a string
31315
31316 $ exim -be '${if eq {${lc:GOOGLE.com}} {google.com}} {yes} {no}}'
31317 true {yes} {no}}
31318
31319 $ exim -be '${if eq {${lc:WHOIS.com}} {google.com}} {yes} {no}}'
31320  {yes} {no}}
31321 </literallayout>
31322 <para revisionflag="changed">
31323 In each example above, the <option>if</option> statement actually ends after
31324 <quote>{google.com}}</quote>.  Since no true or false braces were defined, the
31325 default <option>if</option> behavior is to return a boolean true or a null answer
31326 (which evaluates to false). The rest of the line is then treated as a
31327 string. So the first example resulted in the boolean answer <quote>true</quote>
31328 with the string <quote> {yes} {no}}</quote> appended to it. The second example
31329 resulted in the null output (indicating false) with the string
31330 <quote> {yes} {no}}</quote> appended to it.
31331 </para>
31332 <para revisionflag="changed">
31333 In fact you can put excess forward braces in too.  In the router
31334 <option>condition</option>, Exim&#x2019;s parser only looks for <quote>{</quote> symbols when they
31335 mean something, like after a <quote>$</quote> or when required as part of a
31336 conditional.  But otherwise <quote>{</quote> and <quote>}</quote> are treated as ordinary
31337 string characters.
31338 </para>
31339 <para revisionflag="changed">
31340 Thus, in a Router, the above expansion strings will both always evaluate
31341 true, as the result of expansion is a non-empty string which doesn&#x2019;t
31342 match an explicit false value.  This can be tricky to debug.  By
31343 contrast, in an ACL either of those strings will always result in an
31344 expansion error because the result doesn&#x2019;t look sufficiently boolean.
31345 </para>
31346 <para>
31347 <indexterm role="option">
31348 <primary><option>debug_print</option></primary>
31349 </indexterm>
31350 </para>
31351 <informaltable frame="all">
31352 <tgroup cols="4" colsep="0" rowsep="0">
31353 <colspec colwidth="8*" align="left"/>
31354 <colspec colwidth="6*" align="center"/>
31355 <colspec colwidth="6*" align="center"/>
31356 <colspec colwidth="6*" align="right"/>
31357 <tbody>
31358 <row>
31359 <entry><option>debug_print</option></entry>
31360 <entry>Use: <emphasis>routers</emphasis></entry>
31361 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31362 <entry>Default: <emphasis>unset</emphasis></entry>
31363 </row>
31364 </tbody>
31365 </tgroup>
31366 </informaltable>
31367 <para>
31368 <indexterm role="concept">
31369 <primary>testing</primary>
31370 <secondary>variables in drivers</secondary>
31371 </indexterm>
31372 If this option is set and debugging is enabled (see the <option>-d</option> command line
31373 option) or in address-testing mode (see the <option>-bt</option> command line option),
31374 the string is expanded and included in the debugging output.
31375 If expansion of the string fails, the error message is written to the debugging
31376 output, and Exim carries on processing.
31377 This option is provided to help with checking out the values of variables and
31378 so on when debugging router configurations. For example, if a <option>condition</option>
31379 option appears not to be working, <option>debug_print</option> can be used to output the
31380 variables it references. The output happens after checks for <option>domains</option>,
31381 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
31382 are tested. A newline is added to the text if it does not end with one.
31383 The variable <varname>$router_name</varname> contains the name of the router.
31384 </para>
31385 <para>
31386 <indexterm role="option">
31387 <primary><option>disable_logging</option></primary>
31388 </indexterm>
31389 </para>
31390 <informaltable frame="all">
31391 <tgroup cols="4" colsep="0" rowsep="0">
31392 <colspec colwidth="8*" align="left"/>
31393 <colspec colwidth="6*" align="center"/>
31394 <colspec colwidth="6*" align="center"/>
31395 <colspec colwidth="6*" align="right"/>
31396 <tbody>
31397 <row>
31398 <entry><option>disable_logging</option></entry>
31399 <entry>Use: <emphasis>routers</emphasis></entry>
31400 <entry>Type: <emphasis>boolean</emphasis></entry>
31401 <entry>Default: <emphasis>false</emphasis></entry>
31402 </row>
31403 </tbody>
31404 </tgroup>
31405 </informaltable>
31406 <para>
31407 If this option is set true, nothing is logged for any routing errors
31408 or for any deliveries caused by this router. You should not set this option
31409 unless you really, really know what you are doing. See also the generic
31410 transport option of the same name.
31411 </para>
31412 <para>
31413 <indexterm role="option">
31414 <primary><option>domains</option></primary>
31415 </indexterm>
31416 </para>
31417 <informaltable frame="all">
31418 <tgroup cols="4" colsep="0" rowsep="0">
31419 <colspec colwidth="8*" align="left"/>
31420 <colspec colwidth="6*" align="center"/>
31421 <colspec colwidth="6*" align="center"/>
31422 <colspec colwidth="6*" align="right"/>
31423 <tbody>
31424 <row>
31425 <entry><option>domains</option></entry>
31426 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31427 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
31428 <entry>Default: <emphasis>unset</emphasis></entry>
31429 </row>
31430 </tbody>
31431 </tgroup>
31432 </informaltable>
31433 <para>
31434 <indexterm role="concept">
31435 <primary>router</primary>
31436 <secondary>restricting to specific domains</secondary>
31437 </indexterm>
31438 <indexterm role="variable">
31439 <primary><varname>$domain_data</varname></primary>
31440 </indexterm>
31441 If this option is set, the router is skipped unless the current domain matches
31442 the list. If the match is achieved by means of a file lookup, the data that the
31443 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
31444 expansions of the driver&#x2019;s private options. See section <xref linkend="SECTrouprecon"/> for
31445 a list of the order in which preconditions are evaluated.
31446 </para>
31447 <para>
31448 <indexterm role="option">
31449 <primary><option>driver</option></primary>
31450 </indexterm>
31451 </para>
31452 <informaltable frame="all">
31453 <tgroup cols="4" colsep="0" rowsep="0">
31454 <colspec colwidth="8*" align="left"/>
31455 <colspec colwidth="6*" align="center"/>
31456 <colspec colwidth="6*" align="center"/>
31457 <colspec colwidth="6*" align="right"/>
31458 <tbody>
31459 <row>
31460 <entry><option>driver</option></entry>
31461 <entry>Use: <emphasis>routers</emphasis></entry>
31462 <entry>Type: <emphasis>string</emphasis></entry>
31463 <entry>Default: <emphasis>unset</emphasis></entry>
31464 </row>
31465 </tbody>
31466 </tgroup>
31467 </informaltable>
31468 <para>
31469 This option must always be set. It specifies which of the available routers is
31470 to be used.
31471 </para>
31472 <para>
31473 <indexterm role="option">
31474 <primary><option>errors_to</option></primary>
31475 </indexterm>
31476 </para>
31477 <informaltable frame="all">
31478 <tgroup cols="4" colsep="0" rowsep="0">
31479 <colspec colwidth="8*" align="left"/>
31480 <colspec colwidth="6*" align="center"/>
31481 <colspec colwidth="6*" align="center"/>
31482 <colspec colwidth="6*" align="right"/>
31483 <tbody>
31484 <row>
31485 <entry><option>errors_to</option></entry>
31486 <entry>Use: <emphasis>routers</emphasis></entry>
31487 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31488 <entry>Default: <emphasis>unset</emphasis></entry>
31489 </row>
31490 </tbody>
31491 </tgroup>
31492 </informaltable>
31493 <para>
31494 <indexterm role="concept">
31495 <primary>envelope sender</primary>
31496 </indexterm>
31497 <indexterm role="concept">
31498 <primary>router</primary>
31499 <secondary>changing address for errors</secondary>
31500 </indexterm>
31501 If a router successfully handles an address, it may assign the address to a
31502 transport for delivery or it may generate child addresses. In both cases, if
31503 there is a delivery problem during later processing, the resulting bounce
31504 message is sent to the address that results from expanding this string,
31505 provided that the address verifies successfully. The <option>errors_to</option> option is
31506 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
31507 </para>
31508 <para>
31509 The <option>errors_to</option> setting associated with an address can be overridden if it
31510 subsequently passes through other routers that have their own <option>errors_to</option>
31511 settings, or if the message is delivered by a transport with a <option>return_path</option>
31512 setting.
31513 </para>
31514 <para>
31515 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
31516 the expansion fails to verify, the errors address associated with the incoming
31517 address is used. At top level, this is the envelope sender. A non-forced
31518 expansion failure causes delivery to be deferred.
31519 </para>
31520 <para>
31521 If an address for which <option>errors_to</option> has been set ends up being delivered over
31522 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
31523 any bounces that are generated by other MTAs on the delivery route are also
31524 sent there. You can set <option>errors_to</option> to the empty string by either of these
31525 settings:
31526 </para>
31527 <literallayout class="monospaced">
31528 errors_to =
31529 errors_to = ""
31530 </literallayout>
31531 <para>
31532 An expansion item that yields an empty string has the same effect. If you do
31533 this, a locally detected delivery error for addresses processed by this router
31534 no longer gives rise to a bounce message; the error is discarded. If the
31535 address is delivered to a remote host, the return path is set to <literal>&lt;&gt;</literal>, unless
31536 overridden by the <option>return_path</option> option on the transport.
31537 </para>
31538 <para>
31539 <indexterm role="variable">
31540 <primary><varname>$address_data</varname></primary>
31541 </indexterm>
31542 If for some reason you want to discard local errors, but use a non-empty
31543 MAIL command for remote delivery, you can preserve the original return
31544 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
31545 setting <option>return_path</option>.
31546 </para>
31547 <para>
31548 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
31549 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
31550 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
31551 </para>
31552 <para>
31553 <indexterm role="option">
31554 <primary><option>expn</option></primary>
31555 </indexterm>
31556 </para>
31557 <informaltable frame="all">
31558 <tgroup cols="4" colsep="0" rowsep="0">
31559 <colspec colwidth="8*" align="left"/>
31560 <colspec colwidth="6*" align="center"/>
31561 <colspec colwidth="6*" align="center"/>
31562 <colspec colwidth="6*" align="right"/>
31563 <tbody>
31564 <row>
31565 <entry><option>expn</option></entry>
31566 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31567 <entry>Type: <emphasis>boolean</emphasis></entry>
31568 <entry>Default: <emphasis>true</emphasis></entry>
31569 </row>
31570 </tbody>
31571 </tgroup>
31572 </informaltable>
31573 <para>
31574 <indexterm role="concept">
31575 <primary>address</primary>
31576 <secondary>testing</secondary>
31577 </indexterm>
31578 <indexterm role="concept">
31579 <primary>testing</primary>
31580 <secondary>addresses</secondary>
31581 </indexterm>
31582 <indexterm role="concept">
31583 <primary>EXPN</primary>
31584 <secondary>router skipping</secondary>
31585 </indexterm>
31586 <indexterm role="concept">
31587 <primary>router</primary>
31588 <secondary>skipping for EXPN</secondary>
31589 </indexterm>
31590 If this option is turned off, the router is skipped when testing an address
31591 as a result of processing an SMTP EXPN command. You might, for example,
31592 want to turn it off on a router for users&#x2019; <filename>.forward</filename> files, while leaving it
31593 on for the system alias file.
31594 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
31595 are evaluated.
31596 </para>
31597 <para>
31598 The use of the SMTP EXPN command is controlled by an ACL (see chapter
31599 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
31600 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
31601 </para>
31602 <para>
31603 <indexterm role="option">
31604 <primary><option>fail_verify</option></primary>
31605 </indexterm>
31606 </para>
31607 <informaltable frame="all">
31608 <tgroup cols="4" colsep="0" rowsep="0">
31609 <colspec colwidth="8*" align="left"/>
31610 <colspec colwidth="6*" align="center"/>
31611 <colspec colwidth="6*" align="center"/>
31612 <colspec colwidth="6*" align="right"/>
31613 <tbody>
31614 <row>
31615 <entry><option>fail_verify</option></entry>
31616 <entry>Use: <emphasis>routers</emphasis></entry>
31617 <entry>Type: <emphasis>boolean</emphasis></entry>
31618 <entry>Default: <emphasis>false</emphasis></entry>
31619 </row>
31620 </tbody>
31621 </tgroup>
31622 </informaltable>
31623 <para>
31624 <indexterm role="concept">
31625 <primary>router</primary>
31626 <secondary>forcing verification failure</secondary>
31627 </indexterm>
31628 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
31629 <option>fail_verify_recipient</option> to the same value.
31630 </para>
31631 <para>
31632 <indexterm role="option">
31633 <primary><option>fail_verify_recipient</option></primary>
31634 </indexterm>
31635 </para>
31636 <informaltable frame="all">
31637 <tgroup cols="4" colsep="0" rowsep="0">
31638 <colspec colwidth="8*" align="left"/>
31639 <colspec colwidth="6*" align="center"/>
31640 <colspec colwidth="6*" align="center"/>
31641 <colspec colwidth="6*" align="right"/>
31642 <tbody>
31643 <row>
31644 <entry><option>fail_verify_recipient</option></entry>
31645 <entry>Use: <emphasis>routers</emphasis></entry>
31646 <entry>Type: <emphasis>boolean</emphasis></entry>
31647 <entry>Default: <emphasis>false</emphasis></entry>
31648 </row>
31649 </tbody>
31650 </tgroup>
31651 </informaltable>
31652 <para>
31653 If this option is true and an address is accepted by this router when
31654 verifying a recipient, verification fails.
31655 </para>
31656 <para>
31657 <indexterm role="option">
31658 <primary><option>fail_verify_sender</option></primary>
31659 </indexterm>
31660 </para>
31661 <informaltable frame="all">
31662 <tgroup cols="4" colsep="0" rowsep="0">
31663 <colspec colwidth="8*" align="left"/>
31664 <colspec colwidth="6*" align="center"/>
31665 <colspec colwidth="6*" align="center"/>
31666 <colspec colwidth="6*" align="right"/>
31667 <tbody>
31668 <row>
31669 <entry><option>fail_verify_sender</option></entry>
31670 <entry>Use: <emphasis>routers</emphasis></entry>
31671 <entry>Type: <emphasis>boolean</emphasis></entry>
31672 <entry>Default: <emphasis>false</emphasis></entry>
31673 </row>
31674 </tbody>
31675 </tgroup>
31676 </informaltable>
31677 <para>
31678 If this option is true and an address is accepted by this router when
31679 verifying a sender, verification fails.
31680 </para>
31681 <para>
31682 <indexterm role="option">
31683 <primary><option>fallback_hosts</option></primary>
31684 </indexterm>
31685 </para>
31686 <informaltable frame="all">
31687 <tgroup cols="4" colsep="0" rowsep="0">
31688 <colspec colwidth="8*" align="left"/>
31689 <colspec colwidth="6*" align="center"/>
31690 <colspec colwidth="6*" align="center"/>
31691 <colspec colwidth="6*" align="right"/>
31692 <tbody>
31693 <row>
31694 <entry><option>fallback_hosts</option></entry>
31695 <entry>Use: <emphasis>routers</emphasis></entry>
31696 <entry>Type: <emphasis>string list</emphasis></entry>
31697 <entry>Default: <emphasis>unset</emphasis></entry>
31698 </row>
31699 </tbody>
31700 </tgroup>
31701 </informaltable>
31702 <para>
31703 <indexterm role="concept">
31704 <primary>router</primary>
31705 <secondary>fallback hosts</secondary>
31706 </indexterm>
31707 <indexterm role="concept">
31708 <primary>fallback</primary>
31709 <secondary>hosts specified on router</secondary>
31710 </indexterm>
31711 String expansion is not applied to this option. The argument must be a
31712 colon-separated list of host names or IP addresses. The list separator can be
31713 changed (see section <xref linkend="SECTlistconstruct"/>), and a port can be specified with
31714 each name or address. In fact, the format of each item is exactly the same as
31715 defined for the list of hosts in a <command>manualroute</command> router (see section
31716 <xref linkend="SECTformatonehostitem"/>).
31717 </para>
31718 <para>
31719 If a router queues an address for a remote transport, this host list is
31720 associated with the address, and used instead of the transport&#x2019;s fallback host
31721 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
31722 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
31723 transport for further details.
31724 </para>
31725 <para>
31726 <indexterm role="option">
31727 <primary><option>group</option></primary>
31728 </indexterm>
31729 </para>
31730 <informaltable frame="all">
31731 <tgroup cols="4" colsep="0" rowsep="0">
31732 <colspec colwidth="8*" align="left"/>
31733 <colspec colwidth="6*" align="center"/>
31734 <colspec colwidth="6*" align="center"/>
31735 <colspec colwidth="6*" align="right"/>
31736 <tbody>
31737 <row>
31738 <entry><option>group</option></entry>
31739 <entry>Use: <emphasis>routers</emphasis></entry>
31740 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31741 <entry>Default: <emphasis>see below</emphasis></entry>
31742 </row>
31743 </tbody>
31744 </tgroup>
31745 </informaltable>
31746 <para>
31747 <indexterm role="concept">
31748 <primary>gid (group id)</primary>
31749 <secondary>local delivery</secondary>
31750 </indexterm>
31751 <indexterm role="concept">
31752 <primary>local transports</primary>
31753 <secondary>uid and gid</secondary>
31754 </indexterm>
31755 <indexterm role="concept">
31756 <primary>transport</primary>
31757 <secondary>local</secondary>
31758 </indexterm>
31759 <indexterm role="concept">
31760 <primary>router</primary>
31761 <secondary>setting group</secondary>
31762 </indexterm>
31763 When a router queues an address for a transport, and the transport does not
31764 specify a group, the group given here is used when running the delivery
31765 process.
31766 The group may be specified numerically or by name. If expansion fails, the
31767 error is logged and delivery is deferred.
31768 The default is unset, unless <option>check_local_user</option> is set, when the default
31769 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
31770 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
31771 </para>
31772 <para>
31773 <indexterm role="option">
31774 <primary><option>headers_add</option></primary>
31775 </indexterm>
31776 </para>
31777 <informaltable frame="all">
31778 <tgroup cols="4" colsep="0" rowsep="0">
31779 <colspec colwidth="8*" align="left"/>
31780 <colspec colwidth="6*" align="center"/>
31781 <colspec colwidth="6*" align="center"/>
31782 <colspec colwidth="6*" align="right"/>
31783 <tbody>
31784 <row>
31785 <entry><option>headers_add</option></entry>
31786 <entry>Use: <emphasis>routers</emphasis></entry>
31787 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
31788 <entry>Default: <emphasis>unset</emphasis></entry>
31789 </row>
31790 </tbody>
31791 </tgroup>
31792 </informaltable>
31793 <para>
31794 <indexterm role="concept">
31795 <primary>header lines</primary>
31796 <secondary>adding</secondary>
31797 </indexterm>
31798 <indexterm role="concept">
31799 <primary>router</primary>
31800 <secondary>adding header lines</secondary>
31801 </indexterm>
31802 This option specifies a list of text headers, newline-separated,
31803 that is associated with any addresses that are accepted by the router.
31804 Each item is separately expanded, at routing time.  However, this
31805 option has no effect when an address is just being verified. The way in which
31806 the text is used to add header lines at transport time is described in section
31807 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
31808 message is in the process of being transported. This means that references to
31809 header lines in string expansions in the transport&#x2019;s configuration do not
31810 <quote>see</quote> the added header lines.
31811 </para>
31812 <para>
31813 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
31814 <option>headers_remove</option> and <option>transport</option>. If an item is empty, or if
31815 an item expansion is forced to fail, the item has no effect. Other expansion
31816 failures are treated as configuration errors.
31817 </para>
31818 <para>
31819 Unlike most options, <option>headers_add</option> can be specified multiple times
31820 for a router; all listed headers are added.
31821 </para>
31822 <para>
31823 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
31824 router that has the <option>one_time</option> option set.
31825 </para>
31826 <para>
31827 <indexterm role="concept">
31828 <primary>duplicate addresses</primary>
31829 </indexterm>
31830 <indexterm role="option">
31831 <primary><option>unseen</option></primary>
31832 </indexterm>
31833 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
31834 additions are deleted when the address is passed on to subsequent routers.
31835 For a <option>redirect</option> router, if a generated address is the same as the incoming
31836 address, this can lead to duplicate addresses with different header
31837 modifications. Exim does not do duplicate deliveries (except, in certain
31838 circumstances, to pipes -- see section <xref linkend="SECTdupaddr"/>), but it is undefined
31839 which of the duplicates is discarded, so this ambiguous situation should be
31840 avoided. The <option>repeat_use</option> option of the <option>redirect</option> router may be of help.
31841 </para>
31842 <para>
31843 <indexterm role="option">
31844 <primary><option>headers_remove</option></primary>
31845 </indexterm>
31846 </para>
31847 <informaltable frame="all">
31848 <tgroup cols="4" colsep="0" rowsep="0">
31849 <colspec colwidth="8*" align="left"/>
31850 <colspec colwidth="6*" align="center"/>
31851 <colspec colwidth="6*" align="center"/>
31852 <colspec colwidth="6*" align="right"/>
31853 <tbody>
31854 <row>
31855 <entry><option>headers_remove</option></entry>
31856 <entry>Use: <emphasis>routers</emphasis></entry>
31857 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
31858 <entry>Default: <emphasis>unset</emphasis></entry>
31859 </row>
31860 </tbody>
31861 </tgroup>
31862 </informaltable>
31863 <para>
31864 <indexterm role="concept">
31865 <primary>header lines</primary>
31866 <secondary>removing</secondary>
31867 </indexterm>
31868 <indexterm role="concept">
31869 <primary>router</primary>
31870 <secondary>removing header lines</secondary>
31871 </indexterm>
31872 This option specifies a list of text headers, colon-separated,
31873 that is associated with any addresses that are accepted by the router.
31874 Each item is separately expanded, at routing time.  However, this
31875 option has no effect when an address is just being verified. The way in which
31876 the text is used to remove header lines at transport time is described in
31877 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
31878 the message is in the process of being transported. This means that references
31879 to header lines in string expansions in the transport&#x2019;s configuration still
31880 <quote>see</quote> the original header lines.
31881 </para>
31882 <para>
31883 The <option>headers_remove</option> option is expanded after <option>errors_to</option> and
31884 <option>headers_add</option>, but before <option>transport</option>. If an item expansion is forced to fail,
31885 the item has no effect. Other expansion failures are treated as configuration
31886 errors.
31887 </para>
31888 <para>
31889 Unlike most options, <option>headers_remove</option> can be specified multiple times
31890 for a router; all listed headers are removed.
31891 </para>
31892 <para>
31893 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
31894 router that has the <option>one_time</option> option set.
31895 </para>
31896 <para>
31897 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
31898 removal requests are deleted when the address is passed on to subsequent
31899 routers, and this can lead to problems with duplicates -- see the similar
31900 warning for <option>headers_add</option> above.
31901 </para>
31902 <para>
31903 <indexterm role="option">
31904 <primary><option>ignore_target_hosts</option></primary>
31905 </indexterm>
31906 </para>
31907 <informaltable frame="all">
31908 <tgroup cols="4" colsep="0" rowsep="0">
31909 <colspec colwidth="8*" align="left"/>
31910 <colspec colwidth="6*" align="center"/>
31911 <colspec colwidth="6*" align="center"/>
31912 <colspec colwidth="6*" align="right"/>
31913 <tbody>
31914 <row>
31915 <entry><option>ignore_target_hosts</option></entry>
31916 <entry>Use: <emphasis>routers</emphasis></entry>
31917 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
31918 <entry>Default: <emphasis>unset</emphasis></entry>
31919 </row>
31920 </tbody>
31921 </tgroup>
31922 </informaltable>
31923 <para>
31924 <indexterm role="concept">
31925 <primary>IP address</primary>
31926 <secondary>discarding</secondary>
31927 </indexterm>
31928 <indexterm role="concept">
31929 <primary>router</primary>
31930 <secondary>discarding IP addresses</secondary>
31931 </indexterm>
31932 Although this option is a host list, it should normally contain IP address
31933 entries rather than names. If any host that is looked up by the router has an
31934 IP address that matches an item in this list, Exim behaves as if that IP
31935 address did not exist. This option allows you to cope with rogue DNS entries
31936 like
31937 </para>
31938 <literallayout class="monospaced">
31939 remote.domain.example.  A  127.0.0.1
31940 </literallayout>
31941 <para>
31942 by setting
31943 </para>
31944 <literallayout class="monospaced">
31945 ignore_target_hosts = 127.0.0.1
31946 </literallayout>
31947 <para>
31948 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
31949 discarded in this way, the router declines. In a conventional configuration, an
31950 attempt to mail to such a domain would normally provoke the <quote>unrouteable
31951 domain</quote> error, and an attempt to verify an address in the domain would fail.
31952 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
31953 router declines if presented with one of the listed addresses.
31954 </para>
31955 <para>
31956 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
31957 means of the first or the second of the following settings, respectively:
31958 </para>
31959 <literallayout class="monospaced">
31960 ignore_target_hosts = 0.0.0.0/0
31961 ignore_target_hosts = &lt;; 0::0/0
31962 </literallayout>
31963 <para>
31964 The pattern in the first line matches all IPv4 addresses, whereas the pattern
31965 in the second line matches all IPv6 addresses.
31966 </para>
31967 <para>
31968 This option may also be useful for ignoring link-local and site-local IPv6
31969 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
31970 is expanded before use as a list, it is possible to make it dependent on the
31971 domain that is being routed.
31972 </para>
31973 <para>
31974 <indexterm role="variable">
31975 <primary><varname>$host_address</varname></primary>
31976 </indexterm>
31977 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
31978 checked.
31979 </para>
31980 <para>
31981 <indexterm role="option">
31982 <primary><option>initgroups</option></primary>
31983 </indexterm>
31984 </para>
31985 <informaltable frame="all">
31986 <tgroup cols="4" colsep="0" rowsep="0">
31987 <colspec colwidth="8*" align="left"/>
31988 <colspec colwidth="6*" align="center"/>
31989 <colspec colwidth="6*" align="center"/>
31990 <colspec colwidth="6*" align="right"/>
31991 <tbody>
31992 <row>
31993 <entry><option>initgroups</option></entry>
31994 <entry>Use: <emphasis>routers</emphasis></entry>
31995 <entry>Type: <emphasis>boolean</emphasis></entry>
31996 <entry>Default: <emphasis>false</emphasis></entry>
31997 </row>
31998 </tbody>
31999 </tgroup>
32000 </informaltable>
32001 <para>
32002 <indexterm role="concept">
32003 <primary>additional groups</primary>
32004 </indexterm>
32005 <indexterm role="concept">
32006 <primary>groups</primary>
32007 <secondary>additional</secondary>
32008 </indexterm>
32009 <indexterm role="concept">
32010 <primary>local transports</primary>
32011 <secondary>uid and gid</secondary>
32012 </indexterm>
32013 <indexterm role="concept">
32014 <primary>transport</primary>
32015 <secondary>local</secondary>
32016 </indexterm>
32017 If the router queues an address for a transport, and this option is true, and
32018 the uid supplied by the router is not overridden by the transport, the
32019 <function>initgroups()</function> function is called when running the transport to ensure that
32020 any additional groups associated with the uid are set up. See also <option>group</option>
32021 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
32022 </para>
32023 <para>
32024 <indexterm role="option">
32025 <primary><option>local_part_prefix</option></primary>
32026 </indexterm>
32027 </para>
32028 <informaltable frame="all">
32029 <tgroup cols="4" colsep="0" rowsep="0">
32030 <colspec colwidth="8*" align="left"/>
32031 <colspec colwidth="6*" align="center"/>
32032 <colspec colwidth="6*" align="center"/>
32033 <colspec colwidth="6*" align="right"/>
32034 <tbody>
32035 <row>
32036 <entry><option>local_part_prefix</option></entry>
32037 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32038 <entry>Type: <emphasis>string list</emphasis></entry>
32039 <entry>Default: <emphasis>unset</emphasis></entry>
32040 </row>
32041 </tbody>
32042 </tgroup>
32043 </informaltable>
32044 <para>
32045 <indexterm role="concept">
32046 <primary>router</primary>
32047 <secondary>prefix for local part</secondary>
32048 </indexterm>
32049 <indexterm role="concept">
32050 <primary>prefix</primary>
32051 <secondary>for local part, used in router</secondary>
32052 </indexterm>
32053 If this option is set, the router is skipped unless the local part starts with
32054 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
32055 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
32056 evaluated.
32057 </para>
32058 <para>
32059 The list is scanned from left to right, and the first prefix that matches is
32060 used. A limited form of wildcard is available; if the prefix begins with an
32061 asterisk, it matches the longest possible sequence of arbitrary characters at
32062 the start of the local part. An asterisk should therefore always be followed by
32063 some character that does not occur in normal local parts.
32064 <indexterm role="concept">
32065 <primary>multiple mailboxes</primary>
32066 </indexterm>
32067 <indexterm role="concept">
32068 <primary>mailbox</primary>
32069 <secondary>multiple</secondary>
32070 </indexterm>
32071 Wildcarding can be used to set up multiple user mailboxes, as described in
32072 section <xref linkend="SECTmulbox"/>.
32073 </para>
32074 <para>
32075 <indexterm role="variable">
32076 <primary><varname>$local_part</varname></primary>
32077 </indexterm>
32078 <indexterm role="variable">
32079 <primary><varname>$local_part_prefix</varname></primary>
32080 </indexterm>
32081 During the testing of the <option>local_parts</option> option, and while the router is
32082 running, the prefix is removed from the local part, and is available in the
32083 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
32084 the router accepts the address, this remains true during subsequent delivery by
32085 a transport. In particular, the local part that is transmitted in the RCPT
32086 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
32087 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
32088 the relevant transport.
32089 </para>
32090 <para>
32091 When an address is being verified, <option>local_part_prefix</option> affects only the
32092 behaviour of the router. If the callout feature of verification is in use, this
32093 means that the full address, including the prefix, will be used during the
32094 callout.
32095 </para>
32096 <para>
32097 The prefix facility is commonly used to handle local parts of the form
32098 <option>owner-something</option>. Another common use is to support local parts of the form
32099 <option>real-username</option> to bypass a user&#x2019;s <filename>.forward</filename> file &ndash; helpful when trying
32100 to tell a user their forwarding is broken &ndash; by placing a router like this one
32101 immediately before the router that handles <filename>.forward</filename> files:
32102 </para>
32103 <literallayout class="monospaced">
32104 real_localuser:
32105   driver = accept
32106   local_part_prefix = real-
32107   check_local_user
32108   transport = local_delivery
32109 </literallayout>
32110 <para>
32111 For security, it would probably be a good idea to restrict the use of this
32112 router to locally-generated messages, using a condition such as this:
32113 </para>
32114 <literallayout class="monospaced">
32115   condition = ${if match {$sender_host_address}\
32116                          {\N^(|127\.0\.0\.1)$\N}}
32117 </literallayout>
32118 <para>
32119 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
32120 both conditions must be met if not optional. Care must be taken if wildcards
32121 are used in both a prefix and a suffix on the same router. Different
32122 separator characters must be used to avoid ambiguity.
32123 </para>
32124 <para>
32125 <indexterm role="option">
32126 <primary><option>local_part_prefix_optional</option></primary>
32127 </indexterm>
32128 </para>
32129 <informaltable frame="all">
32130 <tgroup cols="4" colsep="0" rowsep="0">
32131 <colspec colwidth="8*" align="left"/>
32132 <colspec colwidth="6*" align="center"/>
32133 <colspec colwidth="6*" align="center"/>
32134 <colspec colwidth="6*" align="right"/>
32135 <tbody>
32136 <row>
32137 <entry><option>local_part_prefix_optional</option></entry>
32138 <entry>Use: <emphasis>routers</emphasis></entry>
32139 <entry>Type: <emphasis>boolean</emphasis></entry>
32140 <entry>Default: <emphasis>false</emphasis></entry>
32141 </row>
32142 </tbody>
32143 </tgroup>
32144 </informaltable>
32145 <para>
32146 See <option>local_part_prefix</option> above.
32147 </para>
32148 <para>
32149 <indexterm role="option">
32150 <primary><option>local_part_suffix</option></primary>
32151 </indexterm>
32152 </para>
32153 <informaltable frame="all">
32154 <tgroup cols="4" colsep="0" rowsep="0">
32155 <colspec colwidth="8*" align="left"/>
32156 <colspec colwidth="6*" align="center"/>
32157 <colspec colwidth="6*" align="center"/>
32158 <colspec colwidth="6*" align="right"/>
32159 <tbody>
32160 <row>
32161 <entry><option>local_part_suffix</option></entry>
32162 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32163 <entry>Type: <emphasis>string list</emphasis></entry>
32164 <entry>Default: <emphasis>unset</emphasis></entry>
32165 </row>
32166 </tbody>
32167 </tgroup>
32168 </informaltable>
32169 <para>
32170 <indexterm role="concept">
32171 <primary>router</primary>
32172 <secondary>suffix for local part</secondary>
32173 </indexterm>
32174 <indexterm role="concept">
32175 <primary>suffix for local part</primary>
32176 <secondary>used in router</secondary>
32177 </indexterm>
32178 This option operates in the same way as <option>local_part_prefix</option>, except that the
32179 local part must end (rather than start) with the given string, the
32180 <option>local_part_suffix_optional</option> option determines whether the suffix is
32181 mandatory, and the wildcard * character, if present, must be the last
32182 character of the suffix. This option facility is commonly used to handle local
32183 parts of the form <option>something-request</option> and multiple user mailboxes of the form
32184 <option>username-foo</option>.
32185 </para>
32186 <para>
32187 <indexterm role="option">
32188 <primary><option>local_part_suffix_optional</option></primary>
32189 </indexterm>
32190 </para>
32191 <informaltable frame="all">
32192 <tgroup cols="4" colsep="0" rowsep="0">
32193 <colspec colwidth="8*" align="left"/>
32194 <colspec colwidth="6*" align="center"/>
32195 <colspec colwidth="6*" align="center"/>
32196 <colspec colwidth="6*" align="right"/>
32197 <tbody>
32198 <row>
32199 <entry><option>local_part_suffix_optional</option></entry>
32200 <entry>Use: <emphasis>routers</emphasis></entry>
32201 <entry>Type: <emphasis>boolean</emphasis></entry>
32202 <entry>Default: <emphasis>false</emphasis></entry>
32203 </row>
32204 </tbody>
32205 </tgroup>
32206 </informaltable>
32207 <para>
32208 See <option>local_part_suffix</option> above.
32209 </para>
32210 <para>
32211 <indexterm role="option">
32212 <primary><option>local_parts</option></primary>
32213 </indexterm>
32214 </para>
32215 <informaltable frame="all">
32216 <tgroup cols="4" colsep="0" rowsep="0">
32217 <colspec colwidth="8*" align="left"/>
32218 <colspec colwidth="6*" align="center"/>
32219 <colspec colwidth="6*" align="center"/>
32220 <colspec colwidth="6*" align="right"/>
32221 <tbody>
32222 <row>
32223 <entry><option>local_parts</option></entry>
32224 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32225 <entry>Type: <emphasis>local part list</emphasis>&dagger;<emphasis></emphasis></entry>
32226 <entry>Default: <emphasis>unset</emphasis></entry>
32227 </row>
32228 </tbody>
32229 </tgroup>
32230 </informaltable>
32231 <para>
32232 <indexterm role="concept">
32233 <primary>router</primary>
32234 <secondary>restricting to specific local parts</secondary>
32235 </indexterm>
32236 <indexterm role="concept">
32237 <primary>local part</primary>
32238 <secondary>checking in router</secondary>
32239 </indexterm>
32240 The router is run only if the local part of the address matches the list.
32241 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
32242 are evaluated, and
32243 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
32244 string is expanded, it is possible to make it depend on the domain, for
32245 example:
32246 </para>
32247 <literallayout class="monospaced">
32248 local_parts = dbm;/usr/local/specials/$domain
32249 </literallayout>
32250 <para>
32251 <indexterm role="variable">
32252 <primary><varname>$local_part_data</varname></primary>
32253 </indexterm>
32254 If the match is achieved by a lookup, the data that the lookup returned
32255 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
32256 expansions of the router&#x2019;s private options. You might use this option, for
32257 example, if you have a large number of local virtual domains, and you want to
32258 send all postmaster mail to the same place without having to set up an alias in
32259 each virtual domain:
32260 </para>
32261 <literallayout class="monospaced">
32262 postmaster:
32263   driver = redirect
32264   local_parts = postmaster
32265   data = postmaster@real.domain.example
32266 </literallayout>
32267 <para>
32268 <indexterm role="option">
32269 <primary><option>log_as_local</option></primary>
32270 </indexterm>
32271 </para>
32272 <informaltable frame="all">
32273 <tgroup cols="4" colsep="0" rowsep="0">
32274 <colspec colwidth="8*" align="left"/>
32275 <colspec colwidth="6*" align="center"/>
32276 <colspec colwidth="6*" align="center"/>
32277 <colspec colwidth="6*" align="right"/>
32278 <tbody>
32279 <row>
32280 <entry><option>log_as_local</option></entry>
32281 <entry>Use: <emphasis>routers</emphasis></entry>
32282 <entry>Type: <emphasis>boolean</emphasis></entry>
32283 <entry>Default: <emphasis>see below</emphasis></entry>
32284 </row>
32285 </tbody>
32286 </tgroup>
32287 </informaltable>
32288 <para>
32289 <indexterm role="concept">
32290 <primary>log</primary>
32291 <secondary>delivery line</secondary>
32292 </indexterm>
32293 <indexterm role="concept">
32294 <primary>delivery</primary>
32295 <secondary>log line format</secondary>
32296 </indexterm>
32297 Exim has two logging styles for delivery, the idea being to make local
32298 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
32299 recipient address is given just as the local part, without a domain. The use of
32300 this style is controlled by this option. It defaults to true for the <command>accept</command>
32301 router, and false for all the others. This option applies only when a
32302 router assigns an address to a transport. It has no effect on routers that
32303 redirect addresses.
32304 </para>
32305 <para>
32306 <indexterm role="option">
32307 <primary><option>more</option></primary>
32308 </indexterm>
32309 </para>
32310 <informaltable frame="all">
32311 <tgroup cols="4" colsep="0" rowsep="0">
32312 <colspec colwidth="8*" align="left"/>
32313 <colspec colwidth="6*" align="center"/>
32314 <colspec colwidth="6*" align="center"/>
32315 <colspec colwidth="6*" align="right"/>
32316 <tbody>
32317 <row>
32318 <entry><option>more</option></entry>
32319 <entry>Use: <emphasis>routers</emphasis></entry>
32320 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
32321 <entry>Default: <emphasis>true</emphasis></entry>
32322 </row>
32323 </tbody>
32324 </tgroup>
32325 </informaltable>
32326 <para>
32327 The result of string expansion for this option must be a valid boolean value,
32328 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
32329 result causes an error, and delivery is deferred. If the expansion is forced to
32330 fail, the default value for the option (true) is used. Other failures cause
32331 delivery to be deferred.
32332 </para>
32333 <para>
32334 If this option is set false, and the router declines to handle the address, no
32335 further routers are tried, routing fails, and the address is bounced.
32336 <indexterm role="option">
32337 <primary><option>self</option></primary>
32338 </indexterm>
32339 However, if the router explicitly passes an address to the following router by
32340 means of the setting
32341 </para>
32342 <literallayout class="monospaced">
32343 self = pass
32344 </literallayout>
32345 <para>
32346 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
32347 does not affect the behaviour if one of the precondition tests fails. In that
32348 case, the address is always passed to the next router.
32349 </para>
32350 <para>
32351 Note that <option>address_data</option> is not considered to be a precondition. If its
32352 expansion is forced to fail, the router declines, and the value of <option>more</option>
32353 controls what happens next.
32354 </para>
32355 <para>
32356 <indexterm role="option">
32357 <primary><option>pass_on_timeout</option></primary>
32358 </indexterm>
32359 </para>
32360 <informaltable frame="all">
32361 <tgroup cols="4" colsep="0" rowsep="0">
32362 <colspec colwidth="8*" align="left"/>
32363 <colspec colwidth="6*" align="center"/>
32364 <colspec colwidth="6*" align="center"/>
32365 <colspec colwidth="6*" align="right"/>
32366 <tbody>
32367 <row>
32368 <entry><option>pass_on_timeout</option></entry>
32369 <entry>Use: <emphasis>routers</emphasis></entry>
32370 <entry>Type: <emphasis>boolean</emphasis></entry>
32371 <entry>Default: <emphasis>false</emphasis></entry>
32372 </row>
32373 </tbody>
32374 </tgroup>
32375 </informaltable>
32376 <para>
32377 <indexterm role="concept">
32378 <primary>timeout</primary>
32379 <secondary>of router</secondary>
32380 </indexterm>
32381 <indexterm role="concept">
32382 <primary>router</primary>
32383 <secondary>timeout</secondary>
32384 </indexterm>
32385 If a router times out during a host lookup, it normally causes deferral of the
32386 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
32387 router, overriding <option>no_more</option>. This may be helpful for systems that are
32388 intermittently connected to the Internet, or those that want to pass to a smart
32389 host any messages that cannot immediately be delivered.
32390 </para>
32391 <para>
32392 There are occasional other temporary errors that can occur while doing DNS
32393 lookups. They are treated in the same way as a timeout, and this option
32394 applies to all of them.
32395 </para>
32396 <para>
32397 <indexterm role="option">
32398 <primary><option>pass_router</option></primary>
32399 </indexterm>
32400 </para>
32401 <informaltable frame="all">
32402 <tgroup cols="4" colsep="0" rowsep="0">
32403 <colspec colwidth="8*" align="left"/>
32404 <colspec colwidth="6*" align="center"/>
32405 <colspec colwidth="6*" align="center"/>
32406 <colspec colwidth="6*" align="right"/>
32407 <tbody>
32408 <row>
32409 <entry><option>pass_router</option></entry>
32410 <entry>Use: <emphasis>routers</emphasis></entry>
32411 <entry>Type: <emphasis>string</emphasis></entry>
32412 <entry>Default: <emphasis>unset</emphasis></entry>
32413 </row>
32414 </tbody>
32415 </tgroup>
32416 </informaltable>
32417 <para>
32418 <indexterm role="concept">
32419 <primary>router</primary>
32420 <secondary>go to after <quote>pass</quote></secondary>
32421 </indexterm>
32422 Routers that recognize the generic <option>self</option> option (<command>dnslookup</command>,
32423 <command>ipliteral</command>, and <command>manualroute</command>) are able to return <quote>pass</quote>, forcing
32424 routing to continue, and overriding a false setting of <option>more</option>. When one of
32425 these routers returns <quote>pass</quote>, the address is normally handed on to the next
32426 router in sequence. This can be changed by setting <option>pass_router</option> to the name
32427 of another router. However (unlike <option>redirect_router</option>) the named router must
32428 be below the current router, to avoid loops. Note that this option applies only
32429 to the special case of <quote>pass</quote>. It does not apply when a router returns
32430 <quote>decline</quote> because it cannot handle an address.
32431 </para>
32432 <para>
32433 <indexterm role="option">
32434 <primary><option>redirect_router</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>redirect_router</option></entry>
32446 <entry>Use: <emphasis>routers</emphasis></entry>
32447 <entry>Type: <emphasis>string</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>router</primary>
32456 <secondary>start at after redirection</secondary>
32457 </indexterm>
32458 Sometimes an administrator knows that it is pointless to reprocess addresses
32459 generated from alias or forward files with the same router again. For
32460 example, if an alias file translates real names into login ids there is no
32461 point searching the alias file a second time, especially if it is a large file.
32462 </para>
32463 <para>
32464 The <option>redirect_router</option> option can be set to the name of any router instance.
32465 It causes the routing of any generated addresses to start at the named router
32466 instead of at the first router. This option has no effect if the router in
32467 which it is set does not generate new addresses.
32468 </para>
32469 <para>
32470 <indexterm role="option">
32471 <primary><option>require_files</option></primary>
32472 </indexterm>
32473 </para>
32474 <informaltable frame="all">
32475 <tgroup cols="4" colsep="0" rowsep="0">
32476 <colspec colwidth="8*" align="left"/>
32477 <colspec colwidth="6*" align="center"/>
32478 <colspec colwidth="6*" align="center"/>
32479 <colspec colwidth="6*" align="right"/>
32480 <tbody>
32481 <row>
32482 <entry><option>require_files</option></entry>
32483 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32484 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
32485 <entry>Default: <emphasis>unset</emphasis></entry>
32486 </row>
32487 </tbody>
32488 </tgroup>
32489 </informaltable>
32490 <para>
32491 <indexterm role="concept">
32492 <primary>file</primary>
32493 <secondary>requiring for router</secondary>
32494 </indexterm>
32495 <indexterm role="concept">
32496 <primary>router</primary>
32497 <secondary>requiring file existence</secondary>
32498 </indexterm>
32499 This option provides a general mechanism for predicating the running of a
32500 router on the existence or non-existence of certain files or directories.
32501 Before running a router, as one of its precondition tests, Exim works its way
32502 through the <option>require_files</option> list, expanding each item separately.
32503 </para>
32504 <para>
32505 Because the list is split before expansion, any colons in expansion items must
32506 be doubled, or the facility for using a different list separator must be used.
32507 If any expansion is forced to fail, the item is ignored. Other expansion
32508 failures cause routing of the address to be deferred.
32509 </para>
32510 <para>
32511 If any expanded string is empty, it is ignored. Otherwise, except as described
32512 below, each string must be a fully qualified file path, optionally preceded by
32513 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
32514 existence of the files or directories. The router is skipped if any paths not
32515 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
32516 </para>
32517 <para>
32518 <indexterm role="concept">
32519 <primary>NFS</primary>
32520 </indexterm>
32521 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
32522 the message is deferred. This can happen when NFS-mounted filesystems are
32523 unavailable.
32524 </para>
32525 <para>
32526 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
32527 options, so you cannot use it to check for the existence of a file in which to
32528 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
32529 full list of the order in which preconditions are evaluated.) However, as
32530 these options are all expanded, you can use the <option>exists</option> expansion condition
32531 to make such tests. The <option>require_files</option> option is intended for checking files
32532 that the router may be going to use internally, or which are needed by a
32533 transport (for example <filename>.procmailrc</filename>).
32534 </para>
32535 <para>
32536 During delivery, the <function>stat()</function> function is run as root, but there is a
32537 facility for some checking of the accessibility of a file by another user.
32538 This is not a proper permissions check, but just a <quote>rough</quote> check that
32539 operates as follows:
32540 </para>
32541 <para>
32542 If an item in a <option>require_files</option> list does not contain any forward slash
32543 characters, it is taken to be the user (and optional group, separated by a
32544 comma) to be checked for subsequent files in the list. If no group is specified
32545 but the user is specified symbolically, the gid associated with the uid is
32546 used. For example:
32547 </para>
32548 <literallayout class="monospaced">
32549 require_files = mail:/some/file
32550 require_files = $local_part:$home/.procmailrc
32551 </literallayout>
32552 <para>
32553 If a user or group name in a <option>require_files</option> list does not exist, the
32554 <option>require_files</option> condition fails.
32555 </para>
32556 <para>
32557 Exim performs the check by scanning along the components of the file path, and
32558 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
32559 directories, and <quote>r</quote> access on the final file. Note that this means that file
32560 access control lists, if the operating system has them, are ignored.
32561 </para>
32562 <para>
32563 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
32564 incoming SMTP message, Exim is not running as root, but under its own uid. This
32565 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
32566 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
32567 user is not permitted to read one of the directories on the file&#x2019;s path.
32568 </para>
32569 <para>
32570 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
32571 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
32572 without root access. In this case, if a check for access by a particular user
32573 is requested, Exim creates a subprocess that runs as that user, and tries the
32574 check again in that process.
32575 </para>
32576 <para>
32577 The default action for handling an unresolved EACCES is to consider it to
32578 be caused by a configuration error, and routing is deferred because the
32579 existence or non-existence of the file cannot be determined. However, in some
32580 circumstances it may be desirable to treat this condition as if the file did
32581 not exist. If the file name (or the exclamation mark that precedes the file
32582 name for non-existence) is preceded by a plus sign, the EACCES error is treated
32583 as if the file did not exist. For example:
32584 </para>
32585 <literallayout class="monospaced">
32586 require_files = +/some/file
32587 </literallayout>
32588 <para>
32589 If the router is not an essential part of verification (for example, it
32590 handles users&#x2019; <filename>.forward</filename> files), another solution is to set the <option>verify</option>
32591 option false so that the router is skipped when verifying.
32592 </para>
32593 <para>
32594 <indexterm role="option">
32595 <primary><option>retry_use_local_part</option></primary>
32596 </indexterm>
32597 </para>
32598 <informaltable frame="all">
32599 <tgroup cols="4" colsep="0" rowsep="0">
32600 <colspec colwidth="8*" align="left"/>
32601 <colspec colwidth="6*" align="center"/>
32602 <colspec colwidth="6*" align="center"/>
32603 <colspec colwidth="6*" align="right"/>
32604 <tbody>
32605 <row>
32606 <entry><option>retry_use_local_part</option></entry>
32607 <entry>Use: <emphasis>routers</emphasis></entry>
32608 <entry>Type: <emphasis>boolean</emphasis></entry>
32609 <entry>Default: <emphasis>see below</emphasis></entry>
32610 </row>
32611 </tbody>
32612 </tgroup>
32613 </informaltable>
32614 <para>
32615 <indexterm role="concept">
32616 <primary>hints database</primary>
32617 <secondary>retry keys</secondary>
32618 </indexterm>
32619 <indexterm role="concept">
32620 <primary>local part</primary>
32621 <secondary>in retry keys</secondary>
32622 </indexterm>
32623 When a delivery suffers a temporary routing failure, a retry record is created
32624 in Exim&#x2019;s hints database. For addresses whose routing depends only on the
32625 domain, the key for the retry record should not involve the local part, but for
32626 other addresses, both the domain and the local part should be included.
32627 Usually, remote routing is of the former kind, and local routing is of the
32628 latter kind.
32629 </para>
32630 <para>
32631 This option controls whether the local part is used to form the key for retry
32632 hints for addresses that suffer temporary errors while being handled by this
32633 router. The default value is true for any router that has <option>check_local_user</option>
32634 set, and false otherwise. Note that this option does not apply to hints keys
32635 for transport delays; they are controlled by a generic transport option of the
32636 same name.
32637 </para>
32638 <para>
32639 The setting of <option>retry_use_local_part</option> applies only to the router on which it
32640 appears. If the router generates child addresses, they are routed
32641 independently; this setting does not become attached to them.
32642 </para>
32643 <para>
32644 <indexterm role="option">
32645 <primary><option>router_home_directory</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>router_home_directory</option></entry>
32657 <entry>Use: <emphasis>routers</emphasis></entry>
32658 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32659 <entry>Default: <emphasis>unset</emphasis></entry>
32660 </row>
32661 </tbody>
32662 </tgroup>
32663 </informaltable>
32664 <para>
32665 <indexterm role="concept">
32666 <primary>router</primary>
32667 <secondary>home directory for</secondary>
32668 </indexterm>
32669 <indexterm role="concept">
32670 <primary>home directory</primary>
32671 <secondary>for router</secondary>
32672 </indexterm>
32673 <indexterm role="variable">
32674 <primary><varname>$home</varname></primary>
32675 </indexterm>
32676 This option sets a home directory for use while the router is running. (Compare
32677 <option>transport_home_directory</option>, which sets a home directory for later
32678 transporting.) In particular, if used on a <command>redirect</command> router, this option
32679 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
32680 forced expansion failure causes the option to be ignored &ndash; other failures
32681 cause the router to defer.
32682 </para>
32683 <para>
32684 Expansion of <option>router_home_directory</option> happens immediately after the
32685 <option>check_local_user</option> test (if configured), before any further expansions take
32686 place.
32687 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
32688 are evaluated.)
32689 While the router is running, <option>router_home_directory</option> overrides the value of
32690 <varname>$home</varname> that came from <option>check_local_user</option>.
32691 </para>
32692 <para>
32693 When a router accepts an address and assigns it to a local transport (including
32694 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
32695 delivery), the home directory setting for the transport is taken from the first
32696 of these values that is set:
32697 </para>
32698 <itemizedlist>
32699 <listitem>
32700 <para>
32701 The <option>home_directory</option> option on the transport;
32702 </para>
32703 </listitem>
32704 <listitem>
32705 <para>
32706 The <option>transport_home_directory</option> option on the router;
32707 </para>
32708 </listitem>
32709 <listitem>
32710 <para>
32711 The password data if <option>check_local_user</option> is set on the router;
32712 </para>
32713 </listitem>
32714 <listitem>
32715 <para>
32716 The <option>router_home_directory</option> option on the router.
32717 </para>
32718 </listitem>
32719 </itemizedlist>
32720 <para>
32721 In other words, <option>router_home_directory</option> overrides the password data for the
32722 router, but not for the transport.
32723 </para>
32724 <para>
32725 <indexterm role="option">
32726 <primary><option>self</option></primary>
32727 </indexterm>
32728 </para>
32729 <informaltable frame="all">
32730 <tgroup cols="4" colsep="0" rowsep="0">
32731 <colspec colwidth="8*" align="left"/>
32732 <colspec colwidth="6*" align="center"/>
32733 <colspec colwidth="6*" align="center"/>
32734 <colspec colwidth="6*" align="right"/>
32735 <tbody>
32736 <row>
32737 <entry><option>self</option></entry>
32738 <entry>Use: <emphasis>routers</emphasis></entry>
32739 <entry>Type: <emphasis>string</emphasis></entry>
32740 <entry>Default: <emphasis>freeze</emphasis></entry>
32741 </row>
32742 </tbody>
32743 </tgroup>
32744 </informaltable>
32745 <para>
32746 <indexterm role="concept">
32747 <primary>MX record</primary>
32748 <secondary>pointing to local host</secondary>
32749 </indexterm>
32750 <indexterm role="concept">
32751 <primary>local host</primary>
32752 <secondary>MX pointing to</secondary>
32753 </indexterm>
32754 This option applies to those routers that use a recipient address to find a
32755 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
32756 and <command>manualroute</command> routers.
32757 Certain configurations of the <command>queryprogram</command> router can also specify a list
32758 of remote hosts.
32759 Usually such routers are configured to send the message to a remote host via an
32760 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
32761 host on the list turns out to be the local host.
32762 The way in which Exim checks for the local host is described in section
32763 <xref linkend="SECTreclocipadd"/>.
32764 </para>
32765 <para>
32766 Normally this situation indicates either an error in Exim&#x2019;s configuration (for
32767 example, the router should be configured not to process this domain), or an
32768 error in the DNS (for example, the MX should not point to this host). For this
32769 reason, the default action is to log the incident, defer the address, and
32770 freeze the message. The following alternatives are provided for use in special
32771 cases:
32772 </para>
32773 <variablelist>
32774 <varlistentry>
32775 <term><option>defer</option></term>
32776 <listitem>
32777 <para>
32778 Delivery of the message is tried again later, but the message is not frozen.
32779 </para>
32780 </listitem></varlistentry>
32781 <varlistentry>
32782 <term><option>reroute</option>: &lt;<emphasis>domain</emphasis>&gt;</term>
32783 <listitem>
32784 <para>
32785 The domain is changed to the given domain, and the address is passed back to
32786 be reprocessed by the routers. No rewriting of headers takes place. This
32787 behaviour is essentially a redirection.
32788 </para>
32789 </listitem></varlistentry>
32790 <varlistentry>
32791 <term><option>reroute: rewrite:</option> &lt;<emphasis>domain</emphasis>&gt;</term>
32792 <listitem>
32793 <para>
32794 The domain is changed to the given domain, and the address is passed back to be
32795 reprocessed by the routers. Any headers that contain the original domain are
32796 rewritten.
32797 </para>
32798 </listitem></varlistentry>
32799 <varlistentry>
32800 <term><option>pass</option></term>
32801 <listitem>
32802 <para>
32803 <indexterm role="option">
32804 <primary><option>more</option></primary>
32805 </indexterm>
32806 <indexterm role="variable">
32807 <primary><varname>$self_hostname</varname></primary>
32808 </indexterm>
32809 The router passes the address to the next router, or to the router named in the
32810 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
32811 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
32812 name of the local host that the router encountered. This can be used to
32813 distinguish between different cases for hosts with multiple names. The
32814 combination
32815 </para>
32816 <literallayout class="monospaced">
32817 self = pass
32818 no_more
32819 </literallayout>
32820 <para>
32821 ensures that only those addresses that routed to the local host are passed on.
32822 Without <option>no_more</option>, addresses that were declined for other reasons would also
32823 be passed to the next router.
32824 </para>
32825 </listitem></varlistentry>
32826 <varlistentry>
32827 <term><option>fail</option></term>
32828 <listitem>
32829 <para>
32830 Delivery fails and an error report is generated.
32831 </para>
32832 </listitem></varlistentry>
32833 <varlistentry>
32834 <term><option>send</option></term>
32835 <listitem>
32836 <para>
32837 <indexterm role="concept">
32838 <primary>local host</primary>
32839 <secondary>sending to</secondary>
32840 </indexterm>
32841 The anomaly is ignored and the address is queued for the transport. This
32842 setting should be used with extreme caution. For an <command>smtp</command> transport, it
32843 makes sense only in cases where the program that is listening on the SMTP port
32844 is not this version of Exim. That is, it must be some other MTA, or Exim with a
32845 different configuration file that handles the domain in another way.
32846 </para>
32847 </listitem></varlistentry>
32848 </variablelist>
32849 <para>
32850 <indexterm role="option">
32851 <primary><option>senders</option></primary>
32852 </indexterm>
32853 </para>
32854 <informaltable frame="all">
32855 <tgroup cols="4" colsep="0" rowsep="0">
32856 <colspec colwidth="8*" align="left"/>
32857 <colspec colwidth="6*" align="center"/>
32858 <colspec colwidth="6*" align="center"/>
32859 <colspec colwidth="6*" align="right"/>
32860 <tbody>
32861 <row>
32862 <entry><option>senders</option></entry>
32863 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32864 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
32865 <entry>Default: <emphasis>unset</emphasis></entry>
32866 </row>
32867 </tbody>
32868 </tgroup>
32869 </informaltable>
32870 <para>
32871 <indexterm role="concept">
32872 <primary>router</primary>
32873 <secondary>checking senders</secondary>
32874 </indexterm>
32875 If this option is set, the router is skipped unless the message&#x2019;s sender
32876 address matches something on the list.
32877 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
32878 are evaluated.
32879 </para>
32880 <para>
32881 There are issues concerning verification when the running of routers is
32882 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
32883 setting, it sets the sender to the null string. When using the <option>-bt</option> option
32884 to check a configuration file, it is necessary also to use the <option>-f</option> option to
32885 set an appropriate sender. For incoming mail, the sender is unset when
32886 verifying the sender, but is available when verifying any recipients. If the
32887 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
32888 matters.
32889 </para>
32890 <para>
32891 <indexterm role="option">
32892 <primary><option>translate_ip_address</option></primary>
32893 </indexterm>
32894 </para>
32895 <informaltable frame="all">
32896 <tgroup cols="4" colsep="0" rowsep="0">
32897 <colspec colwidth="8*" align="left"/>
32898 <colspec colwidth="6*" align="center"/>
32899 <colspec colwidth="6*" align="center"/>
32900 <colspec colwidth="6*" align="right"/>
32901 <tbody>
32902 <row>
32903 <entry><option>translate_ip_address</option></entry>
32904 <entry>Use: <emphasis>routers</emphasis></entry>
32905 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32906 <entry>Default: <emphasis>unset</emphasis></entry>
32907 </row>
32908 </tbody>
32909 </tgroup>
32910 </informaltable>
32911 <para>
32912 <indexterm role="concept">
32913 <primary>IP address</primary>
32914 <secondary>translating</secondary>
32915 </indexterm>
32916 <indexterm role="concept">
32917 <primary>packet radio</primary>
32918 </indexterm>
32919 <indexterm role="concept">
32920 <primary>router</primary>
32921 <secondary>IP address translation</secondary>
32922 </indexterm>
32923 There exist some rare networking situations (for example, packet radio) where
32924 it is helpful to be able to translate IP addresses generated by normal routing
32925 mechanisms into other IP addresses, thus performing a kind of manual IP
32926 routing. This should be done only if the normal IP routing of the TCP/IP stack
32927 is inadequate or broken. Because this is an extremely uncommon requirement, the
32928 code to support this option is not included in the Exim binary unless
32929 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
32930 </para>
32931 <para>
32932 <indexterm role="variable">
32933 <primary><varname>$host_address</varname></primary>
32934 </indexterm>
32935 The <option>translate_ip_address</option> string is expanded for every IP address generated
32936 by the router, with the generated address set in <varname>$host_address</varname>. If the
32937 expansion is forced to fail, no action is taken.
32938 For any other expansion error, delivery of the message is deferred.
32939 If the result of the expansion is an IP address, that replaces the original
32940 address; otherwise the result is assumed to be a host name &ndash; this is looked
32941 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
32942 produce one or more replacement IP addresses. For example, to subvert all IP
32943 addresses in some specific networks, this could be added to a router:
32944 </para>
32945 <literallayout class="monospaced">
32946 translate_ip_address = \
32947   ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
32948     {$value}fail}}
32949 </literallayout>
32950 <para>
32951 The file would contain lines like
32952 </para>
32953 <literallayout class="monospaced">
32954 10.2.3.128/26    some.host
32955 10.8.4.34/26     10.44.8.15
32956 </literallayout>
32957 <para>
32958 You should not make use of this facility unless you really understand what you
32959 are doing.
32960 </para>
32961 <para>
32962 <indexterm role="option">
32963 <primary><option>transport</option></primary>
32964 </indexterm>
32965 </para>
32966 <informaltable frame="all">
32967 <tgroup cols="4" colsep="0" rowsep="0">
32968 <colspec colwidth="8*" align="left"/>
32969 <colspec colwidth="6*" align="center"/>
32970 <colspec colwidth="6*" align="center"/>
32971 <colspec colwidth="6*" align="right"/>
32972 <tbody>
32973 <row>
32974 <entry><option>transport</option></entry>
32975 <entry>Use: <emphasis>routers</emphasis></entry>
32976 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32977 <entry>Default: <emphasis>unset</emphasis></entry>
32978 </row>
32979 </tbody>
32980 </tgroup>
32981 </informaltable>
32982 <para>
32983 This option specifies the transport to be used when a router accepts an address
32984 and sets it up for delivery. A transport is never needed if a router is used
32985 only for verification. The value of the option is expanded at routing time,
32986 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
32987 and result must be the name of one of the configured transports. If it is not,
32988 delivery is deferred.
32989 </para>
32990 <para>
32991 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
32992 have some private options that set up transports for pipe and file deliveries
32993 (see chapter <xref linkend="CHAPredirect"/>).
32994 </para>
32995 <para>
32996 <indexterm role="option">
32997 <primary><option>transport_current_directory</option></primary>
32998 </indexterm>
32999 </para>
33000 <informaltable frame="all">
33001 <tgroup cols="4" colsep="0" rowsep="0">
33002 <colspec colwidth="8*" align="left"/>
33003 <colspec colwidth="6*" align="center"/>
33004 <colspec colwidth="6*" align="center"/>
33005 <colspec colwidth="6*" align="right"/>
33006 <tbody>
33007 <row>
33008 <entry><option>transport_current_directory</option></entry>
33009 <entry>Use: <emphasis>routers</emphasis></entry>
33010 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33011 <entry>Default: <emphasis>unset</emphasis></entry>
33012 </row>
33013 </tbody>
33014 </tgroup>
33015 </informaltable>
33016 <para>
33017 <indexterm role="concept">
33018 <primary>current directory for local transport</primary>
33019 </indexterm>
33020 This option associates a current directory with any address that is routed
33021 to a local transport. This can happen either because a transport is
33022 explicitly configured for the router, or because it generates a delivery to a
33023 file or a pipe. During the delivery process (that is, at transport time), this
33024 option string is expanded and is set as the current directory, unless
33025 overridden by a setting on the transport.
33026 If the expansion fails for any reason, including forced failure, an error is
33027 logged, and delivery is deferred.
33028 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
33029 environment.
33030 </para>
33031 <para>
33032 <indexterm role="option">
33033 <primary><option>transport_home_directory</option></primary>
33034 </indexterm>
33035 </para>
33036 <informaltable frame="all">
33037 <tgroup cols="4" colsep="0" rowsep="0">
33038 <colspec colwidth="8*" align="left"/>
33039 <colspec colwidth="6*" align="center"/>
33040 <colspec colwidth="6*" align="center"/>
33041 <colspec colwidth="6*" align="right"/>
33042 <tbody>
33043 <row>
33044 <entry><option>transport_home_directory</option></entry>
33045 <entry>Use: <emphasis>routers</emphasis></entry>
33046 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33047 <entry>Default: <emphasis>see below</emphasis></entry>
33048 </row>
33049 </tbody>
33050 </tgroup>
33051 </informaltable>
33052 <para>
33053 <indexterm role="concept">
33054 <primary>home directory</primary>
33055 <secondary>for local transport</secondary>
33056 </indexterm>
33057 This option associates a home directory with any address that is routed to a
33058 local transport. This can happen either because a transport is explicitly
33059 configured for the router, or because it generates a delivery to a file or a
33060 pipe. During the delivery process (that is, at transport time), the option
33061 string is expanded and is set as the home directory, unless overridden by a
33062 setting of <option>home_directory</option> on the transport.
33063 If the expansion fails for any reason, including forced failure, an error is
33064 logged, and delivery is deferred.
33065 </para>
33066 <para>
33067 If the transport does not specify a home directory, and
33068 <option>transport_home_directory</option> is not set for the router, the home directory for
33069 the transport is taken from the password data if <option>check_local_user</option> is set for
33070 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
33071 is set; if not, no home directory is set for the transport.
33072 </para>
33073 <para>
33074 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
33075 environment.
33076 </para>
33077 <para>
33078 <indexterm role="option">
33079 <primary><option>unseen</option></primary>
33080 </indexterm>
33081 </para>
33082 <informaltable frame="all">
33083 <tgroup cols="4" colsep="0" rowsep="0">
33084 <colspec colwidth="8*" align="left"/>
33085 <colspec colwidth="6*" align="center"/>
33086 <colspec colwidth="6*" align="center"/>
33087 <colspec colwidth="6*" align="right"/>
33088 <tbody>
33089 <row>
33090 <entry><option>unseen</option></entry>
33091 <entry>Use: <emphasis>routers</emphasis></entry>
33092 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
33093 <entry>Default: <emphasis>false</emphasis></entry>
33094 </row>
33095 </tbody>
33096 </tgroup>
33097 </informaltable>
33098 <para>
33099 <indexterm role="concept">
33100 <primary>router</primary>
33101 <secondary>carrying on after success</secondary>
33102 </indexterm>
33103 The result of string expansion for this option must be a valid boolean value,
33104 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
33105 result causes an error, and delivery is deferred. If the expansion is forced to
33106 fail, the default value for the option (false) is used. Other failures cause
33107 delivery to be deferred.
33108 </para>
33109 <para>
33110 When this option is set true, routing does not cease if the router accepts the
33111 address. Instead, a copy of the incoming address is passed to the next router,
33112 overriding a false setting of <option>more</option>. There is little point in setting
33113 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
33114 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
33115 sometimes true and sometimes false).
33116 </para>
33117 <para>
33118 <indexterm role="concept">
33119 <primary>copy of message (<option>unseen</option> option)</primary>
33120 </indexterm>
33121 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
33122 qualifier in filter files. It can be used to cause copies of messages to be
33123 delivered to some other destination, while also carrying out a normal delivery.
33124 In effect, the current address is made into a <quote>parent</quote> that has two children
33125 &ndash; one that is delivered as specified by this router, and a clone that goes on
33126 to be routed further. For this reason, <option>unseen</option> may not be combined with the
33127 <option>one_time</option> option in a <command>redirect</command> router.
33128 </para>
33129 <para>
33130 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
33131 this router or by previous routers affect the <quote>unseen</quote> copy of the message
33132 only. The clone that continues to be processed by further routers starts with
33133 no added headers and none specified for removal. For a <option>redirect</option> router, if
33134 a generated address is the same as the incoming address, this can lead to
33135 duplicate addresses with different header modifications. Exim does not do
33136 duplicate deliveries (except, in certain circumstances, to pipes -- see section
33137 <xref linkend="SECTdupaddr"/>), but it is undefined which of the duplicates is discarded,
33138 so this ambiguous situation should be avoided. The <option>repeat_use</option> option of the
33139 <option>redirect</option> router may be of help.
33140 </para>
33141 <para>
33142 Unlike the handling of header modifications, any data that was set by the
33143 <option>address_data</option> option in the current or previous routers <emphasis>is</emphasis> passed on to
33144 subsequent routers.
33145 </para>
33146 <para>
33147 <indexterm role="option">
33148 <primary><option>user</option></primary>
33149 </indexterm>
33150 </para>
33151 <informaltable frame="all">
33152 <tgroup cols="4" colsep="0" rowsep="0">
33153 <colspec colwidth="8*" align="left"/>
33154 <colspec colwidth="6*" align="center"/>
33155 <colspec colwidth="6*" align="center"/>
33156 <colspec colwidth="6*" align="right"/>
33157 <tbody>
33158 <row>
33159 <entry><option>user</option></entry>
33160 <entry>Use: <emphasis>routers</emphasis></entry>
33161 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33162 <entry>Default: <emphasis>see below</emphasis></entry>
33163 </row>
33164 </tbody>
33165 </tgroup>
33166 </informaltable>
33167 <para>
33168 <indexterm role="concept">
33169 <primary>uid (user id)</primary>
33170 <secondary>local delivery</secondary>
33171 </indexterm>
33172 <indexterm role="concept">
33173 <primary>local transports</primary>
33174 <secondary>uid and gid</secondary>
33175 </indexterm>
33176 <indexterm role="concept">
33177 <primary>transport</primary>
33178 <secondary>local</secondary>
33179 </indexterm>
33180 <indexterm role="concept">
33181 <primary>router</primary>
33182 <secondary>user for filter processing</secondary>
33183 </indexterm>
33184 <indexterm role="concept">
33185 <primary>filter</primary>
33186 <secondary>user for processing</secondary>
33187 </indexterm>
33188 When a router queues an address for a transport, and the transport does not
33189 specify a user, the user given here is used when running the delivery process.
33190 The user may be specified numerically or by name. If expansion fails, the
33191 error is logged and delivery is deferred.
33192 This user is also used by the <command>redirect</command> router when running a filter file.
33193 The default is unset, except when <option>check_local_user</option> is set. In this case,
33194 the default is taken from the password information. If the user is specified as
33195 a name, and <option>group</option> is not set, the group associated with the user is used.
33196 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
33197 <xref linkend="CHAPenvironment"/>.
33198 </para>
33199 <para>
33200 <indexterm role="option">
33201 <primary><option>verify</option></primary>
33202 </indexterm>
33203 </para>
33204 <informaltable frame="all">
33205 <tgroup cols="4" colsep="0" rowsep="0">
33206 <colspec colwidth="8*" align="left"/>
33207 <colspec colwidth="6*" align="center"/>
33208 <colspec colwidth="6*" align="center"/>
33209 <colspec colwidth="6*" align="right"/>
33210 <tbody>
33211 <row>
33212 <entry><option>verify</option></entry>
33213 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33214 <entry>Type: <emphasis>boolean</emphasis></entry>
33215 <entry>Default: <emphasis>true</emphasis></entry>
33216 </row>
33217 </tbody>
33218 </tgroup>
33219 </informaltable>
33220 <para>
33221 Setting this option has the effect of setting <option>verify_sender</option> and
33222 <option>verify_recipient</option> to the same value.
33223 </para>
33224 <para>
33225 <indexterm role="option">
33226 <primary><option>verify_only</option></primary>
33227 </indexterm>
33228 </para>
33229 <informaltable frame="all">
33230 <tgroup cols="4" colsep="0" rowsep="0">
33231 <colspec colwidth="8*" align="left"/>
33232 <colspec colwidth="6*" align="center"/>
33233 <colspec colwidth="6*" align="center"/>
33234 <colspec colwidth="6*" align="right"/>
33235 <tbody>
33236 <row>
33237 <entry><option>verify_only</option></entry>
33238 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33239 <entry>Type: <emphasis>boolean</emphasis></entry>
33240 <entry>Default: <emphasis>false</emphasis></entry>
33241 </row>
33242 </tbody>
33243 </tgroup>
33244 </informaltable>
33245 <para>
33246 <indexterm role="concept">
33247 <primary>EXPN</primary>
33248 <secondary>with <option>verify_only</option></secondary>
33249 </indexterm>
33250 <indexterm role="option">
33251 <primary><option>-bv</option></primary>
33252 </indexterm>
33253 <indexterm role="concept">
33254 <primary>router</primary>
33255 <secondary>used only when verifying</secondary>
33256 </indexterm>
33257 If this option is set, the router is used only when verifying an address,
33258 delivering in cutthrough mode or
33259 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
33260 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
33261 restricted to verifying only senders or recipients by means of
33262 <option>verify_sender</option> and <option>verify_recipient</option>.
33263 </para>
33264 <para>
33265 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
33266 SMTP message, Exim is not running as root, but under its own uid. If the router
33267 accesses any files, you need to make sure that they are accessible to the Exim
33268 user or group.
33269 </para>
33270 <para>
33271 <indexterm role="option">
33272 <primary><option>verify_recipient</option></primary>
33273 </indexterm>
33274 </para>
33275 <informaltable frame="all">
33276 <tgroup cols="4" colsep="0" rowsep="0">
33277 <colspec colwidth="8*" align="left"/>
33278 <colspec colwidth="6*" align="center"/>
33279 <colspec colwidth="6*" align="center"/>
33280 <colspec colwidth="6*" align="right"/>
33281 <tbody>
33282 <row>
33283 <entry><option>verify_recipient</option></entry>
33284 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33285 <entry>Type: <emphasis>boolean</emphasis></entry>
33286 <entry>Default: <emphasis>true</emphasis></entry>
33287 </row>
33288 </tbody>
33289 </tgroup>
33290 </informaltable>
33291 <para>
33292 If this option is false, the router is skipped when verifying recipient
33293 addresses,
33294 delivering in cutthrough mode
33295 or testing recipient verification using <option>-bv</option>.
33296 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
33297 are evaluated.
33298 See also the <varname>$verify_mode</varname> variable.
33299 </para>
33300 <para>
33301 <indexterm role="option">
33302 <primary><option>verify_sender</option></primary>
33303 </indexterm>
33304 </para>
33305 <informaltable frame="all">
33306 <tgroup cols="4" colsep="0" rowsep="0">
33307 <colspec colwidth="8*" align="left"/>
33308 <colspec colwidth="6*" align="center"/>
33309 <colspec colwidth="6*" align="center"/>
33310 <colspec colwidth="6*" align="right"/>
33311 <tbody>
33312 <row>
33313 <entry><option>verify_sender</option></entry>
33314 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33315 <entry>Type: <emphasis>boolean</emphasis></entry>
33316 <entry>Default: <emphasis>true</emphasis></entry>
33317 </row>
33318 </tbody>
33319 </tgroup>
33320 </informaltable>
33321 <para>
33322 If this option is false, the router is skipped when verifying sender addresses
33323 or testing sender verification using <option>-bvs</option>.
33324 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
33325 are evaluated.
33326 See also the <varname>$verify_mode</varname> variable.
33327 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
33328 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
33329 </para>
33330 </chapter>
33331
33332 <chapter id="CHID4">
33333 <title>The accept router</title>
33334 <para>
33335 <indexterm role="concept">
33336 <primary><command>accept</command> router</primary>
33337 </indexterm>
33338 <indexterm role="concept">
33339 <primary>routers</primary>
33340 <secondary><command>accept</command></secondary>
33341 </indexterm>
33342 The <command>accept</command> router has no private options of its own. Unless it is being
33343 used purely for verification (see <option>verify_only</option>) a transport is required to
33344 be defined by the generic <option>transport</option> option. If the preconditions that are
33345 specified by generic options are met, the router accepts the address and queues
33346 it for the given transport. The most common use of this router is for setting
33347 up deliveries to local mailboxes. For example:
33348 </para>
33349 <literallayout class="monospaced">
33350 localusers:
33351   driver = accept
33352   domains = mydomain.example
33353   check_local_user
33354   transport = local_delivery
33355 </literallayout>
33356 <para>
33357 The <option>domains</option> condition in this example checks the domain of the address, and
33358 <option>check_local_user</option> checks that the local part is the login of a local user.
33359 When both preconditions are met, the <command>accept</command> router runs, and queues the
33360 address for the <command>local_delivery</command> transport.
33361 </para>
33362 </chapter>
33363
33364 <chapter id="CHAPdnslookup">
33365 <title>The dnslookup router</title>
33366 <para>
33367 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
33368 <primary><command>dnslookup</command> router</primary>
33369 </indexterm>
33370 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
33371 <primary>routers</primary>
33372 <secondary><command>dnslookup</command></secondary>
33373 </indexterm>
33374 The <command>dnslookup</command> router looks up the hosts that handle mail for the
33375 recipient&#x2019;s domain in the DNS. A transport must always be set for this router,
33376 unless <option>verify_only</option> is set.
33377 </para>
33378 <para>
33379 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
33380 SRV records. If none are found, or if SRV support is not configured,
33381 MX records are looked up. If no MX records exist, address records are sought.
33382 However, <option>mx_domains</option> can be set to disable the direct use of address
33383 records.
33384 </para>
33385 <para>
33386 MX records of equal priority are sorted by Exim into a random order. Exim then
33387 looks for address records for the host names obtained from MX or SRV records.
33388 When a host has more than one IP address, they are sorted into a random order,
33389 except that IPv6 addresses are always sorted before IPv4 addresses. If all the
33390 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
33391 generic option, the router declines.
33392 </para>
33393 <para>
33394 Unless they have the highest priority (lowest MX value), MX records that point
33395 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
33396 are discarded, together with any other MX records of equal or lower priority.
33397 </para>
33398 <para>
33399 <indexterm role="concept">
33400 <primary>MX record</primary>
33401 <secondary>pointing to local host</secondary>
33402 </indexterm>
33403 <indexterm role="concept">
33404 <primary>local host</primary>
33405 <secondary>MX pointing to</secondary>
33406 </indexterm>
33407 <indexterm role="option">
33408 <primary><option>self</option></primary>
33409 <secondary>in <command>dnslookup</command> router</secondary>
33410 </indexterm>
33411 If the host pointed to by the highest priority MX record, or looked up as an
33412 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
33413 happens is controlled by the generic <option>self</option> option.
33414 </para>
33415 <section id="SECTprowitdnsloo">
33416 <title>Problems with DNS lookups</title>
33417 <para>
33418 There have been problems with DNS servers when SRV records are looked up.
33419 Some mis-behaving servers return a DNS error or timeout when a non-existent
33420 SRV record is sought. Similar problems have in the past been reported for
33421 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
33422 problem, but it is heavy-handed because it is a global option.
33423 </para>
33424 <para>
33425 For this reason, there are two options, <option>srv_fail_domains</option> and
33426 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
33427 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
33428 an attempt to look up an SRV or MX record causes one of these results, and the
33429 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
33430 such record</quote>. In the case of an SRV lookup, this means that the router
33431 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
33432 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
33433 case routing fails.
33434 </para>
33435 </section>
33436 <section id="SECTdnslookupdecline">
33437 <title>Declining addresses by dnslookup</title>
33438 <para>
33439 <indexterm role="concept">
33440 <primary><command>dnslookup</command> router</primary>
33441 <secondary>declines</secondary>
33442 </indexterm>
33443 There are a few cases where a <command>dnslookup</command> router will decline to accept
33444 an address; if such a router is expected to handle "all remaining non-local
33445 domains", then it is important to set <option>no_more</option>.
33446 </para>
33447 <para>
33448 Reasons for a <command>dnslookup</command> router to decline currently include:
33449 </para>
33450 <itemizedlist>
33451 <listitem>
33452 <para>
33453 The domain does not exist in DNS
33454 </para>
33455 </listitem>
33456 <listitem>
33457 <para>
33458 The domain exists but the MX record&#x2019;s host part is just "."; this is a common
33459 convention (borrowed from SRV) used to indicate that there is no such service
33460 for this domain and to not fall back to trying A/AAAA records.
33461 </para>
33462 </listitem>
33463 <listitem>
33464 <para>
33465 Ditto, but for SRV records, when <option>check_srv</option> is set on this router.
33466 </para>
33467 </listitem>
33468 <listitem>
33469 <para>
33470 MX record points to a non-existent host.
33471 </para>
33472 </listitem>
33473 <listitem>
33474 <para>
33475 MX record points to an IP address and the main section option
33476 <option>allow_mx_to_ip</option> is not set.
33477 </para>
33478 </listitem>
33479 <listitem>
33480 <para>
33481 MX records exist and point to valid hosts, but all hosts resolve only to
33482 addresses blocked by the <option>ignore_target_hosts</option> generic option on this router.
33483 </para>
33484 </listitem>
33485 <listitem>
33486 <para>
33487 The domain is not syntactically valid (see also <option>allow_utf8_domains</option> and
33488 <option>dns_check_names_pattern</option> for handling one variant of this)
33489 </para>
33490 </listitem>
33491 <listitem>
33492 <para>
33493 <option>check_secondary_mx</option> is set on this router but the local host can
33494 not be found in the MX records (see below)
33495 </para>
33496 </listitem>
33497 </itemizedlist>
33498 </section>
33499 <section id="SECID118">
33500 <title>Private options for dnslookup</title>
33501 <para>
33502 <indexterm role="concept">
33503 <primary>options</primary>
33504 <secondary><command>dnslookup</command> router</secondary>
33505 </indexterm>
33506 The private options for the <command>dnslookup</command> router are as follows:
33507 </para>
33508 <para>
33509 <indexterm role="option">
33510 <primary><option>check_secondary_mx</option></primary>
33511 </indexterm>
33512 </para>
33513 <informaltable frame="all">
33514 <tgroup cols="4" colsep="0" rowsep="0">
33515 <colspec colwidth="8*" align="left"/>
33516 <colspec colwidth="6*" align="center"/>
33517 <colspec colwidth="6*" align="center"/>
33518 <colspec colwidth="6*" align="right"/>
33519 <tbody>
33520 <row>
33521 <entry><option>check_secondary_mx</option></entry>
33522 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33523 <entry>Type: <emphasis>boolean</emphasis></entry>
33524 <entry>Default: <emphasis>false</emphasis></entry>
33525 </row>
33526 </tbody>
33527 </tgroup>
33528 </informaltable>
33529 <para>
33530 <indexterm role="concept">
33531 <primary>MX record</primary>
33532 <secondary>checking for secondary</secondary>
33533 </indexterm>
33534 If this option is set, the router declines unless the local host is found in
33535 (and removed from) the list of hosts obtained by MX lookup. This can be used to
33536 process domains for which the local host is a secondary mail exchanger
33537 differently to other domains. The way in which Exim decides whether a host is
33538 the local host is described in section <xref linkend="SECTreclocipadd"/>.
33539 </para>
33540 <para>
33541 <indexterm role="option">
33542 <primary><option>check_srv</option></primary>
33543 </indexterm>
33544 </para>
33545 <informaltable frame="all">
33546 <tgroup cols="4" colsep="0" rowsep="0">
33547 <colspec colwidth="8*" align="left"/>
33548 <colspec colwidth="6*" align="center"/>
33549 <colspec colwidth="6*" align="center"/>
33550 <colspec colwidth="6*" align="right"/>
33551 <tbody>
33552 <row>
33553 <entry><option>check_srv</option></entry>
33554 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33555 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33556 <entry>Default: <emphasis>unset</emphasis></entry>
33557 </row>
33558 </tbody>
33559 </tgroup>
33560 </informaltable>
33561 <para>
33562 <indexterm role="concept">
33563 <primary>SRV record</primary>
33564 <secondary>enabling use of</secondary>
33565 </indexterm>
33566 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
33567 addition to MX and address records. The support is disabled by default. To
33568 enable SRV support, set the <option>check_srv</option> option to the name of the service
33569 required. For example,
33570 </para>
33571 <literallayout class="monospaced">
33572 check_srv = smtp
33573 </literallayout>
33574 <para>
33575 looks for SRV records that refer to the normal smtp service. The option is
33576 expanded, so the service name can vary from message to message or address
33577 to address. This might be helpful if SRV records are being used for a
33578 submission service. If the expansion is forced to fail, the <option>check_srv</option>
33579 option is ignored, and the router proceeds to look for MX records in the
33580 normal way.
33581 </para>
33582 <para>
33583 When the expansion succeeds, the router searches first for SRV records for
33584 the given service (it assumes TCP protocol). A single SRV record with a
33585 host name that consists of just a single dot indicates <quote>no such service for
33586 this domain</quote>; if this is encountered, the router declines. If other kinds of
33587 SRV record are found, they are used to construct a host list for delivery
33588 according to the rules of RFC 2782. MX records are not sought in this case.
33589 </para>
33590 <para>
33591 When no SRV records are found, MX records (and address records) are sought in
33592 the traditional way. In other words, SRV records take precedence over MX
33593 records, just as MX records take precedence over address records. Note that
33594 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
33595 defined it. It is apparently believed that MX records are sufficient for email
33596 and that SRV records should not be used for this purpose. However, SRV records
33597 have an additional <quote>weight</quote> feature which some people might find useful when
33598 trying to split an SMTP load between hosts of different power.
33599 </para>
33600 <para>
33601 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim&#x2019;s behaviour
33602 when there is a DNS lookup error.
33603 </para>
33604 <para>
33605 <indexterm role="option">
33606 <primary><option>dnssec_request_domains</option></primary>
33607 </indexterm>
33608 </para>
33609 <informaltable frame="all">
33610 <tgroup cols="4" colsep="0" rowsep="0">
33611 <colspec colwidth="8*" align="left"/>
33612 <colspec colwidth="6*" align="center"/>
33613 <colspec colwidth="6*" align="center"/>
33614 <colspec colwidth="6*" align="right"/>
33615 <tbody>
33616 <row>
33617 <entry><option>dnssec_request_domains</option></entry>
33618 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33619 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33620 <entry>Default: <emphasis>unset</emphasis></entry>
33621 </row>
33622 </tbody>
33623 </tgroup>
33624 </informaltable>
33625 <para>
33626 <indexterm role="concept">
33627 <primary>MX record</primary>
33628 <secondary>security</secondary>
33629 </indexterm>
33630 <indexterm role="concept">
33631 <primary>DNSSEC</primary>
33632 <secondary>MX lookup</secondary>
33633 </indexterm>
33634 <indexterm role="concept">
33635 <primary>security</primary>
33636 <secondary>MX lookup</secondary>
33637 </indexterm>
33638 <indexterm role="concept">
33639 <primary>DNS</primary>
33640 <secondary>DNSSEC</secondary>
33641 </indexterm>
33642 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
33643 the dnssec request bit set.
33644 This applies to all of the SRV, MX A6, AAAA, A lookup sequence.
33645 </para>
33646 <para>
33647 <indexterm role="option">
33648 <primary><option>dnssec_require_domains</option></primary>
33649 </indexterm>
33650 </para>
33651 <informaltable frame="all">
33652 <tgroup cols="4" colsep="0" rowsep="0">
33653 <colspec colwidth="8*" align="left"/>
33654 <colspec colwidth="6*" align="center"/>
33655 <colspec colwidth="6*" align="center"/>
33656 <colspec colwidth="6*" align="right"/>
33657 <tbody>
33658 <row>
33659 <entry><option>dnssec_require_domains</option></entry>
33660 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33661 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33662 <entry>Default: <emphasis>unset</emphasis></entry>
33663 </row>
33664 </tbody>
33665 </tgroup>
33666 </informaltable>
33667 <para>
33668 <indexterm role="concept">
33669 <primary>MX record</primary>
33670 <secondary>security</secondary>
33671 </indexterm>
33672 <indexterm role="concept">
33673 <primary>DNSSEC</primary>
33674 <secondary>MX lookup</secondary>
33675 </indexterm>
33676 <indexterm role="concept">
33677 <primary>security</primary>
33678 <secondary>MX lookup</secondary>
33679 </indexterm>
33680 <indexterm role="concept">
33681 <primary>DNS</primary>
33682 <secondary>DNSSEC</secondary>
33683 </indexterm>
33684 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
33685 the dnssec request bit set.  Any returns not having the Authenticated Data bit
33686 (AD bit) set wil be ignored and logged as a host-lookup failure.
33687 This applies to all of the SRV, MX A6, AAAA, A lookup sequence.
33688 </para>
33689 <para>
33690 <indexterm role="option">
33691 <primary><option>mx_domains</option></primary>
33692 </indexterm>
33693 </para>
33694 <informaltable frame="all">
33695 <tgroup cols="4" colsep="0" rowsep="0">
33696 <colspec colwidth="8*" align="left"/>
33697 <colspec colwidth="6*" align="center"/>
33698 <colspec colwidth="6*" align="center"/>
33699 <colspec colwidth="6*" align="right"/>
33700 <tbody>
33701 <row>
33702 <entry><option>mx_domains</option></entry>
33703 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33704 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33705 <entry>Default: <emphasis>unset</emphasis></entry>
33706 </row>
33707 </tbody>
33708 </tgroup>
33709 </informaltable>
33710 <para>
33711 <indexterm role="concept">
33712 <primary>MX record</primary>
33713 <secondary>required to exist</secondary>
33714 </indexterm>
33715 <indexterm role="concept">
33716 <primary>SRV record</primary>
33717 <secondary>required to exist</secondary>
33718 </indexterm>
33719 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
33720 record in order to be recognized. (The name of this option could be improved.)
33721 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
33722 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
33723 setting:
33724 </para>
33725 <literallayout class="monospaced">
33726 mx_domains = ! *.discworld.fict.example : *.fict.example
33727 </literallayout>
33728 <para>
33729 This specifies that messages addressed to a domain that matches the list but
33730 has no MX record should be bounced immediately instead of being routed using
33731 the address record.
33732 </para>
33733 <para>
33734 <indexterm role="option">
33735 <primary><option>mx_fail_domains</option></primary>
33736 </indexterm>
33737 </para>
33738 <informaltable frame="all">
33739 <tgroup cols="4" colsep="0" rowsep="0">
33740 <colspec colwidth="8*" align="left"/>
33741 <colspec colwidth="6*" align="center"/>
33742 <colspec colwidth="6*" align="center"/>
33743 <colspec colwidth="6*" align="right"/>
33744 <tbody>
33745 <row>
33746 <entry><option>mx_fail_domains</option></entry>
33747 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33748 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33749 <entry>Default: <emphasis>unset</emphasis></entry>
33750 </row>
33751 </tbody>
33752 </tgroup>
33753 </informaltable>
33754 <para>
33755 If the DNS lookup for MX records for one of the domains in this list causes a
33756 DNS lookup error, Exim behaves as if no MX records were found. See section
33757 <xref linkend="SECTprowitdnsloo"/> for more discussion.
33758 </para>
33759 <para>
33760 <indexterm role="option">
33761 <primary><option>qualify_single</option></primary>
33762 </indexterm>
33763 </para>
33764 <informaltable frame="all">
33765 <tgroup cols="4" colsep="0" rowsep="0">
33766 <colspec colwidth="8*" align="left"/>
33767 <colspec colwidth="6*" align="center"/>
33768 <colspec colwidth="6*" align="center"/>
33769 <colspec colwidth="6*" align="right"/>
33770 <tbody>
33771 <row>
33772 <entry><option>qualify_single</option></entry>
33773 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33774 <entry>Type: <emphasis>boolean</emphasis></entry>
33775 <entry>Default: <emphasis>true</emphasis></entry>
33776 </row>
33777 </tbody>
33778 </tgroup>
33779 </informaltable>
33780 <para>
33781 <indexterm role="concept">
33782 <primary>DNS</primary>
33783 <secondary>resolver options</secondary>
33784 </indexterm>
33785 <indexterm role="concept">
33786 <primary>DNS</primary>
33787 <secondary>qualifying single-component names</secondary>
33788 </indexterm>
33789 When this option is true, the resolver option RES_DEFNAMES is set for DNS
33790 lookups. Typically, but not standardly, this causes the resolver to qualify
33791 single-component names with the default domain. For example, on a machine
33792 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
33793 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
33794 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
33795 <emphasis>resolv.conf</emphasis>.
33796 </para>
33797 <para>
33798 <indexterm role="option">
33799 <primary><option>rewrite_headers</option></primary>
33800 </indexterm>
33801 </para>
33802 <informaltable frame="all">
33803 <tgroup cols="4" colsep="0" rowsep="0">
33804 <colspec colwidth="8*" align="left"/>
33805 <colspec colwidth="6*" align="center"/>
33806 <colspec colwidth="6*" align="center"/>
33807 <colspec colwidth="6*" align="right"/>
33808 <tbody>
33809 <row>
33810 <entry><option>rewrite_headers</option></entry>
33811 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33812 <entry>Type: <emphasis>boolean</emphasis></entry>
33813 <entry>Default: <emphasis>true</emphasis></entry>
33814 </row>
33815 </tbody>
33816 </tgroup>
33817 </informaltable>
33818 <para>
33819 <indexterm role="concept">
33820 <primary>rewriting</primary>
33821 <secondary>header lines</secondary>
33822 </indexterm>
33823 <indexterm role="concept">
33824 <primary>header lines</primary>
33825 <secondary>rewriting</secondary>
33826 </indexterm>
33827 If the domain name in the address that is being processed is not fully
33828 qualified, it may be expanded to its full form by a DNS lookup. For example, if
33829 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
33830 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
33831 occur as a result of setting the <option>widen_domains</option> option. If
33832 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
33833 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
33834 header lines of the message are rewritten with the full domain name.
33835 </para>
33836 <para>
33837 This option should be turned off only when it is known that no message is
33838 ever going to be sent outside an environment where the abbreviation makes
33839 sense.
33840 </para>
33841 <para>
33842 When an MX record is looked up in the DNS and matches a wildcard record, name
33843 servers normally return a record containing the name that has been looked up,
33844 making it impossible to detect whether a wildcard was present or not. However,
33845 some name servers have recently been seen to return the wildcard entry. If the
33846 name returned by a DNS lookup begins with an asterisk, it is not used for
33847 header rewriting.
33848 </para>
33849 <para>
33850 <indexterm role="option">
33851 <primary><option>same_domain_copy_routing</option></primary>
33852 </indexterm>
33853 </para>
33854 <informaltable frame="all">
33855 <tgroup cols="4" colsep="0" rowsep="0">
33856 <colspec colwidth="8*" align="left"/>
33857 <colspec colwidth="6*" align="center"/>
33858 <colspec colwidth="6*" align="center"/>
33859 <colspec colwidth="6*" align="right"/>
33860 <tbody>
33861 <row>
33862 <entry><option>same_domain_copy_routing</option></entry>
33863 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33864 <entry>Type: <emphasis>boolean</emphasis></entry>
33865 <entry>Default: <emphasis>false</emphasis></entry>
33866 </row>
33867 </tbody>
33868 </tgroup>
33869 </informaltable>
33870 <para>
33871 <indexterm role="concept">
33872 <primary>address</primary>
33873 <secondary>copying routing</secondary>
33874 </indexterm>
33875 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
33876 to the same list of hosts. However, this cannot be presumed, because the router
33877 options and preconditions may refer to the local part of the address. By
33878 default, therefore, Exim routes each address in a message independently. DNS
33879 servers run caches, so repeated DNS lookups are not normally expensive, and in
33880 any case, personal messages rarely have more than a few recipients.
33881 </para>
33882 <para>
33883 If you are running mailing lists with large numbers of subscribers at the same
33884 domain, and you are using a <command>dnslookup</command> router which is independent of the
33885 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
33886 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
33887 routes an address to a remote transport, any other unrouted addresses in the
33888 message that have the same domain are automatically given the same routing
33889 without processing them independently,
33890 provided the following conditions are met:
33891 </para>
33892 <itemizedlist>
33893 <listitem>
33894 <para>
33895 No router that processed the address specified <option>headers_add</option> or
33896 <option>headers_remove</option>.
33897 </para>
33898 </listitem>
33899 <listitem>
33900 <para>
33901 The router did not change the address in any way, for example, by <quote>widening</quote>
33902 the domain.
33903 </para>
33904 </listitem>
33905 </itemizedlist>
33906 <para>
33907 <indexterm role="option">
33908 <primary><option>search_parents</option></primary>
33909 </indexterm>
33910 </para>
33911 <informaltable frame="all">
33912 <tgroup cols="4" colsep="0" rowsep="0">
33913 <colspec colwidth="8*" align="left"/>
33914 <colspec colwidth="6*" align="center"/>
33915 <colspec colwidth="6*" align="center"/>
33916 <colspec colwidth="6*" align="right"/>
33917 <tbody>
33918 <row>
33919 <entry><option>search_parents</option></entry>
33920 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33921 <entry>Type: <emphasis>boolean</emphasis></entry>
33922 <entry>Default: <emphasis>false</emphasis></entry>
33923 </row>
33924 </tbody>
33925 </tgroup>
33926 </informaltable>
33927 <para>
33928 <indexterm role="concept">
33929 <primary>DNS</primary>
33930 <secondary>resolver options</secondary>
33931 </indexterm>
33932 When this option is true, the resolver option RES_DNSRCH is set for DNS
33933 lookups. This is different from the <option>qualify_single</option> option in that it
33934 applies to domains containing dots. Typically, but not standardly, it causes
33935 the resolver to search for the name in the current domain and in parent
33936 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
33937 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
33938 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
33939 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
33940 </para>
33941 <para>
33942 Setting this option true can cause problems in domains that have a wildcard MX
33943 record, because any domain that does not have its own MX record matches the
33944 local wildcard.
33945 </para>
33946 <para>
33947 <indexterm role="option">
33948 <primary><option>srv_fail_domains</option></primary>
33949 </indexterm>
33950 </para>
33951 <informaltable frame="all">
33952 <tgroup cols="4" colsep="0" rowsep="0">
33953 <colspec colwidth="8*" align="left"/>
33954 <colspec colwidth="6*" align="center"/>
33955 <colspec colwidth="6*" align="center"/>
33956 <colspec colwidth="6*" align="right"/>
33957 <tbody>
33958 <row>
33959 <entry><option>srv_fail_domains</option></entry>
33960 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33961 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33962 <entry>Default: <emphasis>unset</emphasis></entry>
33963 </row>
33964 </tbody>
33965 </tgroup>
33966 </informaltable>
33967 <para>
33968 If the DNS lookup for SRV records for one of the domains in this list causes a
33969 DNS lookup error, Exim behaves as if no SRV records were found. See section
33970 <xref linkend="SECTprowitdnsloo"/> for more discussion.
33971 </para>
33972 <para>
33973 <indexterm role="option">
33974 <primary><option>widen_domains</option></primary>
33975 </indexterm>
33976 </para>
33977 <informaltable frame="all">
33978 <tgroup cols="4" colsep="0" rowsep="0">
33979 <colspec colwidth="8*" align="left"/>
33980 <colspec colwidth="6*" align="center"/>
33981 <colspec colwidth="6*" align="center"/>
33982 <colspec colwidth="6*" align="right"/>
33983 <tbody>
33984 <row>
33985 <entry><option>widen_domains</option></entry>
33986 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33987 <entry>Type: <emphasis>string list</emphasis></entry>
33988 <entry>Default: <emphasis>unset</emphasis></entry>
33989 </row>
33990 </tbody>
33991 </tgroup>
33992 </informaltable>
33993 <para>
33994 <indexterm role="concept">
33995 <primary>domain</primary>
33996 <secondary>partial; widening</secondary>
33997 </indexterm>
33998 If a DNS lookup fails and this option is set, each of its strings in turn is
33999 added onto the end of the domain, and the lookup is tried again. For example,
34000 if
34001 </para>
34002 <literallayout class="monospaced">
34003 widen_domains = fict.example:ref.example
34004 </literallayout>
34005 <para>
34006 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
34007 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
34008 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
34009 and <option>search_parents</option> options can cause some widening to be undertaken inside
34010 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
34011 when verifying, unless <option>rewrite_headers</option> is false (not the default).
34012 </para>
34013 </section>
34014 <section id="SECID119">
34015 <title>Effect of qualify_single and search_parents</title>
34016 <para>
34017 When a domain from an envelope recipient is changed by the resolver as a result
34018 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
34019 corresponding address in the message&#x2019;s header lines unless <option>rewrite_headers</option>
34020 is set false. Exim then re-routes the address, using the full domain.
34021 </para>
34022 <para>
34023 These two options affect only the DNS lookup that takes place inside the router
34024 for the domain of the address that is being routed. They do not affect lookups
34025 such as that implied by
34026 </para>
34027 <literallayout class="monospaced">
34028 domains = @mx_any
34029 </literallayout>
34030 <para>
34031 that may happen while processing a router precondition before the router is
34032 entered. No widening ever takes place for these lookups.
34033 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
34034 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
34035 </para>
34036 </section>
34037 </chapter>
34038
34039 <chapter id="CHID5">
34040 <title>The ipliteral router</title>
34041 <para>
34042 <indexterm role="concept">
34043 <primary><command>ipliteral</command> router</primary>
34044 </indexterm>
34045 <indexterm role="concept">
34046 <primary>domain literal</primary>
34047 <secondary>routing</secondary>
34048 </indexterm>
34049 <indexterm role="concept">
34050 <primary>routers</primary>
34051 <secondary><command>ipliteral</command></secondary>
34052 </indexterm>
34053 This router has no private options. Unless it is being used purely for
34054 verification (see <option>verify_only</option>) a transport is required to be defined by the
34055 generic <option>transport</option> option. The router accepts the address if its domain part
34056 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
34057 router handles the address
34058 </para>
34059 <literallayout class="monospaced">
34060 root@[192.168.1.1]
34061 </literallayout>
34062 <para>
34063 by setting up delivery to the host with that IP address. IPv4 domain literals
34064 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
34065 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
34066 </para>
34067 <literallayout class="monospaced">
34068 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
34069 </literallayout>
34070 <para>
34071 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
34072 grounds that sooner or later somebody will try it.
34073 </para>
34074 <para>
34075 <indexterm role="option">
34076 <primary><option>self</option></primary>
34077 <secondary>in <command>ipliteral</command> router</secondary>
34078 </indexterm>
34079 If the IP address matches something in <option>ignore_target_hosts</option>, the router
34080 declines. If an IP literal turns out to refer to the local host, the generic
34081 <option>self</option> option determines what happens.
34082 </para>
34083 <para>
34084 The RFCs require support for domain literals; however, their use is
34085 controversial in today&#x2019;s Internet. If you want to use this router, you must
34086 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
34087 Exim will not recognize the domain literal syntax in addresses.
34088 </para>
34089 </chapter>
34090
34091 <chapter id="CHID6">
34092 <title>The iplookup router</title>
34093 <para>
34094 <indexterm role="concept">
34095 <primary><command>iplookup</command> router</primary>
34096 </indexterm>
34097 <indexterm role="concept">
34098 <primary>routers</primary>
34099 <secondary><command>iplookup</command></secondary>
34100 </indexterm>
34101 The <command>iplookup</command> router was written to fulfil a specific requirement in
34102 Cambridge University (which in fact no longer exists). For this reason, it is
34103 not included in the binary of Exim by default. If you want to include it, you
34104 must set
34105 </para>
34106 <literallayout class="monospaced">
34107 ROUTER_IPLOOKUP=yes
34108 </literallayout>
34109 <para>
34110 in your <filename>Local/Makefile</filename> configuration file.
34111 </para>
34112 <para>
34113 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
34114 connection to one or more specific hosts. The host can then return the same or
34115 a different address &ndash; in effect rewriting the recipient address in the
34116 message&#x2019;s envelope. The new address is then passed on to subsequent routers. If
34117 this process fails, the address can be passed on to other routers, or delivery
34118 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
34119 must not be specified for it.
34120 </para>
34121 <para>
34122 <indexterm role="concept">
34123 <primary>options</primary>
34124 <secondary><command>iplookup</command> router</secondary>
34125 </indexterm>
34126 <indexterm role="option">
34127 <primary><option>hosts</option></primary>
34128 </indexterm>
34129 </para>
34130 <informaltable frame="all">
34131 <tgroup cols="4" colsep="0" rowsep="0">
34132 <colspec colwidth="8*" align="left"/>
34133 <colspec colwidth="6*" align="center"/>
34134 <colspec colwidth="6*" align="center"/>
34135 <colspec colwidth="6*" align="right"/>
34136 <tbody>
34137 <row>
34138 <entry><option>hosts</option></entry>
34139 <entry>Use: <emphasis>iplookup</emphasis></entry>
34140 <entry>Type: <emphasis>string</emphasis></entry>
34141 <entry>Default: <emphasis>unset</emphasis></entry>
34142 </row>
34143 </tbody>
34144 </tgroup>
34145 </informaltable>
34146 <para>
34147 This option must be supplied. Its value is a colon-separated list of host
34148 names. The hosts are looked up using <function>gethostbyname()</function>
34149 (or <function>getipnodebyname()</function> when available)
34150 and are tried in order until one responds to the query. If none respond, what
34151 happens is controlled by <option>optional</option>.
34152 </para>
34153 <para>
34154 <indexterm role="option">
34155 <primary><option>optional</option></primary>
34156 </indexterm>
34157 </para>
34158 <informaltable frame="all">
34159 <tgroup cols="4" colsep="0" rowsep="0">
34160 <colspec colwidth="8*" align="left"/>
34161 <colspec colwidth="6*" align="center"/>
34162 <colspec colwidth="6*" align="center"/>
34163 <colspec colwidth="6*" align="right"/>
34164 <tbody>
34165 <row>
34166 <entry><option>optional</option></entry>
34167 <entry>Use: <emphasis>iplookup</emphasis></entry>
34168 <entry>Type: <emphasis>boolean</emphasis></entry>
34169 <entry>Default: <emphasis>false</emphasis></entry>
34170 </row>
34171 </tbody>
34172 </tgroup>
34173 </informaltable>
34174 <para>
34175 If <option>optional</option> is true, if no response is obtained from any host, the address
34176 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
34177 delivery to the address is deferred.
34178 </para>
34179 <para>
34180 <indexterm role="option">
34181 <primary><option>port</option></primary>
34182 </indexterm>
34183 </para>
34184 <informaltable frame="all">
34185 <tgroup cols="4" colsep="0" rowsep="0">
34186 <colspec colwidth="8*" align="left"/>
34187 <colspec colwidth="6*" align="center"/>
34188 <colspec colwidth="6*" align="center"/>
34189 <colspec colwidth="6*" align="right"/>
34190 <tbody>
34191 <row>
34192 <entry><option>port</option></entry>
34193 <entry>Use: <emphasis>iplookup</emphasis></entry>
34194 <entry>Type: <emphasis>integer</emphasis></entry>
34195 <entry>Default: <emphasis>0</emphasis></entry>
34196 </row>
34197 </tbody>
34198 </tgroup>
34199 </informaltable>
34200 <para>
34201 <indexterm role="concept">
34202 <primary>port</primary>
34203 <secondary><command>iplookup</command> router</secondary>
34204 </indexterm>
34205 This option must be supplied. It specifies the port number for the TCP or UDP
34206 call.
34207 </para>
34208 <para>
34209 <indexterm role="option">
34210 <primary><option>protocol</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>protocol</option></entry>
34222 <entry>Use: <emphasis>iplookup</emphasis></entry>
34223 <entry>Type: <emphasis>string</emphasis></entry>
34224 <entry>Default: <emphasis>udp</emphasis></entry>
34225 </row>
34226 </tbody>
34227 </tgroup>
34228 </informaltable>
34229 <para>
34230 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
34231 protocols is to be used.
34232 </para>
34233 <para>
34234 <indexterm role="option">
34235 <primary><option>query</option></primary>
34236 </indexterm>
34237 </para>
34238 <informaltable frame="all">
34239 <tgroup cols="4" colsep="0" rowsep="0">
34240 <colspec colwidth="8*" align="left"/>
34241 <colspec colwidth="6*" align="center"/>
34242 <colspec colwidth="6*" align="center"/>
34243 <colspec colwidth="6*" align="right"/>
34244 <tbody>
34245 <row>
34246 <entry><option>query</option></entry>
34247 <entry>Use: <emphasis>iplookup</emphasis></entry>
34248 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34249 <entry>Default: <emphasis>see below</emphasis></entry>
34250 </row>
34251 </tbody>
34252 </tgroup>
34253 </informaltable>
34254 <para>
34255 This defines the content of the query that is sent to the remote hosts. The
34256 default value is:
34257 </para>
34258 <literallayout class="monospaced">
34259 $local_part@$domain $local_part@$domain
34260 </literallayout>
34261 <para>
34262 The repetition serves as a way of checking that a response is to the correct
34263 query in the default case (see <option>response_pattern</option> below).
34264 </para>
34265 <para>
34266 <indexterm role="option">
34267 <primary><option>reroute</option></primary>
34268 </indexterm>
34269 </para>
34270 <informaltable frame="all">
34271 <tgroup cols="4" colsep="0" rowsep="0">
34272 <colspec colwidth="8*" align="left"/>
34273 <colspec colwidth="6*" align="center"/>
34274 <colspec colwidth="6*" align="center"/>
34275 <colspec colwidth="6*" align="right"/>
34276 <tbody>
34277 <row>
34278 <entry><option>reroute</option></entry>
34279 <entry>Use: <emphasis>iplookup</emphasis></entry>
34280 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34281 <entry>Default: <emphasis>unset</emphasis></entry>
34282 </row>
34283 </tbody>
34284 </tgroup>
34285 </informaltable>
34286 <para>
34287 If this option is not set, the rerouted address is precisely the byte string
34288 returned by the remote host, up to the first white space, if any. If set, the
34289 string is expanded to form the rerouted address. It can include parts matched
34290 in the response by <option>response_pattern</option> by means of numeric variables such as
34291 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
34292 whether or not a pattern is in use. In all cases, the rerouted address must end
34293 up in the form <emphasis>local_part@domain</emphasis>.
34294 </para>
34295 <para>
34296 <indexterm role="option">
34297 <primary><option>response_pattern</option></primary>
34298 </indexterm>
34299 </para>
34300 <informaltable frame="all">
34301 <tgroup cols="4" colsep="0" rowsep="0">
34302 <colspec colwidth="8*" align="left"/>
34303 <colspec colwidth="6*" align="center"/>
34304 <colspec colwidth="6*" align="center"/>
34305 <colspec colwidth="6*" align="right"/>
34306 <tbody>
34307 <row>
34308 <entry><option>response_pattern</option></entry>
34309 <entry>Use: <emphasis>iplookup</emphasis></entry>
34310 <entry>Type: <emphasis>string</emphasis></entry>
34311 <entry>Default: <emphasis>unset</emphasis></entry>
34312 </row>
34313 </tbody>
34314 </tgroup>
34315 </informaltable>
34316 <para>
34317 This option can be set to a regular expression that is applied to the string
34318 returned from the remote host. If the pattern does not match the response, the
34319 router declines. If <option>response_pattern</option> is not set, no checking of the
34320 response is done, unless the query was defaulted, in which case there is a
34321 check that the text returned after the first white space is the original
34322 address. This checks that the answer that has been received is in response to
34323 the correct question. For example, if the response is just a new domain, the
34324 following could be used:
34325 </para>
34326 <literallayout class="monospaced">
34327 response_pattern = ^([^@]+)$
34328 reroute = $local_part@$1
34329 </literallayout>
34330 <para>
34331 <indexterm role="option">
34332 <primary><option>timeout</option></primary>
34333 </indexterm>
34334 </para>
34335 <informaltable frame="all">
34336 <tgroup cols="4" colsep="0" rowsep="0">
34337 <colspec colwidth="8*" align="left"/>
34338 <colspec colwidth="6*" align="center"/>
34339 <colspec colwidth="6*" align="center"/>
34340 <colspec colwidth="6*" align="right"/>
34341 <tbody>
34342 <row>
34343 <entry><option>timeout</option></entry>
34344 <entry>Use: <emphasis>iplookup</emphasis></entry>
34345 <entry>Type: <emphasis>time</emphasis></entry>
34346 <entry>Default: <emphasis>5s</emphasis></entry>
34347 </row>
34348 </tbody>
34349 </tgroup>
34350 </informaltable>
34351 <para>
34352 This specifies the amount of time to wait for a response from the remote
34353 machine. The same timeout is used for the <function>connect()</function> function for a TCP
34354 call. It does not apply to UDP.
34355 </para>
34356 </chapter>
34357
34358 <chapter id="CHID7">
34359 <title>The manualroute router</title>
34360 <para>
34361 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
34362 <primary><command>manualroute</command> router</primary>
34363 </indexterm>
34364 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
34365 <primary>routers</primary>
34366 <secondary><command>manualroute</command></secondary>
34367 </indexterm>
34368 <indexterm role="concept">
34369 <primary>domain</primary>
34370 <secondary>manually routing</secondary>
34371 </indexterm>
34372 The <command>manualroute</command> router is so-called because it provides a way of manually
34373 routing an address according to its domain. It is mainly used when you want to
34374 route addresses to remote hosts according to your own rules, bypassing the
34375 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
34376 route to local transports, a facility that may be useful if you want to save
34377 messages for dial-in hosts in local files.
34378 </para>
34379 <para>
34380 The <command>manualroute</command> router compares a list of domain patterns with the domain
34381 it is trying to route. If there is no match, the router declines. Each pattern
34382 has associated with it a list of hosts and some other optional data, which may
34383 include a transport. The combination of a pattern and its data is called a
34384 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
34385 generic <option>transport</option> option must specify a transport, unless the router is
34386 being used purely for verification (see <option>verify_only</option>).
34387 </para>
34388 <para>
34389 <indexterm role="variable">
34390 <primary><varname>$host</varname></primary>
34391 </indexterm>
34392 In the case of verification, matching the domain pattern is sufficient for the
34393 router to accept the address. When actually routing an address for delivery,
34394 an address that matches a domain pattern is queued for the associated
34395 transport. If the transport is not a local one, a host list must be associated
34396 with the pattern; IP addresses are looked up for the hosts, and these are
34397 passed to the transport along with the mail address. For local transports, a
34398 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
34399 text string.
34400 </para>
34401 <para>
34402 The list of routing rules can be provided as an inline string in
34403 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
34404 or database by setting <option>route_data</option>. Only one of these settings may appear in
34405 any one instance of <command>manualroute</command>. The format of routing rules is described
34406 below, following the list of private options.
34407 </para>
34408 <section id="SECTprioptman">
34409 <title>Private options for manualroute</title>
34410 <para>
34411 <indexterm role="concept">
34412 <primary>options</primary>
34413 <secondary><command>manualroute</command> router</secondary>
34414 </indexterm>
34415 The private options for the <command>manualroute</command> router are as follows:
34416 </para>
34417 <para>
34418 <indexterm role="option">
34419 <primary><option>host_all_ignored</option></primary>
34420 </indexterm>
34421 </para>
34422 <informaltable frame="all">
34423 <tgroup cols="4" colsep="0" rowsep="0">
34424 <colspec colwidth="8*" align="left"/>
34425 <colspec colwidth="6*" align="center"/>
34426 <colspec colwidth="6*" align="center"/>
34427 <colspec colwidth="6*" align="right"/>
34428 <tbody>
34429 <row>
34430 <entry><option>host_all_ignored</option></entry>
34431 <entry>Use: <emphasis>manualroute</emphasis></entry>
34432 <entry>Type: <emphasis>string</emphasis></entry>
34433 <entry>Default: <emphasis>defer</emphasis></entry>
34434 </row>
34435 </tbody>
34436 </tgroup>
34437 </informaltable>
34438 <para>
34439 See <option>host_find_failed</option>.
34440 </para>
34441 <para>
34442 <indexterm role="option">
34443 <primary><option>host_find_failed</option></primary>
34444 </indexterm>
34445 </para>
34446 <informaltable frame="all">
34447 <tgroup cols="4" colsep="0" rowsep="0">
34448 <colspec colwidth="8*" align="left"/>
34449 <colspec colwidth="6*" align="center"/>
34450 <colspec colwidth="6*" align="center"/>
34451 <colspec colwidth="6*" align="right"/>
34452 <tbody>
34453 <row>
34454 <entry><option>host_find_failed</option></entry>
34455 <entry>Use: <emphasis>manualroute</emphasis></entry>
34456 <entry>Type: <emphasis>string</emphasis></entry>
34457 <entry>Default: <emphasis>freeze</emphasis></entry>
34458 </row>
34459 </tbody>
34460 </tgroup>
34461 </informaltable>
34462 <para>
34463 This option controls what happens when <command>manualroute</command> tries to find an IP
34464 address for a host, and the host does not exist. The option can be set to one
34465 of the following values:
34466 </para>
34467 <literallayout class="monospaced">
34468 decline
34469 defer
34470 fail
34471 freeze
34472 ignore
34473 pass
34474 </literallayout>
34475 <para>
34476 The default (<quote>freeze</quote>) assumes that this state is a serious configuration
34477 error. The difference between <quote>pass</quote> and <quote>decline</quote> is that the former
34478 forces the address to be passed to the next router (or the router defined by
34479 <option>pass_router</option>),
34480 <indexterm role="option">
34481 <primary><option>more</option></primary>
34482 </indexterm>
34483 overriding <option>no_more</option>, whereas the latter passes the address to the next
34484 router only if <option>more</option> is true.
34485 </para>
34486 <para>
34487 The value <quote>ignore</quote> causes Exim to completely ignore a host whose IP address
34488 cannot be found. If all the hosts in the list are ignored, the behaviour is
34489 controlled by the <option>host_all_ignored</option> option. This takes the same values
34490 as <option>host_find_failed</option>, except that it cannot be set to <quote>ignore</quote>.
34491 </para>
34492 <para>
34493 The <option>host_find_failed</option> option applies only to a definite <quote>does not exist</quote>
34494 state; if a host lookup gets a temporary error, delivery is deferred unless the
34495 generic <option>pass_on_timeout</option> option is set.
34496 </para>
34497 <para>
34498 <indexterm role="option">
34499 <primary><option>hosts_randomize</option></primary>
34500 </indexterm>
34501 </para>
34502 <informaltable frame="all">
34503 <tgroup cols="4" colsep="0" rowsep="0">
34504 <colspec colwidth="8*" align="left"/>
34505 <colspec colwidth="6*" align="center"/>
34506 <colspec colwidth="6*" align="center"/>
34507 <colspec colwidth="6*" align="right"/>
34508 <tbody>
34509 <row>
34510 <entry><option>hosts_randomize</option></entry>
34511 <entry>Use: <emphasis>manualroute</emphasis></entry>
34512 <entry>Type: <emphasis>boolean</emphasis></entry>
34513 <entry>Default: <emphasis>false</emphasis></entry>
34514 </row>
34515 </tbody>
34516 </tgroup>
34517 </informaltable>
34518 <para>
34519 <indexterm role="concept">
34520 <primary>randomized host list</primary>
34521 </indexterm>
34522 <indexterm role="concept">
34523 <primary>host</primary>
34524 <secondary>list of; randomized</secondary>
34525 </indexterm>
34526 If this option is set, the order of the items in a host list in a routing rule
34527 is randomized each time the list is used, unless an option in the routing rule
34528 overrides (see below). Randomizing the order of a host list can be used to do
34529 crude load sharing. However, if more than one mail address is routed by the
34530 same router to the same host list, the host lists are considered to be the same
34531 (even though they may be randomized into different orders) for the purpose of
34532 deciding whether to batch the deliveries into a single SMTP transaction.
34533 </para>
34534 <para>
34535 When <option>hosts_randomize</option> is true, a host list may be split
34536 into groups whose order is separately randomized. This makes it possible to
34537 set up MX-like behaviour. The boundaries between groups are indicated by an
34538 item that is just <literal>+</literal> in the host list. For example:
34539 </para>
34540 <literallayout class="monospaced">
34541 route_list = * host1:host2:host3:+:host4:host5
34542 </literallayout>
34543 <para>
34544 The order of the first three hosts and the order of the last two hosts is
34545 randomized for each use, but the first three always end up before the last two.
34546 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
34547 randomized host list is passed to an <command>smtp</command> transport that also has
34548 <option>hosts_randomize set</option>, the list is not re-randomized.
34549 </para>
34550 <para>
34551 <indexterm role="option">
34552 <primary><option>route_data</option></primary>
34553 </indexterm>
34554 </para>
34555 <informaltable frame="all">
34556 <tgroup cols="4" colsep="0" rowsep="0">
34557 <colspec colwidth="8*" align="left"/>
34558 <colspec colwidth="6*" align="center"/>
34559 <colspec colwidth="6*" align="center"/>
34560 <colspec colwidth="6*" align="right"/>
34561 <tbody>
34562 <row>
34563 <entry><option>route_data</option></entry>
34564 <entry>Use: <emphasis>manualroute</emphasis></entry>
34565 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34566 <entry>Default: <emphasis>unset</emphasis></entry>
34567 </row>
34568 </tbody>
34569 </tgroup>
34570 </informaltable>
34571 <para>
34572 If this option is set, it must expand to yield the data part of a routing rule.
34573 Typically, the expansion string includes a lookup based on the domain. For
34574 example:
34575 </para>
34576 <literallayout class="monospaced">
34577 route_data = ${lookup{$domain}dbm{/etc/routes}}
34578 </literallayout>
34579 <para>
34580 If the expansion is forced to fail, or the result is an empty string, the
34581 router declines. Other kinds of expansion failure cause delivery to be
34582 deferred.
34583 </para>
34584 <para>
34585 <indexterm role="option">
34586 <primary><option>route_list</option></primary>
34587 </indexterm>
34588 </para>
34589 <informaltable frame="all">
34590 <tgroup cols="4" colsep="0" rowsep="0">
34591 <colspec colwidth="8*" align="left"/>
34592 <colspec colwidth="6*" align="center"/>
34593 <colspec colwidth="6*" align="center"/>
34594 <colspec colwidth="6*" align="right"/>
34595 <tbody>
34596 <row>
34597 <entry><option>route_list</option></entry>
34598 <entry>Use: <emphasis>manualroute</emphasis></entry>
34599 <entry>Type: <emphasis>string list</emphasis></entry>
34600 <entry>Default: <emphasis>unset</emphasis></entry>
34601 </row>
34602 </tbody>
34603 </tgroup>
34604 </informaltable>
34605 <para>
34606 This string is a list of routing rules, in the form defined below. Note that,
34607 unlike most string lists, the items are separated by semicolons. This is so
34608 that they may contain colon-separated host lists.
34609 </para>
34610 <para>
34611 <indexterm role="option">
34612 <primary><option>same_domain_copy_routing</option></primary>
34613 </indexterm>
34614 </para>
34615 <informaltable frame="all">
34616 <tgroup cols="4" colsep="0" rowsep="0">
34617 <colspec colwidth="8*" align="left"/>
34618 <colspec colwidth="6*" align="center"/>
34619 <colspec colwidth="6*" align="center"/>
34620 <colspec colwidth="6*" align="right"/>
34621 <tbody>
34622 <row>
34623 <entry><option>same_domain_copy_routing</option></entry>
34624 <entry>Use: <emphasis>manualroute</emphasis></entry>
34625 <entry>Type: <emphasis>boolean</emphasis></entry>
34626 <entry>Default: <emphasis>false</emphasis></entry>
34627 </row>
34628 </tbody>
34629 </tgroup>
34630 </informaltable>
34631 <para>
34632 <indexterm role="concept">
34633 <primary>address</primary>
34634 <secondary>copying routing</secondary>
34635 </indexterm>
34636 Addresses with the same domain are normally routed by the <command>manualroute</command>
34637 router to the same list of hosts. However, this cannot be presumed, because the
34638 router options and preconditions may refer to the local part of the address. By
34639 default, therefore, Exim routes each address in a message independently. DNS
34640 servers run caches, so repeated DNS lookups are not normally expensive, and in
34641 any case, personal messages rarely have more than a few recipients.
34642 </para>
34643 <para>
34644 If you are running mailing lists with large numbers of subscribers at the same
34645 domain, and you are using a <command>manualroute</command> router which is independent of the
34646 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
34647 lookups for identical domains in one message. In this case, when
34648 <command>manualroute</command> routes an address to a remote transport, any other unrouted
34649 addresses in the message that have the same domain are automatically given the
34650 same routing without processing them independently. However, this is only done
34651 if <option>headers_add</option> and <option>headers_remove</option> are unset.
34652 </para>
34653 </section>
34654 <section id="SECID120">
34655 <title>Routing rules in route_list</title>
34656 <para>
34657 The value of <option>route_list</option> is a string consisting of a sequence of routing
34658 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
34659 entered as two semicolons. Alternatively, the list separator can be changed as
34660 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
34661 Empty rules are ignored. The format of each rule is
34662 </para>
34663 <literallayout>
34664 &lt;<emphasis>domain pattern</emphasis>&gt;  &lt;<emphasis>list of hosts</emphasis>&gt;  &lt;<emphasis>options</emphasis>&gt;
34665 </literallayout>
34666 <para>
34667 The following example contains two rules, each with a simple domain pattern and
34668 no options:
34669 </para>
34670 <literallayout class="monospaced">
34671 route_list = \
34672   dict.ref.example  mail-1.ref.example:mail-2.ref.example ; \
34673   thes.ref.example  mail-3.ref.example:mail-4.ref.example
34674 </literallayout>
34675 <para>
34676 The three parts of a rule are separated by white space. The pattern and the
34677 list of hosts can be enclosed in quotes if necessary, and if they are, the
34678 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
34679 single domain pattern, which is the only mandatory item in the rule. The
34680 pattern is in the same format as one item in a domain list (see section
34681 <xref linkend="SECTdomainlist"/>),
34682 except that it may not be the name of an interpolated file.
34683 That is, it may be wildcarded, or a regular expression, or a file or database
34684 lookup (with semicolons doubled, because of the use of semicolon as a separator
34685 in a <option>route_list</option>).
34686 </para>
34687 <para>
34688 The rules in <option>route_list</option> are searched in order until one of the patterns
34689 matches the domain that is being routed. The list of hosts and then options are
34690 then used as described below. If there is no match, the router declines. When
34691 <option>route_list</option> is set, <option>route_data</option> must not be set.
34692 </para>
34693 </section>
34694 <section id="SECID121">
34695 <title>Routing rules in route_data</title>
34696 <para>
34697 The use of <option>route_list</option> is convenient when there are only a small number of
34698 routing rules. For larger numbers, it is easier to use a file or database to
34699 hold the routing information, and use the <option>route_data</option> option instead.
34700 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
34701 Most commonly, <option>route_data</option> is set as a string that contains an
34702 expansion lookup. For example, suppose we place two routing rules in a file
34703 like this:
34704 </para>
34705 <literallayout class="monospaced">
34706 dict.ref.example:  mail-1.ref.example:mail-2.ref.example
34707 thes.ref.example:  mail-3.ref.example:mail-4.ref.example
34708 </literallayout>
34709 <para>
34710 This data can be accessed by setting
34711 </para>
34712 <literallayout class="monospaced">
34713 route_data = ${lookup{$domain}lsearch{/the/file/name}}
34714 </literallayout>
34715 <para>
34716 Failure of the lookup results in an empty string, causing the router to
34717 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
34718 requirement is that the result of expanding the string is a list of hosts,
34719 possibly followed by options, separated by white space. The list of hosts must
34720 be enclosed in quotes if it contains white space.
34721 </para>
34722 </section>
34723 <section id="SECID122">
34724 <title>Format of the list of hosts</title>
34725 <para>
34726 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
34727 always separately expanded before use. If the expansion fails, the router
34728 declines. The result of the expansion must be a colon-separated list of names
34729 and/or IP addresses, optionally also including ports. The format of each item
34730 in the list is described in the next section. The list separator can be changed
34731 as described in section <xref linkend="SECTlistconstruct"/>.
34732 </para>
34733 <para>
34734 If the list of hosts was obtained from a <option>route_list</option> item, the following
34735 variables are set during its expansion:
34736 </para>
34737 <itemizedlist>
34738 <listitem>
34739 <para>
34740 <indexterm role="concept">
34741 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname>  etc)</primary>
34742 <secondary>in <command>manualroute</command> router</secondary>
34743 </indexterm>
34744 If the domain was matched against a regular expression, the numeric variables
34745 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
34746 </para>
34747 <literallayout class="monospaced">
34748 route_list = ^domain(\d+)   host-$1.text.example
34749 </literallayout>
34750 </listitem>
34751 <listitem>
34752 <para>
34753 <varname>$0</varname> is always set to the entire domain.
34754 </para>
34755 </listitem>
34756 <listitem>
34757 <para>
34758 <varname>$1</varname> is also set when partial matching is done in a file lookup.
34759 </para>
34760 </listitem>
34761 <listitem>
34762 <para>
34763 <indexterm role="variable">
34764 <primary><varname>$value</varname></primary>
34765 </indexterm>
34766 If the pattern that matched the domain was a lookup item, the data that was
34767 looked up is available in the expansion variable <varname>$value</varname>. For example:
34768 </para>
34769 <literallayout class="monospaced">
34770 route_list = lsearch;;/some/file.routes  $value
34771 </literallayout>
34772 </listitem>
34773 </itemizedlist>
34774 <para>
34775 Note the doubling of the semicolon in the pattern that is necessary because
34776 semicolon is the default route list separator.
34777 </para>
34778 </section>
34779 <section id="SECTformatonehostitem">
34780 <title>Format of one host item</title>
34781 <para>
34782 Each item in the list of hosts is either a host name or an IP address,
34783 optionally with an attached port number. When no port is given, an IP address
34784 is not enclosed in brackets. When a port is specified, it overrides the port
34785 specification on the transport. The port is separated from the name or address
34786 by a colon. This leads to some complications:
34787 </para>
34788 <itemizedlist>
34789 <listitem>
34790 <para>
34791 Because colon is the default separator for the list of hosts, either
34792 the colon that specifies a port must be doubled, or the list separator must
34793 be changed. The following two examples have the same effect:
34794 </para>
34795 <literallayout class="monospaced">
34796 route_list = * "host1.tld::1225 : host2.tld::1226"
34797 route_list = * "&lt;+ host1.tld:1225 + host2.tld:1226"
34798 </literallayout>
34799 </listitem>
34800 <listitem>
34801 <para>
34802 When IPv6 addresses are involved, it gets worse, because they contain
34803 colons of their own. To make this case easier, it is permitted to
34804 enclose an IP address (either v4 or v6) in square brackets if a port
34805 number follows. For example:
34806 </para>
34807 <literallayout class="monospaced">
34808 route_list = * "&lt;/ [10.1.1.1]:1225 / [::1]:1226"
34809 </literallayout>
34810 </listitem>
34811 </itemizedlist>
34812 </section>
34813 <section id="SECThostshowused">
34814 <title>How the list of hosts is used</title>
34815 <para>
34816 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
34817 the hosts is tried, in the order specified, when carrying out the SMTP
34818 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
34819 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
34820 transport.
34821 </para>
34822 <para>
34823 Hosts may be listed by name or by IP address. An unadorned name in the list of
34824 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
34825 interpreted as an indirection to a sublist of hosts obtained by looking up MX
34826 records in the DNS. For example:
34827 </para>
34828 <literallayout class="monospaced">
34829 route_list = *  x.y.z:p.q.r/MX:e.f.g
34830 </literallayout>
34831 <para>
34832 If this feature is used with a port specifier, the port must come last. For
34833 example:
34834 </para>
34835 <literallayout class="monospaced">
34836 route_list = *  dom1.tld/mx::1225
34837 </literallayout>
34838 <para>
34839 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
34840 randomized before any lookups are done. Exim then scans the list; for any name
34841 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
34842 be an interface on the local host and the item is not the first in the list,
34843 Exim discards it and any subsequent items. If it is the first item, what
34844 happens is controlled by the
34845 <indexterm role="option">
34846 <primary><option>self</option></primary>
34847 <secondary>in <command>manualroute</command> router</secondary>
34848 </indexterm>
34849 <option>self</option> option of the router.
34850 </para>
34851 <para>
34852 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
34853 hosts obtained by looking up MX records for the name. This is always a DNS
34854 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
34855 below) are not relevant here. The order of these hosts is determined by the
34856 preference values in the MX records, according to the usual rules. Because
34857 randomizing happens before the MX lookup, it does not affect the order that is
34858 defined by MX preferences.
34859 </para>
34860 <para>
34861 If the local host is present in the sublist obtained from MX records, but is
34862 not the most preferred host in that list, it and any equally or less
34863 preferred hosts are removed before the sublist is inserted into the main list.
34864 </para>
34865 <para>
34866 If the local host is the most preferred host in the MX list, what happens
34867 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
34868 is not the first item (that is, there are previous hosts in the main list),
34869 Exim discards this name and any subsequent items in the main list.
34870 </para>
34871 <para>
34872 If the MX item is first in the list of hosts, and the local host is the
34873 most preferred host, what happens is controlled by the <option>self</option> option of the
34874 router.
34875 </para>
34876 <para>
34877 DNS failures when lookup up the MX records are treated in the same way as DNS
34878 failures when looking up IP addresses: <option>pass_on_timeout</option> and
34879 <option>host_find_failed</option> are used when relevant.
34880 </para>
34881 <para>
34882 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
34883 whether obtained from an MX lookup or not.
34884 </para>
34885 </section>
34886 <section id="SECThowoptused">
34887 <title>How the options are used</title>
34888 <para>
34889 The options are a sequence of words; in practice no more than three are ever
34890 present. One of the words can be the name of a transport; this overrides the
34891 <option>transport</option> option on the router for this particular routing rule only. The
34892 other words (if present) control randomization of the list of hosts on a
34893 per-rule basis, and how the IP addresses of the hosts are to be found when
34894 routing to a remote transport. These options are as follows:
34895 </para>
34896 <itemizedlist>
34897 <listitem>
34898 <para>
34899 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
34900 setting of <option>hosts_randomize</option> for this routing rule only.
34901 </para>
34902 </listitem>
34903 <listitem>
34904 <para>
34905 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
34906 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
34907 </para>
34908 </listitem>
34909 <listitem>
34910 <para>
34911 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
34912 find IP addresses. This function may ultimately cause a DNS lookup, but it may
34913 also look in <filename>/etc/hosts</filename> or other sources of information.
34914 </para>
34915 </listitem>
34916 <listitem>
34917 <para>
34918 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
34919 no address records are found. If there is a temporary DNS error (such as a
34920 timeout), delivery is deferred.
34921 </para>
34922 </listitem>
34923 </itemizedlist>
34924 <para>
34925 For example:
34926 </para>
34927 <literallayout class="monospaced">
34928 route_list = domain1  host1:host2:host3  randomize bydns;\
34929              domain2  host4:host5
34930 </literallayout>
34931 <para>
34932 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
34933 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
34934 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
34935 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
34936 call.
34937 </para>
34938 <para>
34939 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
34940 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
34941 instead of TRY_AGAIN. That is why the default action is to try a DNS
34942 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
34943 function called.
34944 </para>
34945 <para>
34946 If no IP address for a host can be found, what happens is controlled by the
34947 <option>host_find_failed</option> option.
34948 </para>
34949 <para>
34950 <indexterm role="variable">
34951 <primary><varname>$host</varname></primary>
34952 </indexterm>
34953 When an address is routed to a local transport, IP addresses are not looked up.
34954 The host list is passed to the transport in the <varname>$host</varname> variable.
34955 </para>
34956 </section>
34957 <section id="SECID123">
34958 <title>Manualroute examples</title>
34959 <para>
34960 In some of the examples that follow, the presence of the <option>remote_smtp</option>
34961 transport, as defined in the default configuration file, is assumed:
34962 </para>
34963 <itemizedlist>
34964 <listitem>
34965 <para>
34966 <indexterm role="concept">
34967 <primary>smart host</primary>
34968 <secondary>example router</secondary>
34969 </indexterm>
34970 The <command>manualroute</command> router can be used to forward all external mail to a
34971 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
34972 named domain list that contains your local domains, for example:
34973 </para>
34974 <literallayout class="monospaced">
34975 domainlist local_domains = my.domain.example
34976 </literallayout>
34977 <para>
34978 You can arrange for all other domains to be routed to a smart host by making
34979 your first router something like this:
34980 </para>
34981 <literallayout class="monospaced">
34982 smart_route:
34983   driver = manualroute
34984   domains = !+local_domains
34985   transport = remote_smtp
34986   route_list = * smarthost.ref.example
34987 </literallayout>
34988 <para>
34989 This causes all non-local addresses to be sent to the single host
34990 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
34991 they are tried in order
34992 (but you can use <option>hosts_randomize</option> to vary the order each time).
34993 Another way of configuring the same thing is this:
34994 </para>
34995 <literallayout class="monospaced">
34996 smart_route:
34997   driver = manualroute
34998   transport = remote_smtp
34999   route_list = !+local_domains  smarthost.ref.example
35000 </literallayout>
35001 <para>
35002 There is no difference in behaviour between these two routers as they stand.
35003 However, they behave differently if <option>no_more</option> is added to them. In the first
35004 example, the router is skipped if the domain does not match the <option>domains</option>
35005 precondition; the following router is always tried. If the router runs, it
35006 always matches the domain and so can never decline. Therefore, <option>no_more</option>
35007 would have no effect. In the second case, the router is never skipped; it
35008 always runs. However, if it doesn&#x2019;t match the domain, it declines. In this case
35009 <option>no_more</option> would prevent subsequent routers from running.
35010 </para>
35011 </listitem>
35012 <listitem>
35013 <para>
35014 <indexterm role="concept">
35015 <primary>mail hub example</primary>
35016 </indexterm>
35017 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
35018 records in the DNS and delivers it via its own private routing mechanism. Often
35019 the final destinations are behind a firewall, with the mail hub being the one
35020 machine that can connect to machines both inside and outside the firewall. The
35021 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
35022 to the correct hosts. For a small number of domains, the routing can be inline,
35023 using the <option>route_list</option> option, but for a larger number a file or database
35024 lookup is easier to manage.
35025 </para>
35026 <para>
35027 If the domain names are in fact the names of the machines to which the mail is
35028 to be sent by the mail hub, the configuration can be quite simple. For
35029 example:
35030 </para>
35031 <literallayout class="monospaced">
35032 hub_route:
35033   driver = manualroute
35034   transport = remote_smtp
35035   route_list = *.rhodes.tvs.example  $domain
35036 </literallayout>
35037 <para>
35038 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
35039 whose names are the same as the mail domains. A similar approach can be taken
35040 if the host name can be obtained from the domain name by a string manipulation
35041 that the expansion facilities can handle. Otherwise, a lookup based on the
35042 domain can be used to find the host:
35043 </para>
35044 <literallayout class="monospaced">
35045 through_firewall:
35046   driver = manualroute
35047   transport = remote_smtp
35048   route_data = ${lookup {$domain} cdb {/internal/host/routes}}
35049 </literallayout>
35050 <para>
35051 The result of the lookup must be the name or IP address of the host (or
35052 hosts) to which the address is to be routed. If the lookup fails, the route
35053 data is empty, causing the router to decline. The address then passes to the
35054 next router.
35055 </para>
35056 </listitem>
35057 <listitem>
35058 <para>
35059 <indexterm role="concept">
35060 <primary>batched SMTP output example</primary>
35061 </indexterm>
35062 <indexterm role="concept">
35063 <primary>SMTP</primary>
35064 <secondary>batched outgoing; example</secondary>
35065 </indexterm>
35066 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
35067 SMTP format for onward transportation by some other means. This is one way of
35068 storing mail for a dial-up host when it is not connected. The route list entry
35069 can be as simple as a single domain name in a configuration like this:
35070 </para>
35071 <literallayout class="monospaced">
35072 save_in_file:
35073   driver = manualroute
35074   transport = batchsmtp_appendfile
35075   route_list = saved.domain.example
35076 </literallayout>
35077 <para>
35078 though often a pattern is used to pick up more than one domain. If there are
35079 several domains or groups of domains with different transport requirements,
35080 different transports can be listed in the routing information:
35081 </para>
35082 <literallayout class="monospaced">
35083 save_in_file:
35084   driver = manualroute
35085   route_list = \
35086     *.saved.domain1.example  $domain  batch_appendfile; \
35087     *.saved.domain2.example  \
35088       ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
35089       batch_pipe
35090 </literallayout>
35091 <para>
35092 <indexterm role="variable">
35093 <primary><varname>$domain</varname></primary>
35094 </indexterm>
35095 <indexterm role="variable">
35096 <primary><varname>$host</varname></primary>
35097 </indexterm>
35098 The first of these just passes the domain in the <varname>$host</varname> variable, which
35099 doesn&#x2019;t achieve much (since it is also in <varname>$domain</varname>), but the second does a
35100 file lookup to find a value to pass, causing the router to decline to handle
35101 the address if the lookup fails.
35102 </para>
35103 </listitem>
35104 <listitem>
35105 <para>
35106 <indexterm role="concept">
35107 <primary>UUCP</primary>
35108 <secondary>example of router for</secondary>
35109 </indexterm>
35110 Routing mail directly to UUCP software is a specific case of the use of
35111 <command>manualroute</command> in a gateway to another mail environment. This is an example of
35112 one way it can be done:
35113 </para>
35114 <literallayout class="monospaced">
35115 # Transport
35116 uucp:
35117   driver = pipe
35118   user = nobody
35119   command = /usr/local/bin/uux -r - \
35120     ${substr_-5:$host}!rmail ${local_part}
35121   return_fail_output = true
35122
35123 # Router
35124 uucphost:
35125   transport = uucp
35126   driver = manualroute
35127   route_data = \
35128     ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
35129 </literallayout>
35130 <para>
35131 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
35132 </para>
35133 <literallayout class="monospaced">
35134 darksite.ethereal.example:           darksite.UUCP
35135 </literallayout>
35136 <para>
35137 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
35138 makes clear the distinction between the domain name
35139 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
35140 </para>
35141 </listitem>
35142 </itemizedlist>
35143 <para>
35144 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
35145 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
35146 </para>
35147 </section>
35148 </chapter>
35149
35150 <chapter id="CHAPdriverlast">
35151 <title>The queryprogram router</title>
35152 <para>
35153 <indexterm role="concept" id="IIDquerou1" class="startofrange">
35154 <primary><command>queryprogram</command> router</primary>
35155 </indexterm>
35156 <indexterm role="concept" id="IIDquerou2" class="startofrange">
35157 <primary>routers</primary>
35158 <secondary><command>queryprogram</command></secondary>
35159 </indexterm>
35160 <indexterm role="concept">
35161 <primary>routing</primary>
35162 <secondary>by external program</secondary>
35163 </indexterm>
35164 The <command>queryprogram</command> router routes an address by running an external command
35165 and acting on its output. This is an expensive way to route, and is intended
35166 mainly for use in lightly-loaded systems, or for performing experiments.
35167 However, if it is possible to use the precondition options (<option>domains</option>,
35168 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
35169 be used in special cases, even on a busy host. There are the following private
35170 options:
35171 <indexterm role="concept">
35172 <primary>options</primary>
35173 <secondary><command>queryprogram</command> router</secondary>
35174 </indexterm>
35175 </para>
35176 <para>
35177 <indexterm role="option">
35178 <primary><option>command</option></primary>
35179 </indexterm>
35180 </para>
35181 <informaltable frame="all">
35182 <tgroup cols="4" colsep="0" rowsep="0">
35183 <colspec colwidth="8*" align="left"/>
35184 <colspec colwidth="6*" align="center"/>
35185 <colspec colwidth="6*" align="center"/>
35186 <colspec colwidth="6*" align="right"/>
35187 <tbody>
35188 <row>
35189 <entry><option>command</option></entry>
35190 <entry>Use: <emphasis>queryprogram</emphasis></entry>
35191 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35192 <entry>Default: <emphasis>unset</emphasis></entry>
35193 </row>
35194 </tbody>
35195 </tgroup>
35196 </informaltable>
35197 <para>
35198 This option must be set. It specifies the command that is to be run. The
35199 command is split up into a command name and arguments, and then each is
35200 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
35201 <xref linkend="CHAPpipetransport"/>).
35202 </para>
35203 <para>
35204 <indexterm role="option">
35205 <primary><option>command_group</option></primary>
35206 </indexterm>
35207 </para>
35208 <informaltable frame="all">
35209 <tgroup cols="4" colsep="0" rowsep="0">
35210 <colspec colwidth="8*" align="left"/>
35211 <colspec colwidth="6*" align="center"/>
35212 <colspec colwidth="6*" align="center"/>
35213 <colspec colwidth="6*" align="right"/>
35214 <tbody>
35215 <row>
35216 <entry><option>command_group</option></entry>
35217 <entry>Use: <emphasis>queryprogram</emphasis></entry>
35218 <entry>Type: <emphasis>string</emphasis></entry>
35219 <entry>Default: <emphasis>unset</emphasis></entry>
35220 </row>
35221 </tbody>
35222 </tgroup>
35223 </informaltable>
35224 <para>
35225 <indexterm role="concept">
35226 <primary>gid (group id)</primary>
35227 <secondary>in <command>queryprogram</command> router</secondary>
35228 </indexterm>
35229 This option specifies a gid to be set when running the command while routing an
35230 address for deliver. It must be set if <option>command_user</option> specifies a numerical
35231 uid. If it begins with a digit, it is interpreted as the numerical value of the
35232 gid. Otherwise it is looked up using <function>getgrnam()</function>.
35233 </para>
35234 <para>
35235 <indexterm role="option">
35236 <primary><option>command_user</option></primary>
35237 </indexterm>
35238 </para>
35239 <informaltable frame="all">
35240 <tgroup cols="4" colsep="0" rowsep="0">
35241 <colspec colwidth="8*" align="left"/>
35242 <colspec colwidth="6*" align="center"/>
35243 <colspec colwidth="6*" align="center"/>
35244 <colspec colwidth="6*" align="right"/>
35245 <tbody>
35246 <row>
35247 <entry><option>command_user</option></entry>
35248 <entry>Use: <emphasis>queryprogram</emphasis></entry>
35249 <entry>Type: <emphasis>string</emphasis></entry>
35250 <entry>Default: <emphasis>unset</emphasis></entry>
35251 </row>
35252 </tbody>
35253 </tgroup>
35254 </informaltable>
35255 <para>
35256 <indexterm role="concept">
35257 <primary>uid (user id)</primary>
35258 <secondary>for <command>queryprogram</command></secondary>
35259 </indexterm>
35260 This option must be set. It specifies the uid which is set when running the
35261 command while routing an address for delivery. If the value begins with a digit,
35262 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
35263 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
35264 not set, a value for the gid also.
35265 </para>
35266 <para>
35267 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
35268 root, which it does during a normal delivery in a conventional configuration.
35269 However, when an address is being verified during message reception, Exim is
35270 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
35271 is called from a non-root process, Exim cannot change uid or gid before running
35272 the command. In this circumstance the command runs under the current uid and
35273 gid.
35274 </para>
35275 <para>
35276 <indexterm role="option">
35277 <primary><option>current_directory</option></primary>
35278 </indexterm>
35279 </para>
35280 <informaltable frame="all">
35281 <tgroup cols="4" colsep="0" rowsep="0">
35282 <colspec colwidth="8*" align="left"/>
35283 <colspec colwidth="6*" align="center"/>
35284 <colspec colwidth="6*" align="center"/>
35285 <colspec colwidth="6*" align="right"/>
35286 <tbody>
35287 <row>
35288 <entry><option>current_directory</option></entry>
35289 <entry>Use: <emphasis>queryprogram</emphasis></entry>
35290 <entry>Type: <emphasis>string</emphasis></entry>
35291 <entry>Default: <emphasis>/</emphasis></entry>
35292 </row>
35293 </tbody>
35294 </tgroup>
35295 </informaltable>
35296 <para>
35297 This option specifies an absolute path which is made the current directory
35298 before running the command.
35299 </para>
35300 <para>
35301 <indexterm role="option">
35302 <primary><option>timeout</option></primary>
35303 </indexterm>
35304 </para>
35305 <informaltable frame="all">
35306 <tgroup cols="4" colsep="0" rowsep="0">
35307 <colspec colwidth="8*" align="left"/>
35308 <colspec colwidth="6*" align="center"/>
35309 <colspec colwidth="6*" align="center"/>
35310 <colspec colwidth="6*" align="right"/>
35311 <tbody>
35312 <row>
35313 <entry><option>timeout</option></entry>
35314 <entry>Use: <emphasis>queryprogram</emphasis></entry>
35315 <entry>Type: <emphasis>time</emphasis></entry>
35316 <entry>Default: <emphasis>1h</emphasis></entry>
35317 </row>
35318 </tbody>
35319 </tgroup>
35320 </informaltable>
35321 <para>
35322 If the command does not complete within the timeout period, its process group
35323 is killed and the message is frozen. A value of zero time specifies no
35324 timeout.
35325 </para>
35326 <para>
35327 The standard output of the command is connected to a pipe, which is read when
35328 the command terminates. It should consist of a single line of output,
35329 containing up to five fields, separated by white space. The maximum length of
35330 the line is 1023 characters. Longer lines are silently truncated. The first
35331 field is one of the following words (case-insensitive):
35332 </para>
35333 <itemizedlist>
35334 <listitem>
35335 <para>
35336 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
35337 below).
35338 </para>
35339 </listitem>
35340 <listitem>
35341 <para>
35342 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
35343 <option>no_more</option> is set.
35344 </para>
35345 </listitem>
35346 <listitem>
35347 <para>
35348 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
35349 subsequent text on the line is an error message. If the router is run as part
35350 of address verification during an incoming SMTP message, the message is
35351 included in the SMTP response.
35352 </para>
35353 </listitem>
35354 <listitem>
35355 <para>
35356 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
35357 subsequent text on the line is an error message which is logged. It is not
35358 included in any SMTP response.
35359 </para>
35360 </listitem>
35361 <listitem>
35362 <para>
35363 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
35364 </para>
35365 </listitem>
35366 <listitem>
35367 <para>
35368 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
35369 <option>pass_router</option>), overriding <option>no_more</option>.
35370 </para>
35371 </listitem>
35372 <listitem>
35373 <para>
35374 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
35375 new addresses, which are routed independently, starting with the first router,
35376 or the router specified by <option>redirect_router</option>, if set.
35377 </para>
35378 </listitem>
35379 </itemizedlist>
35380 <para>
35381 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
35382 number of keyed data values, as follows (split into two lines here, to fit on
35383 the page):
35384 </para>
35385 <literallayout class="monospaced">
35386 ACCEPT TRANSPORT=&lt;transport&gt; HOSTS=&lt;list of hosts&gt;
35387 LOOKUP=byname|bydns DATA=&lt;text&gt;
35388 </literallayout>
35389 <para>
35390 The data items can be given in any order, and all are optional. If no transport
35391 is included, the transport specified by the generic <option>transport</option> option is
35392 used. The list of hosts and the lookup type are needed only if the transport is
35393 an <command>smtp</command> transport that does not itself supply a list of hosts.
35394 </para>
35395 <para>
35396 The format of the list of hosts is the same as for the <command>manualroute</command> router.
35397 As well as host names and IP addresses with optional port numbers, as described
35398 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
35399 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
35400 (see section <xref linkend="SECThostshowused"/>).
35401 </para>
35402 <para>
35403 If the lookup type is not specified, Exim behaves as follows when trying to
35404 find an IP address for each host: First, a DNS lookup is done. If this yields
35405 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
35406 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
35407 result of the lookup is the result of that call.
35408 </para>
35409 <para>
35410 <indexterm role="variable">
35411 <primary><varname>$address_data</varname></primary>
35412 </indexterm>
35413 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
35414 variable. For example, this return line
35415 </para>
35416 <literallayout class="monospaced">
35417 accept hosts=x1.y.example:x2.y.example data="rule1"
35418 </literallayout>
35419 <para>
35420 routes the address to the default transport, passing a list of two hosts. When
35421 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
35422 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
35423 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
35424 </para>
35425 </chapter>
35426
35427 <chapter id="CHAPredirect">
35428 <title>The redirect router</title>
35429 <para>
35430 <indexterm role="concept" id="IIDredrou1" class="startofrange">
35431 <primary><command>redirect</command> router</primary>
35432 </indexterm>
35433 <indexterm role="concept" id="IIDredrou2" class="startofrange">
35434 <primary>routers</primary>
35435 <secondary><command>redirect</command></secondary>
35436 </indexterm>
35437 <indexterm role="concept">
35438 <primary>alias file</primary>
35439 <secondary>in a <command>redirect</command> router</secondary>
35440 </indexterm>
35441 <indexterm role="concept">
35442 <primary>address redirection</primary>
35443 <secondary><command>redirect</command> router</secondary>
35444 </indexterm>
35445 The <command>redirect</command> router handles several kinds of address redirection. Its most
35446 common uses are for resolving local part aliases from a central alias file
35447 (usually called <filename>/etc/aliases</filename>) and for handling users&#x2019; personal <filename>.forward</filename>
35448 files, but it has many other potential uses. The incoming address can be
35449 redirected in several different ways:
35450 </para>
35451 <itemizedlist>
35452 <listitem>
35453 <para>
35454 It can be replaced by one or more new addresses which are themselves routed
35455 independently.
35456 </para>
35457 </listitem>
35458 <listitem>
35459 <para>
35460 It can be routed to be delivered to a given file or directory.
35461 </para>
35462 </listitem>
35463 <listitem>
35464 <para>
35465 It can be routed to be delivered to a specified pipe command.
35466 </para>
35467 </listitem>
35468 <listitem>
35469 <para>
35470 It can cause an automatic reply to be generated.
35471 </para>
35472 </listitem>
35473 <listitem>
35474 <para>
35475 It can be forced to fail, optionally with a custom error message.
35476 </para>
35477 </listitem>
35478 <listitem>
35479 <para>
35480 It can be temporarily deferred, optionally with a custom message.
35481 </para>
35482 </listitem>
35483 <listitem>
35484 <para>
35485 It can be discarded.
35486 </para>
35487 </listitem>
35488 </itemizedlist>
35489 <para>
35490 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
35491 However, there are some private options which define transports for delivery to
35492 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
35493 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
35494 </para>
35495 <section id="SECID124">
35496 <title>Redirection data</title>
35497 <para>
35498 The router operates by interpreting a text string which it obtains either by
35499 expanding the contents of the <option>data</option> option, or by reading the entire
35500 contents of a file whose name is given in the <option>file</option> option. These two
35501 options are mutually exclusive. The first is commonly used for handling system
35502 aliases, in a configuration like this:
35503 </para>
35504 <literallayout class="monospaced">
35505 system_aliases:
35506   driver = redirect
35507   data = ${lookup{$local_part}lsearch{/etc/aliases}}
35508 </literallayout>
35509 <para>
35510 If the lookup fails, the expanded string in this example is empty. When the
35511 expansion of <option>data</option> results in an empty string, the router declines. A forced
35512 expansion failure also causes the router to decline; other expansion failures
35513 cause delivery to be deferred.
35514 </para>
35515 <para>
35516 A configuration using <option>file</option> is commonly used for handling users&#x2019;
35517 <filename>.forward</filename> files, like this:
35518 </para>
35519 <literallayout class="monospaced">
35520 userforward:
35521   driver = redirect
35522   check_local_user
35523   file = $home/.forward
35524   no_verify
35525 </literallayout>
35526 <para>
35527 If the file does not exist, or causes no action to be taken (for example, it is
35528 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
35529 is not the case when the file contains syntactically valid items that happen to
35530 yield empty addresses, for example, items containing only RFC 2822 address
35531 comments.
35532 </para>
35533 </section>
35534 <section id="SECID125">
35535 <title>Forward files and address verification</title>
35536 <para>
35537 <indexterm role="concept">
35538 <primary>address redirection</primary>
35539 <secondary>while verifying</secondary>
35540 </indexterm>
35541 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users&#x2019;
35542 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
35543 </para>
35544 <itemizedlist>
35545 <listitem>
35546 <para>
35547 When Exim is receiving an incoming SMTP message from a remote host, it is
35548 running under the Exim uid, not as root. Exim is unable to change uid to read
35549 the file as the user, and it may not be able to read it as the Exim user. So in
35550 practice the router may not be able to operate.
35551 </para>
35552 </listitem>
35553 <listitem>
35554 <para>
35555 However, even when the router can operate, the existence of a <filename>.forward</filename> file
35556 is unimportant when verifying an address. What should be checked is whether the
35557 local part is a valid user name or not. Cutting out the redirection processing
35558 saves some resources.
35559 </para>
35560 </listitem>
35561 </itemizedlist>
35562 </section>
35563 <section id="SECID126">
35564 <title>Interpreting redirection data</title>
35565 <para>
35566 <indexterm role="concept">
35567 <primary>Sieve filter</primary>
35568 <secondary>specifying in redirection data</secondary>
35569 </indexterm>
35570 <indexterm role="concept">
35571 <primary>filter</primary>
35572 <secondary>specifying in redirection data</secondary>
35573 </indexterm>
35574 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
35575 can be interpreted in two different ways:
35576 </para>
35577 <itemizedlist>
35578 <listitem>
35579 <para>
35580 If the <option>allow_filter</option> option is set true, and the data begins with the text
35581 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
35582 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
35583 respectively. Details of the syntax and semantics of filter files are described
35584 in a separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>; this
35585 document is intended for use by end users.
35586 </para>
35587 </listitem>
35588 <listitem>
35589 <para>
35590 Otherwise, the data must be a comma-separated list of redirection items, as
35591 described in the next section.
35592 </para>
35593 </listitem>
35594 </itemizedlist>
35595 <para>
35596 When a message is redirected to a file (a <quote>mail folder</quote>), the file name given
35597 in a non-filter redirection list must always be an absolute path. A filter may
35598 generate a relative path &ndash; how this is handled depends on the transport&#x2019;s
35599 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
35600 for the <command>appendfile</command> transport.
35601 </para>
35602 </section>
35603 <section id="SECTitenonfilred">
35604 <title>Items in a non-filter redirection list</title>
35605 <para>
35606 <indexterm role="concept">
35607 <primary>address redirection</primary>
35608 <secondary>non-filter list items</secondary>
35609 </indexterm>
35610 When the redirection data is not an Exim or Sieve filter, for example, if it
35611 comes from a conventional alias or forward file, it consists of a list of
35612 addresses, file names, pipe commands, or certain special items (see section
35613 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
35614 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
35615 depending on their default values. The items in the list are separated by
35616 commas or newlines.
35617 If a comma is required in an item, the entire item must be enclosed in double
35618 quotes.
35619 </para>
35620 <para>
35621 Lines starting with a # character are comments, and are ignored, and # may
35622 also appear following a comma, in which case everything between the # and the
35623 next newline character is ignored.
35624 </para>
35625 <para>
35626 If an item is entirely enclosed in double quotes, these are removed. Otherwise
35627 double quotes are retained because some forms of mail address require their use
35628 (but never to enclose the entire address). In the following description,
35629 <quote>item</quote> refers to what remains after any surrounding double quotes have been
35630 removed.
35631 </para>
35632 <para>
35633 <indexterm role="variable">
35634 <primary><varname>$local_part</varname></primary>
35635 </indexterm>
35636 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
35637 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
35638 of the <option>quote_local_part</option> expansion operator, in case the local part contains
35639 special characters. For example, to redirect all mail for the domain
35640 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
35641 setting:
35642 </para>
35643 <literallayout class="monospaced">
35644 data = ${quote_local_part:$local_part}@newdomain.example
35645 </literallayout>
35646 </section>
35647 <section id="SECTredlocmai">
35648 <title>Redirecting to a local mailbox</title>
35649 <para>
35650 <indexterm role="concept">
35651 <primary>routing</primary>
35652 <secondary>loops in</secondary>
35653 </indexterm>
35654 <indexterm role="concept">
35655 <primary>loop</primary>
35656 <secondary>while routing, avoidance of</secondary>
35657 </indexterm>
35658 <indexterm role="concept">
35659 <primary>address redirection</primary>
35660 <secondary>to local mailbox</secondary>
35661 </indexterm>
35662 A redirection item may safely be the same as the address currently under
35663 consideration. This does not cause a routing loop, because a router is
35664 automatically skipped if any ancestor of the address that is being processed
35665 is the same as the current address and was processed by the current router.
35666 Such an address is therefore passed to the following routers, so it is handled
35667 as if there were no redirection. When making this loop-avoidance test, the
35668 complete local part, including any prefix or suffix, is used.
35669 </para>
35670 <para>
35671 <indexterm role="concept">
35672 <primary>address redirection</primary>
35673 <secondary>local part without domain</secondary>
35674 </indexterm>
35675 Specifying the same local part without a domain is a common usage in personal
35676 filter files when the user wants to have messages delivered to the local
35677 mailbox and also forwarded elsewhere. For example, the user whose login is
35678 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
35679 </para>
35680 <literallayout class="monospaced">
35681 cleo, cleopatra@egypt.example
35682 </literallayout>
35683 <para>
35684 <indexterm role="concept">
35685 <primary>backslash in alias file</primary>
35686 </indexterm>
35687 <indexterm role="concept">
35688 <primary>alias file</primary>
35689 <secondary>backslash in</secondary>
35690 </indexterm>
35691 For compatibility with other MTAs, such unqualified local parts may be
35692 preceded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
35693 it does make a difference if more than one domain is being handled
35694 synonymously.
35695 </para>
35696 <para>
35697 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
35698 2822 address that does not include a domain, the item is qualified using the
35699 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
35700 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
35701 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
35702 </para>
35703 <para>
35704 Care must be taken if there are alias names for local users.
35705 Consider an MTA handling a single local domain where the system alias file
35706 contains:
35707 </para>
35708 <literallayout class="monospaced">
35709 Sam.Reman: spqr
35710 </literallayout>
35711 <para>
35712 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
35713 messages in the local mailbox, and also forward copies elsewhere. He creates
35714 this forward file:
35715 </para>
35716 <literallayout class="monospaced">
35717 Sam.Reman, spqr@reme.elsewhere.example
35718 </literallayout>
35719 <para>
35720 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
35721 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
35722 second time round, because it has previously routed it,
35723 and the following routers presumably cannot handle the alias. The forward file
35724 should really contain
35725 </para>
35726 <literallayout class="monospaced">
35727 spqr, spqr@reme.elsewhere.example
35728 </literallayout>
35729 <para>
35730 but because this is such a common error, the <option>check_ancestor</option> option (see
35731 below) exists to provide a way to get round it. This is normally set on a
35732 <command>redirect</command> router that is handling users&#x2019; <filename>.forward</filename> files.
35733 </para>
35734 </section>
35735 <section id="SECTspecitredli">
35736 <title>Special items in redirection lists</title>
35737 <para>
35738 In addition to addresses, the following types of item may appear in redirection
35739 lists (that is, in non-filter redirection data):
35740 </para>
35741 <itemizedlist>
35742 <listitem>
35743 <para>
35744 <indexterm role="concept">
35745 <primary>pipe</primary>
35746 <secondary>in redirection list</secondary>
35747 </indexterm>
35748 <indexterm role="concept">
35749 <primary>address redirection</primary>
35750 <secondary>to pipe</secondary>
35751 </indexterm>
35752 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
35753 as a valid RFC 2822 address that includes a domain. A transport for running the
35754 command must be specified by the <option>pipe_transport</option> option.
35755 Normally, either the router or the transport specifies a user and a group under
35756 which to run the delivery. The default is to use the Exim user and group.
35757 </para>
35758 <para>
35759 Single or double quotes can be used for enclosing the individual arguments of
35760 the pipe command; no interpretation of escapes is done for single quotes. If
35761 the command contains a comma character, it is necessary to put the whole item
35762 in double quotes, for example:
35763 </para>
35764 <literallayout class="monospaced">
35765 "|/some/command ready,steady,go"
35766 </literallayout>
35767 <para>
35768 since items in redirection lists are terminated by commas. Do not, however,
35769 quote just the command. An item such as
35770 </para>
35771 <literallayout class="monospaced">
35772 |"/some/command ready,steady,go"
35773 </literallayout>
35774 <para>
35775 is interpreted as a pipe with a rather strange command name, and no arguments.
35776 </para>
35777 <para>
35778 Note that the above example assumes that the text comes from a lookup source
35779 of some sort, so that the quotes are part of the data.  If composing a
35780 redirect router with a <option>data</option> option directly specifying this command, the
35781 quotes will be used by the configuration parser to define the extent of one
35782 string, but will not be passed down into the redirect router itself.  There
35783 are two main approaches to get around this: escape quotes to be part of the
35784 data itself, or avoid using this mechanism and instead create a custom
35785 transport with the <option>command</option> option set and reference that transport from
35786 an <option>accept</option> router.
35787 </para>
35788 </listitem>
35789 <listitem>
35790 <para>
35791 <indexterm role="concept">
35792 <primary>file</primary>
35793 <secondary>in redirection list</secondary>
35794 </indexterm>
35795 <indexterm role="concept">
35796 <primary>address redirection</primary>
35797 <secondary>to file</secondary>
35798 </indexterm>
35799 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
35800 parse as a valid RFC 2822 address that includes a domain. For example,
35801 </para>
35802 <literallayout class="monospaced">
35803 /home/world/minbari
35804 </literallayout>
35805 <para>
35806 is treated as a file name, but
35807 </para>
35808 <literallayout class="monospaced">
35809 /s=molari/o=babylon/@x400gate.way
35810 </literallayout>
35811 <para>
35812 is treated as an address. For a file name, a transport must be specified using
35813 the <option>file_transport</option> option. However, if the generated path name ends with a
35814 forward slash character, it is interpreted as a directory name rather than a
35815 file name, and <option>directory_transport</option> is used instead.
35816 </para>
35817 <para>
35818 Normally, either the router or the transport specifies a user and a group under
35819 which to run the delivery. The default is to use the Exim user and group.
35820 </para>
35821 <para>
35822 <indexterm role="concept">
35823 <primary><filename>/dev/null</filename></primary>
35824 </indexterm>
35825 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
35826 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
35827 instead of a transport name. In this case the user and group are not used.
35828 </para>
35829 </listitem>
35830 <listitem>
35831 <para>
35832 <indexterm role="concept">
35833 <primary>included address list</primary>
35834 </indexterm>
35835 <indexterm role="concept">
35836 <primary>address redirection</primary>
35837 <secondary>included external list</secondary>
35838 </indexterm>
35839 If an item is of the form
35840 </para>
35841 <literallayout class="monospaced">
35842 :include:&lt;path name&gt;
35843 </literallayout>
35844 <para>
35845 a list of further items is taken from the given file and included at that
35846 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
35847 out-of-line addition to the list. The items in the included list are separated
35848 by commas or newlines and are not subject to expansion. If this is the first
35849 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
35850 the alias name. This example is incorrect:
35851 </para>
35852 <literallayout class="monospaced">
35853 list1    :include:/opt/lists/list1
35854 </literallayout>
35855 <para>
35856 It must be given as
35857 </para>
35858 <literallayout class="monospaced">
35859 list1:   :include:/opt/lists/list1
35860 </literallayout>
35861 </listitem>
35862 <listitem>
35863 <para>
35864 <indexterm role="concept">
35865 <primary>address redirection</primary>
35866 <secondary>to black hole</secondary>
35867 </indexterm>
35868 Sometimes you want to throw away mail to a particular local part. Making the
35869 <option>data</option> option expand to an empty string does not work, because that causes
35870 the router to decline. Instead, the alias item
35871 <indexterm role="concept">
35872 <primary>black hole</primary>
35873 </indexterm>
35874 <indexterm role="concept">
35875 <primary>abandoning mail</primary>
35876 </indexterm>
35877 <emphasis>:blackhole:</emphasis> can be used. It does what its name implies. No delivery is
35878 done, and no error message is generated. This has the same effect as specifing
35879 <filename>/dev/null</filename> as a destination, but it can be independently disabled.
35880 </para>
35881 <para>
35882 <emphasis role="bold">Warning</emphasis>: If <emphasis>:blackhole:</emphasis> appears anywhere in a redirection list, no
35883 delivery is done for the original local part, even if other redirection items
35884 are present. If you are generating a multi-item list (for example, by reading a
35885 database) and need the ability to provide a no-op item, you must use
35886 <filename>/dev/null</filename>.
35887 </para>
35888 </listitem>
35889 <listitem>
35890 <para>
35891 <indexterm role="concept">
35892 <primary>delivery</primary>
35893 <secondary>forcing failure</secondary>
35894 </indexterm>
35895 <indexterm role="concept">
35896 <primary>delivery</primary>
35897 <secondary>forcing deferral</secondary>
35898 </indexterm>
35899 <indexterm role="concept">
35900 <primary>failing delivery</primary>
35901 <secondary>forcing</secondary>
35902 </indexterm>
35903 <indexterm role="concept">
35904 <primary>deferred delivery, forcing</primary>
35905 </indexterm>
35906 <indexterm role="concept">
35907 <primary>customizing</primary>
35908 <secondary>failure message</secondary>
35909 </indexterm>
35910 An attempt to deliver a particular address can be deferred or forced to fail by
35911 redirection items of the form
35912 </para>
35913 <literallayout class="monospaced">
35914 :defer:
35915 :fail:
35916 </literallayout>
35917 <para>
35918 respectively. When a redirection list contains such an item, it applies
35919 to the entire redirection; any other items in the list are ignored. Any
35920 text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error text
35921 associated with the failure. For example, an alias file might contain:
35922 </para>
35923 <literallayout class="monospaced">
35924 X.Employee:  :fail: Gone away, no forwarding address
35925 </literallayout>
35926 <para>
35927 In the case of an address that is being verified from an ACL or as the subject
35928 of a
35929 <indexterm role="concept">
35930 <primary>VRFY</primary>
35931 <secondary>error text, display of</secondary>
35932 </indexterm>
35933 VRFY command, the text is included in the SMTP error response by
35934 default.
35935 <indexterm role="concept">
35936 <primary>EXPN</primary>
35937 <secondary>error text, display of</secondary>
35938 </indexterm>
35939 The text is not included in the response to an EXPN command. In non-SMTP cases
35940 the text is included in the error message that Exim generates.
35941 </para>
35942 <para>
35943 <indexterm role="concept">
35944 <primary>SMTP</primary>
35945 <secondary>error codes</secondary>
35946 </indexterm>
35947 By default, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
35948 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
35949 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
35950 followed by a space, and the very first digit is the same as the default error
35951 code, the code from the message is used instead. If the very first digit is
35952 incorrect, a panic error is logged, and the default code is used. You can
35953 suppress the use of the supplied code in a redirect router by setting the
35954 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
35955 ignored.
35956 </para>
35957 <para>
35958 <indexterm role="variable">
35959 <primary><varname>$acl_verify_message</varname></primary>
35960 </indexterm>
35961 In an ACL, an explicitly provided message overrides the default, but the
35962 default message is available in the variable <varname>$acl_verify_message</varname> and can
35963 therefore be included in a custom message if this is desired.
35964 </para>
35965 <para>
35966 Normally the error text is the rest of the redirection list &ndash; a comma does
35967 not terminate it &ndash; but a newline does act as a terminator. Newlines are not
35968 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
35969 as part of the continuation process, but they may exist in other kinds of
35970 lookup and in <emphasis>:include:</emphasis> files.
35971 </para>
35972 <para>
35973 During routing for message delivery (as opposed to verification), a redirection
35974 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
35975 whereas <emphasis>:defer:</emphasis> causes the message to remain on the queue so that a
35976 subsequent delivery attempt can happen at a later time. If an address is
35977 deferred for too long, it will ultimately fail, because the normal retry
35978 rules still apply.
35979 </para>
35980 </listitem>
35981 <listitem>
35982 <para>
35983 <indexterm role="concept">
35984 <primary>alias file</primary>
35985 <secondary>exception to default</secondary>
35986 </indexterm>
35987 Sometimes it is useful to use a single-key search type with a default (see
35988 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
35989 for exceptions to the default. These can be handled by aliasing them to
35990 <emphasis>:unknown:</emphasis>. This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command>
35991 router to decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which
35992 results in an empty redirection list has the same effect.
35993 </para>
35994 </listitem>
35995 </itemizedlist>
35996 </section>
35997 <section id="SECTdupaddr">
35998 <title>Duplicate addresses</title>
35999 <para>
36000 <indexterm role="concept">
36001 <primary>duplicate addresses</primary>
36002 </indexterm>
36003 <indexterm role="concept">
36004 <primary>address duplicate, discarding</primary>
36005 </indexterm>
36006 <indexterm role="concept">
36007 <primary>pipe</primary>
36008 <secondary>duplicated</secondary>
36009 </indexterm>
36010 Exim removes duplicate addresses from the list to which it is delivering, so as
36011 to deliver just one copy to each address. This does not apply to deliveries
36012 routed to pipes by different immediate parent addresses, but an indirect
36013 aliasing scheme of the type
36014 </para>
36015 <literallayout class="monospaced">
36016 pipe:       |/some/command $local_part
36017 localpart1: pipe
36018 localpart2: pipe
36019 </literallayout>
36020 <para>
36021 does not work with a message that is addressed to both local parts, because
36022 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
36023 discarded as being the same as a previously handled address. However, a scheme
36024 such as
36025 </para>
36026 <literallayout class="monospaced">
36027 localpart1: |/some/command $local_part
36028 localpart2: |/some/command $local_part
36029 </literallayout>
36030 <para>
36031 does result in two different pipe deliveries, because the immediate parents of
36032 the pipes are distinct.
36033 </para>
36034 </section>
36035 <section id="SECID128">
36036 <title>Repeated redirection expansion</title>
36037 <para>
36038 <indexterm role="concept">
36039 <primary>repeated redirection expansion</primary>
36040 </indexterm>
36041 <indexterm role="concept">
36042 <primary>address redirection</primary>
36043 <secondary>repeated for each delivery attempt</secondary>
36044 </indexterm>
36045 When a message cannot be delivered to all of its recipients immediately,
36046 leading to two or more delivery attempts, redirection expansion is carried out
36047 afresh each time for those addresses whose children were not all previously
36048 delivered. If redirection is being used as a mailing list, this can lead to new
36049 members of the list receiving copies of old messages. The <option>one_time</option> option
36050 can be used to avoid this.
36051 </para>
36052 </section>
36053 <section id="SECID129">
36054 <title>Errors in redirection lists</title>
36055 <para>
36056 <indexterm role="concept">
36057 <primary>address redirection</primary>
36058 <secondary>errors</secondary>
36059 </indexterm>
36060 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
36061 error is skipped, and an entry is written to the main log. This may be useful
36062 for mailing lists that are automatically managed. Otherwise, if an error is
36063 detected while generating the list of new addresses, the original address is
36064 deferred. See also <option>syntax_errors_to</option>.
36065 </para>
36066 </section>
36067 <section id="SECID130">
36068 <title>Private options for the redirect router</title>
36069 <para>
36070 <indexterm role="concept">
36071 <primary>options</primary>
36072 <secondary><command>redirect</command> router</secondary>
36073 </indexterm>
36074 The private options for the <command>redirect</command> router are as follows:
36075 </para>
36076 <para>
36077 <indexterm role="option">
36078 <primary><option>allow_defer</option></primary>
36079 </indexterm>
36080 </para>
36081 <informaltable frame="all">
36082 <tgroup cols="4" colsep="0" rowsep="0">
36083 <colspec colwidth="8*" align="left"/>
36084 <colspec colwidth="6*" align="center"/>
36085 <colspec colwidth="6*" align="center"/>
36086 <colspec colwidth="6*" align="right"/>
36087 <tbody>
36088 <row>
36089 <entry><option>allow_defer</option></entry>
36090 <entry>Use: <emphasis>redirect</emphasis></entry>
36091 <entry>Type: <emphasis>boolean</emphasis></entry>
36092 <entry>Default: <emphasis>false</emphasis></entry>
36093 </row>
36094 </tbody>
36095 </tgroup>
36096 </informaltable>
36097 <para>
36098 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
36099 data, or the <option>defer</option> command in an Exim filter file.
36100 </para>
36101 <para>
36102 <indexterm role="option">
36103 <primary><option>allow_fail</option></primary>
36104 </indexterm>
36105 </para>
36106 <informaltable frame="all">
36107 <tgroup cols="4" colsep="0" rowsep="0">
36108 <colspec colwidth="8*" align="left"/>
36109 <colspec colwidth="6*" align="center"/>
36110 <colspec colwidth="6*" align="center"/>
36111 <colspec colwidth="6*" align="right"/>
36112 <tbody>
36113 <row>
36114 <entry><option>allow_fail</option></entry>
36115 <entry>Use: <emphasis>redirect</emphasis></entry>
36116 <entry>Type: <emphasis>boolean</emphasis></entry>
36117 <entry>Default: <emphasis>false</emphasis></entry>
36118 </row>
36119 </tbody>
36120 </tgroup>
36121 </informaltable>
36122 <para>
36123 <indexterm role="concept">
36124 <primary>failing delivery</primary>
36125 <secondary>from filter</secondary>
36126 </indexterm>
36127 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
36128 and the <option>fail</option> command may be used in an Exim filter file.
36129 </para>
36130 <para>
36131 <indexterm role="option">
36132 <primary><option>allow_filter</option></primary>
36133 </indexterm>
36134 </para>
36135 <informaltable frame="all">
36136 <tgroup cols="4" colsep="0" rowsep="0">
36137 <colspec colwidth="8*" align="left"/>
36138 <colspec colwidth="6*" align="center"/>
36139 <colspec colwidth="6*" align="center"/>
36140 <colspec colwidth="6*" align="right"/>
36141 <tbody>
36142 <row>
36143 <entry><option>allow_filter</option></entry>
36144 <entry>Use: <emphasis>redirect</emphasis></entry>
36145 <entry>Type: <emphasis>boolean</emphasis></entry>
36146 <entry>Default: <emphasis>false</emphasis></entry>
36147 </row>
36148 </tbody>
36149 </tgroup>
36150 </informaltable>
36151 <para>
36152 <indexterm role="concept">
36153 <primary>filter</primary>
36154 <secondary>enabling use of</secondary>
36155 </indexterm>
36156 <indexterm role="concept">
36157 <primary>Sieve filter</primary>
36158 <secondary>enabling use of</secondary>
36159 </indexterm>
36160 Setting this option allows Exim to interpret redirection data that starts with
36161 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
36162 are some features of Exim filter files that some administrators may wish to
36163 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
36164 </para>
36165 <para>
36166 It is also possible to lock out Exim filters or Sieve filters while allowing
36167 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
36168 </para>
36169 <para>
36170 The filter is run using the uid and gid set by the generic <option>user</option> and
36171 <option>group</option> options. These take their defaults from the password data if
36172 <option>check_local_user</option> is set, so in the normal case of users&#x2019; personal filter
36173 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
36174 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
36175 </para>
36176 <para>
36177 <indexterm role="option">
36178 <primary><option>allow_freeze</option></primary>
36179 </indexterm>
36180 </para>
36181 <informaltable frame="all">
36182 <tgroup cols="4" colsep="0" rowsep="0">
36183 <colspec colwidth="8*" align="left"/>
36184 <colspec colwidth="6*" align="center"/>
36185 <colspec colwidth="6*" align="center"/>
36186 <colspec colwidth="6*" align="right"/>
36187 <tbody>
36188 <row>
36189 <entry><option>allow_freeze</option></entry>
36190 <entry>Use: <emphasis>redirect</emphasis></entry>
36191 <entry>Type: <emphasis>boolean</emphasis></entry>
36192 <entry>Default: <emphasis>false</emphasis></entry>
36193 </row>
36194 </tbody>
36195 </tgroup>
36196 </informaltable>
36197 <para>
36198 <indexterm role="concept">
36199 <primary>freezing messages</primary>
36200 <secondary>allowing in filter</secondary>
36201 </indexterm>
36202 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
36203 This command is more normally encountered in system filters, and is disabled by
36204 default for redirection filters because it isn&#x2019;t something you usually want to
36205 let ordinary users do.
36206 </para>
36207 <para>
36208 <indexterm role="option">
36209 <primary><option>check_ancestor</option></primary>
36210 </indexterm>
36211 </para>
36212 <informaltable frame="all">
36213 <tgroup cols="4" colsep="0" rowsep="0">
36214 <colspec colwidth="8*" align="left"/>
36215 <colspec colwidth="6*" align="center"/>
36216 <colspec colwidth="6*" align="center"/>
36217 <colspec colwidth="6*" align="right"/>
36218 <tbody>
36219 <row>
36220 <entry><option>check_ancestor</option></entry>
36221 <entry>Use: <emphasis>redirect</emphasis></entry>
36222 <entry>Type: <emphasis>boolean</emphasis></entry>
36223 <entry>Default: <emphasis>false</emphasis></entry>
36224 </row>
36225 </tbody>
36226 </tgroup>
36227 </informaltable>
36228 <para>
36229 This option is concerned with handling generated addresses that are the same
36230 as some address in the list of redirection ancestors of the current address.
36231 Although it is turned off by default in the code, it is set in the default
36232 configuration file for handling users&#x2019; <filename>.forward</filename> files. It is recommended
36233 for this use of the <command>redirect</command> router.
36234 </para>
36235 <para>
36236 When <option>check_ancestor</option> is set, if a generated address (including the domain)
36237 is the same as any ancestor of the current address, it is replaced by a copy of
36238 the current address. This helps in the case where local part A is aliased to B,
36239 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
36240 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
36241 <filename>&nbsp;jb/.forward</filename> contains:
36242 </para>
36243 <literallayout class="monospaced">
36244 \Joe.Bloggs, &lt;other item(s)&gt;
36245 </literallayout>
36246 <para>
36247 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
36248 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
36249 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
36250 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
36251 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
36252 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
36253 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
36254 original address. See also the <option>repeat_use</option> option below.
36255 </para>
36256 <para>
36257 <indexterm role="option">
36258 <primary><option>check_group</option></primary>
36259 </indexterm>
36260 </para>
36261 <informaltable frame="all">
36262 <tgroup cols="4" colsep="0" rowsep="0">
36263 <colspec colwidth="8*" align="left"/>
36264 <colspec colwidth="6*" align="center"/>
36265 <colspec colwidth="6*" align="center"/>
36266 <colspec colwidth="6*" align="right"/>
36267 <tbody>
36268 <row>
36269 <entry><option>check_group</option></entry>
36270 <entry>Use: <emphasis>redirect</emphasis></entry>
36271 <entry>Type: <emphasis>boolean</emphasis></entry>
36272 <entry>Default: <emphasis>see below</emphasis></entry>
36273 </row>
36274 </tbody>
36275 </tgroup>
36276 </informaltable>
36277 <para>
36278 When the <option>file</option> option is used, the group owner of the file is checked only
36279 when this option is set. The permitted groups are those listed in the
36280 <option>owngroups</option> option, together with the user&#x2019;s default group if
36281 <option>check_local_user</option> is set. If the file has the wrong group, routing is
36282 deferred. The default setting for this option is true if <option>check_local_user</option>
36283 is set and the <option>modemask</option> option permits the group write bit, or if the
36284 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
36285 </para>
36286 <para>
36287 <indexterm role="option">
36288 <primary><option>check_owner</option></primary>
36289 </indexterm>
36290 </para>
36291 <informaltable frame="all">
36292 <tgroup cols="4" colsep="0" rowsep="0">
36293 <colspec colwidth="8*" align="left"/>
36294 <colspec colwidth="6*" align="center"/>
36295 <colspec colwidth="6*" align="center"/>
36296 <colspec colwidth="6*" align="right"/>
36297 <tbody>
36298 <row>
36299 <entry><option>check_owner</option></entry>
36300 <entry>Use: <emphasis>redirect</emphasis></entry>
36301 <entry>Type: <emphasis>boolean</emphasis></entry>
36302 <entry>Default: <emphasis>see below</emphasis></entry>
36303 </row>
36304 </tbody>
36305 </tgroup>
36306 </informaltable>
36307 <para>
36308 When the <option>file</option> option is used, the owner of the file is checked only when
36309 this option is set. If <option>check_local_user</option> is set, the local user is
36310 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
36311 option. The default value for this option is true if <option>check_local_user</option> or
36312 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
36313 </para>
36314 <para>
36315 <indexterm role="option">
36316 <primary><option>data</option></primary>
36317 </indexterm>
36318 </para>
36319 <informaltable frame="all">
36320 <tgroup cols="4" colsep="0" rowsep="0">
36321 <colspec colwidth="8*" align="left"/>
36322 <colspec colwidth="6*" align="center"/>
36323 <colspec colwidth="6*" align="center"/>
36324 <colspec colwidth="6*" align="right"/>
36325 <tbody>
36326 <row>
36327 <entry><option>data</option></entry>
36328 <entry>Use: <emphasis>redirect</emphasis></entry>
36329 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36330 <entry>Default: <emphasis>unset</emphasis></entry>
36331 </row>
36332 </tbody>
36333 </tgroup>
36334 </informaltable>
36335 <para>
36336 This option is mutually exclusive with <option>file</option>. One or other of them must be
36337 set, but not both. The contents of <option>data</option> are expanded, and then used as the
36338 list of forwarding items, or as a set of filtering instructions. If the
36339 expansion is forced to fail, or the result is an empty string or a string that
36340 has no effect (consists entirely of comments), the router declines.
36341 </para>
36342 <para>
36343 When filtering instructions are used, the string must begin with <quote>#Exim
36344 filter</quote>, and all comments in the string, including this initial one, must be
36345 terminated with newline characters. For example:
36346 </para>
36347 <literallayout class="monospaced">
36348 data = #Exim filter\n\
36349        if $h_to: contains Exim then save $home/mail/exim endif
36350 </literallayout>
36351 <para>
36352 If you are reading the data from a database where newlines cannot be included,
36353 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
36354 choice into a newline.
36355 </para>
36356 <para>
36357 <indexterm role="option">
36358 <primary><option>directory_transport</option></primary>
36359 </indexterm>
36360 </para>
36361 <informaltable frame="all">
36362 <tgroup cols="4" colsep="0" rowsep="0">
36363 <colspec colwidth="8*" align="left"/>
36364 <colspec colwidth="6*" align="center"/>
36365 <colspec colwidth="6*" align="center"/>
36366 <colspec colwidth="6*" align="right"/>
36367 <tbody>
36368 <row>
36369 <entry><option>directory_transport</option></entry>
36370 <entry>Use: <emphasis>redirect</emphasis></entry>
36371 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36372 <entry>Default: <emphasis>unset</emphasis></entry>
36373 </row>
36374 </tbody>
36375 </tgroup>
36376 </informaltable>
36377 <para>
36378 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
36379 ending with a slash is specified as a new <quote>address</quote>. The transport used is
36380 specified by this option, which, after expansion, must be the name of a
36381 configured transport. This should normally be an <command>appendfile</command> transport.
36382 </para>
36383 <para>
36384 <indexterm role="option">
36385 <primary><option>file</option></primary>
36386 </indexterm>
36387 </para>
36388 <informaltable frame="all">
36389 <tgroup cols="4" colsep="0" rowsep="0">
36390 <colspec colwidth="8*" align="left"/>
36391 <colspec colwidth="6*" align="center"/>
36392 <colspec colwidth="6*" align="center"/>
36393 <colspec colwidth="6*" align="right"/>
36394 <tbody>
36395 <row>
36396 <entry><option>file</option></entry>
36397 <entry>Use: <emphasis>redirect</emphasis></entry>
36398 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36399 <entry>Default: <emphasis>unset</emphasis></entry>
36400 </row>
36401 </tbody>
36402 </tgroup>
36403 </informaltable>
36404 <para>
36405 This option specifies the name of a file that contains the redirection data. It
36406 is mutually exclusive with the <option>data</option> option. The string is expanded before
36407 use; if the expansion is forced to fail, the router declines. Other expansion
36408 failures cause delivery to be deferred. The result of a successful expansion
36409 must be an absolute path. The entire file is read and used as the redirection
36410 data. If the data is an empty string or a string that has no effect (consists
36411 entirely of comments), the router declines.
36412 </para>
36413 <para>
36414 <indexterm role="concept">
36415 <primary>NFS</primary>
36416 <secondary>checking for file existence</secondary>
36417 </indexterm>
36418 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
36419 runs a check on the containing directory,
36420 unless <option>ignore_enotdir</option> is true (see below).
36421 If the directory does not appear to exist, delivery is deferred. This can
36422 happen when users&#x2019; <filename>.forward</filename> files are in NFS-mounted directories, and there
36423 is a mount problem. If the containing directory does exist, but the file does
36424 not, the router declines.
36425 </para>
36426 <para>
36427 <indexterm role="option">
36428 <primary><option>file_transport</option></primary>
36429 </indexterm>
36430 </para>
36431 <informaltable frame="all">
36432 <tgroup cols="4" colsep="0" rowsep="0">
36433 <colspec colwidth="8*" align="left"/>
36434 <colspec colwidth="6*" align="center"/>
36435 <colspec colwidth="6*" align="center"/>
36436 <colspec colwidth="6*" align="right"/>
36437 <tbody>
36438 <row>
36439 <entry><option>file_transport</option></entry>
36440 <entry>Use: <emphasis>redirect</emphasis></entry>
36441 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36442 <entry>Default: <emphasis>unset</emphasis></entry>
36443 </row>
36444 </tbody>
36445 </tgroup>
36446 </informaltable>
36447 <para>
36448 <indexterm role="variable">
36449 <primary><varname>$address_file</varname></primary>
36450 </indexterm>
36451 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
36452 ending in a slash is specified as a new <quote>address</quote>. The transport used is
36453 specified by this option, which, after expansion, must be the name of a
36454 configured transport. This should normally be an <command>appendfile</command> transport. When
36455 it is running, the file name is in <varname>$address_file</varname>.
36456 </para>
36457 <para>
36458 <indexterm role="option">
36459 <primary><option>filter_prepend_home</option></primary>
36460 </indexterm>
36461 </para>
36462 <informaltable frame="all">
36463 <tgroup cols="4" colsep="0" rowsep="0">
36464 <colspec colwidth="8*" align="left"/>
36465 <colspec colwidth="6*" align="center"/>
36466 <colspec colwidth="6*" align="center"/>
36467 <colspec colwidth="6*" align="right"/>
36468 <tbody>
36469 <row>
36470 <entry><option>filter_prepend_home</option></entry>
36471 <entry>Use: <emphasis>redirect</emphasis></entry>
36472 <entry>Type: <emphasis>boolean</emphasis></entry>
36473 <entry>Default: <emphasis>true</emphasis></entry>
36474 </row>
36475 </tbody>
36476 </tgroup>
36477 </informaltable>
36478 <para>
36479 When this option is true, if a <command>save</command> command in an Exim filter specifies a
36480 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
36481 relative path. If this option is set false, this action does not happen. The
36482 relative path is then passed to the transport unmodified.
36483 </para>
36484 <para>
36485 <indexterm role="option">
36486 <primary><option>forbid_blackhole</option></primary>
36487 </indexterm>
36488 </para>
36489 <informaltable frame="all">
36490 <tgroup cols="4" colsep="0" rowsep="0">
36491 <colspec colwidth="8*" align="left"/>
36492 <colspec colwidth="6*" align="center"/>
36493 <colspec colwidth="6*" align="center"/>
36494 <colspec colwidth="6*" align="right"/>
36495 <tbody>
36496 <row>
36497 <entry><option>forbid_blackhole</option></entry>
36498 <entry>Use: <emphasis>redirect</emphasis></entry>
36499 <entry>Type: <emphasis>boolean</emphasis></entry>
36500 <entry>Default: <emphasis>false</emphasis></entry>
36501 </row>
36502 </tbody>
36503 </tgroup>
36504 </informaltable>
36505 <para>
36506 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
36507 redirection list.
36508 </para>
36509 <para>
36510 <indexterm role="option">
36511 <primary><option>forbid_exim_filter</option></primary>
36512 </indexterm>
36513 </para>
36514 <informaltable frame="all">
36515 <tgroup cols="4" colsep="0" rowsep="0">
36516 <colspec colwidth="8*" align="left"/>
36517 <colspec colwidth="6*" align="center"/>
36518 <colspec colwidth="6*" align="center"/>
36519 <colspec colwidth="6*" align="right"/>
36520 <tbody>
36521 <row>
36522 <entry><option>forbid_exim_filter</option></entry>
36523 <entry>Use: <emphasis>redirect</emphasis></entry>
36524 <entry>Type: <emphasis>boolean</emphasis></entry>
36525 <entry>Default: <emphasis>false</emphasis></entry>
36526 </row>
36527 </tbody>
36528 </tgroup>
36529 </informaltable>
36530 <para>
36531 If this option is set true, only Sieve filters are permitted when
36532 <option>allow_filter</option> is true.
36533 </para>
36534 <para>
36535 <indexterm role="option">
36536 <primary><option>forbid_file</option></primary>
36537 </indexterm>
36538 </para>
36539 <informaltable frame="all">
36540 <tgroup cols="4" colsep="0" rowsep="0">
36541 <colspec colwidth="8*" align="left"/>
36542 <colspec colwidth="6*" align="center"/>
36543 <colspec colwidth="6*" align="center"/>
36544 <colspec colwidth="6*" align="right"/>
36545 <tbody>
36546 <row>
36547 <entry><option>forbid_file</option></entry>
36548 <entry>Use: <emphasis>redirect</emphasis></entry>
36549 <entry>Type: <emphasis>boolean</emphasis></entry>
36550 <entry>Default: <emphasis>false</emphasis></entry>
36551 </row>
36552 </tbody>
36553 </tgroup>
36554 </informaltable>
36555 <para>
36556 <indexterm role="concept">
36557 <primary>delivery</primary>
36558 <secondary>to file; forbidding</secondary>
36559 </indexterm>
36560 <indexterm role="concept">
36561 <primary>Sieve filter</primary>
36562 <secondary>forbidding delivery to a file</secondary>
36563 </indexterm>
36564 <indexterm role="concept">
36565 <primary>Sieve filter</primary>
36566 <secondary><quote>keep</quote> facility; disabling</secondary>
36567 </indexterm>
36568 If this option is true, this router may not generate a new address that
36569 specifies delivery to a local file or directory, either from a filter or from a
36570 conventional forward file. This option is forced to be true if <option>one_time</option> is
36571 set. It applies to Sieve filters as well as to Exim filters, but if true, it
36572 locks out the Sieve&#x2019;s <quote>keep</quote> facility.
36573 </para>
36574 <para>
36575 <indexterm role="option">
36576 <primary><option>forbid_filter_dlfunc</option></primary>
36577 </indexterm>
36578 </para>
36579 <informaltable frame="all">
36580 <tgroup cols="4" colsep="0" rowsep="0">
36581 <colspec colwidth="8*" align="left"/>
36582 <colspec colwidth="6*" align="center"/>
36583 <colspec colwidth="6*" align="center"/>
36584 <colspec colwidth="6*" align="right"/>
36585 <tbody>
36586 <row>
36587 <entry><option>forbid_filter_dlfunc</option></entry>
36588 <entry>Use: <emphasis>redirect</emphasis></entry>
36589 <entry>Type: <emphasis>boolean</emphasis></entry>
36590 <entry>Default: <emphasis>false</emphasis></entry>
36591 </row>
36592 </tbody>
36593 </tgroup>
36594 </informaltable>
36595 <para>
36596 <indexterm role="concept">
36597 <primary>filter</primary>
36598 <secondary>locking out certain features</secondary>
36599 </indexterm>
36600 If this option is true, string expansions in Exim filters are not allowed to
36601 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
36602 functions.
36603 </para>
36604 <para>
36605 <indexterm role="option">
36606 <primary><option>forbid_filter_existstest</option></primary>
36607 </indexterm>
36608 </para>
36609 <informaltable frame="all">
36610 <tgroup cols="4" colsep="0" rowsep="0">
36611 <colspec colwidth="8*" align="left"/>
36612 <colspec colwidth="6*" align="center"/>
36613 <colspec colwidth="6*" align="center"/>
36614 <colspec colwidth="6*" align="right"/>
36615 <tbody>
36616 <row>
36617 <entry><option>forbid_filter_existstest</option></entry>
36618 <entry>Use: <emphasis>redirect</emphasis></entry>
36619 <entry>Type: <emphasis>boolean</emphasis></entry>
36620 <entry>Default: <emphasis>false</emphasis></entry>
36621 </row>
36622 </tbody>
36623 </tgroup>
36624 </informaltable>
36625 <para>
36626 <indexterm role="concept">
36627 <primary>expansion</primary>
36628 <secondary>statting a file</secondary>
36629 </indexterm>
36630 If this option is true, string expansions in Exim filters are not allowed to
36631 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
36632 </para>
36633 <para>
36634 <indexterm role="option">
36635 <primary><option>forbid_filter_logwrite</option></primary>
36636 </indexterm>
36637 </para>
36638 <informaltable frame="all">
36639 <tgroup cols="4" colsep="0" rowsep="0">
36640 <colspec colwidth="8*" align="left"/>
36641 <colspec colwidth="6*" align="center"/>
36642 <colspec colwidth="6*" align="center"/>
36643 <colspec colwidth="6*" align="right"/>
36644 <tbody>
36645 <row>
36646 <entry><option>forbid_filter_logwrite</option></entry>
36647 <entry>Use: <emphasis>redirect</emphasis></entry>
36648 <entry>Type: <emphasis>boolean</emphasis></entry>
36649 <entry>Default: <emphasis>false</emphasis></entry>
36650 </row>
36651 </tbody>
36652 </tgroup>
36653 </informaltable>
36654 <para>
36655 If this option is true, use of the logging facility in Exim filters is not
36656 permitted. Logging is in any case available only if the filter is being run
36657 under some unprivileged uid (which is normally the case for ordinary users&#x2019;
36658 <filename>.forward</filename> files).
36659 </para>
36660 <para>
36661 <indexterm role="option">
36662 <primary><option>forbid_filter_lookup</option></primary>
36663 </indexterm>
36664 </para>
36665 <informaltable frame="all">
36666 <tgroup cols="4" colsep="0" rowsep="0">
36667 <colspec colwidth="8*" align="left"/>
36668 <colspec colwidth="6*" align="center"/>
36669 <colspec colwidth="6*" align="center"/>
36670 <colspec colwidth="6*" align="right"/>
36671 <tbody>
36672 <row>
36673 <entry><option>forbid_filter_lookup</option></entry>
36674 <entry>Use: <emphasis>redirect</emphasis></entry>
36675 <entry>Type: <emphasis>boolean</emphasis></entry>
36676 <entry>Default: <emphasis>false</emphasis></entry>
36677 </row>
36678 </tbody>
36679 </tgroup>
36680 </informaltable>
36681 <para>
36682 If this option is true, string expansions in Exim filter files are not allowed
36683 to make use of <option>lookup</option> items.
36684 </para>
36685 <para>
36686 <indexterm role="option">
36687 <primary><option>forbid_filter_perl</option></primary>
36688 </indexterm>
36689 </para>
36690 <informaltable frame="all">
36691 <tgroup cols="4" colsep="0" rowsep="0">
36692 <colspec colwidth="8*" align="left"/>
36693 <colspec colwidth="6*" align="center"/>
36694 <colspec colwidth="6*" align="center"/>
36695 <colspec colwidth="6*" align="right"/>
36696 <tbody>
36697 <row>
36698 <entry><option>forbid_filter_perl</option></entry>
36699 <entry>Use: <emphasis>redirect</emphasis></entry>
36700 <entry>Type: <emphasis>boolean</emphasis></entry>
36701 <entry>Default: <emphasis>false</emphasis></entry>
36702 </row>
36703 </tbody>
36704 </tgroup>
36705 </informaltable>
36706 <para>
36707 This option has an effect only if Exim is built with embedded Perl support. If
36708 it is true, string expansions in Exim filter files are not allowed to make use
36709 of the embedded Perl support.
36710 </para>
36711 <para>
36712 <indexterm role="option">
36713 <primary><option>forbid_filter_readfile</option></primary>
36714 </indexterm>
36715 </para>
36716 <informaltable frame="all">
36717 <tgroup cols="4" colsep="0" rowsep="0">
36718 <colspec colwidth="8*" align="left"/>
36719 <colspec colwidth="6*" align="center"/>
36720 <colspec colwidth="6*" align="center"/>
36721 <colspec colwidth="6*" align="right"/>
36722 <tbody>
36723 <row>
36724 <entry><option>forbid_filter_readfile</option></entry>
36725 <entry>Use: <emphasis>redirect</emphasis></entry>
36726 <entry>Type: <emphasis>boolean</emphasis></entry>
36727 <entry>Default: <emphasis>false</emphasis></entry>
36728 </row>
36729 </tbody>
36730 </tgroup>
36731 </informaltable>
36732 <para>
36733 If this option is true, string expansions in Exim filter files are not allowed
36734 to make use of <option>readfile</option> items.
36735 </para>
36736 <para>
36737 <indexterm role="option">
36738 <primary><option>forbid_filter_readsocket</option></primary>
36739 </indexterm>
36740 </para>
36741 <informaltable frame="all">
36742 <tgroup cols="4" colsep="0" rowsep="0">
36743 <colspec colwidth="8*" align="left"/>
36744 <colspec colwidth="6*" align="center"/>
36745 <colspec colwidth="6*" align="center"/>
36746 <colspec colwidth="6*" align="right"/>
36747 <tbody>
36748 <row>
36749 <entry><option>forbid_filter_readsocket</option></entry>
36750 <entry>Use: <emphasis>redirect</emphasis></entry>
36751 <entry>Type: <emphasis>boolean</emphasis></entry>
36752 <entry>Default: <emphasis>false</emphasis></entry>
36753 </row>
36754 </tbody>
36755 </tgroup>
36756 </informaltable>
36757 <para>
36758 If this option is true, string expansions in Exim filter files are not allowed
36759 to make use of <option>readsocket</option> items.
36760 </para>
36761 <para>
36762 <indexterm role="option">
36763 <primary><option>forbid_filter_reply</option></primary>
36764 </indexterm>
36765 </para>
36766 <informaltable frame="all">
36767 <tgroup cols="4" colsep="0" rowsep="0">
36768 <colspec colwidth="8*" align="left"/>
36769 <colspec colwidth="6*" align="center"/>
36770 <colspec colwidth="6*" align="center"/>
36771 <colspec colwidth="6*" align="right"/>
36772 <tbody>
36773 <row>
36774 <entry><option>forbid_filter_reply</option></entry>
36775 <entry>Use: <emphasis>redirect</emphasis></entry>
36776 <entry>Type: <emphasis>boolean</emphasis></entry>
36777 <entry>Default: <emphasis>false</emphasis></entry>
36778 </row>
36779 </tbody>
36780 </tgroup>
36781 </informaltable>
36782 <para>
36783 If this option is true, this router may not generate an automatic reply
36784 message. Automatic replies can be generated only from Exim or Sieve filter
36785 files, not from traditional forward files. This option is forced to be true if
36786 <option>one_time</option> is set.
36787 </para>
36788 <para>
36789 <indexterm role="option">
36790 <primary><option>forbid_filter_run</option></primary>
36791 </indexterm>
36792 </para>
36793 <informaltable frame="all">
36794 <tgroup cols="4" colsep="0" rowsep="0">
36795 <colspec colwidth="8*" align="left"/>
36796 <colspec colwidth="6*" align="center"/>
36797 <colspec colwidth="6*" align="center"/>
36798 <colspec colwidth="6*" align="right"/>
36799 <tbody>
36800 <row>
36801 <entry><option>forbid_filter_run</option></entry>
36802 <entry>Use: <emphasis>redirect</emphasis></entry>
36803 <entry>Type: <emphasis>boolean</emphasis></entry>
36804 <entry>Default: <emphasis>false</emphasis></entry>
36805 </row>
36806 </tbody>
36807 </tgroup>
36808 </informaltable>
36809 <para>
36810 If this option is true, string expansions in Exim filter files are not allowed
36811 to make use of <option>run</option> items.
36812 </para>
36813 <para>
36814 <indexterm role="option">
36815 <primary><option>forbid_include</option></primary>
36816 </indexterm>
36817 </para>
36818 <informaltable frame="all">
36819 <tgroup cols="4" colsep="0" rowsep="0">
36820 <colspec colwidth="8*" align="left"/>
36821 <colspec colwidth="6*" align="center"/>
36822 <colspec colwidth="6*" align="center"/>
36823 <colspec colwidth="6*" align="right"/>
36824 <tbody>
36825 <row>
36826 <entry><option>forbid_include</option></entry>
36827 <entry>Use: <emphasis>redirect</emphasis></entry>
36828 <entry>Type: <emphasis>boolean</emphasis></entry>
36829 <entry>Default: <emphasis>false</emphasis></entry>
36830 </row>
36831 </tbody>
36832 </tgroup>
36833 </informaltable>
36834 <para>
36835 If this option is true, items of the form
36836 </para>
36837 <literallayout class="monospaced">
36838 :include:&lt;path name&gt;
36839 </literallayout>
36840 <para>
36841 are not permitted in non-filter redirection lists.
36842 </para>
36843 <para>
36844 <indexterm role="option">
36845 <primary><option>forbid_pipe</option></primary>
36846 </indexterm>
36847 </para>
36848 <informaltable frame="all">
36849 <tgroup cols="4" colsep="0" rowsep="0">
36850 <colspec colwidth="8*" align="left"/>
36851 <colspec colwidth="6*" align="center"/>
36852 <colspec colwidth="6*" align="center"/>
36853 <colspec colwidth="6*" align="right"/>
36854 <tbody>
36855 <row>
36856 <entry><option>forbid_pipe</option></entry>
36857 <entry>Use: <emphasis>redirect</emphasis></entry>
36858 <entry>Type: <emphasis>boolean</emphasis></entry>
36859 <entry>Default: <emphasis>false</emphasis></entry>
36860 </row>
36861 </tbody>
36862 </tgroup>
36863 </informaltable>
36864 <para>
36865 <indexterm role="concept">
36866 <primary>delivery</primary>
36867 <secondary>to pipe; forbidding</secondary>
36868 </indexterm>
36869 If this option is true, this router may not generate a new address which
36870 specifies delivery to a pipe, either from an Exim filter or from a conventional
36871 forward file. This option is forced to be true if <option>one_time</option> is set.
36872 </para>
36873 <para>
36874 <indexterm role="option">
36875 <primary><option>forbid_sieve_filter</option></primary>
36876 </indexterm>
36877 </para>
36878 <informaltable frame="all">
36879 <tgroup cols="4" colsep="0" rowsep="0">
36880 <colspec colwidth="8*" align="left"/>
36881 <colspec colwidth="6*" align="center"/>
36882 <colspec colwidth="6*" align="center"/>
36883 <colspec colwidth="6*" align="right"/>
36884 <tbody>
36885 <row>
36886 <entry><option>forbid_sieve_filter</option></entry>
36887 <entry>Use: <emphasis>redirect</emphasis></entry>
36888 <entry>Type: <emphasis>boolean</emphasis></entry>
36889 <entry>Default: <emphasis>false</emphasis></entry>
36890 </row>
36891 </tbody>
36892 </tgroup>
36893 </informaltable>
36894 <para>
36895 If this option is set true, only Exim filters are permitted when
36896 <option>allow_filter</option> is true.
36897 </para>
36898 <para>
36899 <indexterm role="concept">
36900 <primary>SMTP</primary>
36901 <secondary>error codes</secondary>
36902 </indexterm>
36903 <indexterm role="option">
36904 <primary><option>forbid_smtp_code</option></primary>
36905 </indexterm>
36906 </para>
36907 <informaltable frame="all">
36908 <tgroup cols="4" colsep="0" rowsep="0">
36909 <colspec colwidth="8*" align="left"/>
36910 <colspec colwidth="6*" align="center"/>
36911 <colspec colwidth="6*" align="center"/>
36912 <colspec colwidth="6*" align="right"/>
36913 <tbody>
36914 <row>
36915 <entry><option>forbid_smtp_code</option></entry>
36916 <entry>Use: <emphasis>redirect</emphasis></entry>
36917 <entry>Type: <emphasis>boolean</emphasis></entry>
36918 <entry>Default: <emphasis>false</emphasis></entry>
36919 </row>
36920 </tbody>
36921 </tgroup>
36922 </informaltable>
36923 <para>
36924 If this option is set true, any SMTP error codes that are present at the start
36925 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
36926 the default codes (451 and 550, respectively) are always used.
36927 </para>
36928 <para>
36929 <indexterm role="option">
36930 <primary><option>hide_child_in_errmsg</option></primary>
36931 </indexterm>
36932 </para>
36933 <informaltable frame="all">
36934 <tgroup cols="4" colsep="0" rowsep="0">
36935 <colspec colwidth="8*" align="left"/>
36936 <colspec colwidth="6*" align="center"/>
36937 <colspec colwidth="6*" align="center"/>
36938 <colspec colwidth="6*" align="right"/>
36939 <tbody>
36940 <row>
36941 <entry><option>hide_child_in_errmsg</option></entry>
36942 <entry>Use: <emphasis>redirect</emphasis></entry>
36943 <entry>Type: <emphasis>boolean</emphasis></entry>
36944 <entry>Default: <emphasis>false</emphasis></entry>
36945 </row>
36946 </tbody>
36947 </tgroup>
36948 </informaltable>
36949 <para>
36950 <indexterm role="concept">
36951 <primary>bounce message</primary>
36952 <secondary>redirection details; suppressing</secondary>
36953 </indexterm>
36954 If this option is true, it prevents Exim from quoting a child address if it
36955 generates a bounce or delay message for it. Instead it says <quote>an address
36956 generated from &lt;<emphasis>the top level address</emphasis>&gt;</quote>. Of course, this applies only to
36957 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
36958 bounce may well quote the generated address.
36959 </para>
36960 <para>
36961 <indexterm role="option">
36962 <primary><option>ignore_eacces</option></primary>
36963 </indexterm>
36964 </para>
36965 <informaltable frame="all">
36966 <tgroup cols="4" colsep="0" rowsep="0">
36967 <colspec colwidth="8*" align="left"/>
36968 <colspec colwidth="6*" align="center"/>
36969 <colspec colwidth="6*" align="center"/>
36970 <colspec colwidth="6*" align="right"/>
36971 <tbody>
36972 <row>
36973 <entry><option>ignore_eacces</option></entry>
36974 <entry>Use: <emphasis>redirect</emphasis></entry>
36975 <entry>Type: <emphasis>boolean</emphasis></entry>
36976 <entry>Default: <emphasis>false</emphasis></entry>
36977 </row>
36978 </tbody>
36979 </tgroup>
36980 </informaltable>
36981 <para>
36982 <indexterm role="concept">
36983 <primary>EACCES</primary>
36984 </indexterm>
36985 If this option is set and an attempt to open a redirection file yields the
36986 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
36987 file did not exist.
36988 </para>
36989 <para>
36990 <indexterm role="option">
36991 <primary><option>ignore_enotdir</option></primary>
36992 </indexterm>
36993 </para>
36994 <informaltable frame="all">
36995 <tgroup cols="4" colsep="0" rowsep="0">
36996 <colspec colwidth="8*" align="left"/>
36997 <colspec colwidth="6*" align="center"/>
36998 <colspec colwidth="6*" align="center"/>
36999 <colspec colwidth="6*" align="right"/>
37000 <tbody>
37001 <row>
37002 <entry><option>ignore_enotdir</option></entry>
37003 <entry>Use: <emphasis>redirect</emphasis></entry>
37004 <entry>Type: <emphasis>boolean</emphasis></entry>
37005 <entry>Default: <emphasis>false</emphasis></entry>
37006 </row>
37007 </tbody>
37008 </tgroup>
37009 </informaltable>
37010 <para>
37011 <indexterm role="concept">
37012 <primary>ENOTDIR</primary>
37013 </indexterm>
37014 If this option is set and an attempt to open a redirection file yields the
37015 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
37016 router behaves as if the file did not exist.
37017 </para>
37018 <para>
37019 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
37020 router that has the <option>file</option> option set discovers that the file does not exist
37021 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
37022 against unmounted NFS directories. If the parent can not be statted, delivery
37023 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
37024 is set, because that option tells Exim to ignore <quote>something on the path is not
37025 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
37026 that some operating systems give ENOENT where others give ENOTDIR.
37027 </para>
37028 <para>
37029 <indexterm role="option">
37030 <primary><option>include_directory</option></primary>
37031 </indexterm>
37032 </para>
37033 <informaltable frame="all">
37034 <tgroup cols="4" colsep="0" rowsep="0">
37035 <colspec colwidth="8*" align="left"/>
37036 <colspec colwidth="6*" align="center"/>
37037 <colspec colwidth="6*" align="center"/>
37038 <colspec colwidth="6*" align="right"/>
37039 <tbody>
37040 <row>
37041 <entry><option>include_directory</option></entry>
37042 <entry>Use: <emphasis>redirect</emphasis></entry>
37043 <entry>Type: <emphasis>string</emphasis></entry>
37044 <entry>Default: <emphasis>unset</emphasis></entry>
37045 </row>
37046 </tbody>
37047 </tgroup>
37048 </informaltable>
37049 <para>
37050 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
37051 redirection list must start with this directory.
37052 </para>
37053 <para>
37054 <indexterm role="option">
37055 <primary><option>modemask</option></primary>
37056 </indexterm>
37057 </para>
37058 <informaltable frame="all">
37059 <tgroup cols="4" colsep="0" rowsep="0">
37060 <colspec colwidth="8*" align="left"/>
37061 <colspec colwidth="6*" align="center"/>
37062 <colspec colwidth="6*" align="center"/>
37063 <colspec colwidth="6*" align="right"/>
37064 <tbody>
37065 <row>
37066 <entry><option>modemask</option></entry>
37067 <entry>Use: <emphasis>redirect</emphasis></entry>
37068 <entry>Type: <emphasis>octal integer</emphasis></entry>
37069 <entry>Default: <emphasis>022</emphasis></entry>
37070 </row>
37071 </tbody>
37072 </tgroup>
37073 </informaltable>
37074 <para>
37075 This specifies mode bits which must not be set for a file specified by the
37076 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
37077 </para>
37078 <para>
37079 <indexterm role="option">
37080 <primary><option>one_time</option></primary>
37081 </indexterm>
37082 </para>
37083 <informaltable frame="all">
37084 <tgroup cols="4" colsep="0" rowsep="0">
37085 <colspec colwidth="8*" align="left"/>
37086 <colspec colwidth="6*" align="center"/>
37087 <colspec colwidth="6*" align="center"/>
37088 <colspec colwidth="6*" align="right"/>
37089 <tbody>
37090 <row>
37091 <entry><option>one_time</option></entry>
37092 <entry>Use: <emphasis>redirect</emphasis></entry>
37093 <entry>Type: <emphasis>boolean</emphasis></entry>
37094 <entry>Default: <emphasis>false</emphasis></entry>
37095 </row>
37096 </tbody>
37097 </tgroup>
37098 </informaltable>
37099 <para>
37100 <indexterm role="concept">
37101 <primary>one-time aliasing/forwarding expansion</primary>
37102 </indexterm>
37103 <indexterm role="concept">
37104 <primary>alias file</primary>
37105 <secondary>one-time expansion</secondary>
37106 </indexterm>
37107 <indexterm role="concept">
37108 <primary>forward file</primary>
37109 <secondary>one-time expansion</secondary>
37110 </indexterm>
37111 <indexterm role="concept">
37112 <primary>mailing lists</primary>
37113 <secondary>one-time expansion</secondary>
37114 </indexterm>
37115 <indexterm role="concept">
37116 <primary>address redirection</primary>
37117 <secondary>one-time expansion</secondary>
37118 </indexterm>
37119 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
37120 files each time it tries to deliver a message causes a problem when one or more
37121 of the generated addresses fails be delivered at the first attempt. The problem
37122 is not one of duplicate delivery &ndash; Exim is clever enough to handle that &ndash;
37123 but of what happens when the redirection list changes during the time that the
37124 message is on Exim&#x2019;s queue. This is particularly true in the case of mailing
37125 lists, where new subscribers might receive copies of messages that were posted
37126 before they subscribed.
37127 </para>
37128 <para>
37129 If <option>one_time</option> is set and any addresses generated by the router fail to
37130 deliver at the first attempt, the failing addresses are added to the message as
37131 <quote>top level</quote> addresses, and the parent address that generated them is marked
37132 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
37133 attempt.
37134 </para>
37135 <para>
37136 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
37137 router would be lost if delivery did not succeed at the first attempt. For this
37138 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
37139 permitted when <option>one_time</option> is set.
37140 </para>
37141 <para>
37142 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
37143 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
37144 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
37145 </para>
37146 <para>
37147 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
37148 <option>one_time</option>.
37149 </para>
37150 <para>
37151 The original top-level address is remembered with each of the generated
37152 addresses, and is output in any log messages. However, any intermediate parent
37153 addresses are not recorded. This makes a difference to the log only if
37154 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
37155 typically be used for mailing lists, where there is normally just one level of
37156 expansion.
37157 </para>
37158 <para>
37159 <indexterm role="option">
37160 <primary><option>owners</option></primary>
37161 </indexterm>
37162 </para>
37163 <informaltable frame="all">
37164 <tgroup cols="4" colsep="0" rowsep="0">
37165 <colspec colwidth="8*" align="left"/>
37166 <colspec colwidth="6*" align="center"/>
37167 <colspec colwidth="6*" align="center"/>
37168 <colspec colwidth="6*" align="right"/>
37169 <tbody>
37170 <row>
37171 <entry><option>owners</option></entry>
37172 <entry>Use: <emphasis>redirect</emphasis></entry>
37173 <entry>Type: <emphasis>string list</emphasis></entry>
37174 <entry>Default: <emphasis>unset</emphasis></entry>
37175 </row>
37176 </tbody>
37177 </tgroup>
37178 </informaltable>
37179 <para>
37180 <indexterm role="concept">
37181 <primary>ownership</primary>
37182 <secondary>alias file</secondary>
37183 </indexterm>
37184 <indexterm role="concept">
37185 <primary>ownership</primary>
37186 <secondary>forward file</secondary>
37187 </indexterm>
37188 <indexterm role="concept">
37189 <primary>alias file</primary>
37190 <secondary>ownership</secondary>
37191 </indexterm>
37192 <indexterm role="concept">
37193 <primary>forward file</primary>
37194 <secondary>ownership</secondary>
37195 </indexterm>
37196 This specifies a list of permitted owners for the file specified by <option>file</option>.
37197 This list is in addition to the local user when <option>check_local_user</option> is set.
37198 See <option>check_owner</option> above.
37199 </para>
37200 <para>
37201 <indexterm role="option">
37202 <primary><option>owngroups</option></primary>
37203 </indexterm>
37204 </para>
37205 <informaltable frame="all">
37206 <tgroup cols="4" colsep="0" rowsep="0">
37207 <colspec colwidth="8*" align="left"/>
37208 <colspec colwidth="6*" align="center"/>
37209 <colspec colwidth="6*" align="center"/>
37210 <colspec colwidth="6*" align="right"/>
37211 <tbody>
37212 <row>
37213 <entry><option>owngroups</option></entry>
37214 <entry>Use: <emphasis>redirect</emphasis></entry>
37215 <entry>Type: <emphasis>string list</emphasis></entry>
37216 <entry>Default: <emphasis>unset</emphasis></entry>
37217 </row>
37218 </tbody>
37219 </tgroup>
37220 </informaltable>
37221 <para>
37222 This specifies a list of permitted groups for the file specified by <option>file</option>.
37223 The list is in addition to the local user&#x2019;s primary group when
37224 <option>check_local_user</option> is set. See <option>check_group</option> above.
37225 </para>
37226 <para>
37227 <indexterm role="option">
37228 <primary><option>pipe_transport</option></primary>
37229 </indexterm>
37230 </para>
37231 <informaltable frame="all">
37232 <tgroup cols="4" colsep="0" rowsep="0">
37233 <colspec colwidth="8*" align="left"/>
37234 <colspec colwidth="6*" align="center"/>
37235 <colspec colwidth="6*" align="center"/>
37236 <colspec colwidth="6*" align="right"/>
37237 <tbody>
37238 <row>
37239 <entry><option>pipe_transport</option></entry>
37240 <entry>Use: <emphasis>redirect</emphasis></entry>
37241 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37242 <entry>Default: <emphasis>unset</emphasis></entry>
37243 </row>
37244 </tbody>
37245 </tgroup>
37246 </informaltable>
37247 <para>
37248 <indexterm role="variable">
37249 <primary><varname>$address_pipe</varname></primary>
37250 </indexterm>
37251 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
37252 starting with a vertical bar character is specified as a new <quote>address</quote>. The
37253 transport used is specified by this option, which, after expansion, must be the
37254 name of a configured transport. This should normally be a <command>pipe</command> transport.
37255 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
37256 </para>
37257 <para>
37258 <indexterm role="option">
37259 <primary><option>qualify_domain</option></primary>
37260 </indexterm>
37261 </para>
37262 <informaltable frame="all">
37263 <tgroup cols="4" colsep="0" rowsep="0">
37264 <colspec colwidth="8*" align="left"/>
37265 <colspec colwidth="6*" align="center"/>
37266 <colspec colwidth="6*" align="center"/>
37267 <colspec colwidth="6*" align="right"/>
37268 <tbody>
37269 <row>
37270 <entry><option>qualify_domain</option></entry>
37271 <entry>Use: <emphasis>redirect</emphasis></entry>
37272 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37273 <entry>Default: <emphasis>unset</emphasis></entry>
37274 </row>
37275 </tbody>
37276 </tgroup>
37277 </informaltable>
37278 <para>
37279 <indexterm role="variable">
37280 <primary><varname>$qualify_recipient</varname></primary>
37281 </indexterm>
37282 If this option is set, and an unqualified address (one without a domain) is
37283 generated, and that address would normally be qualified by the global setting
37284 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
37285 expanding this string. If the expansion fails, the router declines. If you want
37286 to revert to the default, you can have the expansion generate
37287 <varname>$qualify_recipient</varname>.
37288 </para>
37289 <para>
37290 This option applies to all unqualified addresses generated by Exim filters,
37291 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
37292 not preceded by a backslash. Sieve filters cannot generate unqualified
37293 addresses.
37294 </para>
37295 <para>
37296 <indexterm role="option">
37297 <primary><option>qualify_preserve_domain</option></primary>
37298 </indexterm>
37299 </para>
37300 <informaltable frame="all">
37301 <tgroup cols="4" colsep="0" rowsep="0">
37302 <colspec colwidth="8*" align="left"/>
37303 <colspec colwidth="6*" align="center"/>
37304 <colspec colwidth="6*" align="center"/>
37305 <colspec colwidth="6*" align="right"/>
37306 <tbody>
37307 <row>
37308 <entry><option>qualify_preserve_domain</option></entry>
37309 <entry>Use: <emphasis>redirect</emphasis></entry>
37310 <entry>Type: <emphasis>boolean</emphasis></entry>
37311 <entry>Default: <emphasis>false</emphasis></entry>
37312 </row>
37313 </tbody>
37314 </tgroup>
37315 </informaltable>
37316 <para>
37317 <indexterm role="concept">
37318 <primary>domain</primary>
37319 <secondary>in redirection; preserving</secondary>
37320 </indexterm>
37321 <indexterm role="concept">
37322 <primary>preserving domain in redirection</primary>
37323 </indexterm>
37324 <indexterm role="concept">
37325 <primary>address redirection</primary>
37326 <secondary>domain; preserving</secondary>
37327 </indexterm>
37328 If this option is set, the router&#x2019;s local <option>qualify_domain</option> option must not be
37329 set (a configuration error occurs if it is). If an unqualified address (one
37330 without a domain) is generated, it is qualified with the domain of the parent
37331 address (the immediately preceding ancestor) instead of the global
37332 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
37333 this applies whether or not the address is preceded by a backslash.
37334 </para>
37335 <para>
37336 <indexterm role="option">
37337 <primary><option>repeat_use</option></primary>
37338 </indexterm>
37339 </para>
37340 <informaltable frame="all">
37341 <tgroup cols="4" colsep="0" rowsep="0">
37342 <colspec colwidth="8*" align="left"/>
37343 <colspec colwidth="6*" align="center"/>
37344 <colspec colwidth="6*" align="center"/>
37345 <colspec colwidth="6*" align="right"/>
37346 <tbody>
37347 <row>
37348 <entry><option>repeat_use</option></entry>
37349 <entry>Use: <emphasis>redirect</emphasis></entry>
37350 <entry>Type: <emphasis>boolean</emphasis></entry>
37351 <entry>Default: <emphasis>true</emphasis></entry>
37352 </row>
37353 </tbody>
37354 </tgroup>
37355 </informaltable>
37356 <para>
37357 If this option is set false, the router is skipped for a child address that has
37358 any ancestor that was routed by this router. This test happens before any of
37359 the other preconditions are tested. Exim&#x2019;s default anti-looping rules skip
37360 only when the ancestor is the same as the current address. See also
37361 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
37362 </para>
37363 <para>
37364 <indexterm role="option">
37365 <primary><option>reply_transport</option></primary>
37366 </indexterm>
37367 </para>
37368 <informaltable frame="all">
37369 <tgroup cols="4" colsep="0" rowsep="0">
37370 <colspec colwidth="8*" align="left"/>
37371 <colspec colwidth="6*" align="center"/>
37372 <colspec colwidth="6*" align="center"/>
37373 <colspec colwidth="6*" align="right"/>
37374 <tbody>
37375 <row>
37376 <entry><option>reply_transport</option></entry>
37377 <entry>Use: <emphasis>redirect</emphasis></entry>
37378 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37379 <entry>Default: <emphasis>unset</emphasis></entry>
37380 </row>
37381 </tbody>
37382 </tgroup>
37383 </informaltable>
37384 <para>
37385 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
37386 <option>vacation</option> command is used in a filter file. The transport used is specified
37387 by this option, which, after expansion, must be the name of a configured
37388 transport. This should normally be an <command>autoreply</command> transport. Other transports
37389 are unlikely to do anything sensible or useful.
37390 </para>
37391 <para>
37392 <indexterm role="option">
37393 <primary><option>rewrite</option></primary>
37394 </indexterm>
37395 </para>
37396 <informaltable frame="all">
37397 <tgroup cols="4" colsep="0" rowsep="0">
37398 <colspec colwidth="8*" align="left"/>
37399 <colspec colwidth="6*" align="center"/>
37400 <colspec colwidth="6*" align="center"/>
37401 <colspec colwidth="6*" align="right"/>
37402 <tbody>
37403 <row>
37404 <entry><option>rewrite</option></entry>
37405 <entry>Use: <emphasis>redirect</emphasis></entry>
37406 <entry>Type: <emphasis>boolean</emphasis></entry>
37407 <entry>Default: <emphasis>true</emphasis></entry>
37408 </row>
37409 </tbody>
37410 </tgroup>
37411 </informaltable>
37412 <para>
37413 <indexterm role="concept">
37414 <primary>address redirection</primary>
37415 <secondary>disabling rewriting</secondary>
37416 </indexterm>
37417 If this option is set false, addresses generated by the router are not
37418 subject to address rewriting. Otherwise, they are treated like new addresses
37419 and are rewritten according to the global rewriting rules.
37420 </para>
37421 <para>
37422 <indexterm role="option">
37423 <primary><option>sieve_subaddress</option></primary>
37424 </indexterm>
37425 </para>
37426 <informaltable frame="all">
37427 <tgroup cols="4" colsep="0" rowsep="0">
37428 <colspec colwidth="8*" align="left"/>
37429 <colspec colwidth="6*" align="center"/>
37430 <colspec colwidth="6*" align="center"/>
37431 <colspec colwidth="6*" align="right"/>
37432 <tbody>
37433 <row>
37434 <entry><option>sieve_subaddress</option></entry>
37435 <entry>Use: <emphasis>redirect</emphasis></entry>
37436 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37437 <entry>Default: <emphasis>unset</emphasis></entry>
37438 </row>
37439 </tbody>
37440 </tgroup>
37441 </informaltable>
37442 <para>
37443 The value of this option is passed to a Sieve filter to specify the
37444 :subaddress part of an address.
37445 </para>
37446 <para>
37447 <indexterm role="option">
37448 <primary><option>sieve_useraddress</option></primary>
37449 </indexterm>
37450 </para>
37451 <informaltable frame="all">
37452 <tgroup cols="4" colsep="0" rowsep="0">
37453 <colspec colwidth="8*" align="left"/>
37454 <colspec colwidth="6*" align="center"/>
37455 <colspec colwidth="6*" align="center"/>
37456 <colspec colwidth="6*" align="right"/>
37457 <tbody>
37458 <row>
37459 <entry><option>sieve_useraddress</option></entry>
37460 <entry>Use: <emphasis>redirect</emphasis></entry>
37461 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37462 <entry>Default: <emphasis>unset</emphasis></entry>
37463 </row>
37464 </tbody>
37465 </tgroup>
37466 </informaltable>
37467 <para>
37468 The value of this option is passed to a Sieve filter to specify the :user part
37469 of an address. However, if it is unset, the entire original local part
37470 (including any prefix or suffix) is used for :user.
37471 </para>
37472 <para>
37473 <indexterm role="option">
37474 <primary><option>sieve_vacation_directory</option></primary>
37475 </indexterm>
37476 </para>
37477 <informaltable frame="all">
37478 <tgroup cols="4" colsep="0" rowsep="0">
37479 <colspec colwidth="8*" align="left"/>
37480 <colspec colwidth="6*" align="center"/>
37481 <colspec colwidth="6*" align="center"/>
37482 <colspec colwidth="6*" align="right"/>
37483 <tbody>
37484 <row>
37485 <entry><option>sieve_vacation_directory</option></entry>
37486 <entry>Use: <emphasis>redirect</emphasis></entry>
37487 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37488 <entry>Default: <emphasis>unset</emphasis></entry>
37489 </row>
37490 </tbody>
37491 </tgroup>
37492 </informaltable>
37493 <para>
37494 <indexterm role="concept">
37495 <primary>Sieve filter</primary>
37496 <secondary>vacation directory</secondary>
37497 </indexterm>
37498 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
37499 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
37500 (do not put anything else in that directory), and ensure that the
37501 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
37502 needs their own directory; Exim will create it if necessary.
37503 </para>
37504 <para>
37505 <indexterm role="option">
37506 <primary><option>skip_syntax_errors</option></primary>
37507 </indexterm>
37508 </para>
37509 <informaltable frame="all">
37510 <tgroup cols="4" colsep="0" rowsep="0">
37511 <colspec colwidth="8*" align="left"/>
37512 <colspec colwidth="6*" align="center"/>
37513 <colspec colwidth="6*" align="center"/>
37514 <colspec colwidth="6*" align="right"/>
37515 <tbody>
37516 <row>
37517 <entry><option>skip_syntax_errors</option></entry>
37518 <entry>Use: <emphasis>redirect</emphasis></entry>
37519 <entry>Type: <emphasis>boolean</emphasis></entry>
37520 <entry>Default: <emphasis>false</emphasis></entry>
37521 </row>
37522 </tbody>
37523 </tgroup>
37524 </informaltable>
37525 <para>
37526 <indexterm role="concept">
37527 <primary>forward file</primary>
37528 <secondary>broken</secondary>
37529 </indexterm>
37530 <indexterm role="concept">
37531 <primary>address redirection</primary>
37532 <secondary>broken files</secondary>
37533 </indexterm>
37534 <indexterm role="concept">
37535 <primary>alias file</primary>
37536 <secondary>broken</secondary>
37537 </indexterm>
37538 <indexterm role="concept">
37539 <primary>broken alias or forward files</primary>
37540 </indexterm>
37541 <indexterm role="concept">
37542 <primary>ignoring faulty addresses</primary>
37543 </indexterm>
37544 <indexterm role="concept">
37545 <primary>skipping faulty addresses</primary>
37546 </indexterm>
37547 <indexterm role="concept">
37548 <primary>error</primary>
37549 <secondary>skipping bad syntax</secondary>
37550 </indexterm>
37551 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
37552 non-filter redirection data are skipped, and each failing address is logged. If
37553 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
37554 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
37555 are expanded and placed at the head of the error message generated by
37556 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
37557 be the same address as the generic <option>errors_to</option> option. The
37558 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
37559 </para>
37560 <para>
37561 If all the addresses in a redirection list are skipped because of syntax
37562 errors, the router declines to handle the original address, and it is passed to
37563 the following routers.
37564 </para>
37565 <para>
37566 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
37567 error in the filter causes filtering to be abandoned without any action being
37568 taken. The incident is logged, and the router declines to handle the address,
37569 so it is passed to the following routers.
37570 </para>
37571 <para>
37572 <indexterm role="concept">
37573 <primary>Sieve filter</primary>
37574 <secondary>syntax errors in</secondary>
37575 </indexterm>
37576 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
37577 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
37578 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
37579 </para>
37580 <para>
37581 <option>skip_syntax_errors</option> can be used to specify that errors in users&#x2019; forward
37582 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
37583 option, used with an address that does not get redirected, can be used to
37584 notify users of these errors, by means of a router like this:
37585 </para>
37586 <literallayout class="monospaced">
37587 userforward:
37588   driver = redirect
37589   allow_filter
37590   check_local_user
37591   file = $home/.forward
37592   file_transport = address_file
37593   pipe_transport = address_pipe
37594   reply_transport = address_reply
37595   no_verify
37596   skip_syntax_errors
37597   syntax_errors_to = real-$local_part@$domain
37598   syntax_errors_text = \
37599    This is an automatically generated message. An error has\n\
37600    been found in your .forward file. Details of the error are\n\
37601    reported below. While this error persists, you will receive\n\
37602    a copy of this message for every message that is addressed\n\
37603    to you. If your .forward file is a filter file, or if it is\n\
37604    a non-filter file containing no valid forwarding addresses,\n\
37605    a copy of each incoming message will be put in your normal\n\
37606    mailbox. If a non-filter file contains at least one valid\n\
37607    forwarding address, forwarding to the valid addresses will\n\
37608    happen, and those will be the only deliveries that occur.
37609 </literallayout>
37610 <para>
37611 You also need a router to ensure that local addresses that are prefixed by
37612 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
37613 put this immediately before the <command>userforward</command> router:
37614 </para>
37615 <literallayout class="monospaced">
37616 real_localuser:
37617   driver = accept
37618   check_local_user
37619   local_part_prefix = real-
37620   transport = local_delivery
37621 </literallayout>
37622 <para>
37623 For security, it would probably be a good idea to restrict the use of this
37624 router to locally-generated messages, using a condition such as this:
37625 </para>
37626 <literallayout class="monospaced">
37627   condition = ${if match {$sender_host_address}\
37628                          {\N^(|127\.0\.0\.1)$\N}}
37629 </literallayout>
37630 <para>
37631 <indexterm role="option">
37632 <primary><option>syntax_errors_text</option></primary>
37633 </indexterm>
37634 </para>
37635 <informaltable frame="all">
37636 <tgroup cols="4" colsep="0" rowsep="0">
37637 <colspec colwidth="8*" align="left"/>
37638 <colspec colwidth="6*" align="center"/>
37639 <colspec colwidth="6*" align="center"/>
37640 <colspec colwidth="6*" align="right"/>
37641 <tbody>
37642 <row>
37643 <entry><option>syntax_errors_text</option></entry>
37644 <entry>Use: <emphasis>redirect</emphasis></entry>
37645 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37646 <entry>Default: <emphasis>unset</emphasis></entry>
37647 </row>
37648 </tbody>
37649 </tgroup>
37650 </informaltable>
37651 <para>
37652 See <option>skip_syntax_errors</option> above.
37653 </para>
37654 <para>
37655 <indexterm role="option">
37656 <primary><option>syntax_errors_to</option></primary>
37657 </indexterm>
37658 </para>
37659 <informaltable frame="all">
37660 <tgroup cols="4" colsep="0" rowsep="0">
37661 <colspec colwidth="8*" align="left"/>
37662 <colspec colwidth="6*" align="center"/>
37663 <colspec colwidth="6*" align="center"/>
37664 <colspec colwidth="6*" align="right"/>
37665 <tbody>
37666 <row>
37667 <entry><option>syntax_errors_to</option></entry>
37668 <entry>Use: <emphasis>redirect</emphasis></entry>
37669 <entry>Type: <emphasis>string</emphasis></entry>
37670 <entry>Default: <emphasis>unset</emphasis></entry>
37671 </row>
37672 </tbody>
37673 </tgroup>
37674 </informaltable>
37675 <para>
37676 See <option>skip_syntax_errors</option> above.
37677 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
37678 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
37679 </para>
37680 </section>
37681 </chapter>
37682
37683 <chapter id="CHAPenvironment">
37684 <title>Environment for running local transports</title>
37685 <titleabbrev>Environment for local transports</titleabbrev>
37686 <para>
37687 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
37688 <primary>local transports</primary>
37689 <secondary>environment for</secondary>
37690 </indexterm>
37691 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
37692 <primary>environment for local transports</primary>
37693 </indexterm>
37694 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
37695 <primary>transport</primary>
37696 <secondary>local; environment for</secondary>
37697 </indexterm>
37698 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
37699 transport can be thought of as similar to a pipe.) Exim always runs transports
37700 in subprocesses, under specified uids and gids. Typical deliveries to local
37701 mailboxes run under the uid and gid of the local user.
37702 </para>
37703 <para>
37704 Exim also sets a specific current directory while running the transport; for
37705 some transports a home directory setting is also relevant. The <command>pipe</command>
37706 transport is the only one that sets up environment variables; see section
37707 <xref linkend="SECTpipeenv"/> for details.
37708 </para>
37709 <para>
37710 The values used for the uid, gid, and the directories may come from several
37711 different places. In many cases, the router that handles the address associates
37712 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
37713 or <option>user</option> options. However, values may also be given in the transport&#x2019;s own
37714 configuration, and these override anything that comes from the router.
37715 </para>
37716 <section id="SECID131">
37717 <title>Concurrent deliveries</title>
37718 <para>
37719 <indexterm role="concept">
37720 <primary>concurrent deliveries</primary>
37721 </indexterm>
37722 <indexterm role="concept">
37723 <primary>simultaneous deliveries</primary>
37724 </indexterm>
37725 If two different messages for the same local recipient arrive more or less
37726 simultaneously, the two delivery processes are likely to run concurrently. When
37727 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
37728 rules to stop concurrent processes from writing to the same file at the same
37729 time.
37730 </para>
37731 <para>
37732 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
37733 locking that is needed. Here is a silly example:
37734 </para>
37735 <literallayout class="monospaced">
37736 my_transport:
37737   driver = pipe
37738   command = /bin/sh -c 'cat &gt;&gt;/some/file'
37739 </literallayout>
37740 <para>
37741 This is supposed to write the message at the end of the file. However, if two
37742 messages arrive at the same time, the file will be scrambled. You can use the
37743 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
37744 file using the same algorithm that Exim itself uses.
37745 </para>
37746 </section>
37747 <section id="SECTenvuidgid">
37748 <title>Uids and gids</title>
37749 <para>
37750 <indexterm role="concept">
37751 <primary>local transports</primary>
37752 <secondary>uid and gid</secondary>
37753 </indexterm>
37754 <indexterm role="concept">
37755 <primary>transport</primary>
37756 <secondary>local; uid and gid</secondary>
37757 </indexterm>
37758 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
37759 overrides any group that the router set in the address, even if <option>user</option> is not
37760 set for the transport. This makes it possible, for example, to run local mail
37761 delivery under the uid of the recipient (set by the router), but in a special
37762 group (set by the transport). For example:
37763 </para>
37764 <literallayout class="monospaced">
37765 # Routers ...
37766 # User/group are set by check_local_user in this router
37767 local_users:
37768   driver = accept
37769   check_local_user
37770   transport = group_delivery
37771
37772 # Transports ...
37773 # This transport overrides the group
37774 group_delivery:
37775   driver = appendfile
37776   file = /var/spool/mail/$local_part
37777   group = mail
37778 </literallayout>
37779 <para>
37780 If <option>user</option> is set for a transport, its value overrides what is set in the
37781 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
37782 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
37783 set.
37784 </para>
37785 <para>
37786 <indexterm role="option">
37787 <primary><option>initgroups</option></primary>
37788 </indexterm>
37789 When the uid is taken from the transport&#x2019;s configuration, the <function>initgroups()</function>
37790 function is called for the groups associated with that uid if the
37791 <option>initgroups</option> option is set for the transport. When the uid is not specified
37792 by the transport, but is associated with the address by a router, the option
37793 for calling <function>initgroups()</function> is taken from the router configuration.
37794 </para>
37795 <para>
37796 <indexterm role="concept">
37797 <primary><command>pipe</command> transport</primary>
37798 <secondary>uid for</secondary>
37799 </indexterm>
37800 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
37801 is set and <option>user</option> is not set, the uid of the process that called Exim to
37802 receive the message is used, and if <option>group</option> is not set, the corresponding
37803 original gid is also used.
37804 </para>
37805 <para>
37806 This is the detailed preference order for obtaining a gid; the first of the
37807 following that is set is used:
37808 </para>
37809 <itemizedlist>
37810 <listitem>
37811 <para>
37812 A <option>group</option> setting of the transport;
37813 </para>
37814 </listitem>
37815 <listitem>
37816 <para>
37817 A <option>group</option> setting of the router;
37818 </para>
37819 </listitem>
37820 <listitem>
37821 <para>
37822 A gid associated with a user setting of the router, either as a result of
37823 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
37824 </para>
37825 </listitem>
37826 <listitem>
37827 <para>
37828 The group associated with a non-numeric <option>user</option> setting of the transport;
37829 </para>
37830 </listitem>
37831 <listitem>
37832 <para>
37833 In a <command>pipe</command> transport, the creator&#x2019;s gid if <option>deliver_as_creator</option> is set and
37834 the uid is the creator&#x2019;s uid;
37835 </para>
37836 </listitem>
37837 <listitem>
37838 <para>
37839 The Exim gid if the Exim uid is being used as a default.
37840 </para>
37841 </listitem>
37842 </itemizedlist>
37843 <para>
37844 If, for example, the user is specified numerically on the router and there are
37845 no group settings, no gid is available. In this situation, an error occurs.
37846 This is different for the uid, for which there always is an ultimate default.
37847 The first of the following that is set is used:
37848 </para>
37849 <itemizedlist>
37850 <listitem>
37851 <para>
37852 A <option>user</option> setting of the transport;
37853 </para>
37854 </listitem>
37855 <listitem>
37856 <para>
37857 In a <command>pipe</command> transport, the creator&#x2019;s uid if <option>deliver_as_creator</option> is set;
37858 </para>
37859 </listitem>
37860 <listitem>
37861 <para>
37862 A <option>user</option> setting of the router;
37863 </para>
37864 </listitem>
37865 <listitem>
37866 <para>
37867 A <option>check_local_user</option> setting of the router;
37868 </para>
37869 </listitem>
37870 <listitem>
37871 <para>
37872 The Exim uid.
37873 </para>
37874 </listitem>
37875 </itemizedlist>
37876 <para>
37877 Of course, an error will still occur if the uid that is chosen is on the
37878 <option>never_users</option> list.
37879 </para>
37880 </section>
37881 <section id="SECID132">
37882 <title>Current and home directories</title>
37883 <para>
37884 <indexterm role="concept">
37885 <primary>current directory for local transport</primary>
37886 </indexterm>
37887 <indexterm role="concept">
37888 <primary>home directory</primary>
37889 <secondary>for local transport</secondary>
37890 </indexterm>
37891 <indexterm role="concept">
37892 <primary>transport</primary>
37893 <secondary>local; home directory for</secondary>
37894 </indexterm>
37895 <indexterm role="concept">
37896 <primary>transport</primary>
37897 <secondary>local; current directory for</secondary>
37898 </indexterm>
37899 Routers may set current and home directories for local transports by means of
37900 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
37901 However, if the transport&#x2019;s <option>current_directory</option> or <option>home_directory</option> options
37902 are set, they override the router&#x2019;s values. In detail, the home directory
37903 for a local transport is taken from the first of these values that is set:
37904 </para>
37905 <itemizedlist>
37906 <listitem>
37907 <para>
37908 The <option>home_directory</option> option on the transport;
37909 </para>
37910 </listitem>
37911 <listitem>
37912 <para>
37913 The <option>transport_home_directory</option> option on the router;
37914 </para>
37915 </listitem>
37916 <listitem>
37917 <para>
37918 The password data if <option>check_local_user</option> is set on the router;
37919 </para>
37920 </listitem>
37921 <listitem>
37922 <para>
37923 The <option>router_home_directory</option> option on the router.
37924 </para>
37925 </listitem>
37926 </itemizedlist>
37927 <para>
37928 The current directory is taken from the first of these values that is set:
37929 </para>
37930 <itemizedlist>
37931 <listitem>
37932 <para>
37933 The <option>current_directory</option> option on the transport;
37934 </para>
37935 </listitem>
37936 <listitem>
37937 <para>
37938 The <option>transport_current_directory</option> option on the router.
37939 </para>
37940 </listitem>
37941 </itemizedlist>
37942 <para>
37943 If neither the router nor the transport sets a current directory, Exim uses the
37944 value of the home directory, if it is set. Otherwise it sets the current
37945 directory to <filename>/</filename> before running a local transport.
37946 </para>
37947 </section>
37948 <section id="SECID133">
37949 <title>Expansion variables derived from the address</title>
37950 <para>
37951 <indexterm role="variable">
37952 <primary><varname>$domain</varname></primary>
37953 </indexterm>
37954 <indexterm role="variable">
37955 <primary><varname>$local_part</varname></primary>
37956 </indexterm>
37957 <indexterm role="variable">
37958 <primary><varname>$original_domain</varname></primary>
37959 </indexterm>
37960 Normally a local delivery is handling a single address, and in that case the
37961 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
37962 deliveries. However, in some circumstances more than one address may be handled
37963 at once (for example, while writing batch SMTP for onward transmission by some
37964 other means). In this case, the variables associated with the local part are
37965 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
37966 and <varname>$original_domain</varname> is never set.
37967 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
37968 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
37969 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
37970 </para>
37971 </section>
37972 </chapter>
37973
37974 <chapter id="CHAPtransportgeneric">
37975 <title>Generic options for transports</title>
37976 <para>
37977 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
37978 <primary>generic options</primary>
37979 <secondary>transport</secondary>
37980 </indexterm>
37981 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
37982 <primary>options</primary>
37983 <secondary>generic; for transports</secondary>
37984 </indexterm>
37985 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
37986 <primary>transport</primary>
37987 <secondary>generic options for</secondary>
37988 </indexterm>
37989 The following generic options apply to all transports:
37990 </para>
37991 <para>
37992 <indexterm role="option">
37993 <primary><option>body_only</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>body_only</option></entry>
38005 <entry>Use: <emphasis>transports</emphasis></entry>
38006 <entry>Type: <emphasis>boolean</emphasis></entry>
38007 <entry>Default: <emphasis>false</emphasis></entry>
38008 </row>
38009 </tbody>
38010 </tgroup>
38011 </informaltable>
38012 <para>
38013 <indexterm role="concept">
38014 <primary>transport</primary>
38015 <secondary>body only</secondary>
38016 </indexterm>
38017 <indexterm role="concept">
38018 <primary>message</primary>
38019 <secondary>transporting body only</secondary>
38020 </indexterm>
38021 <indexterm role="concept">
38022 <primary>body of message</primary>
38023 <secondary>transporting</secondary>
38024 </indexterm>
38025 If this option is set, the message&#x2019;s headers are not transported. It is
38026 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
38027 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
38028 <option>message_suffix</option> should be checked, because this option does not
38029 automatically suppress them.
38030 </para>
38031 <para>
38032 <indexterm role="option">
38033 <primary><option>current_directory</option></primary>
38034 </indexterm>
38035 </para>
38036 <informaltable frame="all">
38037 <tgroup cols="4" colsep="0" rowsep="0">
38038 <colspec colwidth="8*" align="left"/>
38039 <colspec colwidth="6*" align="center"/>
38040 <colspec colwidth="6*" align="center"/>
38041 <colspec colwidth="6*" align="right"/>
38042 <tbody>
38043 <row>
38044 <entry><option>current_directory</option></entry>
38045 <entry>Use: <emphasis>transports</emphasis></entry>
38046 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38047 <entry>Default: <emphasis>unset</emphasis></entry>
38048 </row>
38049 </tbody>
38050 </tgroup>
38051 </informaltable>
38052 <para>
38053 <indexterm role="concept">
38054 <primary>transport</primary>
38055 <secondary>current directory for</secondary>
38056 </indexterm>
38057 This specifies the current directory that is to be set while running the
38058 transport, overriding any value that may have been set by the router.
38059 If the expansion fails for any reason, including forced failure, an error is
38060 logged, and delivery is deferred.
38061 </para>
38062 <para>
38063 <indexterm role="option">
38064 <primary><option>disable_logging</option></primary>
38065 </indexterm>
38066 </para>
38067 <informaltable frame="all">
38068 <tgroup cols="4" colsep="0" rowsep="0">
38069 <colspec colwidth="8*" align="left"/>
38070 <colspec colwidth="6*" align="center"/>
38071 <colspec colwidth="6*" align="center"/>
38072 <colspec colwidth="6*" align="right"/>
38073 <tbody>
38074 <row>
38075 <entry><option>disable_logging</option></entry>
38076 <entry>Use: <emphasis>transports</emphasis></entry>
38077 <entry>Type: <emphasis>boolean</emphasis></entry>
38078 <entry>Default: <emphasis>false</emphasis></entry>
38079 </row>
38080 </tbody>
38081 </tgroup>
38082 </informaltable>
38083 <para>
38084 If this option is set true, nothing is logged for any
38085 deliveries by the transport or for any
38086 transport errors. You should not set this option unless you really, really know
38087 what you are doing.
38088 </para>
38089 <para>
38090 <indexterm role="option">
38091 <primary><option>debug_print</option></primary>
38092 </indexterm>
38093 </para>
38094 <informaltable frame="all">
38095 <tgroup cols="4" colsep="0" rowsep="0">
38096 <colspec colwidth="8*" align="left"/>
38097 <colspec colwidth="6*" align="center"/>
38098 <colspec colwidth="6*" align="center"/>
38099 <colspec colwidth="6*" align="right"/>
38100 <tbody>
38101 <row>
38102 <entry><option>debug_print</option></entry>
38103 <entry>Use: <emphasis>transports</emphasis></entry>
38104 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38105 <entry>Default: <emphasis>unset</emphasis></entry>
38106 </row>
38107 </tbody>
38108 </tgroup>
38109 </informaltable>
38110 <para>
38111 <indexterm role="concept">
38112 <primary>testing</primary>
38113 <secondary>variables in drivers</secondary>
38114 </indexterm>
38115 If this option is set and debugging is enabled (see the <option>-d</option> command line
38116 option), the string is expanded and included in the debugging output when the
38117 transport is run.
38118 If expansion of the string fails, the error message is written to the debugging
38119 output, and Exim carries on processing.
38120 This facility is provided to help with checking out the values of variables and
38121 so on when debugging driver configurations. For example, if a <option>headers_add</option>
38122 option is not working properly, <option>debug_print</option> could be used to output the
38123 variables it references. A newline is added to the text if it does not end with
38124 one.
38125 The variables <varname>$transport_name</varname> and <varname>$router_name</varname> contain the name of the
38126 transport and the router that called it.
38127 </para>
38128 <para>
38129 <indexterm role="option">
38130 <primary><option>delivery_date_add</option></primary>
38131 </indexterm>
38132 </para>
38133 <informaltable frame="all">
38134 <tgroup cols="4" colsep="0" rowsep="0">
38135 <colspec colwidth="8*" align="left"/>
38136 <colspec colwidth="6*" align="center"/>
38137 <colspec colwidth="6*" align="center"/>
38138 <colspec colwidth="6*" align="right"/>
38139 <tbody>
38140 <row>
38141 <entry><option>delivery_date_add</option></entry>
38142 <entry>Use: <emphasis>transports</emphasis></entry>
38143 <entry>Type: <emphasis>boolean</emphasis></entry>
38144 <entry>Default: <emphasis>false</emphasis></entry>
38145 </row>
38146 </tbody>
38147 </tgroup>
38148 </informaltable>
38149 <para>
38150 <indexterm role="concept">
38151 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
38152 </indexterm>
38153 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
38154 This gives the actual time the delivery was made. As this is not a standard
38155 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
38156 requests its removal from incoming messages, so that delivered messages can
38157 safely be resent to other recipients.
38158 </para>
38159 <para>
38160 <indexterm role="option">
38161 <primary><option>driver</option></primary>
38162 </indexterm>
38163 </para>
38164 <informaltable frame="all">
38165 <tgroup cols="4" colsep="0" rowsep="0">
38166 <colspec colwidth="8*" align="left"/>
38167 <colspec colwidth="6*" align="center"/>
38168 <colspec colwidth="6*" align="center"/>
38169 <colspec colwidth="6*" align="right"/>
38170 <tbody>
38171 <row>
38172 <entry><option>driver</option></entry>
38173 <entry>Use: <emphasis>transports</emphasis></entry>
38174 <entry>Type: <emphasis>string</emphasis></entry>
38175 <entry>Default: <emphasis>unset</emphasis></entry>
38176 </row>
38177 </tbody>
38178 </tgroup>
38179 </informaltable>
38180 <para>
38181 This specifies which of the available transport drivers is to be used.
38182 There is no default, and this option must be set for every transport.
38183 </para>
38184 <para>
38185 <indexterm role="option">
38186 <primary><option>envelope_to_add</option></primary>
38187 </indexterm>
38188 </para>
38189 <informaltable frame="all">
38190 <tgroup cols="4" colsep="0" rowsep="0">
38191 <colspec colwidth="8*" align="left"/>
38192 <colspec colwidth="6*" align="center"/>
38193 <colspec colwidth="6*" align="center"/>
38194 <colspec colwidth="6*" align="right"/>
38195 <tbody>
38196 <row>
38197 <entry><option>envelope_to_add</option></entry>
38198 <entry>Use: <emphasis>transports</emphasis></entry>
38199 <entry>Type: <emphasis>boolean</emphasis></entry>
38200 <entry>Default: <emphasis>false</emphasis></entry>
38201 </row>
38202 </tbody>
38203 </tgroup>
38204 </informaltable>
38205 <para>
38206 <indexterm role="concept">
38207 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
38208 </indexterm>
38209 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
38210 This gives the original address(es) in the incoming envelope that caused this
38211 delivery to happen. More than one address may be present if the transport is
38212 configured to handle several addresses at once, or if more than one original
38213 address was redirected to the same final address. As this is not a standard
38214 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
38215 its removal from incoming messages, so that delivered messages can safely be
38216 resent to other recipients.
38217 </para>
38218 <para>
38219 <indexterm role="option">
38220 <primary><option>group</option></primary>
38221 </indexterm>
38222 </para>
38223 <informaltable frame="all">
38224 <tgroup cols="4" colsep="0" rowsep="0">
38225 <colspec colwidth="8*" align="left"/>
38226 <colspec colwidth="6*" align="center"/>
38227 <colspec colwidth="6*" align="center"/>
38228 <colspec colwidth="6*" align="right"/>
38229 <tbody>
38230 <row>
38231 <entry><option>group</option></entry>
38232 <entry>Use: <emphasis>transports</emphasis></entry>
38233 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38234 <entry>Default: <emphasis>Exim group</emphasis></entry>
38235 </row>
38236 </tbody>
38237 </tgroup>
38238 </informaltable>
38239 <para>
38240 <indexterm role="concept">
38241 <primary>transport</primary>
38242 <secondary>group; specifying</secondary>
38243 </indexterm>
38244 This option specifies a gid for running the transport process, overriding any
38245 value that the router supplies, and also overriding any value associated with
38246 <option>user</option> (see below).
38247 </para>
38248 <para>
38249 <indexterm role="option">
38250 <primary><option>headers_add</option></primary>
38251 </indexterm>
38252 </para>
38253 <informaltable frame="all">
38254 <tgroup cols="4" colsep="0" rowsep="0">
38255 <colspec colwidth="8*" align="left"/>
38256 <colspec colwidth="6*" align="center"/>
38257 <colspec colwidth="6*" align="center"/>
38258 <colspec colwidth="6*" align="right"/>
38259 <tbody>
38260 <row>
38261 <entry><option>headers_add</option></entry>
38262 <entry>Use: <emphasis>transports</emphasis></entry>
38263 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
38264 <entry>Default: <emphasis>unset</emphasis></entry>
38265 </row>
38266 </tbody>
38267 </tgroup>
38268 </informaltable>
38269 <para>
38270 <indexterm role="concept">
38271 <primary>header lines</primary>
38272 <secondary>adding in transport</secondary>
38273 </indexterm>
38274 <indexterm role="concept">
38275 <primary>transport</primary>
38276 <secondary>header lines; adding</secondary>
38277 </indexterm>
38278 This option specifies a list of text headers, newline-separated,
38279 which are (separately) expanded and added to the header
38280 portion of a message as it is transported, as described in section
38281 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
38282 routers. If the result of the expansion is an empty string, or if the expansion
38283 is forced to fail, no action is taken. Other expansion failures are treated as
38284 errors and cause the delivery to be deferred.
38285 </para>
38286 <para>
38287 Unlike most options, <option>headers_add</option> can be specified multiple times
38288 for a transport; all listed headers are added.
38289 </para>
38290 <para>
38291 <indexterm role="option">
38292 <primary><option>headers_only</option></primary>
38293 </indexterm>
38294 </para>
38295 <informaltable frame="all">
38296 <tgroup cols="4" colsep="0" rowsep="0">
38297 <colspec colwidth="8*" align="left"/>
38298 <colspec colwidth="6*" align="center"/>
38299 <colspec colwidth="6*" align="center"/>
38300 <colspec colwidth="6*" align="right"/>
38301 <tbody>
38302 <row>
38303 <entry><option>headers_only</option></entry>
38304 <entry>Use: <emphasis>transports</emphasis></entry>
38305 <entry>Type: <emphasis>boolean</emphasis></entry>
38306 <entry>Default: <emphasis>false</emphasis></entry>
38307 </row>
38308 </tbody>
38309 </tgroup>
38310 </informaltable>
38311 <para>
38312 <indexterm role="concept">
38313 <primary>transport</primary>
38314 <secondary>header lines only</secondary>
38315 </indexterm>
38316 <indexterm role="concept">
38317 <primary>message</primary>
38318 <secondary>transporting headers only</secondary>
38319 </indexterm>
38320 <indexterm role="concept">
38321 <primary>header lines</primary>
38322 <secondary>transporting</secondary>
38323 </indexterm>
38324 If this option is set, the message&#x2019;s body is not transported. It is mutually
38325 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
38326 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
38327 checked, since this option does not automatically suppress them.
38328 </para>
38329 <para>
38330 <indexterm role="option">
38331 <primary><option>headers_remove</option></primary>
38332 </indexterm>
38333 </para>
38334 <informaltable frame="all">
38335 <tgroup cols="4" colsep="0" rowsep="0">
38336 <colspec colwidth="8*" align="left"/>
38337 <colspec colwidth="6*" align="center"/>
38338 <colspec colwidth="6*" align="center"/>
38339 <colspec colwidth="6*" align="right"/>
38340 <tbody>
38341 <row>
38342 <entry><option>headers_remove</option></entry>
38343 <entry>Use: <emphasis>transports</emphasis></entry>
38344 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
38345 <entry>Default: <emphasis>unset</emphasis></entry>
38346 </row>
38347 </tbody>
38348 </tgroup>
38349 </informaltable>
38350 <para>
38351 <indexterm role="concept">
38352 <primary>header lines</primary>
38353 <secondary>removing</secondary>
38354 </indexterm>
38355 <indexterm role="concept">
38356 <primary>transport</primary>
38357 <secondary>header lines; removing</secondary>
38358 </indexterm>
38359 This option specifies a list of header names, colon-separated;
38360 these headers are omitted from the message as it is transported, as described
38361 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
38362 routers.
38363 Each list item is separately expanded.
38364 If the result of the expansion is an empty string, or if the expansion
38365 is forced to fail, no action is taken. Other expansion failures are treated as
38366 errors and cause the delivery to be deferred.
38367 </para>
38368 <para>
38369 Unlike most options, <option>headers_remove</option> can be specified multiple times
38370 for a router; all listed headers are removed.
38371 </para>
38372 <para>
38373 <indexterm role="option">
38374 <primary><option>headers_rewrite</option></primary>
38375 </indexterm>
38376 </para>
38377 <informaltable frame="all">
38378 <tgroup cols="4" colsep="0" rowsep="0">
38379 <colspec colwidth="8*" align="left"/>
38380 <colspec colwidth="6*" align="center"/>
38381 <colspec colwidth="6*" align="center"/>
38382 <colspec colwidth="6*" align="right"/>
38383 <tbody>
38384 <row>
38385 <entry><option>headers_rewrite</option></entry>
38386 <entry>Use: <emphasis>transports</emphasis></entry>
38387 <entry>Type: <emphasis>string</emphasis></entry>
38388 <entry>Default: <emphasis>unset</emphasis></entry>
38389 </row>
38390 </tbody>
38391 </tgroup>
38392 </informaltable>
38393 <para>
38394 <indexterm role="concept">
38395 <primary>transport</primary>
38396 <secondary>header lines; rewriting</secondary>
38397 </indexterm>
38398 <indexterm role="concept">
38399 <primary>rewriting</primary>
38400 <secondary>at transport time</secondary>
38401 </indexterm>
38402 This option allows addresses in header lines to be rewritten at transport time,
38403 that is, as the message is being copied to its destination. The contents of the
38404 option are a colon-separated list of rewriting rules. Each rule is in exactly
38405 the same form as one of the general rewriting rules that are applied when a
38406 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
38407 example,
38408 </para>
38409 <literallayout class="monospaced">
38410 headers_rewrite = a@b c@d f : \
38411                   x@y w@z
38412 </literallayout>
38413 <para>
38414 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
38415 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
38416 header lines just before they are written out at transport time, so they affect
38417 only those copies of the message that pass through the transport. However, only
38418 the message&#x2019;s original header lines, and any that were added by a system
38419 filter, are rewritten. If a router or transport adds header lines, they are not
38420 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
38421 envelope. You can change the return path using <option>return_path</option>, but you cannot
38422 change envelope recipients at this time.
38423 </para>
38424 <para>
38425 <indexterm role="option">
38426 <primary><option>home_directory</option></primary>
38427 </indexterm>
38428 </para>
38429 <informaltable frame="all">
38430 <tgroup cols="4" colsep="0" rowsep="0">
38431 <colspec colwidth="8*" align="left"/>
38432 <colspec colwidth="6*" align="center"/>
38433 <colspec colwidth="6*" align="center"/>
38434 <colspec colwidth="6*" align="right"/>
38435 <tbody>
38436 <row>
38437 <entry><option>home_directory</option></entry>
38438 <entry>Use: <emphasis>transports</emphasis></entry>
38439 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38440 <entry>Default: <emphasis>unset</emphasis></entry>
38441 </row>
38442 </tbody>
38443 </tgroup>
38444 </informaltable>
38445 <para>
38446 <indexterm role="concept">
38447 <primary>transport</primary>
38448 <secondary>home directory for</secondary>
38449 </indexterm>
38450 <indexterm role="variable">
38451 <primary><varname>$home</varname></primary>
38452 </indexterm>
38453 This option specifies a home directory setting for a local transport,
38454 overriding any value that may be set by the router. The home directory is
38455 placed in <varname>$home</varname> while expanding the transport&#x2019;s private options. It is also
38456 used as the current directory if no current directory is set by the
38457 <option>current_directory</option> option on the transport or the
38458 <option>transport_current_directory</option> option on the router. If the expansion fails
38459 for any reason, including forced failure, an error is logged, and delivery is
38460 deferred.
38461 </para>
38462 <para>
38463 <indexterm role="option">
38464 <primary><option>initgroups</option></primary>
38465 </indexterm>
38466 </para>
38467 <informaltable frame="all">
38468 <tgroup cols="4" colsep="0" rowsep="0">
38469 <colspec colwidth="8*" align="left"/>
38470 <colspec colwidth="6*" align="center"/>
38471 <colspec colwidth="6*" align="center"/>
38472 <colspec colwidth="6*" align="right"/>
38473 <tbody>
38474 <row>
38475 <entry><option>initgroups</option></entry>
38476 <entry>Use: <emphasis>transports</emphasis></entry>
38477 <entry>Type: <emphasis>boolean</emphasis></entry>
38478 <entry>Default: <emphasis>false</emphasis></entry>
38479 </row>
38480 </tbody>
38481 </tgroup>
38482 </informaltable>
38483 <para>
38484 <indexterm role="concept">
38485 <primary>additional groups</primary>
38486 </indexterm>
38487 <indexterm role="concept">
38488 <primary>groups</primary>
38489 <secondary>additional</secondary>
38490 </indexterm>
38491 <indexterm role="concept">
38492 <primary>transport</primary>
38493 <secondary>group; additional</secondary>
38494 </indexterm>
38495 If this option is true and the uid for the delivery process is provided by the
38496 transport, the <function>initgroups()</function> function is called when running the transport
38497 to ensure that any additional groups associated with the uid are set up.
38498 </para>
38499 <para>
38500 <indexterm role="option">
38501 <primary><option>message_size_limit</option></primary>
38502 </indexterm>
38503 </para>
38504 <informaltable frame="all">
38505 <tgroup cols="4" colsep="0" rowsep="0">
38506 <colspec colwidth="8*" align="left"/>
38507 <colspec colwidth="6*" align="center"/>
38508 <colspec colwidth="6*" align="center"/>
38509 <colspec colwidth="6*" align="right"/>
38510 <tbody>
38511 <row>
38512 <entry><option>message_size_limit</option></entry>
38513 <entry>Use: <emphasis>transports</emphasis></entry>
38514 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38515 <entry>Default: <emphasis>0</emphasis></entry>
38516 </row>
38517 </tbody>
38518 </tgroup>
38519 </informaltable>
38520 <para>
38521 <indexterm role="concept">
38522 <primary>limit</primary>
38523 <secondary>message size per transport</secondary>
38524 </indexterm>
38525 <indexterm role="concept">
38526 <primary>size</primary>
38527 <secondary>of message, limit</secondary>
38528 </indexterm>
38529 <indexterm role="concept">
38530 <primary>transport</primary>
38531 <secondary>message size; limiting</secondary>
38532 </indexterm>
38533 This option controls the size of messages passed through the transport. It is
38534 expanded before use; the result of the expansion must be a sequence of decimal
38535 digits, optionally followed by K or M. If the expansion fails for any reason,
38536 including forced failure, or if the result is not of the required form,
38537 delivery is deferred. If the value is greater than zero and the size of a
38538 message exceeds this limit, the address is failed. If there is any chance that
38539 the resulting bounce message could be routed to the same transport, you should
38540 ensure that <option>return_size_limit</option> is less than the transport&#x2019;s
38541 <option>message_size_limit</option>, as otherwise the bounce message will fail to get
38542 delivered.
38543 </para>
38544 <para>
38545 <indexterm role="option">
38546 <primary><option>rcpt_include_affixes</option></primary>
38547 </indexterm>
38548 </para>
38549 <informaltable frame="all">
38550 <tgroup cols="4" colsep="0" rowsep="0">
38551 <colspec colwidth="8*" align="left"/>
38552 <colspec colwidth="6*" align="center"/>
38553 <colspec colwidth="6*" align="center"/>
38554 <colspec colwidth="6*" align="right"/>
38555 <tbody>
38556 <row>
38557 <entry><option>rcpt_include_affixes</option></entry>
38558 <entry>Use: <emphasis>transports</emphasis></entry>
38559 <entry>Type: <emphasis>boolean</emphasis></entry>
38560 <entry>Default: <emphasis>false</emphasis></entry>
38561 </row>
38562 </tbody>
38563 </tgroup>
38564 </informaltable>
38565 <para>
38566 <indexterm role="concept">
38567 <primary>prefix</primary>
38568 <secondary>for local part, including in envelope</secondary>
38569 </indexterm>
38570 <indexterm role="concept">
38571 <primary>suffix for local part</primary>
38572 <secondary>including in envelope</secondary>
38573 </indexterm>
38574 <indexterm role="concept">
38575 <primary>local part</primary>
38576 <secondary>prefix</secondary>
38577 </indexterm>
38578 <indexterm role="concept">
38579 <primary>local part</primary>
38580 <secondary>suffix</secondary>
38581 </indexterm>
38582 When this option is false (the default), and an address that has had any
38583 affixes (prefixes or suffixes) removed from the local part is delivered by any
38584 form of SMTP or LMTP, the affixes are not included. For example, if a router
38585 that contains
38586 </para>
38587 <literallayout class="monospaced">
38588 local_part_prefix = *-
38589 </literallayout>
38590 <para>
38591 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
38592 is delivered with
38593 </para>
38594 <literallayout class="monospaced">
38595 RCPT TO:&lt;xyz@some.domain&gt;
38596 </literallayout>
38597 <para>
38598 This is also the case when an ACL-time callout is being used to verify a
38599 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
38600 whole local part is included in the RCPT command. This option applies to BSMTP
38601 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
38602 <command>lmtp</command> and <command>smtp</command> transports.
38603 </para>
38604 <para>
38605 <indexterm role="option">
38606 <primary><option>retry_use_local_part</option></primary>
38607 </indexterm>
38608 </para>
38609 <informaltable frame="all">
38610 <tgroup cols="4" colsep="0" rowsep="0">
38611 <colspec colwidth="8*" align="left"/>
38612 <colspec colwidth="6*" align="center"/>
38613 <colspec colwidth="6*" align="center"/>
38614 <colspec colwidth="6*" align="right"/>
38615 <tbody>
38616 <row>
38617 <entry><option>retry_use_local_part</option></entry>
38618 <entry>Use: <emphasis>transports</emphasis></entry>
38619 <entry>Type: <emphasis>boolean</emphasis></entry>
38620 <entry>Default: <emphasis>see below</emphasis></entry>
38621 </row>
38622 </tbody>
38623 </tgroup>
38624 </informaltable>
38625 <para>
38626 <indexterm role="concept">
38627 <primary>hints database</primary>
38628 <secondary>retry keys</secondary>
38629 </indexterm>
38630 When a delivery suffers a temporary failure, a retry record is created
38631 in Exim&#x2019;s hints database. For remote deliveries, the key for the retry record
38632 is based on the name and/or IP address of the failing remote host. For local
38633 deliveries, the key is normally the entire address, including both the local
38634 part and the domain. This is suitable for most common cases of local delivery
38635 temporary failure &ndash; for example, exceeding a mailbox quota should delay only
38636 deliveries to that mailbox, not to the whole domain.
38637 </para>
38638 <para>
38639 However, in some special cases you may want to treat a temporary local delivery
38640 as a failure associated with the domain, and not with a particular local part.
38641 (For example, if you are storing all mail for some domain in files.) You can do
38642 this by setting <option>retry_use_local_part</option> false.
38643 </para>
38644 <para>
38645 For all the local transports, its default value is true. For remote transports,
38646 the default value is false for tidiness, but changing the value has no effect
38647 on a remote transport in the current implementation.
38648 </para>
38649 <para>
38650 <indexterm role="option">
38651 <primary><option>return_path</option></primary>
38652 </indexterm>
38653 </para>
38654 <informaltable frame="all">
38655 <tgroup cols="4" colsep="0" rowsep="0">
38656 <colspec colwidth="8*" align="left"/>
38657 <colspec colwidth="6*" align="center"/>
38658 <colspec colwidth="6*" align="center"/>
38659 <colspec colwidth="6*" align="right"/>
38660 <tbody>
38661 <row>
38662 <entry><option>return_path</option></entry>
38663 <entry>Use: <emphasis>transports</emphasis></entry>
38664 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38665 <entry>Default: <emphasis>unset</emphasis></entry>
38666 </row>
38667 </tbody>
38668 </tgroup>
38669 </informaltable>
38670 <para>
38671 <indexterm role="concept">
38672 <primary>envelope sender</primary>
38673 </indexterm>
38674 <indexterm role="concept">
38675 <primary>transport</primary>
38676 <secondary>return path; changing</secondary>
38677 </indexterm>
38678 <indexterm role="concept">
38679 <primary>return path</primary>
38680 <secondary>changing in transport</secondary>
38681 </indexterm>
38682 If this option is set, the string is expanded at transport time and replaces
38683 the existing return path (envelope sender) value in the copy of the message
38684 that is being delivered. An empty return path is permitted. This feature is
38685 designed for remote deliveries, where the value of this option is used in the
38686 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
38687 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
38688 header line, if one is added to the message (see the next option).
38689 </para>
38690 <para>
38691 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
38692 <option>return_path_on_delivery</option> to the log selector.
38693 </para>
38694 <para>
38695 <indexterm role="variable">
38696 <primary><varname>$return_path</varname></primary>
38697 </indexterm>
38698 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
38699 either the message&#x2019;s envelope sender, or an address set by the
38700 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
38701 replacement occurs; if it fails for another reason, delivery is deferred. This
38702 option can be used to support VERP (Variable Envelope Return Paths) &ndash; see
38703 section <xref linkend="SECTverp"/>.
38704 </para>
38705 <para>
38706 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
38707 remote server rejects a message at SMTP time, the bounce message is not sent to
38708 the value of this option. It is sent to the previously set errors address.
38709 This defaults to the incoming sender address, but can be changed by setting
38710 <option>errors_to</option> in a router.
38711 </para>
38712 <para>
38713 <indexterm role="option">
38714 <primary><option>return_path_add</option></primary>
38715 </indexterm>
38716 </para>
38717 <informaltable frame="all">
38718 <tgroup cols="4" colsep="0" rowsep="0">
38719 <colspec colwidth="8*" align="left"/>
38720 <colspec colwidth="6*" align="center"/>
38721 <colspec colwidth="6*" align="center"/>
38722 <colspec colwidth="6*" align="right"/>
38723 <tbody>
38724 <row>
38725 <entry><option>return_path_add</option></entry>
38726 <entry>Use: <emphasis>transports</emphasis></entry>
38727 <entry>Type: <emphasis>boolean</emphasis></entry>
38728 <entry>Default: <emphasis>false</emphasis></entry>
38729 </row>
38730 </tbody>
38731 </tgroup>
38732 </informaltable>
38733 <para>
38734 <indexterm role="concept">
38735 <primary><emphasis>Return-path:</emphasis> header line</primary>
38736 </indexterm>
38737 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
38738 Although the return path is normally available in the prefix line of BSD
38739 mailboxes, this is commonly not displayed by MUAs, and so the user does not
38740 have easy access to it.
38741 </para>
38742 <para>
38743 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
38744 the delivery SMTP server makes the final delivery</quote>. This implies that this
38745 header should not be present in incoming messages. Exim has a configuration
38746 option, <option>return_path_remove</option>, which requests removal of this header from
38747 incoming messages, so that delivered messages can safely be resent to other
38748 recipients.
38749 </para>
38750 <para>
38751 <indexterm role="option">
38752 <primary><option>shadow_condition</option></primary>
38753 </indexterm>
38754 </para>
38755 <informaltable frame="all">
38756 <tgroup cols="4" colsep="0" rowsep="0">
38757 <colspec colwidth="8*" align="left"/>
38758 <colspec colwidth="6*" align="center"/>
38759 <colspec colwidth="6*" align="center"/>
38760 <colspec colwidth="6*" align="right"/>
38761 <tbody>
38762 <row>
38763 <entry><option>shadow_condition</option></entry>
38764 <entry>Use: <emphasis>transports</emphasis></entry>
38765 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38766 <entry>Default: <emphasis>unset</emphasis></entry>
38767 </row>
38768 </tbody>
38769 </tgroup>
38770 </informaltable>
38771 <para>
38772 See <option>shadow_transport</option> below.
38773 </para>
38774 <para>
38775 <indexterm role="option">
38776 <primary><option>shadow_transport</option></primary>
38777 </indexterm>
38778 </para>
38779 <informaltable frame="all">
38780 <tgroup cols="4" colsep="0" rowsep="0">
38781 <colspec colwidth="8*" align="left"/>
38782 <colspec colwidth="6*" align="center"/>
38783 <colspec colwidth="6*" align="center"/>
38784 <colspec colwidth="6*" align="right"/>
38785 <tbody>
38786 <row>
38787 <entry><option>shadow_transport</option></entry>
38788 <entry>Use: <emphasis>transports</emphasis></entry>
38789 <entry>Type: <emphasis>string</emphasis></entry>
38790 <entry>Default: <emphasis>unset</emphasis></entry>
38791 </row>
38792 </tbody>
38793 </tgroup>
38794 </informaltable>
38795 <para>
38796 <indexterm role="concept">
38797 <primary>shadow transport</primary>
38798 </indexterm>
38799 <indexterm role="concept">
38800 <primary>transport</primary>
38801 <secondary>shadow</secondary>
38802 </indexterm>
38803 A local transport may set the <option>shadow_transport</option> option to the name of
38804 another local transport. Shadow remote transports are not supported.
38805 </para>
38806 <para>
38807 Whenever a delivery to the main transport succeeds, and either
38808 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
38809 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
38810 passed to the shadow transport, with the same delivery address or addresses. If
38811 expansion fails, no action is taken except that non-forced expansion failures
38812 cause a log line to be written.
38813 </para>
38814 <para>
38815 The result of the shadow transport is discarded and does not affect the
38816 subsequent processing of the message. Only a single level of shadowing is
38817 provided; the <option>shadow_transport</option> option is ignored on any transport when it
38818 is running as a shadow. Options concerned with output from pipes are also
38819 ignored. The log line for the successful delivery has an item added on the end,
38820 of the form
38821 </para>
38822 <literallayout class="monospaced">
38823 ST=&lt;shadow transport name&gt;
38824 </literallayout>
38825 <para>
38826 If the shadow transport did not succeed, the error message is put in
38827 parentheses afterwards. Shadow transports can be used for a number of different
38828 purposes, including keeping more detailed log information than Exim normally
38829 provides, and implementing automatic acknowledgment policies based on message
38830 headers that some sites insist on.
38831 </para>
38832 <para>
38833 <indexterm role="option">
38834 <primary><option>transport_filter</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>transport_filter</option></entry>
38846 <entry>Use: <emphasis>transports</emphasis></entry>
38847 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38848 <entry>Default: <emphasis>unset</emphasis></entry>
38849 </row>
38850 </tbody>
38851 </tgroup>
38852 </informaltable>
38853 <para>
38854 <indexterm role="concept">
38855 <primary>transport</primary>
38856 <secondary>filter</secondary>
38857 </indexterm>
38858 <indexterm role="concept">
38859 <primary>filter</primary>
38860 <secondary>transport filter</secondary>
38861 </indexterm>
38862 This option sets up a filtering (in the Unix shell sense) process for messages
38863 at transport time. It should not be confused with mail filtering as set up by
38864 individual users or via a system filter.
38865 </para>
38866 <para>
38867 When the message is about to be written out, the command specified by
38868 <option>transport_filter</option> is started up in a separate, parallel process, and
38869 the entire message, including the header lines, is passed to it on its standard
38870 input (this in fact is done from a third process, to avoid deadlock). The
38871 command must be specified as an absolute path.
38872 </para>
38873 <para>
38874 The lines of the message that are written to the transport filter are
38875 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
38876 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
38877 lines beginning with a dot, and also before any processing implied by the
38878 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
38879 <command>pipe</command> transports.
38880 </para>
38881 <para>
38882 The standard error for the filter process is set to the same destination as its
38883 standard output; this is read and written to the message&#x2019;s ultimate
38884 destination. The process that writes the message to the filter, the
38885 filter itself, and the original process that reads the result and delivers it
38886 are all run in parallel, like a shell pipeline.
38887 </para>
38888 <para>
38889 The filter can perform any transformations it likes, but of course should take
38890 care not to break RFC 2822 syntax. Exim does not check the result, except to
38891 test for a final newline when SMTP is in use. All messages transmitted over
38892 SMTP must end with a newline, so Exim supplies one if it is missing.
38893 </para>
38894 <para>
38895 <indexterm role="concept">
38896 <primary>content scanning</primary>
38897 <secondary>per user</secondary>
38898 </indexterm>
38899 A transport filter can be used to provide content-scanning on a per-user basis
38900 at delivery time if the only required effect of the scan is to modify the
38901 message. For example, a content scan could insert a new header line containing
38902 a spam score. This could be interpreted by a filter in the user&#x2019;s MUA. It is
38903 not possible to discard a message at this stage.
38904 </para>
38905 <para>
38906 <indexterm role="concept">
38907 <primary>SMTP</primary>
38908 <secondary>SIZE</secondary>
38909 </indexterm>
38910 A problem might arise if the filter increases the size of a message that is
38911 being sent down an SMTP connection. If the receiving SMTP server has indicated
38912 support for the SIZE parameter, Exim will have sent the size of the message
38913 at the start of the SMTP session. If what is actually sent is substantially
38914 more, the server might reject the message. This can be worked round by setting
38915 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
38916 additions to the message, or to disable the use of SIZE altogether.
38917 </para>
38918 <para>
38919 <indexterm role="variable">
38920 <primary><varname>$pipe_addresses</varname></primary>
38921 </indexterm>
38922 The value of the <option>transport_filter</option> option is the command string for starting
38923 the filter, which is run directly from Exim, not under a shell. The string is
38924 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
38925 Exim breaks it up into arguments and then expands each argument separately (see
38926 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
38927 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
38928 of arguments, one for each address that applies to this delivery. (This isn&#x2019;t
38929 an ideal name for this feature here, but as it was already implemented for the
38930 <command>pipe</command> transport, it seemed sensible not to change it.)
38931 </para>
38932 <para>
38933 <indexterm role="variable">
38934 <primary><varname>$host</varname></primary>
38935 </indexterm>
38936 <indexterm role="variable">
38937 <primary><varname>$host_address</varname></primary>
38938 </indexterm>
38939 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
38940 transport is a remote one. They contain the name and IP address of the host to
38941 which the message is being sent. For example:
38942 </para>
38943 <literallayout class="monospaced">
38944 transport_filter = /some/directory/transport-filter.pl \
38945   $host $host_address $sender_address $pipe_addresses
38946 </literallayout>
38947 <para>
38948 Two problems arise if you want to use more complicated expansion items to
38949 generate transport filter commands, both of which due to the fact that the
38950 command is split up <emphasis>before</emphasis> expansion.
38951 </para>
38952 <itemizedlist>
38953 <listitem>
38954 <para>
38955 If an expansion item contains white space, you must quote it, so that it is all
38956 part of the same command item. If the entire option setting is one such
38957 expansion item, you have to take care what kind of quoting you use. For
38958 example:
38959 </para>
38960 <literallayout class="monospaced">
38961 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
38962 </literallayout>
38963 <para>
38964 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
38965 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
38966 stripped by Exim when it read the option&#x2019;s value. When the value is used, if
38967 the single quotes were missing, the line would be split into two items,
38968 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
38969 Exim tried to expand the first one.
38970 </para>
38971 </listitem>
38972 <listitem>
38973 <para>
38974 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
38975 expansion cannot generate multiple arguments, or a command name followed by
38976 arguments. Consider this example:
38977 </para>
38978 <literallayout class="monospaced">
38979 transport_filter = ${lookup{$host}lsearch{/a/file}\
38980                     {$value}{/bin/cat}}
38981 </literallayout>
38982 <para>
38983 The result of the lookup is interpreted as the name of the command, even
38984 if it contains white space. The simplest way round this is to use a shell:
38985 </para>
38986 <literallayout class="monospaced">
38987 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/a/file}\
38988                                {$value}{/bin/cat}}
38989 </literallayout>
38990 </listitem>
38991 </itemizedlist>
38992 <para>
38993 The filter process is run under the same uid and gid as the normal delivery.
38994 For remote deliveries this is the Exim uid/gid by default. The command should
38995 normally yield a zero return code. Transport filters are not supposed to fail.
38996 A non-zero code is taken to mean that the transport filter encountered some
38997 serious problem. Delivery of the message is deferred; the message remains on
38998 the queue and is tried again later. It is not possible to cause a message to be
38999 bounced from a transport filter.
39000 </para>
39001 <para>
39002 If a transport filter is set on an autoreply transport, the original message is
39003 passed through the filter as it is being copied into the newly generated
39004 message, which happens if the <option>return_message</option> option is set.
39005 </para>
39006 <para>
39007 <indexterm role="option">
39008 <primary><option>transport_filter_timeout</option></primary>
39009 </indexterm>
39010 </para>
39011 <informaltable frame="all">
39012 <tgroup cols="4" colsep="0" rowsep="0">
39013 <colspec colwidth="8*" align="left"/>
39014 <colspec colwidth="6*" align="center"/>
39015 <colspec colwidth="6*" align="center"/>
39016 <colspec colwidth="6*" align="right"/>
39017 <tbody>
39018 <row>
39019 <entry><option>transport_filter_timeout</option></entry>
39020 <entry>Use: <emphasis>transports</emphasis></entry>
39021 <entry>Type: <emphasis>time</emphasis></entry>
39022 <entry>Default: <emphasis>5m</emphasis></entry>
39023 </row>
39024 </tbody>
39025 </tgroup>
39026 </informaltable>
39027 <para>
39028 <indexterm role="concept">
39029 <primary>transport</primary>
39030 <secondary>filter, timeout</secondary>
39031 </indexterm>
39032 When Exim is reading the output of a transport filter, it applies a timeout
39033 that can be set by this option. Exceeding the timeout is normally treated as a
39034 temporary delivery failure. However, if a transport filter is used with a
39035 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
39036 way as a timeout in the pipe command itself. By default, a timeout is a hard
39037 error, but if the <command>pipe</command> transport&#x2019;s <option>timeout_defer</option> option is set true, it
39038 becomes a temporary error.
39039 </para>
39040 <para>
39041 <indexterm role="option">
39042 <primary><option>user</option></primary>
39043 </indexterm>
39044 </para>
39045 <informaltable frame="all">
39046 <tgroup cols="4" colsep="0" rowsep="0">
39047 <colspec colwidth="8*" align="left"/>
39048 <colspec colwidth="6*" align="center"/>
39049 <colspec colwidth="6*" align="center"/>
39050 <colspec colwidth="6*" align="right"/>
39051 <tbody>
39052 <row>
39053 <entry><option>user</option></entry>
39054 <entry>Use: <emphasis>transports</emphasis></entry>
39055 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39056 <entry>Default: <emphasis>Exim user</emphasis></entry>
39057 </row>
39058 </tbody>
39059 </tgroup>
39060 </informaltable>
39061 <para>
39062 <indexterm role="concept">
39063 <primary>uid (user id)</primary>
39064 <secondary>local delivery</secondary>
39065 </indexterm>
39066 <indexterm role="concept">
39067 <primary>transport</primary>
39068 <secondary>user, specifying</secondary>
39069 </indexterm>
39070 This option specifies the user under whose uid the delivery process is to be
39071 run, overriding any uid that may have been set by the router. If the user is
39072 given as a name, the uid is looked up from the password data, and the
39073 associated group is taken as the value of the gid to be used if the <option>group</option>
39074 option is not set.
39075 </para>
39076 <para>
39077 For deliveries that use local transports, a user and group are normally
39078 specified explicitly or implicitly (for example, as a result of
39079 <option>check_local_user</option>) by the router or transport.
39080 </para>
39081 <para>
39082 <indexterm role="concept">
39083 <primary>hints database</primary>
39084 <secondary>access by remote transport</secondary>
39085 </indexterm>
39086 For remote transports, you should leave this option unset unless you really are
39087 sure you know what you are doing. When a remote transport is running, it needs
39088 to be able to access Exim&#x2019;s hints databases, because each host may have its own
39089 retry data.
39090 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
39091 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
39092 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
39093 </para>
39094 </chapter>
39095
39096 <chapter id="CHAPbatching">
39097 <title>Address batching in local transports</title>
39098 <titleabbrev>Address batching</titleabbrev>
39099 <para>
39100 <indexterm role="concept">
39101 <primary>transport</primary>
39102 <secondary>local; address batching in</secondary>
39103 </indexterm>
39104 The only remote transport (<command>smtp</command>) is normally configured to handle more than
39105 one address at a time, so that when several addresses are routed to the same
39106 remote host, just one copy of the message is sent. Local transports, however,
39107 normally handle one address at a time. That is, a separate instance of the
39108 transport is run for each address that is routed to the transport. A separate
39109 copy of the message is delivered each time.
39110 </para>
39111 <para>
39112 <indexterm role="concept">
39113 <primary>batched local delivery</primary>
39114 </indexterm>
39115 <indexterm role="option">
39116 <primary><option>batch_max</option></primary>
39117 </indexterm>
39118 <indexterm role="option">
39119 <primary><option>batch_id</option></primary>
39120 </indexterm>
39121 In special cases, it may be desirable to handle several addresses at once in a
39122 local transport, for example:
39123 </para>
39124 <itemizedlist>
39125 <listitem>
39126 <para>
39127 In an <command>appendfile</command> transport, when storing messages in files for later
39128 delivery by some other means, a single copy of the message with multiple
39129 recipients saves space.
39130 </para>
39131 </listitem>
39132 <listitem>
39133 <para>
39134 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
39135 a single copy saves time, and is the normal way LMTP is expected to work.
39136 </para>
39137 </listitem>
39138 <listitem>
39139 <para>
39140 In a <command>pipe</command> transport, when passing the message
39141 to a scanner program or
39142 to some other delivery mechanism such as UUCP, multiple recipients may be
39143 acceptable.
39144 </para>
39145 </listitem>
39146 </itemizedlist>
39147 <para>
39148 These three local transports all have the same options for controlling multiple
39149 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
39150 repeating the information for each transport, these options are described here.
39151 </para>
39152 <para>
39153 The <option>batch_max</option> option specifies the maximum number of addresses that can be
39154 delivered together in a single run of the transport. Its default value is one
39155 (no batching). When more than one address is routed to a transport that has a
39156 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
39157 (that is, in a single run of the transport with multiple recipients), subject
39158 to certain conditions:
39159 </para>
39160 <itemizedlist>
39161 <listitem>
39162 <para>
39163 <indexterm role="variable">
39164 <primary><varname>$local_part</varname></primary>
39165 </indexterm>
39166 If any of the transport&#x2019;s options contain a reference to <varname>$local_part</varname>, no
39167 batching is possible.
39168 </para>
39169 </listitem>
39170 <listitem>
39171 <para>
39172 <indexterm role="variable">
39173 <primary><varname>$domain</varname></primary>
39174 </indexterm>
39175 If any of the transport&#x2019;s options contain a reference to <varname>$domain</varname>, only
39176 addresses with the same domain are batched.
39177 </para>
39178 </listitem>
39179 <listitem>
39180 <para>
39181 <indexterm role="concept">
39182 <primary>customizing</primary>
39183 <secondary>batching condition</secondary>
39184 </indexterm>
39185 If <option>batch_id</option> is set, it is expanded for each address, and only those
39186 addresses with the same expanded value are batched. This allows you to specify
39187 customized batching conditions. Failure of the expansion for any reason,
39188 including forced failure, disables batching, but it does not stop the delivery
39189 from taking place.
39190 </para>
39191 </listitem>
39192 <listitem>
39193 <para>
39194 Batched addresses must also have the same errors address (where to send
39195 delivery errors), the same header additions and removals, the same user and
39196 group for the transport, and if a host list is present, the first host must
39197 be the same.
39198 </para>
39199 </listitem>
39200 </itemizedlist>
39201 <para>
39202 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
39203 both when the file or pipe command is specified in the transport, and when it
39204 is specified by a <command>redirect</command> router, but all the batched addresses must of
39205 course be routed to the same file or pipe command. These two transports have an
39206 option called <option>use_bsmtp</option>, which causes them to deliver the message in
39207 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
39208 <option>check_string</option> and <option>escape_string</option> options are forced to the values
39209 </para>
39210 <literallayout class="monospaced">
39211 check_string = "."
39212 escape_string = ".."
39213 </literallayout>
39214 <para>
39215 when batched SMTP is in use. A full description of the batch SMTP mechanism is
39216 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
39217 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
39218 </para>
39219 <para>
39220 <indexterm role="concept">
39221 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
39222 </indexterm>
39223 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
39224 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
39225 that are being processed together. If you are using a batching <command>appendfile</command>
39226 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
39227 addresses is to set the <option>envelope_to_add</option> option.
39228 </para>
39229 <para>
39230 <indexterm role="concept">
39231 <primary><command>pipe</command> transport</primary>
39232 <secondary>with multiple addresses</secondary>
39233 </indexterm>
39234 <indexterm role="variable">
39235 <primary><varname>$pipe_addresses</varname></primary>
39236 </indexterm>
39237 If you are using a <command>pipe</command> transport without BSMTP, and setting the
39238 transport&#x2019;s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
39239 the command. This is not a true variable; it is a bit of magic that causes each
39240 of the recipient addresses to be inserted into the command as a separate
39241 argument. This provides a way of accessing all the addresses that are being
39242 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
39243 are specified by a <command>redirect</command> router.
39244 </para>
39245 </chapter>
39246
39247 <chapter id="CHAPappendfile">
39248 <title>The appendfile transport</title>
39249 <para>
39250 <indexterm role="concept" id="IIDapptra1" class="startofrange">
39251 <primary><command>appendfile</command> transport</primary>
39252 </indexterm>
39253 <indexterm role="concept" id="IIDapptra2" class="startofrange">
39254 <primary>transports</primary>
39255 <secondary><command>appendfile</command></secondary>
39256 </indexterm>
39257 <indexterm role="concept">
39258 <primary>directory creation</primary>
39259 </indexterm>
39260 <indexterm role="concept">
39261 <primary>creating directories</primary>
39262 </indexterm>
39263 The <command>appendfile</command> transport delivers a message by appending it to an existing
39264 file, or by creating an entirely new file in a specified directory. Single
39265 files to which messages are appended can be in the traditional Unix mailbox
39266 format, or optionally in the MBX format supported by the Pine MUA and
39267 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
39268 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
39269 to give added protection against failures that happen part-way through the
39270 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
39271 supported. For all file formats, Exim attempts to create as many levels of
39272 directory as necessary, provided that <option>create_directory</option> is set.
39273 </para>
39274 <para>
39275 The code for the optional formats is not included in the Exim binary by
39276 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
39277 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
39278 included.
39279 </para>
39280 <para>
39281 <indexterm role="concept">
39282 <primary>quota</primary>
39283 <secondary>system</secondary>
39284 </indexterm>
39285 Exim recognizes system quota errors, and generates an appropriate message. Exim
39286 also supports its own quota control within the transport, for use when the
39287 system facility is unavailable or cannot be used for some reason.
39288 </para>
39289 <para>
39290 If there is an error while appending to a file (for example, quota exceeded or
39291 partition filled), Exim attempts to reset the file&#x2019;s length and last
39292 modification time back to what they were before. If there is an error while
39293 creating an entirely new file, the new file is removed.
39294 </para>
39295 <para>
39296 Before appending to a file, a number of security checks are made, and the
39297 file is locked. A detailed description is given below, after the list of
39298 private options.
39299 </para>
39300 <para>
39301 The <command>appendfile</command> transport is most commonly used for local deliveries to
39302 users&#x2019; mailboxes. However, it can also be used as a pseudo-remote transport for
39303 putting messages into files for remote delivery by some means other than Exim.
39304 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
39305 option).
39306 </para>
39307 <section id="SECTfildiropt">
39308 <title>The file and directory options</title>
39309 <para>
39310 The <option>file</option> option specifies a single file, to which the message is appended;
39311 the <option>directory</option> option specifies a directory, in which a new file containing
39312 the message is created. Only one of these two options can be set, and for
39313 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
39314 </para>
39315 <para>
39316 <indexterm role="variable">
39317 <primary><varname>$address_file</varname></primary>
39318 </indexterm>
39319 <indexterm role="variable">
39320 <primary><varname>$local_part</varname></primary>
39321 </indexterm>
39322 However, <command>appendfile</command> is also used for delivering messages to files or
39323 directories whose names (or parts of names) are obtained from alias,
39324 forwarding, or filtering operations (for example, a <option>save</option> command in a
39325 user&#x2019;s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
39326 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
39327 name (or partial name) of the file or directory generated by the redirection
39328 operation. There are two cases:
39329 </para>
39330 <itemizedlist>
39331 <listitem>
39332 <para>
39333 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
39334 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
39335 common case when users with local accounts use filtering to sort mail into
39336 different folders. See for example, the <command>address_file</command> transport in the
39337 default configuration. If the path ends with a slash, it is assumed to be the
39338 name of a directory. A delivery to a directory can also be forced by setting
39339 <option>maildir_format</option> or <option>mailstore_format</option>.
39340 </para>
39341 </listitem>
39342 <listitem>
39343 <para>
39344 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
39345 used to determine the file or directory name for the delivery. Normally, the
39346 contents of <varname>$address_file</varname> are used in some way in the string expansion.
39347 </para>
39348 </listitem>
39349 </itemizedlist>
39350 <para>
39351 <indexterm role="concept">
39352 <primary>Sieve filter</primary>
39353 <secondary>configuring <command>appendfile</command></secondary>
39354 </indexterm>
39355 <indexterm role="concept">
39356 <primary>Sieve filter</primary>
39357 <secondary>relative mailbox path handling</secondary>
39358 </indexterm>
39359 As an example of the second case, consider an environment where users do not
39360 have home directories. They may be permitted to use Exim filter commands of the
39361 form:
39362 </para>
39363 <literallayout class="monospaced">
39364 save folder23
39365 </literallayout>
39366 <para>
39367 or Sieve filter commands of the form:
39368 </para>
39369 <literallayout class="monospaced">
39370 require "fileinto";
39371 fileinto "folder23";
39372 </literallayout>
39373 <para>
39374 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
39375 must transform the relative path into an appropriate absolute file name. In the
39376 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
39377 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
39378 way of handling this requirement:
39379 </para>
39380 <literallayout class="monospaced">
39381 file = ${if eq{$address_file}{inbox} \
39382             {/var/mail/$local_part} \
39383             {${if eq{${substr_0_1:$address_file}}{/} \
39384                   {$address_file} \
39385                   {$home/mail/$address_file} \
39386             }} \
39387        }
39388 </literallayout>
39389 <para>
39390 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
39391 location, absolute paths are used without change, and other folders are in the
39392 <filename>mail</filename> directory within the home directory.
39393 </para>
39394 <para>
39395 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
39396 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
39397 the router. In particular, this is the case if <option>check_local_user</option> is set. If
39398 you want to prevent this happening at routing time, you can set
39399 <option>router_home_directory</option> empty. This forces the router to pass the relative
39400 path to the transport.
39401 </para>
39402 <para>
39403 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
39404 the <option>file</option> or <option>directory</option> option is still used if it is set.
39405 </para>
39406 </section>
39407 <section id="SECID134">
39408 <title>Private options for appendfile</title>
39409 <para>
39410 <indexterm role="concept">
39411 <primary>options</primary>
39412 <secondary><command>appendfile</command> transport</secondary>
39413 </indexterm>
39414 </para>
39415 <para>
39416 <indexterm role="option">
39417 <primary><option>allow_fifo</option></primary>
39418 </indexterm>
39419 </para>
39420 <informaltable frame="all">
39421 <tgroup cols="4" colsep="0" rowsep="0">
39422 <colspec colwidth="8*" align="left"/>
39423 <colspec colwidth="6*" align="center"/>
39424 <colspec colwidth="6*" align="center"/>
39425 <colspec colwidth="6*" align="right"/>
39426 <tbody>
39427 <row>
39428 <entry><option>allow_fifo</option></entry>
39429 <entry>Use: <emphasis>appendfile</emphasis></entry>
39430 <entry>Type: <emphasis>boolean</emphasis></entry>
39431 <entry>Default: <emphasis>false</emphasis></entry>
39432 </row>
39433 </tbody>
39434 </tgroup>
39435 </informaltable>
39436 <para>
39437 <indexterm role="concept">
39438 <primary>fifo (named pipe)</primary>
39439 </indexterm>
39440 <indexterm role="concept">
39441 <primary>named pipe (fifo)</primary>
39442 </indexterm>
39443 <indexterm role="concept">
39444 <primary>pipe</primary>
39445 <secondary>named (fifo)</secondary>
39446 </indexterm>
39447 Setting this option permits delivery to named pipes (FIFOs) as well as to
39448 regular files. If no process is reading the named pipe at delivery time, the
39449 delivery is deferred.
39450 </para>
39451 <para>
39452 <indexterm role="option">
39453 <primary><option>allow_symlink</option></primary>
39454 </indexterm>
39455 </para>
39456 <informaltable frame="all">
39457 <tgroup cols="4" colsep="0" rowsep="0">
39458 <colspec colwidth="8*" align="left"/>
39459 <colspec colwidth="6*" align="center"/>
39460 <colspec colwidth="6*" align="center"/>
39461 <colspec colwidth="6*" align="right"/>
39462 <tbody>
39463 <row>
39464 <entry><option>allow_symlink</option></entry>
39465 <entry>Use: <emphasis>appendfile</emphasis></entry>
39466 <entry>Type: <emphasis>boolean</emphasis></entry>
39467 <entry>Default: <emphasis>false</emphasis></entry>
39468 </row>
39469 </tbody>
39470 </tgroup>
39471 </informaltable>
39472 <para>
39473 <indexterm role="concept">
39474 <primary>symbolic link</primary>
39475 <secondary>to mailbox</secondary>
39476 </indexterm>
39477 <indexterm role="concept">
39478 <primary>mailbox</primary>
39479 <secondary>symbolic link</secondary>
39480 </indexterm>
39481 By default, <command>appendfile</command> will not deliver if the path name for the file is
39482 that of a symbolic link. Setting this option relaxes that constraint, but there
39483 are security issues involved in the use of symbolic links. Be sure you know
39484 what you are doing if you set this. Details of exactly what this option affects
39485 are included in the discussion which follows this list of options.
39486 </para>
39487 <para>
39488 <indexterm role="option">
39489 <primary><option>batch_id</option></primary>
39490 </indexterm>
39491 </para>
39492 <informaltable frame="all">
39493 <tgroup cols="4" colsep="0" rowsep="0">
39494 <colspec colwidth="8*" align="left"/>
39495 <colspec colwidth="6*" align="center"/>
39496 <colspec colwidth="6*" align="center"/>
39497 <colspec colwidth="6*" align="right"/>
39498 <tbody>
39499 <row>
39500 <entry><option>batch_id</option></entry>
39501 <entry>Use: <emphasis>appendfile</emphasis></entry>
39502 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39503 <entry>Default: <emphasis>unset</emphasis></entry>
39504 </row>
39505 </tbody>
39506 </tgroup>
39507 </informaltable>
39508 <para>
39509 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
39510 However, batching is automatically disabled for <command>appendfile</command> deliveries that
39511 happen as a result of forwarding or aliasing or other redirection directly to a
39512 file.
39513 </para>
39514 <para>
39515 <indexterm role="option">
39516 <primary><option>batch_max</option></primary>
39517 </indexterm>
39518 </para>
39519 <informaltable frame="all">
39520 <tgroup cols="4" colsep="0" rowsep="0">
39521 <colspec colwidth="8*" align="left"/>
39522 <colspec colwidth="6*" align="center"/>
39523 <colspec colwidth="6*" align="center"/>
39524 <colspec colwidth="6*" align="right"/>
39525 <tbody>
39526 <row>
39527 <entry><option>batch_max</option></entry>
39528 <entry>Use: <emphasis>appendfile</emphasis></entry>
39529 <entry>Type: <emphasis>integer</emphasis></entry>
39530 <entry>Default: <emphasis>1</emphasis></entry>
39531 </row>
39532 </tbody>
39533 </tgroup>
39534 </informaltable>
39535 <para>
39536 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
39537 </para>
39538 <para>
39539 <indexterm role="option">
39540 <primary><option>check_group</option></primary>
39541 </indexterm>
39542 </para>
39543 <informaltable frame="all">
39544 <tgroup cols="4" colsep="0" rowsep="0">
39545 <colspec colwidth="8*" align="left"/>
39546 <colspec colwidth="6*" align="center"/>
39547 <colspec colwidth="6*" align="center"/>
39548 <colspec colwidth="6*" align="right"/>
39549 <tbody>
39550 <row>
39551 <entry><option>check_group</option></entry>
39552 <entry>Use: <emphasis>appendfile</emphasis></entry>
39553 <entry>Type: <emphasis>boolean</emphasis></entry>
39554 <entry>Default: <emphasis>false</emphasis></entry>
39555 </row>
39556 </tbody>
39557 </tgroup>
39558 </informaltable>
39559 <para>
39560 When this option is set, the group owner of the file defined by the <option>file</option>
39561 option is checked to see that it is the same as the group under which the
39562 delivery process is running. The default setting is false because the default
39563 file mode is 0600, which means that the group is irrelevant.
39564 </para>
39565 <para>
39566 <indexterm role="option">
39567 <primary><option>check_owner</option></primary>
39568 </indexterm>
39569 </para>
39570 <informaltable frame="all">
39571 <tgroup cols="4" colsep="0" rowsep="0">
39572 <colspec colwidth="8*" align="left"/>
39573 <colspec colwidth="6*" align="center"/>
39574 <colspec colwidth="6*" align="center"/>
39575 <colspec colwidth="6*" align="right"/>
39576 <tbody>
39577 <row>
39578 <entry><option>check_owner</option></entry>
39579 <entry>Use: <emphasis>appendfile</emphasis></entry>
39580 <entry>Type: <emphasis>boolean</emphasis></entry>
39581 <entry>Default: <emphasis>true</emphasis></entry>
39582 </row>
39583 </tbody>
39584 </tgroup>
39585 </informaltable>
39586 <para>
39587 When this option is set, the owner of the file defined by the <option>file</option> option
39588 is checked to ensure that it is the same as the user under which the delivery
39589 process is running.
39590 </para>
39591 <para>
39592 <indexterm role="option">
39593 <primary><option>check_string</option></primary>
39594 </indexterm>
39595 </para>
39596 <informaltable frame="all">
39597 <tgroup cols="4" colsep="0" rowsep="0">
39598 <colspec colwidth="8*" align="left"/>
39599 <colspec colwidth="6*" align="center"/>
39600 <colspec colwidth="6*" align="center"/>
39601 <colspec colwidth="6*" align="right"/>
39602 <tbody>
39603 <row>
39604 <entry><option>check_string</option></entry>
39605 <entry>Use: <emphasis>appendfile</emphasis></entry>
39606 <entry>Type: <emphasis>string</emphasis></entry>
39607 <entry>Default: <emphasis>see below</emphasis></entry>
39608 </row>
39609 </tbody>
39610 </tgroup>
39611 </informaltable>
39612 <para>
39613 <indexterm role="concept">
39614 <primary><quote>From</quote> line</primary>
39615 </indexterm>
39616 As <command>appendfile</command> writes the message, the start of each line is tested for
39617 matching <option>check_string</option>, and if it does, the initial matching characters are
39618 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
39619 a literal string, not a regular expression, and the case of any letters it
39620 contains is significant.
39621 </para>
39622 <para>
39623 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
39624 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
39625 configuration are ignored. Otherwise, they default to <quote>From&nbsp;</quote> and
39626 <quote>&gt;From&nbsp;</quote> when the <option>file</option> option is set, and unset when any of the
39627 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
39628 </para>
39629 <para>
39630 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
39631 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
39632 <quote>From&nbsp;</quote> indicates the start of a new message. All four options need changing
39633 if another format is used. For example, to deliver to mailboxes in MMDF format:
39634 <indexterm role="concept">
39635 <primary>MMDF format mailbox</primary>
39636 </indexterm>
39637 <indexterm role="concept">
39638 <primary>mailbox</primary>
39639 <secondary>MMDF format</secondary>
39640 </indexterm>
39641 </para>
39642 <literallayout class="monospaced">
39643 check_string = "\1\1\1\1\n"
39644 escape_string = "\1\1\1\1 \n"
39645 message_prefix = "\1\1\1\1\n"
39646 message_suffix = "\1\1\1\1\n"
39647 </literallayout>
39648 <para>
39649 <indexterm role="option">
39650 <primary><option>create_directory</option></primary>
39651 </indexterm>
39652 </para>
39653 <informaltable frame="all">
39654 <tgroup cols="4" colsep="0" rowsep="0">
39655 <colspec colwidth="8*" align="left"/>
39656 <colspec colwidth="6*" align="center"/>
39657 <colspec colwidth="6*" align="center"/>
39658 <colspec colwidth="6*" align="right"/>
39659 <tbody>
39660 <row>
39661 <entry><option>create_directory</option></entry>
39662 <entry>Use: <emphasis>appendfile</emphasis></entry>
39663 <entry>Type: <emphasis>boolean</emphasis></entry>
39664 <entry>Default: <emphasis>true</emphasis></entry>
39665 </row>
39666 </tbody>
39667 </tgroup>
39668 </informaltable>
39669 <para>
39670 <indexterm role="concept">
39671 <primary>directory creation</primary>
39672 </indexterm>
39673 When this option is true, Exim attempts to create any missing superior
39674 directories for the file that it is about to write. A created directory&#x2019;s mode
39675 is given by the <option>directory_mode</option> option.
39676 </para>
39677 <para>
39678 The group ownership of a newly created directory is highly dependent on the
39679 operating system (and possibly the file system) that is being used. For
39680 example, in Solaris, if the parent directory has the setgid bit set, its group
39681 is propagated to the child; if not, the currently set group is used. However,
39682 in FreeBSD, the parent&#x2019;s group is always used.
39683 </para>
39684 <para>
39685 <indexterm role="option">
39686 <primary><option>create_file</option></primary>
39687 </indexterm>
39688 </para>
39689 <informaltable frame="all">
39690 <tgroup cols="4" colsep="0" rowsep="0">
39691 <colspec colwidth="8*" align="left"/>
39692 <colspec colwidth="6*" align="center"/>
39693 <colspec colwidth="6*" align="center"/>
39694 <colspec colwidth="6*" align="right"/>
39695 <tbody>
39696 <row>
39697 <entry><option>create_file</option></entry>
39698 <entry>Use: <emphasis>appendfile</emphasis></entry>
39699 <entry>Type: <emphasis>string</emphasis></entry>
39700 <entry>Default: <emphasis>anywhere</emphasis></entry>
39701 </row>
39702 </tbody>
39703 </tgroup>
39704 </informaltable>
39705 <para>
39706 This option constrains the location of files and directories that are created
39707 by this transport. It applies to files defined by the <option>file</option> option and
39708 directories defined by the <option>directory</option> option. In the case of maildir
39709 delivery, it applies to the top level directory, not the maildir directories
39710 beneath.
39711 </para>
39712 <para>
39713 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
39714 <quote>belowhome</quote>. In the second and third cases, a home directory must have been
39715 set for the transport. This option is not useful when an explicit file name is
39716 given for normal mailbox deliveries. It is intended for the case when file
39717 names are generated from users&#x2019; <filename>.forward</filename> files. These are usually handled
39718 by an <command>appendfile</command> transport called <option>address_file</option>. See also
39719 <option>file_must_exist</option>.
39720 </para>
39721 <para>
39722 <indexterm role="option">
39723 <primary><option>directory</option></primary>
39724 </indexterm>
39725 </para>
39726 <informaltable frame="all">
39727 <tgroup cols="4" colsep="0" rowsep="0">
39728 <colspec colwidth="8*" align="left"/>
39729 <colspec colwidth="6*" align="center"/>
39730 <colspec colwidth="6*" align="center"/>
39731 <colspec colwidth="6*" align="right"/>
39732 <tbody>
39733 <row>
39734 <entry><option>directory</option></entry>
39735 <entry>Use: <emphasis>appendfile</emphasis></entry>
39736 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39737 <entry>Default: <emphasis>unset</emphasis></entry>
39738 </row>
39739 </tbody>
39740 </tgroup>
39741 </informaltable>
39742 <para>
39743 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
39744 or <option>directory</option> must be set, unless the delivery is the direct result of a
39745 redirection (see section <xref linkend="SECTfildiropt"/>).
39746 </para>
39747 <para>
39748 When <option>directory</option> is set, the string is expanded, and the message is delivered
39749 into a new file or files in or below the given directory, instead of being
39750 appended to a single mailbox file. A number of different formats are provided
39751 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
39752 <xref linkend="SECTopdir"/> for further details of this form of delivery.
39753 </para>
39754 <para>
39755 <indexterm role="option">
39756 <primary><option>directory_file</option></primary>
39757 </indexterm>
39758 </para>
39759 <informaltable frame="all">
39760 <tgroup cols="4" colsep="0" rowsep="0">
39761 <colspec colwidth="8*" align="left"/>
39762 <colspec colwidth="6*" align="center"/>
39763 <colspec colwidth="6*" align="center"/>
39764 <colspec colwidth="6*" align="right"/>
39765 <tbody>
39766 <row>
39767 <entry><option>directory_file</option></entry>
39768 <entry>Use: <emphasis>appendfile</emphasis></entry>
39769 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39770 <entry>Default: <emphasis>see below</emphasis></entry>
39771 </row>
39772 </tbody>
39773 </tgroup>
39774 </informaltable>
39775 <para>
39776 <indexterm role="concept">
39777 <primary>base62</primary>
39778 </indexterm>
39779 <indexterm role="variable">
39780 <primary><varname>$inode</varname></primary>
39781 </indexterm>
39782 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
39783 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
39784 whose name is obtained by expanding this string. The default value is:
39785 </para>
39786 <literallayout class="monospaced">
39787 q${base62:$tod_epoch}-$inode
39788 </literallayout>
39789 <para>
39790 This generates a unique name from the current time, in base 62 form, and the
39791 inode of the file. The variable <varname>$inode</varname> is available only when expanding this
39792 option.
39793 </para>
39794 <para>
39795 <indexterm role="option">
39796 <primary><option>directory_mode</option></primary>
39797 </indexterm>
39798 </para>
39799 <informaltable frame="all">
39800 <tgroup cols="4" colsep="0" rowsep="0">
39801 <colspec colwidth="8*" align="left"/>
39802 <colspec colwidth="6*" align="center"/>
39803 <colspec colwidth="6*" align="center"/>
39804 <colspec colwidth="6*" align="right"/>
39805 <tbody>
39806 <row>
39807 <entry><option>directory_mode</option></entry>
39808 <entry>Use: <emphasis>appendfile</emphasis></entry>
39809 <entry>Type: <emphasis>octal integer</emphasis></entry>
39810 <entry>Default: <emphasis>0700</emphasis></entry>
39811 </row>
39812 </tbody>
39813 </tgroup>
39814 </informaltable>
39815 <para>
39816 If <command>appendfile</command> creates any directories as a result of the
39817 <option>create_directory</option> option, their mode is specified by this option.
39818 </para>
39819 <para>
39820 <indexterm role="option">
39821 <primary><option>escape_string</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>escape_string</option></entry>
39833 <entry>Use: <emphasis>appendfile</emphasis></entry>
39834 <entry>Type: <emphasis>string</emphasis></entry>
39835 <entry>Default: <emphasis>see description</emphasis></entry>
39836 </row>
39837 </tbody>
39838 </tgroup>
39839 </informaltable>
39840 <para>
39841 See <option>check_string</option> above.
39842 </para>
39843 <para>
39844 <indexterm role="option">
39845 <primary><option>file</option></primary>
39846 </indexterm>
39847 </para>
39848 <informaltable frame="all">
39849 <tgroup cols="4" colsep="0" rowsep="0">
39850 <colspec colwidth="8*" align="left"/>
39851 <colspec colwidth="6*" align="center"/>
39852 <colspec colwidth="6*" align="center"/>
39853 <colspec colwidth="6*" align="right"/>
39854 <tbody>
39855 <row>
39856 <entry><option>file</option></entry>
39857 <entry>Use: <emphasis>appendfile</emphasis></entry>
39858 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39859 <entry>Default: <emphasis>unset</emphasis></entry>
39860 </row>
39861 </tbody>
39862 </tgroup>
39863 </informaltable>
39864 <para>
39865 This option is mutually exclusive with the <option>directory</option> option, but one of
39866 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
39867 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
39868 specifies a single file, to which the message is appended. One or more of
39869 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
39870 <option>file</option>.
39871 </para>
39872 <para>
39873 <indexterm role="concept">
39874 <primary>NFS</primary>
39875 <secondary>lock file</secondary>
39876 </indexterm>
39877 <indexterm role="concept">
39878 <primary>locking files</primary>
39879 </indexterm>
39880 <indexterm role="concept">
39881 <primary>lock files</primary>
39882 </indexterm>
39883 If you are using more than one host to deliver over NFS into the same
39884 mailboxes, you should always use lock files.
39885 </para>
39886 <para>
39887 The string value is expanded for each delivery, and must yield an absolute
39888 path. The most common settings of this option are variations on one of these
39889 examples:
39890 </para>
39891 <literallayout class="monospaced">
39892 file = /var/spool/mail/$local_part
39893 file = /home/$local_part/inbox
39894 file = $home/inbox
39895 </literallayout>
39896 <para>
39897 <indexterm role="concept">
39898 <primary><quote>sticky</quote> bit</primary>
39899 </indexterm>
39900 In the first example, all deliveries are done into the same directory. If Exim
39901 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
39902 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
39903 deliveries to be possible, or alternatively the <option>group</option> option can be used to
39904 run the delivery under a group id which has write access to the directory.
39905 </para>
39906 <para>
39907 <indexterm role="option">
39908 <primary><option>file_format</option></primary>
39909 </indexterm>
39910 </para>
39911 <informaltable frame="all">
39912 <tgroup cols="4" colsep="0" rowsep="0">
39913 <colspec colwidth="8*" align="left"/>
39914 <colspec colwidth="6*" align="center"/>
39915 <colspec colwidth="6*" align="center"/>
39916 <colspec colwidth="6*" align="right"/>
39917 <tbody>
39918 <row>
39919 <entry><option>file_format</option></entry>
39920 <entry>Use: <emphasis>appendfile</emphasis></entry>
39921 <entry>Type: <emphasis>string</emphasis></entry>
39922 <entry>Default: <emphasis>unset</emphasis></entry>
39923 </row>
39924 </tbody>
39925 </tgroup>
39926 </informaltable>
39927 <para>
39928 <indexterm role="concept">
39929 <primary>file</primary>
39930 <secondary>mailbox; checking existing format</secondary>
39931 </indexterm>
39932 This option requests the transport to check the format of an existing file
39933 before adding to it. The check consists of matching a specific string at the
39934 start of the file. The value of the option consists of an even number of
39935 colon-separated strings. The first of each pair is the test string, and the
39936 second is the name of a transport. If the transport associated with a matched
39937 string is not the current transport, control is passed over to the other
39938 transport. For example, suppose the standard <command>local_delivery</command> transport has
39939 this added to it:
39940 </para>
39941 <literallayout class="monospaced">
39942 file_format = "From       : local_delivery :\
39943                \1\1\1\1\n : local_mmdf_delivery"
39944 </literallayout>
39945 <para>
39946 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
39947 a mailbox begins with four binary ones followed by a newline, control is passed
39948 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
39949 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
39950 is assumed to match the current transport. If the start of a mailbox doesn&#x2019;t
39951 match any string, or if the transport named for a given string is not defined,
39952 delivery is deferred.
39953 </para>
39954 <para>
39955 <indexterm role="option">
39956 <primary><option>file_must_exist</option></primary>
39957 </indexterm>
39958 </para>
39959 <informaltable frame="all">
39960 <tgroup cols="4" colsep="0" rowsep="0">
39961 <colspec colwidth="8*" align="left"/>
39962 <colspec colwidth="6*" align="center"/>
39963 <colspec colwidth="6*" align="center"/>
39964 <colspec colwidth="6*" align="right"/>
39965 <tbody>
39966 <row>
39967 <entry><option>file_must_exist</option></entry>
39968 <entry>Use: <emphasis>appendfile</emphasis></entry>
39969 <entry>Type: <emphasis>boolean</emphasis></entry>
39970 <entry>Default: <emphasis>false</emphasis></entry>
39971 </row>
39972 </tbody>
39973 </tgroup>
39974 </informaltable>
39975 <para>
39976 If this option is true, the file specified by the <option>file</option> option must exist.
39977 A temporary error occurs if it does not, causing delivery to be deferred.
39978 If this option is false, the file is created if it does not exist.
39979 </para>
39980 <para>
39981 <indexterm role="option">
39982 <primary><option>lock_fcntl_timeout</option></primary>
39983 </indexterm>
39984 </para>
39985 <informaltable frame="all">
39986 <tgroup cols="4" colsep="0" rowsep="0">
39987 <colspec colwidth="8*" align="left"/>
39988 <colspec colwidth="6*" align="center"/>
39989 <colspec colwidth="6*" align="center"/>
39990 <colspec colwidth="6*" align="right"/>
39991 <tbody>
39992 <row>
39993 <entry><option>lock_fcntl_timeout</option></entry>
39994 <entry>Use: <emphasis>appendfile</emphasis></entry>
39995 <entry>Type: <emphasis>time</emphasis></entry>
39996 <entry>Default: <emphasis>0s</emphasis></entry>
39997 </row>
39998 </tbody>
39999 </tgroup>
40000 </informaltable>
40001 <para>
40002 <indexterm role="concept">
40003 <primary>timeout</primary>
40004 <secondary>mailbox locking</secondary>
40005 </indexterm>
40006 <indexterm role="concept">
40007 <primary>mailbox</primary>
40008 <secondary>locking, blocking and non-blocking</secondary>
40009 </indexterm>
40010 <indexterm role="concept">
40011 <primary>locking files</primary>
40012 </indexterm>
40013 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
40014 when locking an open mailbox file. If the call fails, the delivery process
40015 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
40016 Non-blocking calls are used so that the file is not kept open during the wait
40017 for the lock; the reason for this is to make it as safe as possible for
40018 deliveries over NFS in the case when processes might be accessing an NFS
40019 mailbox without using a lock file. This should not be done, but
40020 misunderstandings and hence misconfigurations are not unknown.
40021 </para>
40022 <para>
40023 On a busy system, however, the performance of a non-blocking lock approach is
40024 not as good as using a blocking lock with a timeout. In this case, the waiting
40025 is done inside the system call, and Exim&#x2019;s delivery process acquires the lock
40026 and can proceed as soon as the previous lock holder releases it.
40027 </para>
40028 <para>
40029 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
40030 timeout, are used. There may still be some retrying: the maximum number of
40031 retries is
40032 </para>
40033 <literallayout class="monospaced">
40034 (lock_retries * lock_interval) / lock_fcntl_timeout
40035 </literallayout>
40036 <para>
40037 rounded up to the next whole number. In other words, the total time during
40038 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
40039 <option>lock_fcntl_timeout</option> is set very large.
40040 </para>
40041 <para>
40042 You should consider setting this option if you are getting a lot of delayed
40043 local deliveries because of errors of the form
40044 </para>
40045 <literallayout class="monospaced">
40046 failed to lock mailbox /some/file (fcntl)
40047 </literallayout>
40048 <para>
40049 <indexterm role="option">
40050 <primary><option>lock_flock_timeout</option></primary>
40051 </indexterm>
40052 </para>
40053 <informaltable frame="all">
40054 <tgroup cols="4" colsep="0" rowsep="0">
40055 <colspec colwidth="8*" align="left"/>
40056 <colspec colwidth="6*" align="center"/>
40057 <colspec colwidth="6*" align="center"/>
40058 <colspec colwidth="6*" align="right"/>
40059 <tbody>
40060 <row>
40061 <entry><option>lock_flock_timeout</option></entry>
40062 <entry>Use: <emphasis>appendfile</emphasis></entry>
40063 <entry>Type: <emphasis>time</emphasis></entry>
40064 <entry>Default: <emphasis>0s</emphasis></entry>
40065 </row>
40066 </tbody>
40067 </tgroup>
40068 </informaltable>
40069 <para>
40070 This timeout applies to file locking when using <function>flock()</function> (see
40071 <option>use_flock</option>); the timeout operates in a similar manner to
40072 <option>lock_fcntl_timeout</option>.
40073 </para>
40074 <para>
40075 <indexterm role="option">
40076 <primary><option>lock_interval</option></primary>
40077 </indexterm>
40078 </para>
40079 <informaltable frame="all">
40080 <tgroup cols="4" colsep="0" rowsep="0">
40081 <colspec colwidth="8*" align="left"/>
40082 <colspec colwidth="6*" align="center"/>
40083 <colspec colwidth="6*" align="center"/>
40084 <colspec colwidth="6*" align="right"/>
40085 <tbody>
40086 <row>
40087 <entry><option>lock_interval</option></entry>
40088 <entry>Use: <emphasis>appendfile</emphasis></entry>
40089 <entry>Type: <emphasis>time</emphasis></entry>
40090 <entry>Default: <emphasis>3s</emphasis></entry>
40091 </row>
40092 </tbody>
40093 </tgroup>
40094 </informaltable>
40095 <para>
40096 This specifies the time to wait between attempts to lock the file. See below
40097 for details of locking.
40098 </para>
40099 <para>
40100 <indexterm role="option">
40101 <primary><option>lock_retries</option></primary>
40102 </indexterm>
40103 </para>
40104 <informaltable frame="all">
40105 <tgroup cols="4" colsep="0" rowsep="0">
40106 <colspec colwidth="8*" align="left"/>
40107 <colspec colwidth="6*" align="center"/>
40108 <colspec colwidth="6*" align="center"/>
40109 <colspec colwidth="6*" align="right"/>
40110 <tbody>
40111 <row>
40112 <entry><option>lock_retries</option></entry>
40113 <entry>Use: <emphasis>appendfile</emphasis></entry>
40114 <entry>Type: <emphasis>integer</emphasis></entry>
40115 <entry>Default: <emphasis>10</emphasis></entry>
40116 </row>
40117 </tbody>
40118 </tgroup>
40119 </informaltable>
40120 <para>
40121 This specifies the maximum number of attempts to lock the file. A value of zero
40122 is treated as 1. See below for details of locking.
40123 </para>
40124 <para>
40125 <indexterm role="option">
40126 <primary><option>lockfile_mode</option></primary>
40127 </indexterm>
40128 </para>
40129 <informaltable frame="all">
40130 <tgroup cols="4" colsep="0" rowsep="0">
40131 <colspec colwidth="8*" align="left"/>
40132 <colspec colwidth="6*" align="center"/>
40133 <colspec colwidth="6*" align="center"/>
40134 <colspec colwidth="6*" align="right"/>
40135 <tbody>
40136 <row>
40137 <entry><option>lockfile_mode</option></entry>
40138 <entry>Use: <emphasis>appendfile</emphasis></entry>
40139 <entry>Type: <emphasis>octal integer</emphasis></entry>
40140 <entry>Default: <emphasis>0600</emphasis></entry>
40141 </row>
40142 </tbody>
40143 </tgroup>
40144 </informaltable>
40145 <para>
40146 This specifies the mode of the created lock file, when a lock file is being
40147 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
40148 </para>
40149 <para>
40150 <indexterm role="option">
40151 <primary><option>lockfile_timeout</option></primary>
40152 </indexterm>
40153 </para>
40154 <informaltable frame="all">
40155 <tgroup cols="4" colsep="0" rowsep="0">
40156 <colspec colwidth="8*" align="left"/>
40157 <colspec colwidth="6*" align="center"/>
40158 <colspec colwidth="6*" align="center"/>
40159 <colspec colwidth="6*" align="right"/>
40160 <tbody>
40161 <row>
40162 <entry><option>lockfile_timeout</option></entry>
40163 <entry>Use: <emphasis>appendfile</emphasis></entry>
40164 <entry>Type: <emphasis>time</emphasis></entry>
40165 <entry>Default: <emphasis>30m</emphasis></entry>
40166 </row>
40167 </tbody>
40168 </tgroup>
40169 </informaltable>
40170 <para>
40171 <indexterm role="concept">
40172 <primary>timeout</primary>
40173 <secondary>mailbox locking</secondary>
40174 </indexterm>
40175 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
40176 exists and is older than this value, it is assumed to have been left behind by
40177 accident, and Exim attempts to remove it.
40178 </para>
40179 <para>
40180 <indexterm role="option">
40181 <primary><option>mailbox_filecount</option></primary>
40182 </indexterm>
40183 </para>
40184 <informaltable frame="all">
40185 <tgroup cols="4" colsep="0" rowsep="0">
40186 <colspec colwidth="8*" align="left"/>
40187 <colspec colwidth="6*" align="center"/>
40188 <colspec colwidth="6*" align="center"/>
40189 <colspec colwidth="6*" align="right"/>
40190 <tbody>
40191 <row>
40192 <entry><option>mailbox_filecount</option></entry>
40193 <entry>Use: <emphasis>appendfile</emphasis></entry>
40194 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40195 <entry>Default: <emphasis>unset</emphasis></entry>
40196 </row>
40197 </tbody>
40198 </tgroup>
40199 </informaltable>
40200 <para>
40201 <indexterm role="concept">
40202 <primary>mailbox</primary>
40203 <secondary>specifying size of</secondary>
40204 </indexterm>
40205 <indexterm role="concept">
40206 <primary>size</primary>
40207 <secondary>of mailbox</secondary>
40208 </indexterm>
40209 If this option is set, it is expanded, and the result is taken as the current
40210 number of files in the mailbox. It must be a decimal number, optionally
40211 followed by K or M. This provides a way of obtaining this information from an
40212 external source that maintains the data.
40213 </para>
40214 <para>
40215 <indexterm role="option">
40216 <primary><option>mailbox_size</option></primary>
40217 </indexterm>
40218 </para>
40219 <informaltable frame="all">
40220 <tgroup cols="4" colsep="0" rowsep="0">
40221 <colspec colwidth="8*" align="left"/>
40222 <colspec colwidth="6*" align="center"/>
40223 <colspec colwidth="6*" align="center"/>
40224 <colspec colwidth="6*" align="right"/>
40225 <tbody>
40226 <row>
40227 <entry><option>mailbox_size</option></entry>
40228 <entry>Use: <emphasis>appendfile</emphasis></entry>
40229 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40230 <entry>Default: <emphasis>unset</emphasis></entry>
40231 </row>
40232 </tbody>
40233 </tgroup>
40234 </informaltable>
40235 <para>
40236 <indexterm role="concept">
40237 <primary>mailbox</primary>
40238 <secondary>specifying size of</secondary>
40239 </indexterm>
40240 <indexterm role="concept">
40241 <primary>size</primary>
40242 <secondary>of mailbox</secondary>
40243 </indexterm>
40244 If this option is set, it is expanded, and the result is taken as the current
40245 size the mailbox. It must be a decimal number, optionally followed by K or M.
40246 This provides a way of obtaining this information from an external source that
40247 maintains the data. This is likely to be helpful for maildir deliveries where
40248 it is computationally expensive to compute the size of a mailbox.
40249 </para>
40250 <para>
40251 <indexterm role="option">
40252 <primary><option>maildir_format</option></primary>
40253 </indexterm>
40254 </para>
40255 <informaltable frame="all">
40256 <tgroup cols="4" colsep="0" rowsep="0">
40257 <colspec colwidth="8*" align="left"/>
40258 <colspec colwidth="6*" align="center"/>
40259 <colspec colwidth="6*" align="center"/>
40260 <colspec colwidth="6*" align="right"/>
40261 <tbody>
40262 <row>
40263 <entry><option>maildir_format</option></entry>
40264 <entry>Use: <emphasis>appendfile</emphasis></entry>
40265 <entry>Type: <emphasis>boolean</emphasis></entry>
40266 <entry>Default: <emphasis>false</emphasis></entry>
40267 </row>
40268 </tbody>
40269 </tgroup>
40270 </informaltable>
40271 <para>
40272 <indexterm role="concept">
40273 <primary>maildir format</primary>
40274 <secondary>specifying</secondary>
40275 </indexterm>
40276 If this option is set with the <option>directory</option> option, the delivery is into a new
40277 file, in the <quote>maildir</quote> format that is used by other mail software. When the
40278 transport is activated directly from a <command>redirect</command> router (for example, the
40279 <command>address_file</command> transport in the default configuration), setting
40280 <option>maildir_format</option> causes the path received from the router to be treated as a
40281 directory, whether or not it ends with <literal>/</literal>. This option is available only if
40282 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
40283 <xref linkend="SECTmaildirdelivery"/> below for further details.
40284 </para>
40285 <para>
40286 <indexterm role="option">
40287 <primary><option>maildir_quota_directory_regex</option></primary>
40288 </indexterm>
40289 </para>
40290 <informaltable frame="all">
40291 <tgroup cols="4" colsep="0" rowsep="0">
40292 <colspec colwidth="8*" align="left"/>
40293 <colspec colwidth="6*" align="center"/>
40294 <colspec colwidth="6*" align="center"/>
40295 <colspec colwidth="6*" align="right"/>
40296 <tbody>
40297 <row>
40298 <entry><option>maildir_quota_directory_regex</option></entry>
40299 <entry>Use: <emphasis>appendfile</emphasis></entry>
40300 <entry>Type: <emphasis>string</emphasis></entry>
40301 <entry>Default: <emphasis>See below</emphasis></entry>
40302 </row>
40303 </tbody>
40304 </tgroup>
40305 </informaltable>
40306 <para>
40307 <indexterm role="concept">
40308 <primary>maildir format</primary>
40309 <secondary>quota; directories included in</secondary>
40310 </indexterm>
40311 <indexterm role="concept">
40312 <primary>quota</primary>
40313 <secondary>maildir; directories included in</secondary>
40314 </indexterm>
40315 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
40316 a regular expression for specifying directories, relative to the quota
40317 directory (see <option>quota_directory</option>), that should be included in the quota
40318 calculation. The default value is:
40319 </para>
40320 <literallayout class="monospaced">
40321 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
40322 </literallayout>
40323 <para>
40324 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
40325 (directories whose names begin with a dot). If you want to exclude the
40326 <filename>Trash</filename>
40327 folder from the count (as some sites do), you need to change this setting to
40328 </para>
40329 <literallayout class="monospaced">
40330 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
40331 </literallayout>
40332 <para>
40333 This uses a negative lookahead in the regular expression to exclude the
40334 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
40335 calculations, quota processing is bypassed for any messages that are delivered
40336 directly into that directory.
40337 </para>
40338 <para>
40339 <indexterm role="option">
40340 <primary><option>maildir_retries</option></primary>
40341 </indexterm>
40342 </para>
40343 <informaltable frame="all">
40344 <tgroup cols="4" colsep="0" rowsep="0">
40345 <colspec colwidth="8*" align="left"/>
40346 <colspec colwidth="6*" align="center"/>
40347 <colspec colwidth="6*" align="center"/>
40348 <colspec colwidth="6*" align="right"/>
40349 <tbody>
40350 <row>
40351 <entry><option>maildir_retries</option></entry>
40352 <entry>Use: <emphasis>appendfile</emphasis></entry>
40353 <entry>Type: <emphasis>integer</emphasis></entry>
40354 <entry>Default: <emphasis>10</emphasis></entry>
40355 </row>
40356 </tbody>
40357 </tgroup>
40358 </informaltable>
40359 <para>
40360 This option specifies the number of times to retry when writing a file in
40361 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
40362 </para>
40363 <para>
40364 <indexterm role="option">
40365 <primary><option>maildir_tag</option></primary>
40366 </indexterm>
40367 </para>
40368 <informaltable frame="all">
40369 <tgroup cols="4" colsep="0" rowsep="0">
40370 <colspec colwidth="8*" align="left"/>
40371 <colspec colwidth="6*" align="center"/>
40372 <colspec colwidth="6*" align="center"/>
40373 <colspec colwidth="6*" align="right"/>
40374 <tbody>
40375 <row>
40376 <entry><option>maildir_tag</option></entry>
40377 <entry>Use: <emphasis>appendfile</emphasis></entry>
40378 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40379 <entry>Default: <emphasis>unset</emphasis></entry>
40380 </row>
40381 </tbody>
40382 </tgroup>
40383 </informaltable>
40384 <para>
40385 This option applies only to deliveries in maildir format, and is described in
40386 section <xref linkend="SECTmaildirdelivery"/> below.
40387 </para>
40388 <para>
40389 <indexterm role="option">
40390 <primary><option>maildir_use_size_file</option></primary>
40391 </indexterm>
40392 </para>
40393 <informaltable frame="all">
40394 <tgroup cols="4" colsep="0" rowsep="0">
40395 <colspec colwidth="8*" align="left"/>
40396 <colspec colwidth="6*" align="center"/>
40397 <colspec colwidth="6*" align="center"/>
40398 <colspec colwidth="6*" align="right"/>
40399 <tbody>
40400 <row>
40401 <entry><option>maildir_use_size_file</option></entry>
40402 <entry>Use: <emphasis>appendfile</emphasis>&dagger;<emphasis></emphasis></entry>
40403 <entry>Type: <emphasis>boolean</emphasis></entry>
40404 <entry>Default: <emphasis>false</emphasis></entry>
40405 </row>
40406 </tbody>
40407 </tgroup>
40408 </informaltable>
40409 <para>
40410 <indexterm role="concept">
40411 <primary>maildir format</primary>
40412 <secondary><filename>maildirsize</filename> file</secondary>
40413 </indexterm>
40414 The result of string expansion for this option must be a valid boolean value.
40415 If it is true, it enables support for <filename>maildirsize</filename> files. Exim
40416 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
40417 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
40418 value is zero. See <option>maildir_quota_directory_regex</option> above and section
40419 <xref linkend="SECTmaildirdelivery"/> below for further details.
40420 </para>
40421 <para>
40422 <indexterm role="option">
40423 <primary><option>maildirfolder_create_regex</option></primary>
40424 </indexterm>
40425 </para>
40426 <informaltable frame="all">
40427 <tgroup cols="4" colsep="0" rowsep="0">
40428 <colspec colwidth="8*" align="left"/>
40429 <colspec colwidth="6*" align="center"/>
40430 <colspec colwidth="6*" align="center"/>
40431 <colspec colwidth="6*" align="right"/>
40432 <tbody>
40433 <row>
40434 <entry><option>maildirfolder_create_regex</option></entry>
40435 <entry>Use: <emphasis>appendfile</emphasis></entry>
40436 <entry>Type: <emphasis>string</emphasis></entry>
40437 <entry>Default: <emphasis>unset</emphasis></entry>
40438 </row>
40439 </tbody>
40440 </tgroup>
40441 </informaltable>
40442 <para>
40443 <indexterm role="concept">
40444 <primary>maildir format</primary>
40445 <secondary><filename>maildirfolder</filename> file</secondary>
40446 </indexterm>
40447 <indexterm role="concept">
40448 <primary><filename>maildirfolder</filename>, creating</primary>
40449 </indexterm>
40450 The value of this option is a regular expression. If it is unset, it has no
40451 effect. Otherwise, before a maildir delivery takes place, the pattern is
40452 matched against the name of the maildir directory, that is, the directory
40453 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
40454 delivery. If there is a match, Exim checks for the existence of a file called
40455 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
40456 See section <xref linkend="SECTmaildirdelivery"/> for more details.
40457 </para>
40458 <para>
40459 <indexterm role="option">
40460 <primary><option>mailstore_format</option></primary>
40461 </indexterm>
40462 </para>
40463 <informaltable frame="all">
40464 <tgroup cols="4" colsep="0" rowsep="0">
40465 <colspec colwidth="8*" align="left"/>
40466 <colspec colwidth="6*" align="center"/>
40467 <colspec colwidth="6*" align="center"/>
40468 <colspec colwidth="6*" align="right"/>
40469 <tbody>
40470 <row>
40471 <entry><option>mailstore_format</option></entry>
40472 <entry>Use: <emphasis>appendfile</emphasis></entry>
40473 <entry>Type: <emphasis>boolean</emphasis></entry>
40474 <entry>Default: <emphasis>false</emphasis></entry>
40475 </row>
40476 </tbody>
40477 </tgroup>
40478 </informaltable>
40479 <para>
40480 <indexterm role="concept">
40481 <primary>mailstore format</primary>
40482 <secondary>specifying</secondary>
40483 </indexterm>
40484 If this option is set with the <option>directory</option> option, the delivery is into two
40485 new files in  <quote>mailstore</quote> format. The option is available only if
40486 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
40487 below for further details.
40488 </para>
40489 <para>
40490 <indexterm role="option">
40491 <primary><option>mailstore_prefix</option></primary>
40492 </indexterm>
40493 </para>
40494 <informaltable frame="all">
40495 <tgroup cols="4" colsep="0" rowsep="0">
40496 <colspec colwidth="8*" align="left"/>
40497 <colspec colwidth="6*" align="center"/>
40498 <colspec colwidth="6*" align="center"/>
40499 <colspec colwidth="6*" align="right"/>
40500 <tbody>
40501 <row>
40502 <entry><option>mailstore_prefix</option></entry>
40503 <entry>Use: <emphasis>appendfile</emphasis></entry>
40504 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40505 <entry>Default: <emphasis>unset</emphasis></entry>
40506 </row>
40507 </tbody>
40508 </tgroup>
40509 </informaltable>
40510 <para>
40511 This option applies only to deliveries in mailstore format, and is described in
40512 section <xref linkend="SECTopdir"/> below.
40513 </para>
40514 <para>
40515 <indexterm role="option">
40516 <primary><option>mailstore_suffix</option></primary>
40517 </indexterm>
40518 </para>
40519 <informaltable frame="all">
40520 <tgroup cols="4" colsep="0" rowsep="0">
40521 <colspec colwidth="8*" align="left"/>
40522 <colspec colwidth="6*" align="center"/>
40523 <colspec colwidth="6*" align="center"/>
40524 <colspec colwidth="6*" align="right"/>
40525 <tbody>
40526 <row>
40527 <entry><option>mailstore_suffix</option></entry>
40528 <entry>Use: <emphasis>appendfile</emphasis></entry>
40529 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40530 <entry>Default: <emphasis>unset</emphasis></entry>
40531 </row>
40532 </tbody>
40533 </tgroup>
40534 </informaltable>
40535 <para>
40536 This option applies only to deliveries in mailstore format, and is described in
40537 section <xref linkend="SECTopdir"/> below.
40538 </para>
40539 <para>
40540 <indexterm role="option">
40541 <primary><option>mbx_format</option></primary>
40542 </indexterm>
40543 </para>
40544 <informaltable frame="all">
40545 <tgroup cols="4" colsep="0" rowsep="0">
40546 <colspec colwidth="8*" align="left"/>
40547 <colspec colwidth="6*" align="center"/>
40548 <colspec colwidth="6*" align="center"/>
40549 <colspec colwidth="6*" align="right"/>
40550 <tbody>
40551 <row>
40552 <entry><option>mbx_format</option></entry>
40553 <entry>Use: <emphasis>appendfile</emphasis></entry>
40554 <entry>Type: <emphasis>boolean</emphasis></entry>
40555 <entry>Default: <emphasis>false</emphasis></entry>
40556 </row>
40557 </tbody>
40558 </tgroup>
40559 </informaltable>
40560 <para>
40561 <indexterm role="concept">
40562 <primary>locking files</primary>
40563 </indexterm>
40564 <indexterm role="concept">
40565 <primary>file</primary>
40566 <secondary>locking</secondary>
40567 </indexterm>
40568 <indexterm role="concept">
40569 <primary>file</primary>
40570 <secondary>MBX format</secondary>
40571 </indexterm>
40572 <indexterm role="concept">
40573 <primary>MBX format, specifying</primary>
40574 </indexterm>
40575 This option is available only if Exim has been compiled with SUPPORT_MBX
40576 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
40577 the message is appended to the mailbox file in MBX format instead of
40578 traditional Unix format. This format is supported by Pine4 and its associated
40579 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
40580 </para>
40581 <para>
40582 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
40583 automatically changed by the use of <option>mbx_format</option>. They should normally be set
40584 empty when using MBX format, so this option almost always appears in this
40585 combination:
40586 </para>
40587 <literallayout class="monospaced">
40588 mbx_format = true
40589 message_prefix =
40590 message_suffix =
40591 </literallayout>
40592 <para>
40593 If none of the locking options are mentioned in the configuration,
40594 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
40595 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
40596 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
40597 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
40598 should not be used if any program that does not use this form of locking is
40599 going to access the mailbox, nor should it be used if the mailbox file is NFS
40600 mounted, because it works only when the mailbox is accessed from a single host.
40601 </para>
40602 <para>
40603 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
40604 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
40605 (this means for the whole of a Pine or IMAP session), Exim will not be able to
40606 append messages to it.
40607 </para>
40608 <para>
40609 <indexterm role="option">
40610 <primary><option>message_prefix</option></primary>
40611 </indexterm>
40612 </para>
40613 <informaltable frame="all">
40614 <tgroup cols="4" colsep="0" rowsep="0">
40615 <colspec colwidth="8*" align="left"/>
40616 <colspec colwidth="6*" align="center"/>
40617 <colspec colwidth="6*" align="center"/>
40618 <colspec colwidth="6*" align="right"/>
40619 <tbody>
40620 <row>
40621 <entry><option>message_prefix</option></entry>
40622 <entry>Use: <emphasis>appendfile</emphasis></entry>
40623 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40624 <entry>Default: <emphasis>see below</emphasis></entry>
40625 </row>
40626 </tbody>
40627 </tgroup>
40628 </informaltable>
40629 <para>
40630 <indexterm role="concept">
40631 <primary><quote>From</quote> line</primary>
40632 </indexterm>
40633 The string specified here is expanded and output at the start of every message.
40634 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
40635 in which case it is:
40636 </para>
40637 <literallayout class="monospaced">
40638 message_prefix = "From ${if def:return_path{$return_path}\
40639   {MAILER-DAEMON}} $tod_bsdinbox\n"
40640 </literallayout>
40641 <para>
40642 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
40643 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
40644 </para>
40645 <para>
40646 <indexterm role="option">
40647 <primary><option>message_suffix</option></primary>
40648 </indexterm>
40649 </para>
40650 <informaltable frame="all">
40651 <tgroup cols="4" colsep="0" rowsep="0">
40652 <colspec colwidth="8*" align="left"/>
40653 <colspec colwidth="6*" align="center"/>
40654 <colspec colwidth="6*" align="center"/>
40655 <colspec colwidth="6*" align="right"/>
40656 <tbody>
40657 <row>
40658 <entry><option>message_suffix</option></entry>
40659 <entry>Use: <emphasis>appendfile</emphasis></entry>
40660 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40661 <entry>Default: <emphasis>see below</emphasis></entry>
40662 </row>
40663 </tbody>
40664 </tgroup>
40665 </informaltable>
40666 <para>
40667 The string specified here is expanded and output at the end of every message.
40668 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
40669 in which case it is a single newline character. The suffix can be suppressed by
40670 setting
40671 </para>
40672 <literallayout class="monospaced">
40673 message_suffix =
40674 </literallayout>
40675 <para>
40676 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
40677 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
40678 </para>
40679 <para>
40680 <indexterm role="option">
40681 <primary><option>mode</option></primary>
40682 </indexterm>
40683 </para>
40684 <informaltable frame="all">
40685 <tgroup cols="4" colsep="0" rowsep="0">
40686 <colspec colwidth="8*" align="left"/>
40687 <colspec colwidth="6*" align="center"/>
40688 <colspec colwidth="6*" align="center"/>
40689 <colspec colwidth="6*" align="right"/>
40690 <tbody>
40691 <row>
40692 <entry><option>mode</option></entry>
40693 <entry>Use: <emphasis>appendfile</emphasis></entry>
40694 <entry>Type: <emphasis>octal integer</emphasis></entry>
40695 <entry>Default: <emphasis>0600</emphasis></entry>
40696 </row>
40697 </tbody>
40698 </tgroup>
40699 </informaltable>
40700 <para>
40701 If the output file is created, it is given this mode. If it already exists and
40702 has wider permissions, they are reduced to this mode. If it has narrower
40703 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
40704 if the delivery is the result of a <option>save</option> command in a filter file specifying
40705 a particular mode, the mode of the output file is always forced to take that
40706 value, and this option is ignored.
40707 </para>
40708 <para>
40709 <indexterm role="option">
40710 <primary><option>mode_fail_narrower</option></primary>
40711 </indexterm>
40712 </para>
40713 <informaltable frame="all">
40714 <tgroup cols="4" colsep="0" rowsep="0">
40715 <colspec colwidth="8*" align="left"/>
40716 <colspec colwidth="6*" align="center"/>
40717 <colspec colwidth="6*" align="center"/>
40718 <colspec colwidth="6*" align="right"/>
40719 <tbody>
40720 <row>
40721 <entry><option>mode_fail_narrower</option></entry>
40722 <entry>Use: <emphasis>appendfile</emphasis></entry>
40723 <entry>Type: <emphasis>boolean</emphasis></entry>
40724 <entry>Default: <emphasis>true</emphasis></entry>
40725 </row>
40726 </tbody>
40727 </tgroup>
40728 </informaltable>
40729 <para>
40730 This option applies in the case when an existing mailbox file has a narrower
40731 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
40732 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
40733 continues with the delivery attempt, using the existing mode of the file.
40734 </para>
40735 <para>
40736 <indexterm role="option">
40737 <primary><option>notify_comsat</option></primary>
40738 </indexterm>
40739 </para>
40740 <informaltable frame="all">
40741 <tgroup cols="4" colsep="0" rowsep="0">
40742 <colspec colwidth="8*" align="left"/>
40743 <colspec colwidth="6*" align="center"/>
40744 <colspec colwidth="6*" align="center"/>
40745 <colspec colwidth="6*" align="right"/>
40746 <tbody>
40747 <row>
40748 <entry><option>notify_comsat</option></entry>
40749 <entry>Use: <emphasis>appendfile</emphasis></entry>
40750 <entry>Type: <emphasis>boolean</emphasis></entry>
40751 <entry>Default: <emphasis>false</emphasis></entry>
40752 </row>
40753 </tbody>
40754 </tgroup>
40755 </informaltable>
40756 <para>
40757 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
40758 successful delivery to a user mailbox. This is the daemon that notifies logged
40759 on users about incoming mail.
40760 </para>
40761 <para>
40762 <indexterm role="option">
40763 <primary><option>quota</option></primary>
40764 </indexterm>
40765 </para>
40766 <informaltable frame="all">
40767 <tgroup cols="4" colsep="0" rowsep="0">
40768 <colspec colwidth="8*" align="left"/>
40769 <colspec colwidth="6*" align="center"/>
40770 <colspec colwidth="6*" align="center"/>
40771 <colspec colwidth="6*" align="right"/>
40772 <tbody>
40773 <row>
40774 <entry><option>quota</option></entry>
40775 <entry>Use: <emphasis>appendfile</emphasis></entry>
40776 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40777 <entry>Default: <emphasis>unset</emphasis></entry>
40778 </row>
40779 </tbody>
40780 </tgroup>
40781 </informaltable>
40782 <para>
40783 <indexterm role="concept">
40784 <primary>quota</primary>
40785 <secondary>imposed by Exim</secondary>
40786 </indexterm>
40787 This option imposes a limit on the size of the file to which Exim is appending,
40788 or to the total space used in the directory tree when the <option>directory</option> option
40789 is set. In the latter case, computation of the space used is expensive, because
40790 all the files in the directory (and any sub-directories) have to be
40791 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
40792 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
40793 have no shell access to their mailboxes).
40794 </para>
40795 <para>
40796 As there is no interlock against two simultaneous deliveries into a
40797 multi-file mailbox, it is possible for the quota to be overrun in this case.
40798 For single-file mailboxes, of course, an interlock is a necessity.
40799 </para>
40800 <para>
40801 A file&#x2019;s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
40802 may be a lot less than the actual amount of disk space allocated to the file.
40803 If the sizes of a number of files are being added up, the rounding effect can
40804 become quite noticeable, especially on systems that have large block sizes.
40805 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
40806 the obvious value which users understand most easily.
40807 </para>
40808 <para>
40809 The value of the option is expanded, and must then be a numerical value
40810 (decimal point allowed), optionally followed by one of the letters K, M, or G,
40811 for kilobytes, megabytes, or gigabytes. If Exim is running on a system with
40812 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
40813 be handled.
40814 </para>
40815 <para>
40816 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
40817 </para>
40818 <para>
40819 The expansion happens while Exim is running as root, before it changes uid for
40820 the delivery. This means that files that are inaccessible to the end user can
40821 be used to hold quota values that are looked up in the expansion. When delivery
40822 fails because this quota is exceeded, the handling of the error is as for
40823 system quota failures.
40824 </para>
40825 <para>
40826 By default, Exim&#x2019;s quota checking mimics system quotas, and restricts the
40827 mailbox to the specified maximum size, though the value is not accurate to the
40828 last byte, owing to separator lines and additional headers that may get added
40829 during message delivery. When a mailbox is nearly full, large messages may get
40830 refused even though small ones are accepted, because the size of the current
40831 message is added to the quota when the check is made. This behaviour can be
40832 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
40833 for exceeding the quota does not include the current message. Thus, deliveries
40834 continue until the quota has been exceeded; thereafter, no further messages are
40835 delivered. See also <option>quota_warn_threshold</option>.
40836 </para>
40837 <para>
40838 <indexterm role="option">
40839 <primary><option>quota_directory</option></primary>
40840 </indexterm>
40841 </para>
40842 <informaltable frame="all">
40843 <tgroup cols="4" colsep="0" rowsep="0">
40844 <colspec colwidth="8*" align="left"/>
40845 <colspec colwidth="6*" align="center"/>
40846 <colspec colwidth="6*" align="center"/>
40847 <colspec colwidth="6*" align="right"/>
40848 <tbody>
40849 <row>
40850 <entry><option>quota_directory</option></entry>
40851 <entry>Use: <emphasis>appendfile</emphasis></entry>
40852 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40853 <entry>Default: <emphasis>unset</emphasis></entry>
40854 </row>
40855 </tbody>
40856 </tgroup>
40857 </informaltable>
40858 <para>
40859 This option defines the directory to check for quota purposes when delivering
40860 into individual files. The default is the delivery directory, or, if a file
40861 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
40862 delivery directory.
40863 </para>
40864 <para>
40865 <indexterm role="option">
40866 <primary><option>quota_filecount</option></primary>
40867 </indexterm>
40868 </para>
40869 <informaltable frame="all">
40870 <tgroup cols="4" colsep="0" rowsep="0">
40871 <colspec colwidth="8*" align="left"/>
40872 <colspec colwidth="6*" align="center"/>
40873 <colspec colwidth="6*" align="center"/>
40874 <colspec colwidth="6*" align="right"/>
40875 <tbody>
40876 <row>
40877 <entry><option>quota_filecount</option></entry>
40878 <entry>Use: <emphasis>appendfile</emphasis></entry>
40879 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40880 <entry>Default: <emphasis>0</emphasis></entry>
40881 </row>
40882 </tbody>
40883 </tgroup>
40884 </informaltable>
40885 <para>
40886 This option applies when the <option>directory</option> option is set. It limits the total
40887 number of files in the directory (compare the inode limit in system quotas). It
40888 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
40889 failure causes delivery to be deferred. A value of zero is interpreted as
40890 <quote>no quota</quote>.
40891 </para>
40892 <para>
40893 <indexterm role="option">
40894 <primary><option>quota_is_inclusive</option></primary>
40895 </indexterm>
40896 </para>
40897 <informaltable frame="all">
40898 <tgroup cols="4" colsep="0" rowsep="0">
40899 <colspec colwidth="8*" align="left"/>
40900 <colspec colwidth="6*" align="center"/>
40901 <colspec colwidth="6*" align="center"/>
40902 <colspec colwidth="6*" align="right"/>
40903 <tbody>
40904 <row>
40905 <entry><option>quota_is_inclusive</option></entry>
40906 <entry>Use: <emphasis>appendfile</emphasis></entry>
40907 <entry>Type: <emphasis>boolean</emphasis></entry>
40908 <entry>Default: <emphasis>true</emphasis></entry>
40909 </row>
40910 </tbody>
40911 </tgroup>
40912 </informaltable>
40913 <para>
40914 See <option>quota</option> above.
40915 </para>
40916 <para>
40917 <indexterm role="option">
40918 <primary><option>quota_size_regex</option></primary>
40919 </indexterm>
40920 </para>
40921 <informaltable frame="all">
40922 <tgroup cols="4" colsep="0" rowsep="0">
40923 <colspec colwidth="8*" align="left"/>
40924 <colspec colwidth="6*" align="center"/>
40925 <colspec colwidth="6*" align="center"/>
40926 <colspec colwidth="6*" align="right"/>
40927 <tbody>
40928 <row>
40929 <entry><option>quota_size_regex</option></entry>
40930 <entry>Use: <emphasis>appendfile</emphasis></entry>
40931 <entry>Type: <emphasis>string</emphasis></entry>
40932 <entry>Default: <emphasis>unset</emphasis></entry>
40933 </row>
40934 </tbody>
40935 </tgroup>
40936 </informaltable>
40937 <para>
40938 This option applies when one of the delivery modes that writes a separate file
40939 for each message is being used. When Exim wants to find the size of one of
40940 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
40941 If this is set to a regular expression that matches the file name, and it
40942 captures one string, that string is interpreted as a representation of the
40943 file&#x2019;s size. The value of <option>quota_size_regex</option> is not expanded.
40944 </para>
40945 <para>
40946 This feature is useful only when users have no shell access to their mailboxes
40947 &ndash; otherwise they could defeat the quota simply by renaming the files. This
40948 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
40949 the file length to the file name. For example:
40950 </para>
40951 <literallayout class="monospaced">
40952 maildir_tag = ,S=$message_size
40953 quota_size_regex = ,S=(\d+)
40954 </literallayout>
40955 <para>
40956 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
40957 number of lines in the message.
40958 </para>
40959 <para>
40960 The regular expression should not assume that the length is at the end of the
40961 file name (even though <option>maildir_tag</option> puts it there) because maildir MUAs
40962 sometimes add other information onto the ends of message file names.
40963 </para>
40964 <para>
40965 Section <xref linkend="SECID136"/> contains further information.
40966 </para>
40967 <para>
40968 <indexterm role="option">
40969 <primary><option>quota_warn_message</option></primary>
40970 </indexterm>
40971 </para>
40972 <informaltable frame="all">
40973 <tgroup cols="4" colsep="0" rowsep="0">
40974 <colspec colwidth="8*" align="left"/>
40975 <colspec colwidth="6*" align="center"/>
40976 <colspec colwidth="6*" align="center"/>
40977 <colspec colwidth="6*" align="right"/>
40978 <tbody>
40979 <row>
40980 <entry><option>quota_warn_message</option></entry>
40981 <entry>Use: <emphasis>appendfile</emphasis></entry>
40982 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40983 <entry>Default: <emphasis>see below</emphasis></entry>
40984 </row>
40985 </tbody>
40986 </tgroup>
40987 </informaltable>
40988 <para>
40989 See below for the use of this option. If it is not set when
40990 <option>quota_warn_threshold</option> is set, it defaults to
40991 </para>
40992 <literallayout class="monospaced">
40993 quota_warn_message = "\
40994   To: $local_part@$domain\n\
40995   Subject: Your mailbox\n\n\
40996   This message is automatically created \
40997   by mail delivery software.\n\n\
40998   The size of your mailbox has exceeded \
40999   a warning threshold that is\n\
41000   set by the system administrator.\n"
41001 </literallayout>
41002 <para>
41003 <indexterm role="option">
41004 <primary><option>quota_warn_threshold</option></primary>
41005 </indexterm>
41006 </para>
41007 <informaltable frame="all">
41008 <tgroup cols="4" colsep="0" rowsep="0">
41009 <colspec colwidth="8*" align="left"/>
41010 <colspec colwidth="6*" align="center"/>
41011 <colspec colwidth="6*" align="center"/>
41012 <colspec colwidth="6*" align="right"/>
41013 <tbody>
41014 <row>
41015 <entry><option>quota_warn_threshold</option></entry>
41016 <entry>Use: <emphasis>appendfile</emphasis></entry>
41017 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41018 <entry>Default: <emphasis>0</emphasis></entry>
41019 </row>
41020 </tbody>
41021 </tgroup>
41022 </informaltable>
41023 <para>
41024 <indexterm role="concept">
41025 <primary>quota</primary>
41026 <secondary>warning threshold</secondary>
41027 </indexterm>
41028 <indexterm role="concept">
41029 <primary>mailbox</primary>
41030 <secondary>size warning</secondary>
41031 </indexterm>
41032 <indexterm role="concept">
41033 <primary>size</primary>
41034 <secondary>of mailbox</secondary>
41035 </indexterm>
41036 This option is expanded in the same way as <option>quota</option> (see above). If the
41037 resulting value is greater than zero, and delivery of the message causes the
41038 size of the file or total space in the directory tree to cross the given
41039 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
41040 may be specified as a percentage of it by following the value with a percent
41041 sign. For example:
41042 </para>
41043 <literallayout class="monospaced">
41044 quota = 10M
41045 quota_warn_threshold = 75%
41046 </literallayout>
41047 <para>
41048 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
41049 percent sign is ignored.
41050 </para>
41051 <para>
41052 The warning message itself is specified by the <option>quota_warn_message</option> option,
41053 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
41054 warning message. These do not necessarily have to include the recipient(s) of
41055 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
41056 can include any other header lines that you want. If you do not include a
41057 <emphasis>From:</emphasis> line, the default is:
41058 </para>
41059 <literallayout class="monospaced">
41060 From: Mail Delivery System &lt;mailer-daemon@$qualify_domain_sender&gt;
41061 </literallayout>
41062 <para>
41063 <indexterm role="option">
41064 <primary><option>errors_reply_to</option></primary>
41065 </indexterm>
41066 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
41067 option.
41068 </para>
41069 <para>
41070 The <option>quota</option> option does not have to be set in order to use this option; they
41071 are independent of one another except when the threshold is specified as a
41072 percentage.
41073 </para>
41074 <para>
41075 <indexterm role="option">
41076 <primary><option>use_bsmtp</option></primary>
41077 </indexterm>
41078 </para>
41079 <informaltable frame="all">
41080 <tgroup cols="4" colsep="0" rowsep="0">
41081 <colspec colwidth="8*" align="left"/>
41082 <colspec colwidth="6*" align="center"/>
41083 <colspec colwidth="6*" align="center"/>
41084 <colspec colwidth="6*" align="right"/>
41085 <tbody>
41086 <row>
41087 <entry><option>use_bsmtp</option></entry>
41088 <entry>Use: <emphasis>appendfile</emphasis></entry>
41089 <entry>Type: <emphasis>boolean</emphasis></entry>
41090 <entry>Default: <emphasis>false</emphasis></entry>
41091 </row>
41092 </tbody>
41093 </tgroup>
41094 </informaltable>
41095 <para>
41096 <indexterm role="concept">
41097 <primary>envelope sender</primary>
41098 </indexterm>
41099 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
41100 format, with the envelope sender and recipient(s) included as SMTP commands. If
41101 you want to include a leading HELO command with such messages, you can do
41102 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
41103 for details of batch SMTP.
41104 </para>
41105 <para>
41106 <indexterm role="option">
41107 <primary><option>use_crlf</option></primary>
41108 </indexterm>
41109 </para>
41110 <informaltable frame="all">
41111 <tgroup cols="4" colsep="0" rowsep="0">
41112 <colspec colwidth="8*" align="left"/>
41113 <colspec colwidth="6*" align="center"/>
41114 <colspec colwidth="6*" align="center"/>
41115 <colspec colwidth="6*" align="right"/>
41116 <tbody>
41117 <row>
41118 <entry><option>use_crlf</option></entry>
41119 <entry>Use: <emphasis>appendfile</emphasis></entry>
41120 <entry>Type: <emphasis>boolean</emphasis></entry>
41121 <entry>Default: <emphasis>false</emphasis></entry>
41122 </row>
41123 </tbody>
41124 </tgroup>
41125 </informaltable>
41126 <para>
41127 <indexterm role="concept">
41128 <primary>carriage return</primary>
41129 </indexterm>
41130 <indexterm role="concept">
41131 <primary>linefeed</primary>
41132 </indexterm>
41133 This option causes lines to be terminated with the two-character CRLF sequence
41134 (carriage return, linefeed) instead of just a linefeed character. In the case
41135 of batched SMTP, the byte sequence written to the file is then an exact image
41136 of what would be sent down a real SMTP connection.
41137 </para>
41138 <para>
41139 <emphasis role="bold">Note:</emphasis> The contents of the <option>message_prefix</option> and <option>message_suffix</option> options
41140 (which are used to supply the traditional <quote>From&nbsp;</quote> and blank line separators
41141 in Berkeley-style mailboxes) are written verbatim, so must contain their own
41142 carriage return characters if these are needed. In cases where these options
41143 have non-empty defaults, the values end with a single linefeed, so they must be
41144 changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
41145 </para>
41146 <para>
41147 <indexterm role="option">
41148 <primary><option>use_fcntl_lock</option></primary>
41149 </indexterm>
41150 </para>
41151 <informaltable frame="all">
41152 <tgroup cols="4" colsep="0" rowsep="0">
41153 <colspec colwidth="8*" align="left"/>
41154 <colspec colwidth="6*" align="center"/>
41155 <colspec colwidth="6*" align="center"/>
41156 <colspec colwidth="6*" align="right"/>
41157 <tbody>
41158 <row>
41159 <entry><option>use_fcntl_lock</option></entry>
41160 <entry>Use: <emphasis>appendfile</emphasis></entry>
41161 <entry>Type: <emphasis>boolean</emphasis></entry>
41162 <entry>Default: <emphasis>see below</emphasis></entry>
41163 </row>
41164 </tbody>
41165 </tgroup>
41166 </informaltable>
41167 <para>
41168 This option controls the use of the <function>fcntl()</function> function to lock a file for
41169 exclusive use when a message is being appended. It is set by default unless
41170 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
41171 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
41172 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
41173 </para>
41174 <para>
41175 <indexterm role="option">
41176 <primary><option>use_flock_lock</option></primary>
41177 </indexterm>
41178 </para>
41179 <informaltable frame="all">
41180 <tgroup cols="4" colsep="0" rowsep="0">
41181 <colspec colwidth="8*" align="left"/>
41182 <colspec colwidth="6*" align="center"/>
41183 <colspec colwidth="6*" align="center"/>
41184 <colspec colwidth="6*" align="right"/>
41185 <tbody>
41186 <row>
41187 <entry><option>use_flock_lock</option></entry>
41188 <entry>Use: <emphasis>appendfile</emphasis></entry>
41189 <entry>Type: <emphasis>boolean</emphasis></entry>
41190 <entry>Default: <emphasis>false</emphasis></entry>
41191 </row>
41192 </tbody>
41193 </tgroup>
41194 </informaltable>
41195 <para>
41196 This option is provided to support the use of <function>flock()</function> for file locking, for
41197 the few situations where it is needed. Most modern operating systems support
41198 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
41199 each other. Exim uses <function>fcntl()</function> locking by default.
41200 </para>
41201 <para>
41202 This option is required only if you are using an operating system where
41203 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
41204 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
41205 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
41206 </para>
41207 <para>
41208 <indexterm role="concept">
41209 <primary>Solaris</primary>
41210 <secondary><function>flock()</function> support</secondary>
41211 </indexterm>
41212 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
41213 have it (and some, I think, provide a not quite right version built on top of
41214 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
41215 the ability to use it, and any attempt to do so will cause a configuration
41216 error.
41217 </para>
41218 <para>
41219 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
41220 is just being mapped onto <function>fcntl()</function> by the OS).
41221 </para>
41222 <para>
41223 <indexterm role="option">
41224 <primary><option>use_lockfile</option></primary>
41225 </indexterm>
41226 </para>
41227 <informaltable frame="all">
41228 <tgroup cols="4" colsep="0" rowsep="0">
41229 <colspec colwidth="8*" align="left"/>
41230 <colspec colwidth="6*" align="center"/>
41231 <colspec colwidth="6*" align="center"/>
41232 <colspec colwidth="6*" align="right"/>
41233 <tbody>
41234 <row>
41235 <entry><option>use_lockfile</option></entry>
41236 <entry>Use: <emphasis>appendfile</emphasis></entry>
41237 <entry>Type: <emphasis>boolean</emphasis></entry>
41238 <entry>Default: <emphasis>see below</emphasis></entry>
41239 </row>
41240 </tbody>
41241 </tgroup>
41242 </informaltable>
41243 <para>
41244 If this option is turned off, Exim does not attempt to create a lock file when
41245 appending to a mailbox file. In this situation, the only locking is by
41246 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
41247 sure that every MUA that is ever going to look at your users&#x2019; mailboxes uses
41248 <function>fcntl()</function> rather than a lock file, and even then only when you are not
41249 delivering over NFS from more than one host.
41250 </para>
41251 <para>
41252 <indexterm role="concept">
41253 <primary>NFS</primary>
41254 <secondary>lock file</secondary>
41255 </indexterm>
41256 In order to append to an NFS file safely from more than one host, it is
41257 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
41258 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
41259 file corruption.
41260 </para>
41261 <para>
41262 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
41263 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
41264 except when <option>mbx_format</option> is set.
41265 </para>
41266 <para>
41267 <indexterm role="option">
41268 <primary><option>use_mbx_lock</option></primary>
41269 </indexterm>
41270 </para>
41271 <informaltable frame="all">
41272 <tgroup cols="4" colsep="0" rowsep="0">
41273 <colspec colwidth="8*" align="left"/>
41274 <colspec colwidth="6*" align="center"/>
41275 <colspec colwidth="6*" align="center"/>
41276 <colspec colwidth="6*" align="right"/>
41277 <tbody>
41278 <row>
41279 <entry><option>use_mbx_lock</option></entry>
41280 <entry>Use: <emphasis>appendfile</emphasis></entry>
41281 <entry>Type: <emphasis>boolean</emphasis></entry>
41282 <entry>Default: <emphasis>see below</emphasis></entry>
41283 </row>
41284 </tbody>
41285 </tgroup>
41286 </informaltable>
41287 <para>
41288 This option is available only if Exim has been compiled with SUPPORT_MBX
41289 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
41290 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
41291 of the locking options are mentioned in the configuration. The locking rules
41292 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
41293 the IMAP4 and POP daemons that come with it (see the discussion below). The
41294 rules allow for shared access to the mailbox. However, this kind of locking
41295 does not work when the mailbox is NFS mounted.
41296 </para>
41297 <para>
41298 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
41299 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
41300 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
41301 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
41302 </para>
41303 </section>
41304 <section id="SECTopappend">
41305 <title>Operational details for appending</title>
41306 <para>
41307 <indexterm role="concept">
41308 <primary>appending to a file</primary>
41309 </indexterm>
41310 <indexterm role="concept">
41311 <primary>file</primary>
41312 <secondary>appending</secondary>
41313 </indexterm>
41314 Before appending to a file, the following preparations are made:
41315 </para>
41316 <itemizedlist>
41317 <listitem>
41318 <para>
41319 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
41320 return is given.
41321 </para>
41322 </listitem>
41323 <listitem>
41324 <para>
41325 <indexterm role="concept">
41326 <primary>directory creation</primary>
41327 </indexterm>
41328 If any directories on the file&#x2019;s path are missing, Exim creates them if the
41329 <option>create_directory</option> option is set. A created directory&#x2019;s mode is given by the
41330 <option>directory_mode</option> option.
41331 </para>
41332 </listitem>
41333 <listitem>
41334 <para>
41335 If <option>file_format</option> is set, the format of an existing file is checked. If this
41336 indicates that a different transport should be used, control is passed to that
41337 transport.
41338 </para>
41339 </listitem>
41340 <listitem>
41341 <para>
41342 <indexterm role="concept">
41343 <primary>file</primary>
41344 <secondary>locking</secondary>
41345 </indexterm>
41346 <indexterm role="concept">
41347 <primary>locking files</primary>
41348 </indexterm>
41349 <indexterm role="concept">
41350 <primary>NFS</primary>
41351 <secondary>lock file</secondary>
41352 </indexterm>
41353 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
41354 reliably over NFS, as follows:
41355 </para>
41356 <orderedlist numeration="arabic">
41357 <listitem>
41358 <para>
41359 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
41360 current time, primary host name, and process id added, by opening for writing
41361 as a new file. If this fails with an access error, delivery is deferred.
41362 </para>
41363 </listitem>
41364 <listitem>
41365 <para>
41366 Close the hitching post file, and hard link it to the lock file name.
41367 </para>
41368 </listitem>
41369 <listitem>
41370 <para>
41371 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
41372 Unlink the hitching post name.
41373 </para>
41374 </listitem>
41375 <listitem>
41376 <para>
41377 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
41378 then unlink hitching post name. If the number of links is exactly two, creation
41379 of the lock file succeeded but something (for example, an NFS server crash and
41380 restart) caused this fact not to be communicated to the <function>link()</function> call.
41381 </para>
41382 </listitem>
41383 <listitem>
41384 <para>
41385 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
41386 up to <option>lock_retries</option> times. However, since any program that writes to a
41387 mailbox should complete its task very quickly, it is reasonable to time out old
41388 lock files that are normally the result of user agent and system crashes. If an
41389 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
41390 it before trying again.
41391 </para>
41392 </listitem>
41393 </orderedlist>
41394 </listitem>
41395 <listitem>
41396 <para>
41397 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
41398 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
41399 than non-existence, delivery is deferred.
41400 </para>
41401 </listitem>
41402 <listitem>
41403 <para>
41404 <indexterm role="concept">
41405 <primary>symbolic link</primary>
41406 <secondary>to mailbox</secondary>
41407 </indexterm>
41408 <indexterm role="concept">
41409 <primary>mailbox</primary>
41410 <secondary>symbolic link</secondary>
41411 </indexterm>
41412 If the file does exist and is a symbolic link, delivery is deferred, unless the
41413 <option>allow_symlink</option> option is set, in which case the ownership of the link is
41414 checked, and then <function>stat()</function> is called to find out about the real file, which
41415 is then subjected to the checks below. The check on the top-level link
41416 ownership prevents one user creating a link for another&#x2019;s mailbox in a sticky
41417 directory, though allowing symbolic links in this case is definitely not a good
41418 idea. If there is a chain of symbolic links, the intermediate ones are not
41419 checked.
41420 </para>
41421 </listitem>
41422 <listitem>
41423 <para>
41424 If the file already exists but is not a regular file, or if the file&#x2019;s owner
41425 and group (if the group is being checked &ndash; see <option>check_group</option> above) are
41426 different from the user and group under which the delivery is running,
41427 delivery is deferred.
41428 </para>
41429 </listitem>
41430 <listitem>
41431 <para>
41432 If the file&#x2019;s permissions are more generous than specified, they are reduced.
41433 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
41434 is set false, in which case the delivery is tried using the existing
41435 permissions.
41436 </para>
41437 </listitem>
41438 <listitem>
41439 <para>
41440 The file&#x2019;s inode number is saved, and the file is then opened for appending.
41441 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
41442 hadn&#x2019;t existed (see below). For any other failures, delivery is deferred.
41443 </para>
41444 </listitem>
41445 <listitem>
41446 <para>
41447 If the file is opened successfully, check that the inode number hasn&#x2019;t
41448 changed, that it is still a regular file, and that the owner and permissions
41449 have not changed. If anything is wrong, defer delivery and freeze the message.
41450 </para>
41451 </listitem>
41452 <listitem>
41453 <para>
41454 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
41455 option is set. Otherwise, check that the file is being created in a permitted
41456 directory if the <option>create_file</option> option is set (deferring on failure), and then
41457 open for writing as a new file, with the O_EXCL and O_CREAT options,
41458 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
41459 set). In this case, which can happen if the link points to a non-existent file,
41460 the file is opened for writing using O_CREAT but not O_EXCL, because
41461 that prevents link following.
41462 </para>
41463 </listitem>
41464 <listitem>
41465 <para>
41466 <indexterm role="concept">
41467 <primary>loop</primary>
41468 <secondary>while file testing</secondary>
41469 </indexterm>
41470 If opening fails because the file exists, obey the tests given above for
41471 existing files. However, to avoid looping in a situation where the file is
41472 being continuously created and destroyed, the exists/not-exists loop is broken
41473 after 10 repetitions, and the message is then frozen.
41474 </para>
41475 </listitem>
41476 <listitem>
41477 <para>
41478 If opening fails with any other error, defer delivery.
41479 </para>
41480 </listitem>
41481 <listitem>
41482 <para>
41483 <indexterm role="concept">
41484 <primary>file</primary>
41485 <secondary>locking</secondary>
41486 </indexterm>
41487 <indexterm role="concept">
41488 <primary>locking files</primary>
41489 </indexterm>
41490 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
41491 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
41492 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
41493 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
41494 file, and an exclusive lock on the file whose name is
41495 </para>
41496 <literallayout class="monospaced">
41497 /tmp/.&lt;device-number&gt;.&lt;inode-number&gt;
41498 </literallayout>
41499 <para>
41500 using the device and inode numbers of the open mailbox file, in accordance with
41501 the MBX locking rules. This file is created with a mode that is specified by
41502 the <option>lockfile_mode</option> option.
41503 </para>
41504 <para>
41505 If Exim fails to lock the file, there are two possible courses of action,
41506 depending on the value of the locking timeout. This is obtained from
41507 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
41508 </para>
41509 <para>
41510 If the timeout value is zero, the file is closed, Exim waits for
41511 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
41512 to lock it again. This happens up to <option>lock_retries</option> times, after which the
41513 delivery is deferred.
41514 </para>
41515 <para>
41516 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
41517 <function>flock()</function> are used (with the given timeout), so there has already been some
41518 waiting involved by the time locking fails. Nevertheless, Exim does not give up
41519 immediately. It retries up to
41520 </para>
41521 <literallayout class="monospaced">
41522 (lock_retries * lock_interval) / &lt;timeout&gt;
41523 </literallayout>
41524 <para>
41525 times (rounded up).
41526 </para>
41527 </listitem>
41528 </itemizedlist>
41529 <para>
41530 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
41531 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
41532 </para>
41533 </section>
41534 <section id="SECTopdir">
41535 <title>Operational details for delivery to a new file</title>
41536 <para>
41537 <indexterm role="concept">
41538 <primary>delivery</primary>
41539 <secondary>to single file</secondary>
41540 </indexterm>
41541 <indexterm role="concept">
41542 <primary><quote>From</quote> line</primary>
41543 </indexterm>
41544 When the <option>directory</option> option is set instead of <option>file</option>, each message is
41545 delivered into a newly-created file or set of files. When <command>appendfile</command> is
41546 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
41547 <option>directory</option> is normally set, because the path for delivery is supplied by the
41548 router. (See for example, the <command>address_file</command> transport in the default
41549 configuration.) In this case, delivery is to a new file if either the path name
41550 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
41551 </para>
41552 <para>
41553 No locking is required while writing the message to a new file, so the various
41554 locking options of the transport are ignored. The <quote>From</quote> line that by default
41555 separates messages in a single file is not normally needed, nor is the escaping
41556 of message lines that start with <quote>From</quote>, and there is no need to ensure a
41557 newline at the end of each message. Consequently, the default values for
41558 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
41559 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
41560 </para>
41561 <para>
41562 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
41563 the files in the delivery directory by default. However, you can specify a
41564 different directory by setting <option>quota_directory</option>. Also, for maildir
41565 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
41566 </para>
41567 <para>
41568 <indexterm role="concept">
41569 <primary>maildir format</primary>
41570 </indexterm>
41571 <indexterm role="concept">
41572 <primary>mailstore format</primary>
41573 </indexterm>
41574 There are three different ways in which delivery to individual files can be
41575 done, controlled by the settings of the <option>maildir_format</option> and
41576 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
41577 formats is not included in the binary unless SUPPORT_MAILDIR or
41578 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
41579 </para>
41580 <para>
41581 <indexterm role="concept">
41582 <primary>directory creation</primary>
41583 </indexterm>
41584 In all three cases an attempt is made to create the directory and any necessary
41585 sub-directories if they do not exist, provided that the <option>create_directory</option>
41586 option is set (the default). The location of a created directory can be
41587 constrained by setting <option>create_file</option>. A created directory&#x2019;s mode is given by
41588 the <option>directory_mode</option> option. If creation fails, or if the
41589 <option>create_directory</option> option is not set when creation is required, delivery is
41590 deferred.
41591 </para>
41592 </section>
41593 <section id="SECTmaildirdelivery">
41594 <title>Maildir delivery</title>
41595 <para>
41596 <indexterm role="concept">
41597 <primary>maildir format</primary>
41598 <secondary>description of</secondary>
41599 </indexterm>
41600 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
41601 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
41602 directory that is defined by the <option>directory</option> option (the <quote>delivery
41603 directory</quote>). If the delivery is successful, the file is renamed into the
41604 <filename>new</filename> subdirectory.
41605 </para>
41606 <para>
41607 In the file name, &lt;<emphasis>stime</emphasis>&gt; is the current time of day in seconds, and
41608 &lt;<emphasis>mtime</emphasis>&gt; is the microsecond fraction of the time. After a maildir delivery,
41609 Exim checks that the time-of-day clock has moved on by at least one microsecond
41610 before terminating the delivery process. This guarantees uniqueness for the
41611 file name. However, as a precaution, Exim calls <function>stat()</function> for the file before
41612 opening it. If any response other than ENOENT (does not exist) is given,
41613 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
41614 </para>
41615 <para>
41616 Before Exim carries out a maildir delivery, it ensures that subdirectories
41617 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
41618 do not exist, Exim tries to create them and any superior directories in their
41619 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
41620 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
41621 contains matches the delivery directory, Exim also ensures that a file called
41622 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
41623 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
41624 </para>
41625 <para>
41626 These features make it possible to use Exim to create all the necessary files
41627 and directories in a maildir mailbox, including subdirectories for maildir++
41628 folders. Consider this example:
41629 </para>
41630 <literallayout class="monospaced">
41631 maildir_format = true
41632 directory = /var/mail/$local_part\
41633            ${if eq{$local_part_suffix}{}{}\
41634            {/.${substr_1:$local_part_suffix}}}
41635 maildirfolder_create_regex = /\.[^/]+$
41636 </literallayout>
41637 <para>
41638 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
41639 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
41640 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
41641 not match this name, so Exim will not look for or create the file
41642 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
41643 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
41644 </para>
41645 <para>
41646 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
41647 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
41648 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
41649 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
41650 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
41651 </para>
41652 <para>
41653 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
41654 not inadvertently match the toplevel maildir directory, because a
41655 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
41656 </para>
41657 <para>
41658 <indexterm role="concept">
41659 <primary>quota</primary>
41660 <secondary>in maildir delivery</secondary>
41661 </indexterm>
41662 <indexterm role="concept">
41663 <primary>maildir++</primary>
41664 </indexterm>
41665 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
41666 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
41667 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
41668 Exim assumes the directory is a maildir++ folder directory, which is one level
41669 down from the user&#x2019;s top level mailbox directory. This causes it to start at
41670 the parent directory instead of the current directory when calculating the
41671 amount of space used.
41672 </para>
41673 <para>
41674 One problem with delivering into a multi-file mailbox is that it is
41675 computationally expensive to compute the size of the mailbox for quota
41676 checking. Various approaches have been taken to reduce the amount of work
41677 needed. The next two sections describe two of them. A third alternative is to
41678 use some external process for maintaining the size data, and use the expansion
41679 of the <option>mailbox_size</option> option as a way of importing it into Exim.
41680 </para>
41681 </section>
41682 <section id="SECID135">
41683 <title>Using tags to record message sizes</title>
41684 <para>
41685 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
41686 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
41687 tag is added to its name. However, if adding the tag takes the length of the
41688 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
41689 the tag is dropped and the maildir file is created with no tag.
41690 </para>
41691 <para>
41692 <indexterm role="variable">
41693 <primary><varname>$message_size</varname></primary>
41694 </indexterm>
41695 Tags can be used to encode the size of files in their names; see
41696 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
41697 happens after the message has been written. The value of the <varname>$message_size</varname>
41698 variable is set to the number of bytes actually written. If the expansion is
41699 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
41700 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
41701 Non-printing characters in the string are ignored; if the resulting string is
41702 empty, it is ignored. If it starts with an alphanumeric character, a leading
41703 colon is inserted; this default has not proven to be the path that popular
41704 maildir implementations have chosen (but changing it in Exim would break
41705 backwards compatibility).
41706 </para>
41707 <para>
41708 For one common implementation, you might set:
41709 </para>
41710 <literallayout class="monospaced">
41711 maildir_tag = ,S=${message_size}
41712 </literallayout>
41713 <para>
41714 but you should check the documentation of the other software to be sure.
41715 </para>
41716 <para>
41717 It is advisable to also set <option>quota_size_regex</option> when setting <option>maildir_tag</option>
41718 as this allows Exim to extract the size from your tag, instead of having to
41719 <function>stat()</function> each message file.
41720 </para>
41721 </section>
41722 <section id="SECID136">
41723 <title>Using a maildirsize file</title>
41724 <para>
41725 <indexterm role="concept">
41726 <primary>quota</primary>
41727 <secondary>in maildir delivery</secondary>
41728 </indexterm>
41729 <indexterm role="concept">
41730 <primary>maildir format</primary>
41731 <secondary><filename>maildirsize</filename> file</secondary>
41732 </indexterm>
41733 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
41734 storing quota and message size information in a file called <filename>maildirsize</filename>
41735 within the toplevel maildir directory. If this file does not exist, Exim
41736 creates it, setting the quota from the <option>quota</option> option of the transport. If
41737 the maildir directory itself does not exist, it is created before any attempt
41738 to write a <filename>maildirsize</filename> file.
41739 </para>
41740 <para>
41741 The <filename>maildirsize</filename> file is used to hold information about the sizes of
41742 messages in the maildir, thus speeding up quota calculations. The quota value
41743 in the file is just a cache; if the quota is changed in the transport, the new
41744 value overrides the cached value when the next message is delivered. The cache
41745 is maintained for the benefit of other programs that access the maildir and
41746 need to know the quota.
41747 </para>
41748 <para>
41749 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
41750 file is maintained (with a zero quota setting), but no quota is imposed.
41751 </para>
41752 <para>
41753 A regular expression is available for controlling which directories in the
41754 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
41755 See the description of the <option>maildir_quota_directory_regex</option> option above for
41756 details.
41757 </para>
41758 </section>
41759 <section id="SECID137">
41760 <title>Mailstore delivery</title>
41761 <para>
41762 <indexterm role="concept">
41763 <primary>mailstore format</primary>
41764 <secondary>description of</secondary>
41765 </indexterm>
41766 If the <option>mailstore_format</option> option is true, each message is written as two
41767 files in the given directory. A unique base name is constructed from the
41768 message id and the current delivery process, and the files that are written use
41769 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
41770 contains the message&#x2019;s envelope, and the <filename>.msg</filename> file contains the message
41771 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
41772 </para>
41773 <para>
41774 During delivery, the envelope is first written to a file with the suffix
41775 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
41776 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
41777 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
41778 file before accessing either of them. An alternative approach is to wait for
41779 the absence of a <filename>.tmp</filename> file.
41780 </para>
41781 <para>
41782 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
41783 option, expanded and terminated by a newline if there isn&#x2019;t one. Then follows
41784 the sender address on one line, then all the recipient addresses, one per line.
41785 There can be more than one recipient only if the <option>batch_max</option> option is set
41786 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
41787 appended to the file, followed by a newline if it does not end with one.
41788 </para>
41789 <para>
41790 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
41791 failure, it is ignored. Other expansion errors are treated as serious
41792 configuration errors, and delivery is deferred. The variable
41793 <varname>$mailstore_basename</varname> is available for use during these expansions.
41794 </para>
41795 </section>
41796 <section id="SECID138">
41797 <title>Non-special new file delivery</title>
41798 <para>
41799 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
41800 file is created directly in the named directory. For example, when delivering
41801 messages into files in batched SMTP format for later delivery to some host (see
41802 section <xref linkend="SECTbatchSMTP"/>), a setting such as
41803 </para>
41804 <literallayout class="monospaced">
41805 directory = /var/bsmtp/$host
41806 </literallayout>
41807 <para>
41808 might be used. A message is written to a file with a temporary name, which is
41809 then renamed when the delivery is complete. The final name is obtained by
41810 expanding the contents of the <option>directory_file</option> option.
41811 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
41812 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
41813 </para>
41814 </section>
41815 </chapter>
41816
41817 <chapter id="CHID8">
41818 <title>The autoreply transport</title>
41819 <para>
41820 <indexterm role="concept" id="IIDauttra1" class="startofrange">
41821 <primary>transports</primary>
41822 <secondary><command>autoreply</command></secondary>
41823 </indexterm>
41824 <indexterm role="concept" id="IIDauttra2" class="startofrange">
41825 <primary><command>autoreply</command> transport</primary>
41826 </indexterm>
41827 The <command>autoreply</command> transport is not a true transport in that it does not cause
41828 the message to be transmitted. Instead, it generates a new mail message as an
41829 automatic reply to the incoming message. <emphasis>References:</emphasis> and
41830 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
41831 to the rules in RFCs 2822 and 3834, respectively.
41832 </para>
41833 <para>
41834 If the router that passes the message to this transport does not have the
41835 <option>unseen</option> option set, the original message (for the current recipient) is not
41836 delivered anywhere. However, when the <option>unseen</option> option is set on the router
41837 that passes the message to this transport, routing of the address continues, so
41838 another router can set up a normal message delivery.
41839 </para>
41840 <para>
41841 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
41842 <quote>vacation</quote> message being the standard example. However, it can also be run
41843 directly from a router like any other transport. To reduce the possibility of
41844 message cascades, messages created by the <command>autoreply</command> transport always have
41845 empty envelope sender addresses, like bounce messages.
41846 </para>
41847 <para>
41848 The parameters of the message to be sent can be specified in the configuration
41849 by options described below. However, these are used only when the address
41850 passed to the transport does not contain its own reply information. When the
41851 transport is run as a consequence of a
41852 <option>mail</option>
41853 or <option>vacation</option> command in a filter file, the parameters of the message are
41854 supplied by the filter, and passed with the address. The transport&#x2019;s options
41855 that define the message are then ignored (so they are not usually set in this
41856 case). The message is specified entirely by the filter or by the transport; it
41857 is never built from a mixture of options. However, the <option>file_optional</option>,
41858 <option>mode</option>, and <option>return_message</option> options apply in all cases.
41859 </para>
41860 <para>
41861 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
41862 command in a user&#x2019;s filter file, <command>autoreply</command> normally runs under the uid and
41863 gid of the user, and with appropriate current and home directories (see chapter
41864 <xref linkend="CHAPenvironment"/>).
41865 </para>
41866 <para>
41867 There is a subtle difference between routing a message to a <command>pipe</command> transport
41868 that generates some text to be returned to the sender, and routing it to an
41869 <command>autoreply</command> transport. This difference is noticeable only if more than one
41870 address from the same message is so handled. In the case of a pipe, the
41871 separate outputs from the different addresses are gathered up and returned to
41872 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
41873 message is generated for each address that is passed to it.
41874 </para>
41875 <para>
41876 Non-printing characters are not permitted in the header lines generated for the
41877 message that <command>autoreply</command> creates, with the exception of newlines that are
41878 immediately followed by white space. If any non-printing characters are found,
41879 the transport defers.
41880 Whether characters with the top bit set count as printing characters or not is
41881 controlled by the <option>print_topbitchars</option> global option.
41882 </para>
41883 <para>
41884 If any of the generic options for manipulating headers (for example,
41885 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
41886 of the original message that is included in the generated message when
41887 <option>return_message</option> is set. They do not apply to the generated message itself.
41888 </para>
41889 <para>
41890 <indexterm role="variable">
41891 <primary><varname>$sender_address</varname></primary>
41892 </indexterm>
41893 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
41894 the message, indicating that there were no recipients, it does not treat this
41895 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
41896 is empty (because the incoming message is a bounce message) do not cause
41897 problems. They are just discarded.
41898 </para>
41899 <section id="SECID139">
41900 <title>Private options for autoreply</title>
41901 <para>
41902 <indexterm role="concept">
41903 <primary>options</primary>
41904 <secondary><command>autoreply</command> transport</secondary>
41905 </indexterm>
41906 </para>
41907 <para>
41908 <indexterm role="option">
41909 <primary><option>bcc</option></primary>
41910 </indexterm>
41911 </para>
41912 <informaltable frame="all">
41913 <tgroup cols="4" colsep="0" rowsep="0">
41914 <colspec colwidth="8*" align="left"/>
41915 <colspec colwidth="6*" align="center"/>
41916 <colspec colwidth="6*" align="center"/>
41917 <colspec colwidth="6*" align="right"/>
41918 <tbody>
41919 <row>
41920 <entry><option>bcc</option></entry>
41921 <entry>Use: <emphasis>autoreply</emphasis></entry>
41922 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41923 <entry>Default: <emphasis>unset</emphasis></entry>
41924 </row>
41925 </tbody>
41926 </tgroup>
41927 </informaltable>
41928 <para>
41929 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
41930 message when the message is specified by the transport.
41931 </para>
41932 <para>
41933 <indexterm role="option">
41934 <primary><option>cc</option></primary>
41935 </indexterm>
41936 </para>
41937 <informaltable frame="all">
41938 <tgroup cols="4" colsep="0" rowsep="0">
41939 <colspec colwidth="8*" align="left"/>
41940 <colspec colwidth="6*" align="center"/>
41941 <colspec colwidth="6*" align="center"/>
41942 <colspec colwidth="6*" align="right"/>
41943 <tbody>
41944 <row>
41945 <entry><option>cc</option></entry>
41946 <entry>Use: <emphasis>autoreply</emphasis></entry>
41947 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41948 <entry>Default: <emphasis>unset</emphasis></entry>
41949 </row>
41950 </tbody>
41951 </tgroup>
41952 </informaltable>
41953 <para>
41954 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
41955 when the message is specified by the transport.
41956 </para>
41957 <para>
41958 <indexterm role="option">
41959 <primary><option>file</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>file</option></entry>
41971 <entry>Use: <emphasis>autoreply</emphasis></entry>
41972 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41973 <entry>Default: <emphasis>unset</emphasis></entry>
41974 </row>
41975 </tbody>
41976 </tgroup>
41977 </informaltable>
41978 <para>
41979 The contents of the file are sent as the body of the message when the message
41980 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
41981 string comes first.
41982 </para>
41983 <para>
41984 <indexterm role="option">
41985 <primary><option>file_expand</option></primary>
41986 </indexterm>
41987 </para>
41988 <informaltable frame="all">
41989 <tgroup cols="4" colsep="0" rowsep="0">
41990 <colspec colwidth="8*" align="left"/>
41991 <colspec colwidth="6*" align="center"/>
41992 <colspec colwidth="6*" align="center"/>
41993 <colspec colwidth="6*" align="right"/>
41994 <tbody>
41995 <row>
41996 <entry><option>file_expand</option></entry>
41997 <entry>Use: <emphasis>autoreply</emphasis></entry>
41998 <entry>Type: <emphasis>boolean</emphasis></entry>
41999 <entry>Default: <emphasis>false</emphasis></entry>
42000 </row>
42001 </tbody>
42002 </tgroup>
42003 </informaltable>
42004 <para>
42005 If this is set, the contents of the file named by the <option>file</option> option are
42006 subjected to string expansion as they are added to the message.
42007 </para>
42008 <para>
42009 <indexterm role="option">
42010 <primary><option>file_optional</option></primary>
42011 </indexterm>
42012 </para>
42013 <informaltable frame="all">
42014 <tgroup cols="4" colsep="0" rowsep="0">
42015 <colspec colwidth="8*" align="left"/>
42016 <colspec colwidth="6*" align="center"/>
42017 <colspec colwidth="6*" align="center"/>
42018 <colspec colwidth="6*" align="right"/>
42019 <tbody>
42020 <row>
42021 <entry><option>file_optional</option></entry>
42022 <entry>Use: <emphasis>autoreply</emphasis></entry>
42023 <entry>Type: <emphasis>boolean</emphasis></entry>
42024 <entry>Default: <emphasis>false</emphasis></entry>
42025 </row>
42026 </tbody>
42027 </tgroup>
42028 </informaltable>
42029 <para>
42030 If this option is true, no error is generated if the file named by the <option>file</option>
42031 option or passed with the address does not exist or cannot be read.
42032 </para>
42033 <para>
42034 <indexterm role="option">
42035 <primary><option>from</option></primary>
42036 </indexterm>
42037 </para>
42038 <informaltable frame="all">
42039 <tgroup cols="4" colsep="0" rowsep="0">
42040 <colspec colwidth="8*" align="left"/>
42041 <colspec colwidth="6*" align="center"/>
42042 <colspec colwidth="6*" align="center"/>
42043 <colspec colwidth="6*" align="right"/>
42044 <tbody>
42045 <row>
42046 <entry><option>from</option></entry>
42047 <entry>Use: <emphasis>autoreply</emphasis></entry>
42048 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42049 <entry>Default: <emphasis>unset</emphasis></entry>
42050 </row>
42051 </tbody>
42052 </tgroup>
42053 </informaltable>
42054 <para>
42055 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
42056 specified by the transport.
42057 </para>
42058 <para>
42059 <indexterm role="option">
42060 <primary><option>headers</option></primary>
42061 </indexterm>
42062 </para>
42063 <informaltable frame="all">
42064 <tgroup cols="4" colsep="0" rowsep="0">
42065 <colspec colwidth="8*" align="left"/>
42066 <colspec colwidth="6*" align="center"/>
42067 <colspec colwidth="6*" align="center"/>
42068 <colspec colwidth="6*" align="right"/>
42069 <tbody>
42070 <row>
42071 <entry><option>headers</option></entry>
42072 <entry>Use: <emphasis>autoreply</emphasis></entry>
42073 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42074 <entry>Default: <emphasis>unset</emphasis></entry>
42075 </row>
42076 </tbody>
42077 </tgroup>
42078 </informaltable>
42079 <para>
42080 This specifies additional RFC 2822 headers that are to be added to the message
42081 when the message is specified by the transport. Several can be given by using
42082 <quote>\n</quote> to separate them. There is no check on the format.
42083 </para>
42084 <para>
42085 <indexterm role="option">
42086 <primary><option>log</option></primary>
42087 </indexterm>
42088 </para>
42089 <informaltable frame="all">
42090 <tgroup cols="4" colsep="0" rowsep="0">
42091 <colspec colwidth="8*" align="left"/>
42092 <colspec colwidth="6*" align="center"/>
42093 <colspec colwidth="6*" align="center"/>
42094 <colspec colwidth="6*" align="right"/>
42095 <tbody>
42096 <row>
42097 <entry><option>log</option></entry>
42098 <entry>Use: <emphasis>autoreply</emphasis></entry>
42099 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42100 <entry>Default: <emphasis>unset</emphasis></entry>
42101 </row>
42102 </tbody>
42103 </tgroup>
42104 </informaltable>
42105 <para>
42106 This option names a file in which a record of every message sent is logged when
42107 the message is specified by the transport.
42108 </para>
42109 <para>
42110 <indexterm role="option">
42111 <primary><option>mode</option></primary>
42112 </indexterm>
42113 </para>
42114 <informaltable frame="all">
42115 <tgroup cols="4" colsep="0" rowsep="0">
42116 <colspec colwidth="8*" align="left"/>
42117 <colspec colwidth="6*" align="center"/>
42118 <colspec colwidth="6*" align="center"/>
42119 <colspec colwidth="6*" align="right"/>
42120 <tbody>
42121 <row>
42122 <entry><option>mode</option></entry>
42123 <entry>Use: <emphasis>autoreply</emphasis></entry>
42124 <entry>Type: <emphasis>octal integer</emphasis></entry>
42125 <entry>Default: <emphasis>0600</emphasis></entry>
42126 </row>
42127 </tbody>
42128 </tgroup>
42129 </informaltable>
42130 <para>
42131 If either the log file or the <quote>once</quote> file has to be created, this mode is
42132 used.
42133 </para>
42134 <para>
42135 <indexterm role="option">
42136 <primary><option>never_mail</option></primary>
42137 </indexterm>
42138 </para>
42139 <informaltable frame="all">
42140 <tgroup cols="4" colsep="0" rowsep="0">
42141 <colspec colwidth="8*" align="left"/>
42142 <colspec colwidth="6*" align="center"/>
42143 <colspec colwidth="6*" align="center"/>
42144 <colspec colwidth="6*" align="right"/>
42145 <tbody>
42146 <row>
42147 <entry><option>never_mail</option></entry>
42148 <entry>Use: <emphasis>autoreply</emphasis></entry>
42149 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
42150 <entry>Default: <emphasis>unset</emphasis></entry>
42151 </row>
42152 </tbody>
42153 </tgroup>
42154 </informaltable>
42155 <para>
42156 If any run of the transport creates a message with a recipient that matches any
42157 item in the list, that recipient is quietly discarded. If all recipients are
42158 discarded, no message is created. This applies both when the recipients are
42159 generated by a filter and when they are specified in the transport.
42160 </para>
42161 <para>
42162 <indexterm role="option">
42163 <primary><option>once</option></primary>
42164 </indexterm>
42165 </para>
42166 <informaltable frame="all">
42167 <tgroup cols="4" colsep="0" rowsep="0">
42168 <colspec colwidth="8*" align="left"/>
42169 <colspec colwidth="6*" align="center"/>
42170 <colspec colwidth="6*" align="center"/>
42171 <colspec colwidth="6*" align="right"/>
42172 <tbody>
42173 <row>
42174 <entry><option>once</option></entry>
42175 <entry>Use: <emphasis>autoreply</emphasis></entry>
42176 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42177 <entry>Default: <emphasis>unset</emphasis></entry>
42178 </row>
42179 </tbody>
42180 </tgroup>
42181 </informaltable>
42182 <para>
42183 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
42184 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
42185 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
42186 </para>
42187 <para>
42188 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
42189 By default, if <option>once</option> is set to a non-empty file name, the message
42190 is not sent if a potential recipient is already listed in the database.
42191 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
42192 message is sent if that much time has elapsed since a message was last sent to
42193 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
42194 prevents a message from being sent a second time &ndash; in this case, zero means
42195 infinity.
42196 </para>
42197 <para>
42198 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
42199 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
42200 greater than zero, it changes the way Exim implements the <option>once</option> option.
42201 Instead of using a DBM file to record every recipient it sends to, it uses a
42202 regular file, whose size will never get larger than the given value.
42203 </para>
42204 <para>
42205 In the file, Exim keeps a linear list of recipient addresses and the times at
42206 which they were sent messages. If the file is full when a new address needs to
42207 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
42208 means that a given recipient may receive multiple messages, but at
42209 unpredictable intervals that depend on the rate of turnover of addresses in the
42210 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
42211 </para>
42212 <para>
42213 <indexterm role="option">
42214 <primary><option>once_file_size</option></primary>
42215 </indexterm>
42216 </para>
42217 <informaltable frame="all">
42218 <tgroup cols="4" colsep="0" rowsep="0">
42219 <colspec colwidth="8*" align="left"/>
42220 <colspec colwidth="6*" align="center"/>
42221 <colspec colwidth="6*" align="center"/>
42222 <colspec colwidth="6*" align="right"/>
42223 <tbody>
42224 <row>
42225 <entry><option>once_file_size</option></entry>
42226 <entry>Use: <emphasis>autoreply</emphasis></entry>
42227 <entry>Type: <emphasis>integer</emphasis></entry>
42228 <entry>Default: <emphasis>0</emphasis></entry>
42229 </row>
42230 </tbody>
42231 </tgroup>
42232 </informaltable>
42233 <para>
42234 See <option>once</option> above.
42235 </para>
42236 <para>
42237 <indexterm role="option">
42238 <primary><option>once_repeat</option></primary>
42239 </indexterm>
42240 </para>
42241 <informaltable frame="all">
42242 <tgroup cols="4" colsep="0" rowsep="0">
42243 <colspec colwidth="8*" align="left"/>
42244 <colspec colwidth="6*" align="center"/>
42245 <colspec colwidth="6*" align="center"/>
42246 <colspec colwidth="6*" align="right"/>
42247 <tbody>
42248 <row>
42249 <entry><option>once_repeat</option></entry>
42250 <entry>Use: <emphasis>autoreply</emphasis></entry>
42251 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
42252 <entry>Default: <emphasis>0s</emphasis></entry>
42253 </row>
42254 </tbody>
42255 </tgroup>
42256 </informaltable>
42257 <para>
42258 See <option>once</option> above.
42259 After expansion, the value of this option must be a valid time value.
42260 </para>
42261 <para>
42262 <indexterm role="option">
42263 <primary><option>reply_to</option></primary>
42264 </indexterm>
42265 </para>
42266 <informaltable frame="all">
42267 <tgroup cols="4" colsep="0" rowsep="0">
42268 <colspec colwidth="8*" align="left"/>
42269 <colspec colwidth="6*" align="center"/>
42270 <colspec colwidth="6*" align="center"/>
42271 <colspec colwidth="6*" align="right"/>
42272 <tbody>
42273 <row>
42274 <entry><option>reply_to</option></entry>
42275 <entry>Use: <emphasis>autoreply</emphasis></entry>
42276 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42277 <entry>Default: <emphasis>unset</emphasis></entry>
42278 </row>
42279 </tbody>
42280 </tgroup>
42281 </informaltable>
42282 <para>
42283 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
42284 specified by the transport.
42285 </para>
42286 <para>
42287 <indexterm role="option">
42288 <primary><option>return_message</option></primary>
42289 </indexterm>
42290 </para>
42291 <informaltable frame="all">
42292 <tgroup cols="4" colsep="0" rowsep="0">
42293 <colspec colwidth="8*" align="left"/>
42294 <colspec colwidth="6*" align="center"/>
42295 <colspec colwidth="6*" align="center"/>
42296 <colspec colwidth="6*" align="right"/>
42297 <tbody>
42298 <row>
42299 <entry><option>return_message</option></entry>
42300 <entry>Use: <emphasis>autoreply</emphasis></entry>
42301 <entry>Type: <emphasis>boolean</emphasis></entry>
42302 <entry>Default: <emphasis>false</emphasis></entry>
42303 </row>
42304 </tbody>
42305 </tgroup>
42306 </informaltable>
42307 <para>
42308 If this is set, a copy of the original message is returned with the new
42309 message, subject to the maximum size set in the <option>return_size_limit</option> global
42310 configuration option.
42311 </para>
42312 <para>
42313 <indexterm role="option">
42314 <primary><option>subject</option></primary>
42315 </indexterm>
42316 </para>
42317 <informaltable frame="all">
42318 <tgroup cols="4" colsep="0" rowsep="0">
42319 <colspec colwidth="8*" align="left"/>
42320 <colspec colwidth="6*" align="center"/>
42321 <colspec colwidth="6*" align="center"/>
42322 <colspec colwidth="6*" align="right"/>
42323 <tbody>
42324 <row>
42325 <entry><option>subject</option></entry>
42326 <entry>Use: <emphasis>autoreply</emphasis></entry>
42327 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42328 <entry>Default: <emphasis>unset</emphasis></entry>
42329 </row>
42330 </tbody>
42331 </tgroup>
42332 </informaltable>
42333 <para>
42334 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
42335 specified by the transport. It is tempting to quote the original subject in
42336 automatic responses. For example:
42337 </para>
42338 <literallayout class="monospaced">
42339 subject = Re: $h_subject:
42340 </literallayout>
42341 <para>
42342 There is a danger in doing this, however. It may allow a third party to
42343 subscribe your users to an opt-in mailing list, provided that the list accepts
42344 bounce messages as subscription confirmations. Well-managed lists require a
42345 non-bounce message to confirm a subscription, so the danger is relatively
42346 small.
42347 </para>
42348 <para>
42349 <indexterm role="option">
42350 <primary><option>text</option></primary>
42351 </indexterm>
42352 </para>
42353 <informaltable frame="all">
42354 <tgroup cols="4" colsep="0" rowsep="0">
42355 <colspec colwidth="8*" align="left"/>
42356 <colspec colwidth="6*" align="center"/>
42357 <colspec colwidth="6*" align="center"/>
42358 <colspec colwidth="6*" align="right"/>
42359 <tbody>
42360 <row>
42361 <entry><option>text</option></entry>
42362 <entry>Use: <emphasis>autoreply</emphasis></entry>
42363 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42364 <entry>Default: <emphasis>unset</emphasis></entry>
42365 </row>
42366 </tbody>
42367 </tgroup>
42368 </informaltable>
42369 <para>
42370 This specifies a single string to be used as the body of the message when the
42371 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
42372 the text comes first.
42373 </para>
42374 <para>
42375 <indexterm role="option">
42376 <primary><option>to</option></primary>
42377 </indexterm>
42378 </para>
42379 <informaltable frame="all">
42380 <tgroup cols="4" colsep="0" rowsep="0">
42381 <colspec colwidth="8*" align="left"/>
42382 <colspec colwidth="6*" align="center"/>
42383 <colspec colwidth="6*" align="center"/>
42384 <colspec colwidth="6*" align="right"/>
42385 <tbody>
42386 <row>
42387 <entry><option>to</option></entry>
42388 <entry>Use: <emphasis>autoreply</emphasis></entry>
42389 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42390 <entry>Default: <emphasis>unset</emphasis></entry>
42391 </row>
42392 </tbody>
42393 </tgroup>
42394 </informaltable>
42395 <para>
42396 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
42397 when the message is specified by the transport.
42398 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
42399 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
42400 </para>
42401 </section>
42402 </chapter>
42403
42404 <chapter id="CHAPLMTP">
42405 <title>The lmtp transport</title>
42406 <para>
42407 <indexterm role="concept">
42408 <primary>transports</primary>
42409 <secondary><command>lmtp</command></secondary>
42410 </indexterm>
42411 <indexterm role="concept">
42412 <primary><command>lmtp</command> transport</primary>
42413 </indexterm>
42414 <indexterm role="concept">
42415 <primary>LMTP</primary>
42416 <secondary>over a pipe</secondary>
42417 </indexterm>
42418 <indexterm role="concept">
42419 <primary>LMTP</primary>
42420 <secondary>over a socket</secondary>
42421 </indexterm>
42422 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
42423 specified command
42424 or by interacting with a Unix domain socket.
42425 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
42426 transports. Exim also has support for using LMTP over TCP/IP; this is
42427 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
42428 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
42429 has it commented out. You need to ensure that
42430 </para>
42431 <literallayout class="monospaced">
42432 TRANSPORT_LMTP=yes
42433 </literallayout>
42434 <para>
42435 <indexterm role="concept">
42436 <primary>options</primary>
42437 <secondary><command>lmtp</command> transport</secondary>
42438 </indexterm>
42439 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
42440 included in the Exim binary. The private options of the <command>lmtp</command> transport are
42441 as follows:
42442 </para>
42443 <para>
42444 <indexterm role="option">
42445 <primary><option>batch_id</option></primary>
42446 </indexterm>
42447 </para>
42448 <informaltable frame="all">
42449 <tgroup cols="4" colsep="0" rowsep="0">
42450 <colspec colwidth="8*" align="left"/>
42451 <colspec colwidth="6*" align="center"/>
42452 <colspec colwidth="6*" align="center"/>
42453 <colspec colwidth="6*" align="right"/>
42454 <tbody>
42455 <row>
42456 <entry><option>batch_id</option></entry>
42457 <entry>Use: <emphasis>lmtp</emphasis></entry>
42458 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42459 <entry>Default: <emphasis>unset</emphasis></entry>
42460 </row>
42461 </tbody>
42462 </tgroup>
42463 </informaltable>
42464 <para>
42465 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
42466 </para>
42467 <para>
42468 <indexterm role="option">
42469 <primary><option>batch_max</option></primary>
42470 </indexterm>
42471 </para>
42472 <informaltable frame="all">
42473 <tgroup cols="4" colsep="0" rowsep="0">
42474 <colspec colwidth="8*" align="left"/>
42475 <colspec colwidth="6*" align="center"/>
42476 <colspec colwidth="6*" align="center"/>
42477 <colspec colwidth="6*" align="right"/>
42478 <tbody>
42479 <row>
42480 <entry><option>batch_max</option></entry>
42481 <entry>Use: <emphasis>lmtp</emphasis></entry>
42482 <entry>Type: <emphasis>integer</emphasis></entry>
42483 <entry>Default: <emphasis>1</emphasis></entry>
42484 </row>
42485 </tbody>
42486 </tgroup>
42487 </informaltable>
42488 <para>
42489 This limits the number of addresses that can be handled in a single delivery.
42490 Most LMTP servers can handle several addresses at once, so it is normally a
42491 good idea to increase this value. See the description of local delivery
42492 batching in chapter <xref linkend="CHAPbatching"/>.
42493 </para>
42494 <para>
42495 <indexterm role="option">
42496 <primary><option>command</option></primary>
42497 </indexterm>
42498 </para>
42499 <informaltable frame="all">
42500 <tgroup cols="4" colsep="0" rowsep="0">
42501 <colspec colwidth="8*" align="left"/>
42502 <colspec colwidth="6*" align="center"/>
42503 <colspec colwidth="6*" align="center"/>
42504 <colspec colwidth="6*" align="right"/>
42505 <tbody>
42506 <row>
42507 <entry><option>command</option></entry>
42508 <entry>Use: <emphasis>lmtp</emphasis></entry>
42509 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42510 <entry>Default: <emphasis>unset</emphasis></entry>
42511 </row>
42512 </tbody>
42513 </tgroup>
42514 </informaltable>
42515 <para>
42516 This option must be set if <option>socket</option> is not set. The string is a command which
42517 is run in a separate process. It is split up into a command name and list of
42518 arguments, each of which is separately expanded (so expansion cannot change the
42519 number of arguments). The command is run directly, not via a shell. The message
42520 is passed to the new process using the standard input and output to operate the
42521 LMTP protocol.
42522 </para>
42523 <para>
42524 <indexterm role="option">
42525 <primary><option>ignore_quota</option></primary>
42526 </indexterm>
42527 </para>
42528 <informaltable frame="all">
42529 <tgroup cols="4" colsep="0" rowsep="0">
42530 <colspec colwidth="8*" align="left"/>
42531 <colspec colwidth="6*" align="center"/>
42532 <colspec colwidth="6*" align="center"/>
42533 <colspec colwidth="6*" align="right"/>
42534 <tbody>
42535 <row>
42536 <entry><option>ignore_quota</option></entry>
42537 <entry>Use: <emphasis>lmtp</emphasis></entry>
42538 <entry>Type: <emphasis>boolean</emphasis></entry>
42539 <entry>Default: <emphasis>false</emphasis></entry>
42540 </row>
42541 </tbody>
42542 </tgroup>
42543 </informaltable>
42544 <para>
42545 <indexterm role="concept">
42546 <primary>LMTP</primary>
42547 <secondary>ignoring quota errors</secondary>
42548 </indexterm>
42549 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
42550 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
42551 in its response to the LHLO command.
42552 </para>
42553 <para>
42554 <indexterm role="option">
42555 <primary><option>socket</option></primary>
42556 </indexterm>
42557 </para>
42558 <informaltable frame="all">
42559 <tgroup cols="4" colsep="0" rowsep="0">
42560 <colspec colwidth="8*" align="left"/>
42561 <colspec colwidth="6*" align="center"/>
42562 <colspec colwidth="6*" align="center"/>
42563 <colspec colwidth="6*" align="right"/>
42564 <tbody>
42565 <row>
42566 <entry><option>socket</option></entry>
42567 <entry>Use: <emphasis>lmtp</emphasis></entry>
42568 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42569 <entry>Default: <emphasis>unset</emphasis></entry>
42570 </row>
42571 </tbody>
42572 </tgroup>
42573 </informaltable>
42574 <para>
42575 This option must be set if <option>command</option> is not set. The result of expansion must
42576 be the name of a Unix domain socket. The transport connects to the socket and
42577 delivers the message to it using the LMTP protocol.
42578 </para>
42579 <para>
42580 <indexterm role="option">
42581 <primary><option>timeout</option></primary>
42582 </indexterm>
42583 </para>
42584 <informaltable frame="all">
42585 <tgroup cols="4" colsep="0" rowsep="0">
42586 <colspec colwidth="8*" align="left"/>
42587 <colspec colwidth="6*" align="center"/>
42588 <colspec colwidth="6*" align="center"/>
42589 <colspec colwidth="6*" align="right"/>
42590 <tbody>
42591 <row>
42592 <entry><option>timeout</option></entry>
42593 <entry>Use: <emphasis>lmtp</emphasis></entry>
42594 <entry>Type: <emphasis>time</emphasis></entry>
42595 <entry>Default: <emphasis>5m</emphasis></entry>
42596 </row>
42597 </tbody>
42598 </tgroup>
42599 </informaltable>
42600 <para>
42601 The transport is aborted if the created process or Unix domain socket does not
42602 respond to LMTP commands or message input within this timeout. Delivery
42603 is deferred, and will be tried again later. Here is an example of a typical
42604 LMTP transport:
42605 </para>
42606 <literallayout class="monospaced">
42607 lmtp:
42608   driver = lmtp
42609   command = /some/local/lmtp/delivery/program
42610   batch_max = 20
42611   user = exim
42612 </literallayout>
42613 <para>
42614 This delivers up to 20 addresses at a time, in a mixture of domains if
42615 necessary, running as the user <emphasis>exim</emphasis>.
42616 </para>
42617 </chapter>
42618
42619 <chapter id="CHAPpipetransport">
42620 <title>The pipe transport</title>
42621 <para>
42622 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
42623 <primary>transports</primary>
42624 <secondary><command>pipe</command></secondary>
42625 </indexterm>
42626 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
42627 <primary><command>pipe</command> transport</primary>
42628 </indexterm>
42629 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
42630 running in another process. One example is the use of <command>pipe</command> as a
42631 pseudo-remote transport for passing messages to some other delivery mechanism
42632 (such as UUCP). Another is the use by individual users to automatically process
42633 their incoming messages. The <command>pipe</command> transport can be used in one of the
42634 following ways:
42635 </para>
42636 <itemizedlist>
42637 <listitem>
42638 <para>
42639 <indexterm role="variable">
42640 <primary><varname>$local_part</varname></primary>
42641 </indexterm>
42642 A router routes one address to a transport in the normal way, and the
42643 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
42644 contains the local part of the address (as usual), and the command that is run
42645 is specified by the <option>command</option> option on the transport.
42646 </para>
42647 </listitem>
42648 <listitem>
42649 <para>
42650 <indexterm role="variable">
42651 <primary><varname>$pipe_addresses</varname></primary>
42652 </indexterm>
42653 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
42654 transport can handle more than one address in a single run. In this case, when
42655 more than one address is routed to the transport, <varname>$local_part</varname> is not set
42656 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
42657 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
42658 that are routed to the transport.
42659 </para>
42660 </listitem>
42661 <listitem>
42662 <para>
42663 <indexterm role="variable">
42664 <primary><varname>$address_pipe</varname></primary>
42665 </indexterm>
42666 A router redirects an address directly to a pipe command (for example, from an
42667 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
42668 pipe command, and the <option>command</option> option on the transport is ignored unless
42669 <option>force_command</option> is set. If only one address is being transported
42670 (<option>batch_max</option> is not greater than one, or only one address was redirected to
42671 this pipe command), <varname>$local_part</varname> contains the local part that was redirected.
42672 </para>
42673 </listitem>
42674 </itemizedlist>
42675 <para>
42676 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
42677 deliver messages over pipes using the LMTP interactive protocol. This is
42678 implemented by the <command>lmtp</command> transport.
42679 </para>
42680 <para>
42681 In the case when <command>pipe</command> is run as a consequence of an entry in a local user&#x2019;s
42682 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
42683 other cases, the uid and gid have to be specified explicitly, either on the
42684 transport or on the router that handles the address. Current and <quote>home</quote>
42685 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
42686 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
42687 for a discussion of local delivery batching.
42688 </para>
42689 <section id="SECID140">
42690 <title>Concurrent delivery</title>
42691 <para>
42692 If two messages arrive at almost the same time, and both are routed to a pipe
42693 delivery, the two pipe transports may be run concurrently. You must ensure that
42694 any pipe commands you set up are robust against this happening. If the commands
42695 write to a file, the <option>exim_lock</option> utility might be of use.
42696 </para>
42697 </section>
42698 <section id="SECID141">
42699 <title>Returned status and data</title>
42700 <para>
42701 <indexterm role="concept">
42702 <primary><command>pipe</command> transport</primary>
42703 <secondary>returned data</secondary>
42704 </indexterm>
42705 If the command exits with a non-zero return code, the delivery is deemed to
42706 have failed, unless either the <option>ignore_status</option> option is set (in which case
42707 the return code is treated as zero), or the return code is one of those listed
42708 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
42709 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
42710 logged, but are not included in the bounce message, which merely contains
42711 <quote>local delivery failed</quote>.
42712 </para>
42713 <para>
42714 If the command exits on a signal and the <option>freeze_signal</option> option is set then
42715 the message will be frozen in the queue. If that option is not set, a bounce
42716 will be sent as normal.
42717 </para>
42718 <para>
42719 If the return code is greater than 128 and the command being run is a shell
42720 script, it normally means that the script was terminated by a signal whose
42721 value is the return code minus 128. The <option>freeze_signal</option> option does not
42722 apply in this case.
42723 </para>
42724 <para>
42725 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
42726 return code is set to 127. This is the value that a shell returns if it is
42727 asked to run a non-existent command. The wording for the log line suggests that
42728 a non-existent command may be the problem.
42729 </para>
42730 <para>
42731 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
42732 set and the command produces any output on its standard output or standard
42733 error streams, the command is considered to have failed, even if it gave a zero
42734 return code or if <option>ignore_status</option> is set. The output from the command is
42735 included as part of the bounce message. The <option>return_fail_output</option> option is
42736 similar, except that output is returned only when the command exits with a
42737 failure return code, that is, a value other than zero or a code that matches
42738 <option>temp_errors</option>.
42739 </para>
42740 </section>
42741 <section id="SECThowcommandrun">
42742 <title>How the command is run</title>
42743 <para>
42744 <indexterm role="concept">
42745 <primary><command>pipe</command> transport</primary>
42746 <secondary>path for command</secondary>
42747 </indexterm>
42748 The command line is (by default) broken down into a command name and arguments
42749 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
42750 <option>restrict_to_path</option> options can be used to restrict the commands that may be
42751 run.
42752 </para>
42753 <para>
42754 <indexterm role="concept">
42755 <primary>quoting</primary>
42756 <secondary>in pipe command</secondary>
42757 </indexterm>
42758 Unquoted arguments are delimited by white space. If an argument appears in
42759 double quotes, backslash is interpreted as an escape character in the usual
42760 way. If an argument appears in single quotes, no escaping is done.
42761 </para>
42762 <para>
42763 String expansion is applied to the command line except when it comes from a
42764 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
42765 expansion is applied to each argument in turn rather than to the whole line.
42766 For this reason, any string expansion item that contains white space must be
42767 quoted so as to be contained within a single argument. A setting such as
42768 </para>
42769 <literallayout class="monospaced">
42770 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
42771 </literallayout>
42772 <para>
42773 will not work, because the expansion item gets split between several
42774 arguments. You have to write
42775 </para>
42776 <literallayout class="monospaced">
42777 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
42778 </literallayout>
42779 <para>
42780 to ensure that it is all in one argument. The expansion is done in this way,
42781 argument by argument, so that the number of arguments cannot be changed as a
42782 result of expansion, and quotes or backslashes in inserted variables do not
42783 interact with external quoting. However, this leads to problems if you want to
42784 generate multiple arguments (or the command name plus arguments) from a single
42785 expansion. In this situation, the simplest solution is to use a shell. For
42786 example:
42787 </para>
42788 <literallayout class="monospaced">
42789 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
42790 </literallayout>
42791 <para>
42792 <indexterm role="concept">
42793 <primary>transport</primary>
42794 <secondary>filter</secondary>
42795 </indexterm>
42796 <indexterm role="concept">
42797 <primary>filter</primary>
42798 <secondary>transport filter</secondary>
42799 </indexterm>
42800 <indexterm role="variable">
42801 <primary><varname>$pipe_addresses</varname></primary>
42802 </indexterm>
42803 Special handling takes place when an argument consists of precisely the text
42804 <literal>$pipe_addresses</literal>. This is not a general expansion variable; the only
42805 place this string is recognized is when it appears as an argument for a pipe or
42806 transport filter command. It causes each address that is being handled to be
42807 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
42808 avoids any problems with spaces or shell metacharacters, and is of use when a
42809 <command>pipe</command> transport is handling groups of addresses in a batch.
42810 </para>
42811 <para>
42812 If <option>force_command</option> is enabled on the transport, Special handling takes place
42813 for an argument that consists of precisely the text <literal>$address_pipe</literal>.  It
42814 is handled similarly to <varname>$pipe_addresses</varname> above.  It is expanded and each
42815 argument is inserted in the argument list at that point
42816 <emphasis>as a separate argument</emphasis>.  The <literal>$address_pipe</literal> item does not need to be
42817 the only item in the argument; in fact, if it were then <option>force_command</option>
42818 should behave as a no-op.  Rather, it should be used to adjust the command
42819 run while preserving the argument vector separation.
42820 </para>
42821 <para>
42822 After splitting up into arguments and expansion, the resulting command is run
42823 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
42824 message that is being delivered is supplied on the standard input, and the
42825 standard output and standard error are both connected to a single pipe that is
42826 read by Exim. The <option>max_output</option> option controls how much output the command
42827 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
42828 control what is done with it.
42829 </para>
42830 <para>
42831 Not running the command under a shell (by default) lessens the security risks
42832 in cases when a command from a user&#x2019;s filter file is built out of data that was
42833 taken from an incoming message. If a shell is required, it can of course be
42834 explicitly specified as the command to be run. However, there are circumstances
42835 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
42836 under a shell and cannot easily be modified. To allow for these cases, there is
42837 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
42838 works. Instead of breaking up the command line as just described, it expands it
42839 as a single string and passes the result to <filename>/bin/sh</filename>. The
42840 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
42841 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
42842 </para>
42843 </section>
42844 <section id="SECTpipeenv">
42845 <title>Environment variables</title>
42846 <para>
42847 <indexterm role="concept">
42848 <primary><command>pipe</command> transport</primary>
42849 <secondary>environment for command</secondary>
42850 </indexterm>
42851 <indexterm role="concept">
42852 <primary>environment for pipe transport</primary>
42853 </indexterm>
42854 The environment variables listed below are set up when the command is invoked.
42855 This list is a compromise for maximum compatibility with other MTAs. Note that
42856 the <option>environment</option> option can be used to add additional variables to this
42857 environment.
42858 </para>
42859 <literallayout>
42860 <literal>DOMAIN            </literal>   the domain of the address
42861 <literal>HOME              </literal>   the home directory, if set
42862 <literal>HOST              </literal>   the host name when called from a router (see below)
42863 <literal>LOCAL_PART        </literal>   see below
42864 <literal>LOCAL_PART_PREFIX </literal>   see below
42865 <literal>LOCAL_PART_SUFFIX </literal>   see below
42866 <literal>LOGNAME           </literal>   see below
42867 <literal>MESSAGE_ID        </literal>   Exim&#x2019;s local ID for the message
42868 <literal>PATH              </literal>   as specified by the <option>path</option> option below
42869 <literal>QUALIFY_DOMAIN    </literal>   the sender qualification domain
42870 <literal>RECIPIENT         </literal>   the complete recipient address
42871 <literal>SENDER            </literal>   the sender of the message (empty if a bounce)
42872 <literal>SHELL             </literal>   <literal>/bin/sh</literal>
42873 <literal>TZ                </literal>   the value of the <option>timezone</option> option, if set
42874 <literal>USER              </literal>   see below
42875 </literallayout>
42876 <para>
42877 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
42878 router, LOCAL_PART is set to the local part of the address. When it is
42879 called as a result of a forward or alias expansion, LOCAL_PART is set to
42880 the local part of the address that was expanded. In both cases, any affixes are
42881 removed from the local part, and made available in LOCAL_PART_PREFIX and
42882 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
42883 same value as LOCAL_PART for compatibility with other MTAs.
42884 </para>
42885 <para>
42886 <indexterm role="concept">
42887 <primary>HOST</primary>
42888 </indexterm>
42889 HOST is set only when a <command>pipe</command> transport is called from a router that
42890 associates hosts with an address, typically when using <command>pipe</command> as a
42891 pseudo-remote transport. HOST is set to the first host name specified by
42892 the router.
42893 </para>
42894 <para>
42895 <indexterm role="concept">
42896 <primary>HOME</primary>
42897 </indexterm>
42898 If the transport&#x2019;s generic <option>home_directory</option> option is set, its value is used
42899 for the HOME environment variable. Otherwise, a home directory may be set
42900 by the router&#x2019;s <option>transport_home_directory</option> option, which defaults to the
42901 user&#x2019;s home directory if <option>check_local_user</option> is set.
42902 </para>
42903 </section>
42904 <section id="SECID142">
42905 <title>Private options for pipe</title>
42906 <para>
42907 <indexterm role="concept">
42908 <primary>options</primary>
42909 <secondary><command>pipe</command> transport</secondary>
42910 </indexterm>
42911 </para>
42912 <para>
42913 <indexterm role="option">
42914 <primary><option>allow_commands</option></primary>
42915 </indexterm>
42916 </para>
42917 <informaltable frame="all">
42918 <tgroup cols="4" colsep="0" rowsep="0">
42919 <colspec colwidth="8*" align="left"/>
42920 <colspec colwidth="6*" align="center"/>
42921 <colspec colwidth="6*" align="center"/>
42922 <colspec colwidth="6*" align="right"/>
42923 <tbody>
42924 <row>
42925 <entry><option>allow_commands</option></entry>
42926 <entry>Use: <emphasis>pipe</emphasis></entry>
42927 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
42928 <entry>Default: <emphasis>unset</emphasis></entry>
42929 </row>
42930 </tbody>
42931 </tgroup>
42932 </informaltable>
42933 <para>
42934 <indexterm role="concept">
42935 <primary><command>pipe</command> transport</primary>
42936 <secondary>permitted commands</secondary>
42937 </indexterm>
42938 The string is expanded, and is then interpreted as a colon-separated list of
42939 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
42940 permitted are those in the <option>allow_commands</option> list. They need not be absolute
42941 paths; the <option>path</option> option is still used for relative paths. If
42942 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
42943 in the <option>allow_commands</option> list, or a name without any slashes that is found on
42944 the path. In other words, if neither <option>allow_commands</option> nor
42945 <option>restrict_to_path</option> is set, there is no restriction on the command, but
42946 otherwise only commands that are permitted by one or the other are allowed. For
42947 example, if
42948 </para>
42949 <literallayout class="monospaced">
42950 allow_commands = /usr/bin/vacation
42951 </literallayout>
42952 <para>
42953 and <option>restrict_to_path</option> is not set, the only permitted command is
42954 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
42955 <option>use_shell</option> is set.
42956 </para>
42957 <para>
42958 <indexterm role="option">
42959 <primary><option>batch_id</option></primary>
42960 </indexterm>
42961 </para>
42962 <informaltable frame="all">
42963 <tgroup cols="4" colsep="0" rowsep="0">
42964 <colspec colwidth="8*" align="left"/>
42965 <colspec colwidth="6*" align="center"/>
42966 <colspec colwidth="6*" align="center"/>
42967 <colspec colwidth="6*" align="right"/>
42968 <tbody>
42969 <row>
42970 <entry><option>batch_id</option></entry>
42971 <entry>Use: <emphasis>pipe</emphasis></entry>
42972 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42973 <entry>Default: <emphasis>unset</emphasis></entry>
42974 </row>
42975 </tbody>
42976 </tgroup>
42977 </informaltable>
42978 <para>
42979 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
42980 </para>
42981 <para>
42982 <indexterm role="option">
42983 <primary><option>batch_max</option></primary>
42984 </indexterm>
42985 </para>
42986 <informaltable frame="all">
42987 <tgroup cols="4" colsep="0" rowsep="0">
42988 <colspec colwidth="8*" align="left"/>
42989 <colspec colwidth="6*" align="center"/>
42990 <colspec colwidth="6*" align="center"/>
42991 <colspec colwidth="6*" align="right"/>
42992 <tbody>
42993 <row>
42994 <entry><option>batch_max</option></entry>
42995 <entry>Use: <emphasis>pipe</emphasis></entry>
42996 <entry>Type: <emphasis>integer</emphasis></entry>
42997 <entry>Default: <emphasis>1</emphasis></entry>
42998 </row>
42999 </tbody>
43000 </tgroup>
43001 </informaltable>
43002 <para>
43003 This limits the number of addresses that can be handled in a single delivery.
43004 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
43005 </para>
43006 <para>
43007 <indexterm role="option">
43008 <primary><option>check_string</option></primary>
43009 </indexterm>
43010 </para>
43011 <informaltable frame="all">
43012 <tgroup cols="4" colsep="0" rowsep="0">
43013 <colspec colwidth="8*" align="left"/>
43014 <colspec colwidth="6*" align="center"/>
43015 <colspec colwidth="6*" align="center"/>
43016 <colspec colwidth="6*" align="right"/>
43017 <tbody>
43018 <row>
43019 <entry><option>check_string</option></entry>
43020 <entry>Use: <emphasis>pipe</emphasis></entry>
43021 <entry>Type: <emphasis>string</emphasis></entry>
43022 <entry>Default: <emphasis>unset</emphasis></entry>
43023 </row>
43024 </tbody>
43025 </tgroup>
43026 </informaltable>
43027 <para>
43028 As <command>pipe</command> writes the message, the start of each line is tested for matching
43029 <option>check_string</option>, and if it does, the initial matching characters are replaced
43030 by the contents of <option>escape_string</option>, provided both are set. The value of
43031 <option>check_string</option> is a literal string, not a regular expression, and the case of
43032 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
43033 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
43034 the SMTP escaping protocol. Any settings made in the configuration file are
43035 ignored.
43036 </para>
43037 <para>
43038 <indexterm role="option">
43039 <primary><option>command</option></primary>
43040 </indexterm>
43041 </para>
43042 <informaltable frame="all">
43043 <tgroup cols="4" colsep="0" rowsep="0">
43044 <colspec colwidth="8*" align="left"/>
43045 <colspec colwidth="6*" align="center"/>
43046 <colspec colwidth="6*" align="center"/>
43047 <colspec colwidth="6*" align="right"/>
43048 <tbody>
43049 <row>
43050 <entry><option>command</option></entry>
43051 <entry>Use: <emphasis>pipe</emphasis></entry>
43052 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43053 <entry>Default: <emphasis>unset</emphasis></entry>
43054 </row>
43055 </tbody>
43056 </tgroup>
43057 </informaltable>
43058 <para>
43059 This option need not be set when <command>pipe</command> is being used to deliver to pipes
43060 obtained directly from address redirections. In other cases, the option must be
43061 set, to provide a command to be run. It need not yield an absolute path (see
43062 the <option>path</option> option below). The command is split up into separate arguments by
43063 Exim, and each argument is separately expanded, as described in section
43064 <xref linkend="SECThowcommandrun"/> above.
43065 </para>
43066 <para>
43067 <indexterm role="option">
43068 <primary><option>environment</option></primary>
43069 </indexterm>
43070 </para>
43071 <informaltable frame="all">
43072 <tgroup cols="4" colsep="0" rowsep="0">
43073 <colspec colwidth="8*" align="left"/>
43074 <colspec colwidth="6*" align="center"/>
43075 <colspec colwidth="6*" align="center"/>
43076 <colspec colwidth="6*" align="right"/>
43077 <tbody>
43078 <row>
43079 <entry><option>environment</option></entry>
43080 <entry>Use: <emphasis>pipe</emphasis></entry>
43081 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43082 <entry>Default: <emphasis>unset</emphasis></entry>
43083 </row>
43084 </tbody>
43085 </tgroup>
43086 </informaltable>
43087 <para>
43088 <indexterm role="concept">
43089 <primary><command>pipe</command> transport</primary>
43090 <secondary>environment for command</secondary>
43091 </indexterm>
43092 <indexterm role="concept">
43093 <primary>environment for <command>pipe</command> transport</primary>
43094 </indexterm>
43095 This option is used to add additional variables to the environment in which the
43096 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
43097 a string which is expanded, and then interpreted as a colon-separated list of
43098 environment settings of the form &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;.
43099 </para>
43100 <para>
43101 <indexterm role="option">
43102 <primary><option>escape_string</option></primary>
43103 </indexterm>
43104 </para>
43105 <informaltable frame="all">
43106 <tgroup cols="4" colsep="0" rowsep="0">
43107 <colspec colwidth="8*" align="left"/>
43108 <colspec colwidth="6*" align="center"/>
43109 <colspec colwidth="6*" align="center"/>
43110 <colspec colwidth="6*" align="right"/>
43111 <tbody>
43112 <row>
43113 <entry><option>escape_string</option></entry>
43114 <entry>Use: <emphasis>pipe</emphasis></entry>
43115 <entry>Type: <emphasis>string</emphasis></entry>
43116 <entry>Default: <emphasis>unset</emphasis></entry>
43117 </row>
43118 </tbody>
43119 </tgroup>
43120 </informaltable>
43121 <para>
43122 See <option>check_string</option> above.
43123 </para>
43124 <para>
43125 <indexterm role="option">
43126 <primary><option>freeze_exec_fail</option></primary>
43127 </indexterm>
43128 </para>
43129 <informaltable frame="all">
43130 <tgroup cols="4" colsep="0" rowsep="0">
43131 <colspec colwidth="8*" align="left"/>
43132 <colspec colwidth="6*" align="center"/>
43133 <colspec colwidth="6*" align="center"/>
43134 <colspec colwidth="6*" align="right"/>
43135 <tbody>
43136 <row>
43137 <entry><option>freeze_exec_fail</option></entry>
43138 <entry>Use: <emphasis>pipe</emphasis></entry>
43139 <entry>Type: <emphasis>boolean</emphasis></entry>
43140 <entry>Default: <emphasis>false</emphasis></entry>
43141 </row>
43142 </tbody>
43143 </tgroup>
43144 </informaltable>
43145 <para>
43146 <indexterm role="concept">
43147 <primary>exec failure</primary>
43148 </indexterm>
43149 <indexterm role="concept">
43150 <primary>failure of exec</primary>
43151 </indexterm>
43152 <indexterm role="concept">
43153 <primary><command>pipe</command> transport</primary>
43154 <secondary>failure of exec</secondary>
43155 </indexterm>
43156 Failure to exec the command in a pipe transport is by default treated like
43157 any other failure while running the command. However, if <option>freeze_exec_fail</option>
43158 is set, failure to exec is treated specially, and causes the message to be
43159 frozen, whatever the setting of <option>ignore_status</option>.
43160 </para>
43161 <para>
43162 <indexterm role="option">
43163 <primary><option>freeze_signal</option></primary>
43164 </indexterm>
43165 </para>
43166 <informaltable frame="all">
43167 <tgroup cols="4" colsep="0" rowsep="0">
43168 <colspec colwidth="8*" align="left"/>
43169 <colspec colwidth="6*" align="center"/>
43170 <colspec colwidth="6*" align="center"/>
43171 <colspec colwidth="6*" align="right"/>
43172 <tbody>
43173 <row>
43174 <entry><option>freeze_signal</option></entry>
43175 <entry>Use: <emphasis>pipe</emphasis></entry>
43176 <entry>Type: <emphasis>boolean</emphasis></entry>
43177 <entry>Default: <emphasis>false</emphasis></entry>
43178 </row>
43179 </tbody>
43180 </tgroup>
43181 </informaltable>
43182 <para>
43183 <indexterm role="concept">
43184 <primary>signal exit</primary>
43185 </indexterm>
43186 <indexterm role="concept">
43187 <primary><command>pipe</command> transport</primary>
43188 <secondary>,</secondary>
43189 </indexterm>
43190 Normally if the process run by a command in a pipe transport exits on a signal,
43191 a bounce message is sent. If <option>freeze_signal</option> is set, the message will be
43192 frozen in Exim&#x2019;s queue instead.
43193 </para>
43194 <para>
43195 <indexterm role="option">
43196 <primary><option>force_command</option></primary>
43197 </indexterm>
43198 </para>
43199 <informaltable frame="all">
43200 <tgroup cols="4" colsep="0" rowsep="0">
43201 <colspec colwidth="8*" align="left"/>
43202 <colspec colwidth="6*" align="center"/>
43203 <colspec colwidth="6*" align="center"/>
43204 <colspec colwidth="6*" align="right"/>
43205 <tbody>
43206 <row>
43207 <entry><option>force_command</option></entry>
43208 <entry>Use: <emphasis>pipe</emphasis></entry>
43209 <entry>Type: <emphasis>boolean</emphasis></entry>
43210 <entry>Default: <emphasis>false</emphasis></entry>
43211 </row>
43212 </tbody>
43213 </tgroup>
43214 </informaltable>
43215 <para>
43216 <indexterm role="concept">
43217 <primary>force command</primary>
43218 </indexterm>
43219 <indexterm role="concept">
43220 <primary><command>pipe</command> transport</primary>
43221 <secondary>,</secondary>
43222 </indexterm>
43223 Normally when a router redirects an address directly to a pipe command
43224 the <option>command</option> option on the transport is ignored.  If <option>force_command</option>
43225 is set, the <option>command</option> option will used. This is especially
43226 useful for forcing a wrapper or additional argument to be added to the
43227 command. For example:
43228 </para>
43229 <literallayout class="monospaced">
43230 command = /usr/bin/remote_exec myhost -- $address_pipe
43231 force_command
43232 </literallayout>
43233 <para>
43234 Note that <varname>$address_pipe</varname> is handled specially in <option>command</option> when
43235 <option>force_command</option> is set, expanding out to the original argument vector as
43236 separate items, similarly to a Unix shell <literal>"$@"</literal> construct.
43237 </para>
43238 <para>
43239 <indexterm role="option">
43240 <primary><option>ignore_status</option></primary>
43241 </indexterm>
43242 </para>
43243 <informaltable frame="all">
43244 <tgroup cols="4" colsep="0" rowsep="0">
43245 <colspec colwidth="8*" align="left"/>
43246 <colspec colwidth="6*" align="center"/>
43247 <colspec colwidth="6*" align="center"/>
43248 <colspec colwidth="6*" align="right"/>
43249 <tbody>
43250 <row>
43251 <entry><option>ignore_status</option></entry>
43252 <entry>Use: <emphasis>pipe</emphasis></entry>
43253 <entry>Type: <emphasis>boolean</emphasis></entry>
43254 <entry>Default: <emphasis>false</emphasis></entry>
43255 </row>
43256 </tbody>
43257 </tgroup>
43258 </informaltable>
43259 <para>
43260 If this option is true, the status returned by the subprocess that is set up to
43261 run the command is ignored, and Exim behaves as if zero had been returned.
43262 Otherwise, a non-zero status or termination by signal causes an error return
43263 from the transport unless the status value is one of those listed in
43264 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
43265 </para>
43266 <para>
43267 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
43268 See the <option>timeout_defer</option> option for how timeouts are handled.
43269 </para>
43270 <para>
43271 <indexterm role="option">
43272 <primary><option>log_defer_output</option></primary>
43273 </indexterm>
43274 </para>
43275 <informaltable frame="all">
43276 <tgroup cols="4" colsep="0" rowsep="0">
43277 <colspec colwidth="8*" align="left"/>
43278 <colspec colwidth="6*" align="center"/>
43279 <colspec colwidth="6*" align="center"/>
43280 <colspec colwidth="6*" align="right"/>
43281 <tbody>
43282 <row>
43283 <entry><option>log_defer_output</option></entry>
43284 <entry>Use: <emphasis>pipe</emphasis></entry>
43285 <entry>Type: <emphasis>boolean</emphasis></entry>
43286 <entry>Default: <emphasis>false</emphasis></entry>
43287 </row>
43288 </tbody>
43289 </tgroup>
43290 </informaltable>
43291 <para>
43292 <indexterm role="concept">
43293 <primary><command>pipe</command> transport</primary>
43294 <secondary>logging output</secondary>
43295 </indexterm>
43296 If this option is set, and the status returned by the command is
43297 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
43298 and any output was produced, the first line of it is written to the main log.
43299 </para>
43300 <para>
43301 <indexterm role="option">
43302 <primary><option>log_fail_output</option></primary>
43303 </indexterm>
43304 </para>
43305 <informaltable frame="all">
43306 <tgroup cols="4" colsep="0" rowsep="0">
43307 <colspec colwidth="8*" align="left"/>
43308 <colspec colwidth="6*" align="center"/>
43309 <colspec colwidth="6*" align="center"/>
43310 <colspec colwidth="6*" align="right"/>
43311 <tbody>
43312 <row>
43313 <entry><option>log_fail_output</option></entry>
43314 <entry>Use: <emphasis>pipe</emphasis></entry>
43315 <entry>Type: <emphasis>boolean</emphasis></entry>
43316 <entry>Default: <emphasis>false</emphasis></entry>
43317 </row>
43318 </tbody>
43319 </tgroup>
43320 </informaltable>
43321 <para>
43322 If this option is set, and the command returns any output, and also ends with a
43323 return code that is neither zero nor one of the return codes listed in
43324 <option>temp_errors</option> (that is, the delivery failed), the first line of output is
43325 written to the main log. This option and <option>log_output</option> are mutually exclusive.
43326 Only one of them may be set.
43327 </para>
43328 <para>
43329 <indexterm role="option">
43330 <primary><option>log_output</option></primary>
43331 </indexterm>
43332 </para>
43333 <informaltable frame="all">
43334 <tgroup cols="4" colsep="0" rowsep="0">
43335 <colspec colwidth="8*" align="left"/>
43336 <colspec colwidth="6*" align="center"/>
43337 <colspec colwidth="6*" align="center"/>
43338 <colspec colwidth="6*" align="right"/>
43339 <tbody>
43340 <row>
43341 <entry><option>log_output</option></entry>
43342 <entry>Use: <emphasis>pipe</emphasis></entry>
43343 <entry>Type: <emphasis>boolean</emphasis></entry>
43344 <entry>Default: <emphasis>false</emphasis></entry>
43345 </row>
43346 </tbody>
43347 </tgroup>
43348 </informaltable>
43349 <para>
43350 If this option is set and the command returns any output, the first line of
43351 output is written to the main log, whatever the return code. This option and
43352 <option>log_fail_output</option> are mutually exclusive. Only one of them may be set.
43353 </para>
43354 <para>
43355 <indexterm role="option">
43356 <primary><option>max_output</option></primary>
43357 </indexterm>
43358 </para>
43359 <informaltable frame="all">
43360 <tgroup cols="4" colsep="0" rowsep="0">
43361 <colspec colwidth="8*" align="left"/>
43362 <colspec colwidth="6*" align="center"/>
43363 <colspec colwidth="6*" align="center"/>
43364 <colspec colwidth="6*" align="right"/>
43365 <tbody>
43366 <row>
43367 <entry><option>max_output</option></entry>
43368 <entry>Use: <emphasis>pipe</emphasis></entry>
43369 <entry>Type: <emphasis>integer</emphasis></entry>
43370 <entry>Default: <emphasis>20K</emphasis></entry>
43371 </row>
43372 </tbody>
43373 </tgroup>
43374 </informaltable>
43375 <para>
43376 This specifies the maximum amount of output that the command may produce on its
43377 standard output and standard error file combined. If the limit is exceeded, the
43378 process running the command is killed. This is intended as a safety measure to
43379 catch runaway processes. The limit is applied independently of the settings of
43380 the options that control what is done with such output (for example,
43381 <option>return_output</option>). Because of buffering effects, the amount of output may
43382 exceed the limit by a small amount before Exim notices.
43383 </para>
43384 <para>
43385 <indexterm role="option">
43386 <primary><option>message_prefix</option></primary>
43387 </indexterm>
43388 </para>
43389 <informaltable frame="all">
43390 <tgroup cols="4" colsep="0" rowsep="0">
43391 <colspec colwidth="8*" align="left"/>
43392 <colspec colwidth="6*" align="center"/>
43393 <colspec colwidth="6*" align="center"/>
43394 <colspec colwidth="6*" align="right"/>
43395 <tbody>
43396 <row>
43397 <entry><option>message_prefix</option></entry>
43398 <entry>Use: <emphasis>pipe</emphasis></entry>
43399 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43400 <entry>Default: <emphasis>see below</emphasis></entry>
43401 </row>
43402 </tbody>
43403 </tgroup>
43404 </informaltable>
43405 <para>
43406 The string specified here is expanded and output at the start of every message.
43407 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
43408 </para>
43409 <literallayout class="monospaced">
43410 message_prefix = \
43411   From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
43412   ${tod_bsdinbox}\n
43413 </literallayout>
43414 <para>
43415 <indexterm role="concept">
43416 <primary>Cyrus</primary>
43417 </indexterm>
43418 <indexterm role="concept">
43419 <primary><option>tmail</option></primary>
43420 </indexterm>
43421 <indexterm role="concept">
43422 <primary><quote>From</quote> line</primary>
43423 </indexterm>
43424 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
43425 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
43426 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
43427 setting
43428 </para>
43429 <literallayout class="monospaced">
43430 message_prefix =
43431 </literallayout>
43432 <para>
43433 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
43434 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
43435 </para>
43436 <para>
43437 <indexterm role="option">
43438 <primary><option>message_suffix</option></primary>
43439 </indexterm>
43440 </para>
43441 <informaltable frame="all">
43442 <tgroup cols="4" colsep="0" rowsep="0">
43443 <colspec colwidth="8*" align="left"/>
43444 <colspec colwidth="6*" align="center"/>
43445 <colspec colwidth="6*" align="center"/>
43446 <colspec colwidth="6*" align="right"/>
43447 <tbody>
43448 <row>
43449 <entry><option>message_suffix</option></entry>
43450 <entry>Use: <emphasis>pipe</emphasis></entry>
43451 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43452 <entry>Default: <emphasis>see below</emphasis></entry>
43453 </row>
43454 </tbody>
43455 </tgroup>
43456 </informaltable>
43457 <para>
43458 The string specified here is expanded and output at the end of every message.
43459 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
43460 The suffix can be suppressed by setting
43461 </para>
43462 <literallayout class="monospaced">
43463 message_suffix =
43464 </literallayout>
43465 <para>
43466 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
43467 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
43468 </para>
43469 <para>
43470 <indexterm role="option">
43471 <primary><option>path</option></primary>
43472 </indexterm>
43473 </para>
43474 <informaltable frame="all">
43475 <tgroup cols="4" colsep="0" rowsep="0">
43476 <colspec colwidth="8*" align="left"/>
43477 <colspec colwidth="6*" align="center"/>
43478 <colspec colwidth="6*" align="center"/>
43479 <colspec colwidth="6*" align="right"/>
43480 <tbody>
43481 <row>
43482 <entry><option>path</option></entry>
43483 <entry>Use: <emphasis>pipe</emphasis></entry>
43484 <entry>Type: <emphasis>string</emphasis></entry>
43485 <entry>Default: <emphasis>see below</emphasis></entry>
43486 </row>
43487 </tbody>
43488 </tgroup>
43489 </informaltable>
43490 <para>
43491 This option specifies the string that is set up in the PATH environment
43492 variable of the subprocess. The default is:
43493 </para>
43494 <literallayout class="monospaced">
43495 /bin:/usr/bin
43496 </literallayout>
43497 <para>
43498 If the <option>command</option> option does not yield an absolute path name, the command is
43499 sought in the PATH directories, in the usual way. <emphasis role="bold">Warning</emphasis>: This does not
43500 apply to a command specified as a transport filter.
43501 </para>
43502 <para>
43503 <indexterm role="option">
43504 <primary><option>permit_coredump</option></primary>
43505 </indexterm>
43506 </para>
43507 <informaltable frame="all">
43508 <tgroup cols="4" colsep="0" rowsep="0">
43509 <colspec colwidth="8*" align="left"/>
43510 <colspec colwidth="6*" align="center"/>
43511 <colspec colwidth="6*" align="center"/>
43512 <colspec colwidth="6*" align="right"/>
43513 <tbody>
43514 <row>
43515 <entry><option>permit_coredump</option></entry>
43516 <entry>Use: <emphasis>pipe</emphasis></entry>
43517 <entry>Type: <emphasis>boolean</emphasis></entry>
43518 <entry>Default: <emphasis>false</emphasis></entry>
43519 </row>
43520 </tbody>
43521 </tgroup>
43522 </informaltable>
43523 <para>
43524 Normally Exim inhibits core-dumps during delivery.  If you have a need to get
43525 a core-dump of a pipe command, enable this command.  This enables core-dumps
43526 during delivery and affects both the Exim binary and the pipe command run.
43527 It is recommended that this option remain off unless and until you have a need
43528 for it and that this only be enabled when needed, as the risk of excessive
43529 resource consumption can be quite high.  Note also that Exim is typically
43530 installed as a setuid binary and most operating systems will inhibit coredumps
43531 of these by default, so further OS-specific action may be required.
43532 </para>
43533 <para>
43534 <indexterm role="option">
43535 <primary><option>pipe_as_creator</option></primary>
43536 </indexterm>
43537 </para>
43538 <informaltable frame="all">
43539 <tgroup cols="4" colsep="0" rowsep="0">
43540 <colspec colwidth="8*" align="left"/>
43541 <colspec colwidth="6*" align="center"/>
43542 <colspec colwidth="6*" align="center"/>
43543 <colspec colwidth="6*" align="right"/>
43544 <tbody>
43545 <row>
43546 <entry><option>pipe_as_creator</option></entry>
43547 <entry>Use: <emphasis>pipe</emphasis></entry>
43548 <entry>Type: <emphasis>boolean</emphasis></entry>
43549 <entry>Default: <emphasis>false</emphasis></entry>
43550 </row>
43551 </tbody>
43552 </tgroup>
43553 </informaltable>
43554 <para>
43555 <indexterm role="concept">
43556 <primary>uid (user id)</primary>
43557 <secondary>local delivery</secondary>
43558 </indexterm>
43559 If the generic <option>user</option> option is not set and this option is true, the delivery
43560 process is run under the uid that was in force when Exim was originally called
43561 to accept the message. If the group id is not otherwise set (via the generic
43562 <option>group</option> option), the gid that was in force when Exim was originally called to
43563 accept the message is used.
43564 </para>
43565 <para>
43566 <indexterm role="option">
43567 <primary><option>restrict_to_path</option></primary>
43568 </indexterm>
43569 </para>
43570 <informaltable frame="all">
43571 <tgroup cols="4" colsep="0" rowsep="0">
43572 <colspec colwidth="8*" align="left"/>
43573 <colspec colwidth="6*" align="center"/>
43574 <colspec colwidth="6*" align="center"/>
43575 <colspec colwidth="6*" align="right"/>
43576 <tbody>
43577 <row>
43578 <entry><option>restrict_to_path</option></entry>
43579 <entry>Use: <emphasis>pipe</emphasis></entry>
43580 <entry>Type: <emphasis>boolean</emphasis></entry>
43581 <entry>Default: <emphasis>false</emphasis></entry>
43582 </row>
43583 </tbody>
43584 </tgroup>
43585 </informaltable>
43586 <para>
43587 When this option is set, any command name not listed in <option>allow_commands</option> must
43588 contain no slashes. The command is searched for only in the directories listed
43589 in the <option>path</option> option. This option is intended for use in the case when a pipe
43590 command has been generated from a user&#x2019;s <filename>.forward</filename> file. This is usually
43591 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
43592 </para>
43593 <para>
43594 <indexterm role="option">
43595 <primary><option>return_fail_output</option></primary>
43596 </indexterm>
43597 </para>
43598 <informaltable frame="all">
43599 <tgroup cols="4" colsep="0" rowsep="0">
43600 <colspec colwidth="8*" align="left"/>
43601 <colspec colwidth="6*" align="center"/>
43602 <colspec colwidth="6*" align="center"/>
43603 <colspec colwidth="6*" align="right"/>
43604 <tbody>
43605 <row>
43606 <entry><option>return_fail_output</option></entry>
43607 <entry>Use: <emphasis>pipe</emphasis></entry>
43608 <entry>Type: <emphasis>boolean</emphasis></entry>
43609 <entry>Default: <emphasis>false</emphasis></entry>
43610 </row>
43611 </tbody>
43612 </tgroup>
43613 </informaltable>
43614 <para>
43615 If this option is true, and the command produced any output and ended with a
43616 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
43617 is, the delivery failed), the output is returned in the bounce message.
43618 However, if the message has a null sender (that is, it is itself a bounce
43619 message), output from the command is discarded. This option and
43620 <option>return_output</option> are mutually exclusive. Only one of them may be set.
43621 </para>
43622 <para>
43623 <indexterm role="option">
43624 <primary><option>return_output</option></primary>
43625 </indexterm>
43626 </para>
43627 <informaltable frame="all">
43628 <tgroup cols="4" colsep="0" rowsep="0">
43629 <colspec colwidth="8*" align="left"/>
43630 <colspec colwidth="6*" align="center"/>
43631 <colspec colwidth="6*" align="center"/>
43632 <colspec colwidth="6*" align="right"/>
43633 <tbody>
43634 <row>
43635 <entry><option>return_output</option></entry>
43636 <entry>Use: <emphasis>pipe</emphasis></entry>
43637 <entry>Type: <emphasis>boolean</emphasis></entry>
43638 <entry>Default: <emphasis>false</emphasis></entry>
43639 </row>
43640 </tbody>
43641 </tgroup>
43642 </informaltable>
43643 <para>
43644 If this option is true, and the command produced any output, the delivery is
43645 deemed to have failed whatever the return code from the command, and the output
43646 is returned in the bounce message. Otherwise, the output is just discarded.
43647 However, if the message has a null sender (that is, it is a bounce message),
43648 output from the command is always discarded, whatever the setting of this
43649 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
43650 of them may be set.
43651 </para>
43652 <para>
43653 <indexterm role="option">
43654 <primary><option>temp_errors</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>temp_errors</option></entry>
43666 <entry>Use: <emphasis>pipe</emphasis></entry>
43667 <entry>Type: <emphasis>string list</emphasis></entry>
43668 <entry>Default: <emphasis>see below</emphasis></entry>
43669 </row>
43670 </tbody>
43671 </tgroup>
43672 </informaltable>
43673 <para>
43674 <indexterm role="concept">
43675 <primary><command>pipe</command> transport</primary>
43676 <secondary>temporary failure</secondary>
43677 </indexterm>
43678 This option contains either a colon-separated list of numbers, or a single
43679 asterisk. If <option>ignore_status</option> is false
43680 and <option>return_output</option> is not set,
43681 and the command exits with a non-zero return code, the failure is treated as
43682 temporary and the delivery is deferred if the return code matches one of the
43683 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
43684 codes are treated as permanent errors. The default setting contains the codes
43685 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
43686 compiled on a system that does not define these macros, it assumes values of 75
43687 and 73, respectively.
43688 </para>
43689 <para>
43690 <indexterm role="option">
43691 <primary><option>timeout</option></primary>
43692 </indexterm>
43693 </para>
43694 <informaltable frame="all">
43695 <tgroup cols="4" colsep="0" rowsep="0">
43696 <colspec colwidth="8*" align="left"/>
43697 <colspec colwidth="6*" align="center"/>
43698 <colspec colwidth="6*" align="center"/>
43699 <colspec colwidth="6*" align="right"/>
43700 <tbody>
43701 <row>
43702 <entry><option>timeout</option></entry>
43703 <entry>Use: <emphasis>pipe</emphasis></entry>
43704 <entry>Type: <emphasis>time</emphasis></entry>
43705 <entry>Default: <emphasis>1h</emphasis></entry>
43706 </row>
43707 </tbody>
43708 </tgroup>
43709 </informaltable>
43710 <para>
43711 If the command fails to complete within this time, it is killed. This normally
43712 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
43713 specifies no timeout. In order to ensure that any subprocesses created by the
43714 command are also killed, Exim makes the initial process a process group leader,
43715 and kills the whole process group on a timeout. However, this can be defeated
43716 if one of the processes starts a new process group.
43717 </para>
43718 <para>
43719 <indexterm role="option">
43720 <primary><option>timeout_defer</option></primary>
43721 </indexterm>
43722 </para>
43723 <informaltable frame="all">
43724 <tgroup cols="4" colsep="0" rowsep="0">
43725 <colspec colwidth="8*" align="left"/>
43726 <colspec colwidth="6*" align="center"/>
43727 <colspec colwidth="6*" align="center"/>
43728 <colspec colwidth="6*" align="right"/>
43729 <tbody>
43730 <row>
43731 <entry><option>timeout_defer</option></entry>
43732 <entry>Use: <emphasis>pipe</emphasis></entry>
43733 <entry>Type: <emphasis>boolean</emphasis></entry>
43734 <entry>Default: <emphasis>false</emphasis></entry>
43735 </row>
43736 </tbody>
43737 </tgroup>
43738 </informaltable>
43739 <para>
43740 A timeout in a <command>pipe</command> transport, either in the command that the transport
43741 runs, or in a transport filter that is associated with it, is by default
43742 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
43743 is set true, both kinds of timeout become temporary errors, causing the
43744 delivery to be deferred.
43745 </para>
43746 <para>
43747 <indexterm role="option">
43748 <primary><option>umask</option></primary>
43749 </indexterm>
43750 </para>
43751 <informaltable frame="all">
43752 <tgroup cols="4" colsep="0" rowsep="0">
43753 <colspec colwidth="8*" align="left"/>
43754 <colspec colwidth="6*" align="center"/>
43755 <colspec colwidth="6*" align="center"/>
43756 <colspec colwidth="6*" align="right"/>
43757 <tbody>
43758 <row>
43759 <entry><option>umask</option></entry>
43760 <entry>Use: <emphasis>pipe</emphasis></entry>
43761 <entry>Type: <emphasis>octal integer</emphasis></entry>
43762 <entry>Default: <emphasis>022</emphasis></entry>
43763 </row>
43764 </tbody>
43765 </tgroup>
43766 </informaltable>
43767 <para>
43768 This specifies the umask setting for the subprocess that runs the command.
43769 </para>
43770 <para>
43771 <indexterm role="option">
43772 <primary><option>use_bsmtp</option></primary>
43773 </indexterm>
43774 </para>
43775 <informaltable frame="all">
43776 <tgroup cols="4" colsep="0" rowsep="0">
43777 <colspec colwidth="8*" align="left"/>
43778 <colspec colwidth="6*" align="center"/>
43779 <colspec colwidth="6*" align="center"/>
43780 <colspec colwidth="6*" align="right"/>
43781 <tbody>
43782 <row>
43783 <entry><option>use_bsmtp</option></entry>
43784 <entry>Use: <emphasis>pipe</emphasis></entry>
43785 <entry>Type: <emphasis>boolean</emphasis></entry>
43786 <entry>Default: <emphasis>false</emphasis></entry>
43787 </row>
43788 </tbody>
43789 </tgroup>
43790 </informaltable>
43791 <para>
43792 <indexterm role="concept">
43793 <primary>envelope sender</primary>
43794 </indexterm>
43795 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
43796 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
43797 commands. If you want to include a leading HELO command with such messages,
43798 you can do so by setting the <option>message_prefix</option> option. See section
43799 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
43800 </para>
43801 <para>
43802 <indexterm role="option">
43803 <primary><option>use_classresources</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>use_classresources</option></entry>
43815 <entry>Use: <emphasis>pipe</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>class resources (BSD)</primary>
43825 </indexterm>
43826 This option is available only when Exim is running on FreeBSD, NetBSD, or
43827 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
43828 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
43829 limits for the uid under which the pipe is to run are obtained from the login
43830 class database.
43831 </para>
43832 <para>
43833 <indexterm role="option">
43834 <primary><option>use_crlf</option></primary>
43835 </indexterm>
43836 </para>
43837 <informaltable frame="all">
43838 <tgroup cols="4" colsep="0" rowsep="0">
43839 <colspec colwidth="8*" align="left"/>
43840 <colspec colwidth="6*" align="center"/>
43841 <colspec colwidth="6*" align="center"/>
43842 <colspec colwidth="6*" align="right"/>
43843 <tbody>
43844 <row>
43845 <entry><option>use_crlf</option></entry>
43846 <entry>Use: <emphasis>pipe</emphasis></entry>
43847 <entry>Type: <emphasis>boolean</emphasis></entry>
43848 <entry>Default: <emphasis>false</emphasis></entry>
43849 </row>
43850 </tbody>
43851 </tgroup>
43852 </informaltable>
43853 <para>
43854 <indexterm role="concept">
43855 <primary>carriage return</primary>
43856 </indexterm>
43857 <indexterm role="concept">
43858 <primary>linefeed</primary>
43859 </indexterm>
43860 This option causes lines to be terminated with the two-character CRLF sequence
43861 (carriage return, linefeed) instead of just a linefeed character. In the case
43862 of batched SMTP, the byte sequence written to the pipe is then an exact image
43863 of what would be sent down a real SMTP connection.
43864 </para>
43865 <para>
43866 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
43867 written verbatim, so must contain their own carriage return characters if these
43868 are needed. When <option>use_bsmtp</option> is not set, the default values for both
43869 <option>message_prefix</option> and <option>message_suffix</option> end with a single linefeed, so their
43870 values must be changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
43871 </para>
43872 <para>
43873 <indexterm role="option">
43874 <primary><option>use_shell</option></primary>
43875 </indexterm>
43876 </para>
43877 <informaltable frame="all">
43878 <tgroup cols="4" colsep="0" rowsep="0">
43879 <colspec colwidth="8*" align="left"/>
43880 <colspec colwidth="6*" align="center"/>
43881 <colspec colwidth="6*" align="center"/>
43882 <colspec colwidth="6*" align="right"/>
43883 <tbody>
43884 <row>
43885 <entry><option>use_shell</option></entry>
43886 <entry>Use: <emphasis>pipe</emphasis></entry>
43887 <entry>Type: <emphasis>boolean</emphasis></entry>
43888 <entry>Default: <emphasis>false</emphasis></entry>
43889 </row>
43890 </tbody>
43891 </tgroup>
43892 </informaltable>
43893 <para>
43894 <indexterm role="variable">
43895 <primary><varname>$pipe_addresses</varname></primary>
43896 </indexterm>
43897 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
43898 instead of being run directly from the transport, as described in section
43899 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
43900 where the command is expected to be run under a shell and cannot easily be
43901 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
43902 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
43903 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
43904 its <option>-c</option> option.
43905 </para>
43906 </section>
43907 <section id="SECID143">
43908 <title>Using an external local delivery agent</title>
43909 <para>
43910 <indexterm role="concept">
43911 <primary>local delivery</primary>
43912 <secondary>using an external agent</secondary>
43913 </indexterm>
43914 <indexterm role="concept">
43915 <primary><emphasis>procmail</emphasis></primary>
43916 </indexterm>
43917 <indexterm role="concept">
43918 <primary>external local delivery</primary>
43919 </indexterm>
43920 <indexterm role="concept">
43921 <primary>delivery</primary>
43922 <secondary><emphasis>procmail</emphasis></secondary>
43923 </indexterm>
43924 <indexterm role="concept">
43925 <primary>delivery</primary>
43926 <secondary>by external agent</secondary>
43927 </indexterm>
43928 The <command>pipe</command> transport can be used to pass all messages that require local
43929 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
43930 this, care must be taken to ensure that the pipe is run under an appropriate
43931 uid and gid. In some configurations one wants this to be a uid that is trusted
43932 by the delivery agent to supply the correct sender of the message. It may be
43933 necessary to recompile or reconfigure the delivery agent so that it trusts an
43934 appropriate user. The following is an example transport and router
43935 configuration for <option>procmail</option>:
43936 </para>
43937 <literallayout class="monospaced">
43938 # transport
43939 procmail_pipe:
43940   driver = pipe
43941   command = /usr/local/bin/procmail -d $local_part
43942   return_path_add
43943   delivery_date_add
43944   envelope_to_add
43945   check_string = "From "
43946   escape_string = "&gt;From "
43947   umask = 077
43948   user = $local_part
43949   group = mail
43950
43951 # router
43952 procmail:
43953   driver = accept
43954   check_local_user
43955   transport = procmail_pipe
43956 </literallayout>
43957 <para>
43958 In this example, the pipe is run as the local user, but with the group set to
43959 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
43960 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
43961 user to supply a correct sender address. If you do not specify either a
43962 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
43963 home directory is the user&#x2019;s home directory by default.
43964 </para>
43965 <para>
43966 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
43967 </para>
43968 <literallayout class="monospaced">
43969 IFS=" "
43970 </literallayout>
43971 <para>
43972 as shown in some <option>procmail</option> documentation, because Exim does not by default
43973 use a shell to run pipe commands.
43974 </para>
43975 <para>
43976 <indexterm role="concept">
43977 <primary>Cyrus</primary>
43978 </indexterm>
43979 The next example shows a transport and a router for a system where local
43980 deliveries are handled by the Cyrus IMAP server.
43981 </para>
43982 <literallayout class="monospaced">
43983 # transport
43984 local_delivery_cyrus:
43985   driver = pipe
43986   command = /usr/cyrus/bin/deliver \
43987             -m ${substr_1:$local_part_suffix} -- $local_part
43988   user = cyrus
43989   group = mail
43990   return_output
43991   log_output
43992   message_prefix =
43993   message_suffix =
43994
43995 # router
43996 local_user_cyrus:
43997   driver = accept
43998   check_local_user
43999   local_part_suffix = .*
44000   transport = local_delivery_cyrus
44001 </literallayout>
44002 <para>
44003 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
44004 <option>return_output</option> to cause any text written by Cyrus to be returned to the
44005 sender.
44006 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
44007 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
44008 </para>
44009 </section>
44010 </chapter>
44011
44012 <chapter id="CHAPsmtptrans">
44013 <title>The smtp transport</title>
44014 <para>
44015 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
44016 <primary>transports</primary>
44017 <secondary><command>smtp</command></secondary>
44018 </indexterm>
44019 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
44020 <primary><command>smtp</command> transport</primary>
44021 </indexterm>
44022 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
44023 or LMTP protocol. The list of hosts to try can either be taken from the address
44024 that is being processed (having been set up by the router), or specified
44025 explicitly for the transport. Timeout and retry processing (see chapter
44026 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
44027 </para>
44028 <section id="SECID144">
44029 <title>Multiple messages on a single connection</title>
44030 <para>
44031 The sending of multiple messages over a single TCP/IP connection can arise in
44032 two ways:
44033 </para>
44034 <itemizedlist>
44035 <listitem>
44036 <para>
44037 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
44038 routed to the same host, more than one copy of the message has to be sent to
44039 that host. In this situation, multiple copies may be sent in a single run of
44040 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
44041 does when it has too many addresses to send in one message also depends on the
44042 value of the global <option>remote_max_parallel</option> option. Details are given in
44043 section <xref linkend="SECToutSMTPTCP"/>.)
44044 </para>
44045 </listitem>
44046 <listitem>
44047 <para>
44048 <indexterm role="concept">
44049 <primary>hints database</primary>
44050 <secondary>remembering routing</secondary>
44051 </indexterm>
44052 When a message has been successfully delivered over a TCP/IP connection, Exim
44053 looks in its hints database to see if there are any other messages awaiting a
44054 connection to the same host. If there are, a new delivery process is started
44055 for one of them, and the current TCP/IP connection is passed on to it. The new
44056 process may in turn send multiple copies and possibly create yet another
44057 process.
44058 </para>
44059 </listitem>
44060 </itemizedlist>
44061 <para>
44062 For each copy sent over the same TCP/IP connection, a sequence counter is
44063 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
44064 no further messages are sent over that connection.
44065 </para>
44066 </section>
44067 <section id="SECID145">
44068 <title>Use of the $host and $host_address variables</title>
44069 <para>
44070 <indexterm role="variable">
44071 <primary><varname>$host</varname></primary>
44072 </indexterm>
44073 <indexterm role="variable">
44074 <primary><varname>$host_address</varname></primary>
44075 </indexterm>
44076 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
44077 <varname>$host_address</varname> are the name and IP address of the first host on the host list
44078 passed by the router. However, when the transport is about to connect to a
44079 specific host, and while it is connected to that host, <varname>$host</varname> and
44080 <varname>$host_address</varname> are set to the values for that host. These are the values
44081 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
44082 <option>serialize_hosts</option>, and the various TLS options are expanded.
44083 </para>
44084 </section>
44085 <section id="usecippeer">
44086 <title>Use of $tls_cipher and $tls_peerdn</title>
44087 <para>
44088 <indexterm role="variable">
44089 <primary><varname>$tls_bits</varname></primary>
44090 </indexterm>
44091 <indexterm role="variable">
44092 <primary><varname>$tls_cipher</varname></primary>
44093 </indexterm>
44094 <indexterm role="variable">
44095 <primary><varname>$tls_peerdn</varname></primary>
44096 </indexterm>
44097 <indexterm role="variable">
44098 <primary><varname>$tls_sni</varname></primary>
44099 </indexterm>
44100 At the start of a run of the <command>smtp</command> transport, the values of <varname>$tls_bits</varname>,
44101 <varname>$tls_cipher</varname>, <varname>$tls_peerdn</varname> and <varname>$tls_sni</varname>
44102 are the values that were set when the message was received.
44103 These are the values that are used for options that are expanded before any
44104 SMTP connections are made. Just before each connection is made, these four
44105 variables are emptied. If TLS is subsequently started, they are set to the
44106 appropriate values for the outgoing connection, and these are the values that
44107 are in force when any authenticators are run and when the
44108 <option>authenticated_sender</option> option is expanded.
44109 </para>
44110 <para>
44111 These variables are deprecated in favour of <varname>$tls_in_cipher</varname> et. al.
44112 and will be removed in a future release.
44113 </para>
44114 </section>
44115 <section id="SECID146">
44116 <title>Private options for smtp</title>
44117 <para>
44118 <indexterm role="concept">
44119 <primary>options</primary>
44120 <secondary><command>smtp</command> transport</secondary>
44121 </indexterm>
44122 The private options of the <command>smtp</command> transport are as follows:
44123 </para>
44124 <para>
44125 <indexterm role="option">
44126 <primary><option>address_retry_include_sender</option></primary>
44127 </indexterm>
44128 </para>
44129 <informaltable frame="all">
44130 <tgroup cols="4" colsep="0" rowsep="0">
44131 <colspec colwidth="8*" align="left"/>
44132 <colspec colwidth="6*" align="center"/>
44133 <colspec colwidth="6*" align="center"/>
44134 <colspec colwidth="6*" align="right"/>
44135 <tbody>
44136 <row>
44137 <entry><option>address_retry_include_sender</option></entry>
44138 <entry>Use: <emphasis>smtp</emphasis></entry>
44139 <entry>Type: <emphasis>boolean</emphasis></entry>
44140 <entry>Default: <emphasis>true</emphasis></entry>
44141 </row>
44142 </tbody>
44143 </tgroup>
44144 </informaltable>
44145 <para>
44146 <indexterm role="concept">
44147 <primary>4<emphasis>xx</emphasis> responses</primary>
44148 <secondary>retrying after</secondary>
44149 </indexterm>
44150 When an address is delayed because of a 4<emphasis>xx</emphasis> response to a RCPT command, it
44151 is the combination of sender and recipient that is delayed in subsequent queue
44152 runs until the retry time is reached. You can delay the recipient without
44153 reference to the sender (which is what earlier versions of Exim did), by
44154 setting <option>address_retry_include_sender</option> false. However, this can lead to
44155 problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT commands.
44156 </para>
44157 <para>
44158 <indexterm role="option">
44159 <primary><option>allow_localhost</option></primary>
44160 </indexterm>
44161 </para>
44162 <informaltable frame="all">
44163 <tgroup cols="4" colsep="0" rowsep="0">
44164 <colspec colwidth="8*" align="left"/>
44165 <colspec colwidth="6*" align="center"/>
44166 <colspec colwidth="6*" align="center"/>
44167 <colspec colwidth="6*" align="right"/>
44168 <tbody>
44169 <row>
44170 <entry><option>allow_localhost</option></entry>
44171 <entry>Use: <emphasis>smtp</emphasis></entry>
44172 <entry>Type: <emphasis>boolean</emphasis></entry>
44173 <entry>Default: <emphasis>false</emphasis></entry>
44174 </row>
44175 </tbody>
44176 </tgroup>
44177 </informaltable>
44178 <para>
44179 <indexterm role="concept">
44180 <primary>local host</primary>
44181 <secondary>sending to</secondary>
44182 </indexterm>
44183 <indexterm role="concept">
44184 <primary>fallback</primary>
44185 <secondary>hosts specified on transport</secondary>
44186 </indexterm>
44187 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
44188 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
44189 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
44190 the delivery anyway. This should be used only in special cases when the
44191 configuration ensures that no looping will result (for example, a differently
44192 configured Exim is listening on the port to which the message is sent).
44193 </para>
44194 <para>
44195 <indexterm role="option">
44196 <primary><option>authenticated_sender</option></primary>
44197 </indexterm>
44198 </para>
44199 <informaltable frame="all">
44200 <tgroup cols="4" colsep="0" rowsep="0">
44201 <colspec colwidth="8*" align="left"/>
44202 <colspec colwidth="6*" align="center"/>
44203 <colspec colwidth="6*" align="center"/>
44204 <colspec colwidth="6*" align="right"/>
44205 <tbody>
44206 <row>
44207 <entry><option>authenticated_sender</option></entry>
44208 <entry>Use: <emphasis>smtp</emphasis></entry>
44209 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44210 <entry>Default: <emphasis>unset</emphasis></entry>
44211 </row>
44212 </tbody>
44213 </tgroup>
44214 </informaltable>
44215 <para>
44216 <indexterm role="concept">
44217 <primary>Cyrus</primary>
44218 </indexterm>
44219 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
44220 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
44221 overriding any existing authenticated sender value. If the string expansion is
44222 forced to fail, the option is ignored. Other expansion failures cause delivery
44223 to be deferred. If the result of expansion is an empty string, that is also
44224 ignored.
44225 </para>
44226 <para>
44227 The expansion happens after the outgoing connection has been made and TLS
44228 started, if required. This means that the <varname>$host</varname>, <varname>$host_address</varname>,
44229 <varname>$tls_out_cipher</varname>, and <varname>$tls_out_peerdn</varname> variables are set according to the
44230 particular connection.
44231 </para>
44232 <para>
44233 If the SMTP session is not authenticated, the expansion of
44234 <option>authenticated_sender</option> still happens (and can cause the delivery to be
44235 deferred if it fails), but no AUTH= item is added to MAIL commands
44236 unless <option>authenticated_sender_force</option> is true.
44237 </para>
44238 <para>
44239 This option allows you to use the <command>smtp</command> transport in LMTP mode to
44240 deliver mail to Cyrus IMAP and provide the proper local part as the
44241 <quote>authenticated sender</quote>, via a setting such as:
44242 </para>
44243 <literallayout class="monospaced">
44244 authenticated_sender = $local_part
44245 </literallayout>
44246 <para>
44247 This removes the need for IMAP subfolders to be assigned special ACLs to
44248 allow direct delivery to those subfolders.
44249 </para>
44250 <para>
44251 Because of expected uses such as that just described for Cyrus (when no
44252 domain is involved), there is no checking on the syntax of the provided
44253 value.
44254 </para>
44255 <para>
44256 <indexterm role="option">
44257 <primary><option>authenticated_sender_force</option></primary>
44258 </indexterm>
44259 </para>
44260 <informaltable frame="all">
44261 <tgroup cols="4" colsep="0" rowsep="0">
44262 <colspec colwidth="8*" align="left"/>
44263 <colspec colwidth="6*" align="center"/>
44264 <colspec colwidth="6*" align="center"/>
44265 <colspec colwidth="6*" align="right"/>
44266 <tbody>
44267 <row>
44268 <entry><option>authenticated_sender_force</option></entry>
44269 <entry>Use: <emphasis>smtp</emphasis></entry>
44270 <entry>Type: <emphasis>boolean</emphasis></entry>
44271 <entry>Default: <emphasis>false</emphasis></entry>
44272 </row>
44273 </tbody>
44274 </tgroup>
44275 </informaltable>
44276 <para>
44277 If this option is set true, the <option>authenticated_sender</option> option&#x2019;s value
44278 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
44279 authenticated as a client.
44280 </para>
44281 <para>
44282 <indexterm role="option">
44283 <primary><option>command_timeout</option></primary>
44284 </indexterm>
44285 </para>
44286 <informaltable frame="all">
44287 <tgroup cols="4" colsep="0" rowsep="0">
44288 <colspec colwidth="8*" align="left"/>
44289 <colspec colwidth="6*" align="center"/>
44290 <colspec colwidth="6*" align="center"/>
44291 <colspec colwidth="6*" align="right"/>
44292 <tbody>
44293 <row>
44294 <entry><option>command_timeout</option></entry>
44295 <entry>Use: <emphasis>smtp</emphasis></entry>
44296 <entry>Type: <emphasis>time</emphasis></entry>
44297 <entry>Default: <emphasis>5m</emphasis></entry>
44298 </row>
44299 </tbody>
44300 </tgroup>
44301 </informaltable>
44302 <para>
44303 This sets a timeout for receiving a response to an SMTP command that has been
44304 sent out. It is also used when waiting for the initial banner line from the
44305 remote host. Its value must not be zero.
44306 </para>
44307 <para>
44308 <indexterm role="option">
44309 <primary><option>connect_timeout</option></primary>
44310 </indexterm>
44311 </para>
44312 <informaltable frame="all">
44313 <tgroup cols="4" colsep="0" rowsep="0">
44314 <colspec colwidth="8*" align="left"/>
44315 <colspec colwidth="6*" align="center"/>
44316 <colspec colwidth="6*" align="center"/>
44317 <colspec colwidth="6*" align="right"/>
44318 <tbody>
44319 <row>
44320 <entry><option>connect_timeout</option></entry>
44321 <entry>Use: <emphasis>smtp</emphasis></entry>
44322 <entry>Type: <emphasis>time</emphasis></entry>
44323 <entry>Default: <emphasis>5m</emphasis></entry>
44324 </row>
44325 </tbody>
44326 </tgroup>
44327 </informaltable>
44328 <para>
44329 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
44330 to a remote host. A setting of zero allows the system timeout (typically
44331 several minutes) to act. To have any effect, the value of this option must be
44332 less than the system timeout. However, it has been observed that on some
44333 systems there is no system timeout, which is why the default value for this
44334 option is 5 minutes, a value recommended by RFC 1123.
44335 </para>
44336 <para>
44337 <indexterm role="option">
44338 <primary><option>connection_max_messages</option></primary>
44339 </indexterm>
44340 </para>
44341 <informaltable frame="all">
44342 <tgroup cols="4" colsep="0" rowsep="0">
44343 <colspec colwidth="8*" align="left"/>
44344 <colspec colwidth="6*" align="center"/>
44345 <colspec colwidth="6*" align="center"/>
44346 <colspec colwidth="6*" align="right"/>
44347 <tbody>
44348 <row>
44349 <entry><option>connection_max_messages</option></entry>
44350 <entry>Use: <emphasis>smtp</emphasis></entry>
44351 <entry>Type: <emphasis>integer</emphasis></entry>
44352 <entry>Default: <emphasis>500</emphasis></entry>
44353 </row>
44354 </tbody>
44355 </tgroup>
44356 </informaltable>
44357 <para>
44358 <indexterm role="concept">
44359 <primary>SMTP</primary>
44360 <secondary>passed connection</secondary>
44361 </indexterm>
44362 <indexterm role="concept">
44363 <primary>SMTP</primary>
44364 <secondary>multiple deliveries</secondary>
44365 </indexterm>
44366 <indexterm role="concept">
44367 <primary>multiple SMTP deliveries</primary>
44368 </indexterm>
44369 This controls the maximum number of separate message deliveries that are sent
44370 over a single TCP/IP connection. If the value is zero, there is no limit.
44371 For testing purposes, this value can be overridden by the <option>-oB</option> command line
44372 option.
44373 </para>
44374 <para>
44375 <indexterm role="option">
44376 <primary><option>data_timeout</option></primary>
44377 </indexterm>
44378 </para>
44379 <informaltable frame="all">
44380 <tgroup cols="4" colsep="0" rowsep="0">
44381 <colspec colwidth="8*" align="left"/>
44382 <colspec colwidth="6*" align="center"/>
44383 <colspec colwidth="6*" align="center"/>
44384 <colspec colwidth="6*" align="right"/>
44385 <tbody>
44386 <row>
44387 <entry><option>data_timeout</option></entry>
44388 <entry>Use: <emphasis>smtp</emphasis></entry>
44389 <entry>Type: <emphasis>time</emphasis></entry>
44390 <entry>Default: <emphasis>5m</emphasis></entry>
44391 </row>
44392 </tbody>
44393 </tgroup>
44394 </informaltable>
44395 <para>
44396 This sets a timeout for the transmission of each block in the data portion of
44397 the message. As a result, the overall timeout for a message depends on the size
44398 of the message. Its value must not be zero. See also <option>final_timeout</option>.
44399 </para>
44400 <para>
44401 <indexterm role="option">
44402 <primary><option>delay_after_cutoff</option></primary>
44403 </indexterm>
44404 </para>
44405 <informaltable frame="all">
44406 <tgroup cols="4" colsep="0" rowsep="0">
44407 <colspec colwidth="8*" align="left"/>
44408 <colspec colwidth="6*" align="center"/>
44409 <colspec colwidth="6*" align="center"/>
44410 <colspec colwidth="6*" align="right"/>
44411 <tbody>
44412 <row>
44413 <entry><option>delay_after_cutoff</option></entry>
44414 <entry>Use: <emphasis>smtp</emphasis></entry>
44415 <entry>Type: <emphasis>boolean</emphasis></entry>
44416 <entry>Default: <emphasis>true</emphasis></entry>
44417 </row>
44418 </tbody>
44419 </tgroup>
44420 </informaltable>
44421 <para>
44422 This option controls what happens when all remote IP addresses for a given
44423 domain have been inaccessible for so long that they have passed their retry
44424 cutoff times.
44425 </para>
44426 <para>
44427 In the default state, if the next retry time has not been reached for any of
44428 them, the address is bounced without trying any deliveries. In other words,
44429 Exim delays retrying an IP address after the final cutoff time until a new
44430 retry time is reached, and can therefore bounce an address without ever trying
44431 a delivery, when machines have been down for a long time. Some people are
44432 unhappy at this prospect, so...
44433 </para>
44434 <para>
44435 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
44436 addresses are past their final cutoff time, Exim tries to deliver to those
44437 IP addresses that have not been tried since the message arrived. If there are
44438 none, of if they all fail, the address is bounced. In other words, it does not
44439 delay when a new message arrives, but immediately tries those expired IP
44440 addresses that haven&#x2019;t been tried since the message arrived. If there is a
44441 continuous stream of messages for the dead hosts, unsetting
44442 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
44443 to them.
44444 </para>
44445 <para>
44446 <indexterm role="option">
44447 <primary><option>dns_qualify_single</option></primary>
44448 </indexterm>
44449 </para>
44450 <informaltable frame="all">
44451 <tgroup cols="4" colsep="0" rowsep="0">
44452 <colspec colwidth="8*" align="left"/>
44453 <colspec colwidth="6*" align="center"/>
44454 <colspec colwidth="6*" align="center"/>
44455 <colspec colwidth="6*" align="right"/>
44456 <tbody>
44457 <row>
44458 <entry><option>dns_qualify_single</option></entry>
44459 <entry>Use: <emphasis>smtp</emphasis></entry>
44460 <entry>Type: <emphasis>boolean</emphasis></entry>
44461 <entry>Default: <emphasis>true</emphasis></entry>
44462 </row>
44463 </tbody>
44464 </tgroup>
44465 </informaltable>
44466 <para>
44467 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
44468 and the <option>gethostbyname</option> option is false,
44469 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
44470 in chapter <xref linkend="CHAPdnslookup"/> for more details.
44471 </para>
44472 <para>
44473 <indexterm role="option">
44474 <primary><option>dns_search_parents</option></primary>
44475 </indexterm>
44476 </para>
44477 <informaltable frame="all">
44478 <tgroup cols="4" colsep="0" rowsep="0">
44479 <colspec colwidth="8*" align="left"/>
44480 <colspec colwidth="6*" align="center"/>
44481 <colspec colwidth="6*" align="center"/>
44482 <colspec colwidth="6*" align="right"/>
44483 <tbody>
44484 <row>
44485 <entry><option>dns_search_parents</option></entry>
44486 <entry>Use: <emphasis>smtp</emphasis></entry>
44487 <entry>Type: <emphasis>boolean</emphasis></entry>
44488 <entry>Default: <emphasis>false</emphasis></entry>
44489 </row>
44490 </tbody>
44491 </tgroup>
44492 </informaltable>
44493 <para>
44494 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
44495 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
44496 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
44497 details.
44498 </para>
44499 <para>
44500 <indexterm role="option">
44501 <primary><option>dnssec_request_domains</option></primary>
44502 </indexterm>
44503 </para>
44504 <informaltable frame="all">
44505 <tgroup cols="4" colsep="0" rowsep="0">
44506 <colspec colwidth="8*" align="left"/>
44507 <colspec colwidth="6*" align="center"/>
44508 <colspec colwidth="6*" align="center"/>
44509 <colspec colwidth="6*" align="right"/>
44510 <tbody>
44511 <row>
44512 <entry><option>dnssec_request_domains</option></entry>
44513 <entry>Use: <emphasis>smtp</emphasis></entry>
44514 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
44515 <entry>Default: <emphasis>unset</emphasis></entry>
44516 </row>
44517 </tbody>
44518 </tgroup>
44519 </informaltable>
44520 <para>
44521 <indexterm role="concept">
44522 <primary>MX record</primary>
44523 <secondary>security</secondary>
44524 </indexterm>
44525 <indexterm role="concept">
44526 <primary>DNSSEC</primary>
44527 <secondary>MX lookup</secondary>
44528 </indexterm>
44529 <indexterm role="concept">
44530 <primary>security</primary>
44531 <secondary>MX lookup</secondary>
44532 </indexterm>
44533 <indexterm role="concept">
44534 <primary>DNS</primary>
44535 <secondary>DNSSEC</secondary>
44536 </indexterm>
44537 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
44538 the dnssec request bit set.
44539 This applies to all of the SRV, MX A6, AAAA, A lookup sequence.
44540 </para>
44541 <para>
44542 <indexterm role="option">
44543 <primary><option>dnssec_require_domains</option></primary>
44544 </indexterm>
44545 </para>
44546 <informaltable frame="all">
44547 <tgroup cols="4" colsep="0" rowsep="0">
44548 <colspec colwidth="8*" align="left"/>
44549 <colspec colwidth="6*" align="center"/>
44550 <colspec colwidth="6*" align="center"/>
44551 <colspec colwidth="6*" align="right"/>
44552 <tbody>
44553 <row>
44554 <entry><option>dnssec_require_domains</option></entry>
44555 <entry>Use: <emphasis>smtp</emphasis></entry>
44556 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
44557 <entry>Default: <emphasis>unset</emphasis></entry>
44558 </row>
44559 </tbody>
44560 </tgroup>
44561 </informaltable>
44562 <para>
44563 <indexterm role="concept">
44564 <primary>MX record</primary>
44565 <secondary>security</secondary>
44566 </indexterm>
44567 <indexterm role="concept">
44568 <primary>DNSSEC</primary>
44569 <secondary>MX lookup</secondary>
44570 </indexterm>
44571 <indexterm role="concept">
44572 <primary>security</primary>
44573 <secondary>MX lookup</secondary>
44574 </indexterm>
44575 <indexterm role="concept">
44576 <primary>DNS</primary>
44577 <secondary>DNSSEC</secondary>
44578 </indexterm>
44579 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
44580 the dnssec request bit set.  Any returns not having the Authenticated Data bit
44581 (AD bit) set wil be ignored and logged as a host-lookup failure.
44582 This applies to all of the SRV, MX A6, AAAA, A lookup sequence.
44583 </para>
44584 <para>
44585 <indexterm role="option">
44586 <primary><option>dscp</option></primary>
44587 </indexterm>
44588 </para>
44589 <informaltable frame="all">
44590 <tgroup cols="4" colsep="0" rowsep="0">
44591 <colspec colwidth="8*" align="left"/>
44592 <colspec colwidth="6*" align="center"/>
44593 <colspec colwidth="6*" align="center"/>
44594 <colspec colwidth="6*" align="right"/>
44595 <tbody>
44596 <row>
44597 <entry><option>dscp</option></entry>
44598 <entry>Use: <emphasis>smtp</emphasis></entry>
44599 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44600 <entry>Default: <emphasis>unset</emphasis></entry>
44601 </row>
44602 </tbody>
44603 </tgroup>
44604 </informaltable>
44605 <para>
44606 <indexterm role="concept">
44607 <primary>DCSP</primary>
44608 <secondary>outbound</secondary>
44609 </indexterm>
44610 This option causes the DSCP value associated with a socket to be set to one
44611 of a number of fixed strings or to numeric value.
44612 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
44613 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
44614 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
44615 </para>
44616 <para>
44617 The outbound packets from Exim will be marked with this value in the header
44618 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
44619 that these values will have any effect, not be stripped by networking
44620 equipment, or do much of anything without cooperation with your Network
44621 Engineer and those of all network operators between the source and destination.
44622 </para>
44623 <para>
44624 <indexterm role="option">
44625 <primary><option>fallback_hosts</option></primary>
44626 </indexterm>
44627 </para>
44628 <informaltable frame="all">
44629 <tgroup cols="4" colsep="0" rowsep="0">
44630 <colspec colwidth="8*" align="left"/>
44631 <colspec colwidth="6*" align="center"/>
44632 <colspec colwidth="6*" align="center"/>
44633 <colspec colwidth="6*" align="right"/>
44634 <tbody>
44635 <row>
44636 <entry><option>fallback_hosts</option></entry>
44637 <entry>Use: <emphasis>smtp</emphasis></entry>
44638 <entry>Type: <emphasis>string list</emphasis></entry>
44639 <entry>Default: <emphasis>unset</emphasis></entry>
44640 </row>
44641 </tbody>
44642 </tgroup>
44643 </informaltable>
44644 <para>
44645 <indexterm role="concept">
44646 <primary>fallback</primary>
44647 <secondary>hosts specified on transport</secondary>
44648 </indexterm>
44649 String expansion is not applied to this option. The argument must be a
44650 colon-separated list of host names or IP addresses, optionally also including
44651 port numbers, though the separator can be changed, as described in section
44652 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
44653 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
44654 in section <xref linkend="SECTformatonehostitem"/>.
44655 </para>
44656 <para>
44657 Fallback hosts can also be specified on routers, which associate them with the
44658 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
44659 <option>fallback_hosts</option> specified on the transport is used only if the address does
44660 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
44661 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
44662 However, <option>hosts_randomize</option> does apply to fallback host lists.
44663 </para>
44664 <para>
44665 If Exim is unable to deliver to any of the hosts for a particular address, and
44666 the errors are not permanent rejections, the address is put on a separate
44667 transport queue with its host list replaced by the fallback hosts, unless the
44668 address was routed via MX records and the current host was in the original MX
44669 list. In that situation, the fallback host list is not used.
44670 </para>
44671 <para>
44672 Once normal deliveries are complete, the fallback queue is delivered by
44673 re-running the same transports with the new host lists. If several failing
44674 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
44675 copy of the message is sent.
44676 </para>
44677 <para>
44678 The resolution of the host names on the fallback list is controlled by the
44679 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
44680 both to cases when the host list comes with the address and when it is taken
44681 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
44682 fails</quote> facility.
44683 </para>
44684 <para>
44685 <indexterm role="option">
44686 <primary><option>final_timeout</option></primary>
44687 </indexterm>
44688 </para>
44689 <informaltable frame="all">
44690 <tgroup cols="4" colsep="0" rowsep="0">
44691 <colspec colwidth="8*" align="left"/>
44692 <colspec colwidth="6*" align="center"/>
44693 <colspec colwidth="6*" align="center"/>
44694 <colspec colwidth="6*" align="right"/>
44695 <tbody>
44696 <row>
44697 <entry><option>final_timeout</option></entry>
44698 <entry>Use: <emphasis>smtp</emphasis></entry>
44699 <entry>Type: <emphasis>time</emphasis></entry>
44700 <entry>Default: <emphasis>10m</emphasis></entry>
44701 </row>
44702 </tbody>
44703 </tgroup>
44704 </informaltable>
44705 <para>
44706 This is the timeout that applies while waiting for the response to the final
44707 line containing just <quote>.</quote> that terminates a message. Its value must not be
44708 zero.
44709 </para>
44710 <para>
44711 <indexterm role="option">
44712 <primary><option>gethostbyname</option></primary>
44713 </indexterm>
44714 </para>
44715 <informaltable frame="all">
44716 <tgroup cols="4" colsep="0" rowsep="0">
44717 <colspec colwidth="8*" align="left"/>
44718 <colspec colwidth="6*" align="center"/>
44719 <colspec colwidth="6*" align="center"/>
44720 <colspec colwidth="6*" align="right"/>
44721 <tbody>
44722 <row>
44723 <entry><option>gethostbyname</option></entry>
44724 <entry>Use: <emphasis>smtp</emphasis></entry>
44725 <entry>Type: <emphasis>boolean</emphasis></entry>
44726 <entry>Default: <emphasis>false</emphasis></entry>
44727 </row>
44728 </tbody>
44729 </tgroup>
44730 </informaltable>
44731 <para>
44732 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
44733 being used, names are looked up using <function>gethostbyname()</function>
44734 (or <function>getipnodebyname()</function> when available)
44735 instead of using the DNS. Of course, that function may in fact use the DNS, but
44736 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
44737 </para>
44738 <para>
44739 <indexterm role="option">
44740 <primary><option>gnutls_compat_mode</option></primary>
44741 </indexterm>
44742 </para>
44743 <informaltable frame="all">
44744 <tgroup cols="4" colsep="0" rowsep="0">
44745 <colspec colwidth="8*" align="left"/>
44746 <colspec colwidth="6*" align="center"/>
44747 <colspec colwidth="6*" align="center"/>
44748 <colspec colwidth="6*" align="right"/>
44749 <tbody>
44750 <row>
44751 <entry><option>gnutls_compat_mode</option></entry>
44752 <entry>Use: <emphasis>smtp</emphasis></entry>
44753 <entry>Type: <emphasis>boolean</emphasis></entry>
44754 <entry>Default: <emphasis>unset</emphasis></entry>
44755 </row>
44756 </tbody>
44757 </tgroup>
44758 </informaltable>
44759 <para>
44760 This option controls whether GnuTLS is used in compatibility mode in an Exim
44761 server. This reduces security slightly, but improves interworking with older
44762 implementations of TLS.
44763 </para>
44764 <para>
44765 <indexterm role="option">
44766 <primary><option>helo_data</option></primary>
44767 </indexterm>
44768 </para>
44769 <informaltable frame="all">
44770 <tgroup cols="4" colsep="0" rowsep="0">
44771 <colspec colwidth="8*" align="left"/>
44772 <colspec colwidth="6*" align="center"/>
44773 <colspec colwidth="6*" align="center"/>
44774 <colspec colwidth="6*" align="right"/>
44775 <tbody>
44776 <row>
44777 <entry><option>helo_data</option></entry>
44778 <entry>Use: <emphasis>smtp</emphasis></entry>
44779 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44780 <entry>Default: <emphasis>see below</emphasis></entry>
44781 </row>
44782 </tbody>
44783 </tgroup>
44784 </informaltable>
44785 <para>
44786 <indexterm role="concept">
44787 <primary>HELO</primary>
44788 <secondary>argument, setting</secondary>
44789 </indexterm>
44790 <indexterm role="concept">
44791 <primary>EHLO</primary>
44792 <secondary>argument, setting</secondary>
44793 </indexterm>
44794 <indexterm role="concept">
44795 <primary>LHLO argument setting</primary>
44796 </indexterm>
44797 The value of this option is expanded after a connection to a another host has
44798 been set up. The result is used as the argument for the EHLO, HELO, or LHLO
44799 command that starts the outgoing SMTP or LMTP session. The default value of the
44800 option is:
44801 </para>
44802 <literallayout class="monospaced">
44803 $primary_hostname
44804 </literallayout>
44805 <para>
44806 During the expansion, the variables <varname>$host</varname> and <varname>$host_address</varname> are set to
44807 the identity of the remote host, and the variables <varname>$sending_ip_address</varname> and
44808 <varname>$sending_port</varname> are set to the local IP address and port number that are being
44809 used. These variables can be used to generate different values for different
44810 servers or different local IP addresses. For example, if you want the string
44811 that is used for <option>helo_data</option> to be obtained by a DNS lookup of the outgoing
44812 interface address, you could use this:
44813 </para>
44814 <literallayout class="monospaced">
44815 helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}\
44816   {$primary_hostname}}
44817 </literallayout>
44818 <para>
44819 The use of <option>helo_data</option> applies both to sending messages and when doing
44820 callouts.
44821 </para>
44822 <para>
44823 <indexterm role="option">
44824 <primary><option>hosts</option></primary>
44825 </indexterm>
44826 </para>
44827 <informaltable frame="all">
44828 <tgroup cols="4" colsep="0" rowsep="0">
44829 <colspec colwidth="8*" align="left"/>
44830 <colspec colwidth="6*" align="center"/>
44831 <colspec colwidth="6*" align="center"/>
44832 <colspec colwidth="6*" align="right"/>
44833 <tbody>
44834 <row>
44835 <entry><option>hosts</option></entry>
44836 <entry>Use: <emphasis>smtp</emphasis></entry>
44837 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
44838 <entry>Default: <emphasis>unset</emphasis></entry>
44839 </row>
44840 </tbody>
44841 </tgroup>
44842 </informaltable>
44843 <para>
44844 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
44845 finds the hosts by looking up the address domain in the DNS, or by
44846 <command>manualroute</command>, which has lists of hosts in its configuration. However,
44847 email addresses can be passed to the <command>smtp</command> transport by any router, and not
44848 all of them can provide an associated list of hosts.
44849 </para>
44850 <para>
44851 The <option>hosts</option> option specifies a list of hosts to be used if the address being
44852 processed does not have any hosts associated with it. The hosts specified by
44853 <option>hosts</option> are also used, whether or not the address has its own hosts, if
44854 <option>hosts_override</option> is set.
44855 </para>
44856 <para>
44857 The string is first expanded, before being interpreted as a colon-separated
44858 list of host names or IP addresses, possibly including port numbers. The
44859 separator may be changed to something other than colon, as described in section
44860 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
44861 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
44862 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
44863 of the <command>manualroute</command> router is not available here.
44864 </para>
44865 <para>
44866 If the expansion fails, delivery is deferred. Unless the failure was caused by
44867 the inability to complete a lookup, the error is logged to the panic log as
44868 well as the main log. Host names are looked up either by searching directly for
44869 address records in the DNS or by calling <function>gethostbyname()</function> (or
44870 <function>getipnodebyname()</function> when available), depending on the setting of the
44871 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
44872 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
44873 address are used.
44874 </para>
44875 <para>
44876 During delivery, the hosts are tried in order, subject to their retry status,
44877 unless <option>hosts_randomize</option> is set.
44878 </para>
44879 <para>
44880 <indexterm role="option">
44881 <primary><option>hosts_avoid_esmtp</option></primary>
44882 </indexterm>
44883 </para>
44884 <informaltable frame="all">
44885 <tgroup cols="4" colsep="0" rowsep="0">
44886 <colspec colwidth="8*" align="left"/>
44887 <colspec colwidth="6*" align="center"/>
44888 <colspec colwidth="6*" align="center"/>
44889 <colspec colwidth="6*" align="right"/>
44890 <tbody>
44891 <row>
44892 <entry><option>hosts_avoid_esmtp</option></entry>
44893 <entry>Use: <emphasis>smtp</emphasis></entry>
44894 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
44895 <entry>Default: <emphasis>unset</emphasis></entry>
44896 </row>
44897 </tbody>
44898 </tgroup>
44899 </informaltable>
44900 <para>
44901 <indexterm role="concept">
44902 <primary>ESMTP, avoiding use of</primary>
44903 </indexterm>
44904 <indexterm role="concept">
44905 <primary>HELO</primary>
44906 <secondary>forcing use of</secondary>
44907 </indexterm>
44908 <indexterm role="concept">
44909 <primary>EHLO</primary>
44910 <secondary>avoiding use of</secondary>
44911 </indexterm>
44912 <indexterm role="concept">
44913 <primary>PIPELINING</primary>
44914 <secondary>avoiding the use of</secondary>
44915 </indexterm>
44916 This option is for use with broken hosts that announce ESMTP facilities (for
44917 example, PIPELINING) and then fail to implement them properly. When a host
44918 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
44919 start of the SMTP session. This means that it cannot use any of the ESMTP
44920 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
44921 </para>
44922 <para>
44923 <indexterm role="option">
44924 <primary><option>hosts_avoid_pipelining</option></primary>
44925 </indexterm>
44926 </para>
44927 <informaltable frame="all">
44928 <tgroup cols="4" colsep="0" rowsep="0">
44929 <colspec colwidth="8*" align="left"/>
44930 <colspec colwidth="6*" align="center"/>
44931 <colspec colwidth="6*" align="center"/>
44932 <colspec colwidth="6*" align="right"/>
44933 <tbody>
44934 <row>
44935 <entry><option>hosts_avoid_pipelining</option></entry>
44936 <entry>Use: <emphasis>smtp</emphasis></entry>
44937 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
44938 <entry>Default: <emphasis>unset</emphasis></entry>
44939 </row>
44940 </tbody>
44941 </tgroup>
44942 </informaltable>
44943 <para>
44944 <indexterm role="concept">
44945 <primary>PIPELINING</primary>
44946 <secondary>avoiding the use of</secondary>
44947 </indexterm>
44948 Exim will not use the SMTP PIPELINING extension when delivering to any host
44949 that matches this list, even if the server host advertises PIPELINING support.
44950 </para>
44951 <para>
44952 <indexterm role="option">
44953 <primary><option>hosts_avoid_tls</option></primary>
44954 </indexterm>
44955 </para>
44956 <informaltable frame="all">
44957 <tgroup cols="4" colsep="0" rowsep="0">
44958 <colspec colwidth="8*" align="left"/>
44959 <colspec colwidth="6*" align="center"/>
44960 <colspec colwidth="6*" align="center"/>
44961 <colspec colwidth="6*" align="right"/>
44962 <tbody>
44963 <row>
44964 <entry><option>hosts_avoid_tls</option></entry>
44965 <entry>Use: <emphasis>smtp</emphasis></entry>
44966 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
44967 <entry>Default: <emphasis>unset</emphasis></entry>
44968 </row>
44969 </tbody>
44970 </tgroup>
44971 </informaltable>
44972 <para>
44973 <indexterm role="concept">
44974 <primary>TLS</primary>
44975 <secondary>avoiding for certain hosts</secondary>
44976 </indexterm>
44977 Exim will not try to start a TLS session when delivering to any host that
44978 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
44979 </para>
44980 <para>
44981 <indexterm role="option">
44982 <primary><option>hosts_verify_avoid_tls</option></primary>
44983 </indexterm>
44984 </para>
44985 <informaltable frame="all">
44986 <tgroup cols="4" colsep="0" rowsep="0">
44987 <colspec colwidth="8*" align="left"/>
44988 <colspec colwidth="6*" align="center"/>
44989 <colspec colwidth="6*" align="center"/>
44990 <colspec colwidth="6*" align="right"/>
44991 <tbody>
44992 <row>
44993 <entry><option>hosts_verify_avoid_tls</option></entry>
44994 <entry>Use: <emphasis>smtp</emphasis></entry>
44995 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
44996 <entry>Default: <emphasis>*</emphasis></entry>
44997 </row>
44998 </tbody>
44999 </tgroup>
45000 </informaltable>
45001 <para>
45002 <indexterm role="concept">
45003 <primary>TLS</primary>
45004 <secondary>avoiding for certain hosts</secondary>
45005 </indexterm>
45006 Exim will not try to start a TLS session for a verify callout,
45007 or when delivering in cutthrough mode,
45008 to any host that matches this list.
45009 Note that the default is to not use TLS.
45010 </para>
45011 <para>
45012 <indexterm role="option">
45013 <primary><option>hosts_max_try</option></primary>
45014 </indexterm>
45015 </para>
45016 <informaltable frame="all">
45017 <tgroup cols="4" colsep="0" rowsep="0">
45018 <colspec colwidth="8*" align="left"/>
45019 <colspec colwidth="6*" align="center"/>
45020 <colspec colwidth="6*" align="center"/>
45021 <colspec colwidth="6*" align="right"/>
45022 <tbody>
45023 <row>
45024 <entry><option>hosts_max_try</option></entry>
45025 <entry>Use: <emphasis>smtp</emphasis></entry>
45026 <entry>Type: <emphasis>integer</emphasis></entry>
45027 <entry>Default: <emphasis>5</emphasis></entry>
45028 </row>
45029 </tbody>
45030 </tgroup>
45031 </informaltable>
45032 <para>
45033 <indexterm role="concept">
45034 <primary>host</primary>
45035 <secondary>maximum number to try</secondary>
45036 </indexterm>
45037 <indexterm role="concept">
45038 <primary>limit</primary>
45039 <secondary>number of hosts tried</secondary>
45040 </indexterm>
45041 <indexterm role="concept">
45042 <primary>limit</primary>
45043 <secondary>number of MX tried</secondary>
45044 </indexterm>
45045 <indexterm role="concept">
45046 <primary>MX record</primary>
45047 <secondary>maximum tried</secondary>
45048 </indexterm>
45049 This option limits the number of IP addresses that are tried for any one
45050 delivery in cases where there are temporary delivery errors. Section
45051 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
45052 </para>
45053 <para>
45054 <indexterm role="option">
45055 <primary><option>hosts_max_try_hardlimit</option></primary>
45056 </indexterm>
45057 </para>
45058 <informaltable frame="all">
45059 <tgroup cols="4" colsep="0" rowsep="0">
45060 <colspec colwidth="8*" align="left"/>
45061 <colspec colwidth="6*" align="center"/>
45062 <colspec colwidth="6*" align="center"/>
45063 <colspec colwidth="6*" align="right"/>
45064 <tbody>
45065 <row>
45066 <entry><option>hosts_max_try_hardlimit</option></entry>
45067 <entry>Use: <emphasis>smtp</emphasis></entry>
45068 <entry>Type: <emphasis>integer</emphasis></entry>
45069 <entry>Default: <emphasis>50</emphasis></entry>
45070 </row>
45071 </tbody>
45072 </tgroup>
45073 </informaltable>
45074 <para>
45075 This is an additional check on the maximum number of IP addresses that Exim
45076 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
45077 why it exists.
45078 </para>
45079 <para>
45080 <indexterm role="option">
45081 <primary><option>hosts_nopass_tls</option></primary>
45082 </indexterm>
45083 </para>
45084 <informaltable frame="all">
45085 <tgroup cols="4" colsep="0" rowsep="0">
45086 <colspec colwidth="8*" align="left"/>
45087 <colspec colwidth="6*" align="center"/>
45088 <colspec colwidth="6*" align="center"/>
45089 <colspec colwidth="6*" align="right"/>
45090 <tbody>
45091 <row>
45092 <entry><option>hosts_nopass_tls</option></entry>
45093 <entry>Use: <emphasis>smtp</emphasis></entry>
45094 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45095 <entry>Default: <emphasis>unset</emphasis></entry>
45096 </row>
45097 </tbody>
45098 </tgroup>
45099 </informaltable>
45100 <para>
45101 <indexterm role="concept">
45102 <primary>TLS</primary>
45103 <secondary>passing connection</secondary>
45104 </indexterm>
45105 <indexterm role="concept">
45106 <primary>multiple SMTP deliveries</primary>
45107 </indexterm>
45108 <indexterm role="concept">
45109 <primary>TLS</primary>
45110 <secondary>multiple message deliveries</secondary>
45111 </indexterm>
45112 For any host that matches this list, a connection on which a TLS session has
45113 been started will not be passed to a new delivery process for sending another
45114 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
45115 explanation of when this might be needed.
45116 </para>
45117 <para>
45118 <indexterm role="option">
45119 <primary><option>hosts_override</option></primary>
45120 </indexterm>
45121 </para>
45122 <informaltable frame="all">
45123 <tgroup cols="4" colsep="0" rowsep="0">
45124 <colspec colwidth="8*" align="left"/>
45125 <colspec colwidth="6*" align="center"/>
45126 <colspec colwidth="6*" align="center"/>
45127 <colspec colwidth="6*" align="right"/>
45128 <tbody>
45129 <row>
45130 <entry><option>hosts_override</option></entry>
45131 <entry>Use: <emphasis>smtp</emphasis></entry>
45132 <entry>Type: <emphasis>boolean</emphasis></entry>
45133 <entry>Default: <emphasis>false</emphasis></entry>
45134 </row>
45135 </tbody>
45136 </tgroup>
45137 </informaltable>
45138 <para>
45139 If this option is set and the <option>hosts</option> option is also set, any hosts that are
45140 attached to the address are ignored, and instead the hosts specified by the
45141 <option>hosts</option> option are always used. This option does not apply to
45142 <option>fallback_hosts</option>.
45143 </para>
45144 <para>
45145 <indexterm role="option">
45146 <primary><option>hosts_randomize</option></primary>
45147 </indexterm>
45148 </para>
45149 <informaltable frame="all">
45150 <tgroup cols="4" colsep="0" rowsep="0">
45151 <colspec colwidth="8*" align="left"/>
45152 <colspec colwidth="6*" align="center"/>
45153 <colspec colwidth="6*" align="center"/>
45154 <colspec colwidth="6*" align="right"/>
45155 <tbody>
45156 <row>
45157 <entry><option>hosts_randomize</option></entry>
45158 <entry>Use: <emphasis>smtp</emphasis></entry>
45159 <entry>Type: <emphasis>boolean</emphasis></entry>
45160 <entry>Default: <emphasis>false</emphasis></entry>
45161 </row>
45162 </tbody>
45163 </tgroup>
45164 </informaltable>
45165 <para>
45166 <indexterm role="concept">
45167 <primary>randomized host list</primary>
45168 </indexterm>
45169 <indexterm role="concept">
45170 <primary>host</primary>
45171 <secondary>list of; randomized</secondary>
45172 </indexterm>
45173 <indexterm role="concept">
45174 <primary>fallback</primary>
45175 <secondary>randomized hosts</secondary>
45176 </indexterm>
45177 If this option is set, and either the list of hosts is taken from the
45178 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
45179 were not obtained from MX records (this includes fallback hosts from the
45180 router), and were not randomized by the router, the order of trying the hosts
45181 is randomized each time the transport runs. Randomizing the order of a host
45182 list can be used to do crude load sharing.
45183 </para>
45184 <para>
45185 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
45186 order is separately randomized. This makes it possible to set up MX-like
45187 behaviour. The boundaries between groups are indicated by an item that is just
45188 <literal>+</literal> in the host list. For example:
45189 </para>
45190 <literallayout class="monospaced">
45191 hosts = host1:host2:host3:+:host4:host5
45192 </literallayout>
45193 <para>
45194 The order of the first three hosts and the order of the last two hosts is
45195 randomized for each use, but the first three always end up before the last two.
45196 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
45197 </para>
45198 <para>
45199 <indexterm role="option">
45200 <primary><option>hosts_require_auth</option></primary>
45201 </indexterm>
45202 </para>
45203 <informaltable frame="all">
45204 <tgroup cols="4" colsep="0" rowsep="0">
45205 <colspec colwidth="8*" align="left"/>
45206 <colspec colwidth="6*" align="center"/>
45207 <colspec colwidth="6*" align="center"/>
45208 <colspec colwidth="6*" align="right"/>
45209 <tbody>
45210 <row>
45211 <entry><option>hosts_require_auth</option></entry>
45212 <entry>Use: <emphasis>smtp</emphasis></entry>
45213 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45214 <entry>Default: <emphasis>unset</emphasis></entry>
45215 </row>
45216 </tbody>
45217 </tgroup>
45218 </informaltable>
45219 <para>
45220 <indexterm role="concept">
45221 <primary>authentication</primary>
45222 <secondary>required by client</secondary>
45223 </indexterm>
45224 This option provides a list of servers for which authentication must succeed
45225 before Exim will try to transfer a message. If authentication fails for
45226 servers which are not in this list, Exim tries to send unauthenticated. If
45227 authentication fails for one of these servers, delivery is deferred. This
45228 temporary error is detectable in the retry rules, so it can be turned into a
45229 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
45230 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
45231 </para>
45232 <para>
45233 <indexterm role="option">
45234 <primary><option>hosts_request_ocsp</option></primary>
45235 </indexterm>
45236 </para>
45237 <informaltable frame="all">
45238 <tgroup cols="4" colsep="0" rowsep="0">
45239 <colspec colwidth="8*" align="left"/>
45240 <colspec colwidth="6*" align="center"/>
45241 <colspec colwidth="6*" align="center"/>
45242 <colspec colwidth="6*" align="right"/>
45243 <tbody>
45244 <row>
45245 <entry><option>hosts_request_ocsp</option></entry>
45246 <entry>Use: <emphasis>smtp</emphasis></entry>
45247 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45248 <entry>Default: <emphasis>*</emphasis></entry>
45249 </row>
45250 </tbody>
45251 </tgroup>
45252 </informaltable>
45253 <para>
45254 <indexterm role="concept">
45255 <primary>TLS</primary>
45256 <secondary>requiring for certain servers</secondary>
45257 </indexterm>
45258 Exim will request a Certificate Status on a
45259 TLS session for any host that matches this list.
45260 <option>tls_verify_certificates</option> should also be set for the transport.
45261 </para>
45262 <para>
45263 <indexterm role="option">
45264 <primary><option>hosts_require_ocsp</option></primary>
45265 </indexterm>
45266 </para>
45267 <informaltable frame="all">
45268 <tgroup cols="4" colsep="0" rowsep="0">
45269 <colspec colwidth="8*" align="left"/>
45270 <colspec colwidth="6*" align="center"/>
45271 <colspec colwidth="6*" align="center"/>
45272 <colspec colwidth="6*" align="right"/>
45273 <tbody>
45274 <row>
45275 <entry><option>hosts_require_ocsp</option></entry>
45276 <entry>Use: <emphasis>smtp</emphasis></entry>
45277 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45278 <entry>Default: <emphasis>unset</emphasis></entry>
45279 </row>
45280 </tbody>
45281 </tgroup>
45282 </informaltable>
45283 <para>
45284 <indexterm role="concept">
45285 <primary>TLS</primary>
45286 <secondary>requiring for certain servers</secondary>
45287 </indexterm>
45288 Exim will request, and check for a valid Certificate Status being given, on a
45289 TLS session for any host that matches this list.
45290 <option>tls_verify_certificates</option> should also be set for the transport.
45291 </para>
45292 <para>
45293 <indexterm role="option">
45294 <primary><option>hosts_require_tls</option></primary>
45295 </indexterm>
45296 </para>
45297 <informaltable frame="all">
45298 <tgroup cols="4" colsep="0" rowsep="0">
45299 <colspec colwidth="8*" align="left"/>
45300 <colspec colwidth="6*" align="center"/>
45301 <colspec colwidth="6*" align="center"/>
45302 <colspec colwidth="6*" align="right"/>
45303 <tbody>
45304 <row>
45305 <entry><option>hosts_require_tls</option></entry>
45306 <entry>Use: <emphasis>smtp</emphasis></entry>
45307 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45308 <entry>Default: <emphasis>unset</emphasis></entry>
45309 </row>
45310 </tbody>
45311 </tgroup>
45312 </informaltable>
45313 <para>
45314 <indexterm role="concept">
45315 <primary>TLS</primary>
45316 <secondary>requiring for certain servers</secondary>
45317 </indexterm>
45318 Exim will insist on using a TLS session when delivering to any host that
45319 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
45320 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
45321 incoming messages, use an appropriate ACL.
45322 </para>
45323 <para>
45324 <indexterm role="option">
45325 <primary><option>hosts_try_auth</option></primary>
45326 </indexterm>
45327 </para>
45328 <informaltable frame="all">
45329 <tgroup cols="4" colsep="0" rowsep="0">
45330 <colspec colwidth="8*" align="left"/>
45331 <colspec colwidth="6*" align="center"/>
45332 <colspec colwidth="6*" align="center"/>
45333 <colspec colwidth="6*" align="right"/>
45334 <tbody>
45335 <row>
45336 <entry><option>hosts_try_auth</option></entry>
45337 <entry>Use: <emphasis>smtp</emphasis></entry>
45338 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45339 <entry>Default: <emphasis>unset</emphasis></entry>
45340 </row>
45341 </tbody>
45342 </tgroup>
45343 </informaltable>
45344 <para>
45345 <indexterm role="concept">
45346 <primary>authentication</primary>
45347 <secondary>optional in client</secondary>
45348 </indexterm>
45349 This option provides a list of servers to which, provided they announce
45350 authentication support, Exim will attempt to authenticate as a client when it
45351 connects. If authentication fails, Exim will try to transfer the message
45352 unauthenticated. See also <option>hosts_require_auth</option>, and chapter
45353 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
45354 </para>
45355 <para>
45356 <indexterm role="option">
45357 <primary><option>hosts_try_prdr</option></primary>
45358 </indexterm>
45359 </para>
45360 <informaltable frame="all">
45361 <tgroup cols="4" colsep="0" rowsep="0">
45362 <colspec colwidth="8*" align="left"/>
45363 <colspec colwidth="6*" align="center"/>
45364 <colspec colwidth="6*" align="center"/>
45365 <colspec colwidth="6*" align="right"/>
45366 <tbody>
45367 <row>
45368 <entry><option>hosts_try_prdr</option></entry>
45369 <entry>Use: <emphasis>smtp</emphasis></entry>
45370 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45371 <entry>Default: <emphasis>unset</emphasis></entry>
45372 </row>
45373 </tbody>
45374 </tgroup>
45375 </informaltable>
45376 <para>
45377 <indexterm role="concept">
45378 <primary>PRDR</primary>
45379 <secondary>enabling, optional in client</secondary>
45380 </indexterm>
45381 This option provides a list of servers to which, provided they announce
45382 PRDR support, Exim will attempt to negotiate PRDR
45383 for multi-recipient messages.
45384 </para>
45385 <para>
45386 <indexterm role="option">
45387 <primary><option>interface</option></primary>
45388 </indexterm>
45389 </para>
45390 <informaltable frame="all">
45391 <tgroup cols="4" colsep="0" rowsep="0">
45392 <colspec colwidth="8*" align="left"/>
45393 <colspec colwidth="6*" align="center"/>
45394 <colspec colwidth="6*" align="center"/>
45395 <colspec colwidth="6*" align="right"/>
45396 <tbody>
45397 <row>
45398 <entry><option>interface</option></entry>
45399 <entry>Use: <emphasis>smtp</emphasis></entry>
45400 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
45401 <entry>Default: <emphasis>unset</emphasis></entry>
45402 </row>
45403 </tbody>
45404 </tgroup>
45405 </informaltable>
45406 <para>
45407 <indexterm role="concept">
45408 <primary>bind IP address</primary>
45409 </indexterm>
45410 <indexterm role="concept">
45411 <primary>IP address</primary>
45412 <secondary>binding</secondary>
45413 </indexterm>
45414 <indexterm role="variable">
45415 <primary><varname>$host</varname></primary>
45416 </indexterm>
45417 <indexterm role="variable">
45418 <primary><varname>$host_address</varname></primary>
45419 </indexterm>
45420 This option specifies which interface to bind to when making an outgoing SMTP
45421 call. The value is an IP address, not an interface name such as
45422 <literal>eth0</literal>. Do not confuse this with the interface address that was used when a
45423 message was received, which is in <varname>$received_ip_address</varname>, formerly known as
45424 <varname>$interface_address</varname>. The name was changed to minimize confusion with the
45425 outgoing interface address. There is no variable that contains an outgoing
45426 interface address because, unless it is set by this option, its value is
45427 unknown.
45428 </para>
45429 <para>
45430 During the expansion of the <option>interface</option> option the variables <varname>$host</varname> and
45431 <varname>$host_address</varname> refer to the host to which a connection is about to be made
45432 during the expansion of the string. Forced expansion failure, or an empty
45433 string result causes the option to be ignored. Otherwise, after expansion, the
45434 string must be a list of IP addresses, colon-separated by default, but the
45435 separator can be changed in the usual way. For example:
45436 </para>
45437 <literallayout class="monospaced">
45438 interface = &lt;; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
45439 </literallayout>
45440 <para>
45441 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
45442 connection. If none of them are the correct type, the option is ignored. If
45443 <option>interface</option> is not set, or is ignored, the system&#x2019;s IP functions choose which
45444 interface to use if the host has more than one.
45445 </para>
45446 <para>
45447 <indexterm role="option">
45448 <primary><option>keepalive</option></primary>
45449 </indexterm>
45450 </para>
45451 <informaltable frame="all">
45452 <tgroup cols="4" colsep="0" rowsep="0">
45453 <colspec colwidth="8*" align="left"/>
45454 <colspec colwidth="6*" align="center"/>
45455 <colspec colwidth="6*" align="center"/>
45456 <colspec colwidth="6*" align="right"/>
45457 <tbody>
45458 <row>
45459 <entry><option>keepalive</option></entry>
45460 <entry>Use: <emphasis>smtp</emphasis></entry>
45461 <entry>Type: <emphasis>boolean</emphasis></entry>
45462 <entry>Default: <emphasis>true</emphasis></entry>
45463 </row>
45464 </tbody>
45465 </tgroup>
45466 </informaltable>
45467 <para>
45468 <indexterm role="concept">
45469 <primary>keepalive</primary>
45470 <secondary>on outgoing connection</secondary>
45471 </indexterm>
45472 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
45473 connections. When set, it causes the kernel to probe idle connections
45474 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
45475 of the connection should send a acknowledgment if the connection is still okay
45476 or a reset if the connection has been aborted. The reason for doing this is
45477 that it has the beneficial effect of freeing up certain types of connection
45478 that can get stuck when the remote host is disconnected without tidying up the
45479 TCP/IP call properly. The keepalive mechanism takes several hours to detect
45480 unreachable hosts.
45481 </para>
45482 <para>
45483 <indexterm role="option">
45484 <primary><option>lmtp_ignore_quota</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>lmtp_ignore_quota</option></entry>
45496 <entry>Use: <emphasis>smtp</emphasis></entry>
45497 <entry>Type: <emphasis>boolean</emphasis></entry>
45498 <entry>Default: <emphasis>false</emphasis></entry>
45499 </row>
45500 </tbody>
45501 </tgroup>
45502 </informaltable>
45503 <para>
45504 <indexterm role="concept">
45505 <primary>LMTP</primary>
45506 <secondary>ignoring quota errors</secondary>
45507 </indexterm>
45508 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
45509 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
45510 has advertised support for IGNOREQUOTA in its response to the LHLO command.
45511 </para>
45512 <para>
45513 <indexterm role="option">
45514 <primary><option>max_rcpt</option></primary>
45515 </indexterm>
45516 </para>
45517 <informaltable frame="all">
45518 <tgroup cols="4" colsep="0" rowsep="0">
45519 <colspec colwidth="8*" align="left"/>
45520 <colspec colwidth="6*" align="center"/>
45521 <colspec colwidth="6*" align="center"/>
45522 <colspec colwidth="6*" align="right"/>
45523 <tbody>
45524 <row>
45525 <entry><option>max_rcpt</option></entry>
45526 <entry>Use: <emphasis>smtp</emphasis></entry>
45527 <entry>Type: <emphasis>integer</emphasis></entry>
45528 <entry>Default: <emphasis>100</emphasis></entry>
45529 </row>
45530 </tbody>
45531 </tgroup>
45532 </informaltable>
45533 <para>
45534 <indexterm role="concept">
45535 <primary>RCPT</primary>
45536 <secondary>maximum number of outgoing</secondary>
45537 </indexterm>
45538 This option limits the number of RCPT commands that are sent in a single
45539 SMTP message transaction. Each set of addresses is treated independently, and
45540 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
45541 permits this.
45542 </para>
45543 <para>
45544 <indexterm role="option">
45545 <primary><option>multi_domain</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>multi_domain</option></entry>
45557 <entry>Use: <emphasis>smtp</emphasis></entry>
45558 <entry>Type: <emphasis>boolean</emphasis></entry>
45559 <entry>Default: <emphasis>true</emphasis></entry>
45560 </row>
45561 </tbody>
45562 </tgroup>
45563 </informaltable>
45564 <para>
45565 <indexterm role="variable">
45566 <primary><varname>$domain</varname></primary>
45567 </indexterm>
45568 When this option is set, the <command>smtp</command> transport can handle a number of
45569 addresses containing a mixture of different domains provided they all resolve
45570 to the same list of hosts. Turning the option off restricts the transport to
45571 handling only one domain at a time. This is useful if you want to use
45572 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
45573 is a single domain involved in a remote delivery.
45574 </para>
45575 <para>
45576 <indexterm role="option">
45577 <primary><option>port</option></primary>
45578 </indexterm>
45579 </para>
45580 <informaltable frame="all">
45581 <tgroup cols="4" colsep="0" rowsep="0">
45582 <colspec colwidth="8*" align="left"/>
45583 <colspec colwidth="6*" align="center"/>
45584 <colspec colwidth="6*" align="center"/>
45585 <colspec colwidth="6*" align="right"/>
45586 <tbody>
45587 <row>
45588 <entry><option>port</option></entry>
45589 <entry>Use: <emphasis>smtp</emphasis></entry>
45590 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45591 <entry>Default: <emphasis>see below</emphasis></entry>
45592 </row>
45593 </tbody>
45594 </tgroup>
45595 </informaltable>
45596 <para>
45597 <indexterm role="concept">
45598 <primary>port</primary>
45599 <secondary>sending TCP/IP</secondary>
45600 </indexterm>
45601 <indexterm role="concept">
45602 <primary>TCP/IP</primary>
45603 <secondary>setting outgoing port</secondary>
45604 </indexterm>
45605 This option specifies the TCP/IP port on the server to which Exim connects.
45606 <emphasis role="bold">Note:</emphasis> Do not confuse this with the port that was used when a message was
45607 received, which is in <varname>$received_port</varname>, formerly known as <varname>$interface_port</varname>.
45608 The name was changed to minimize confusion with the outgoing port. There is no
45609 variable that contains an outgoing port.
45610 </para>
45611 <para>
45612 If the value of this option begins with a digit it is taken as a port number;
45613 otherwise it is looked up using <function>getservbyname()</function>. The default value is
45614 normally <quote>smtp</quote>, but if <option>protocol</option> is set to <quote>lmtp</quote>, the default is
45615 <quote>lmtp</quote>. If the expansion fails, or if a port number cannot be found, delivery
45616 is deferred.
45617 </para>
45618 <para>
45619 <indexterm role="option">
45620 <primary><option>protocol</option></primary>
45621 </indexterm>
45622 </para>
45623 <informaltable frame="all">
45624 <tgroup cols="4" colsep="0" rowsep="0">
45625 <colspec colwidth="8*" align="left"/>
45626 <colspec colwidth="6*" align="center"/>
45627 <colspec colwidth="6*" align="center"/>
45628 <colspec colwidth="6*" align="right"/>
45629 <tbody>
45630 <row>
45631 <entry><option>protocol</option></entry>
45632 <entry>Use: <emphasis>smtp</emphasis></entry>
45633 <entry>Type: <emphasis>string</emphasis></entry>
45634 <entry>Default: <emphasis>smtp</emphasis></entry>
45635 </row>
45636 </tbody>
45637 </tgroup>
45638 </informaltable>
45639 <para>
45640 <indexterm role="concept">
45641 <primary>LMTP</primary>
45642 <secondary>over TCP/IP</secondary>
45643 </indexterm>
45644 <indexterm role="concept">
45645 <primary>ssmtp protocol</primary>
45646 <secondary>outbound</secondary>
45647 </indexterm>
45648 <indexterm role="concept">
45649 <primary>TLS</primary>
45650 <secondary>SSL-on-connect outbound</secondary>
45651 </indexterm>
45652 <indexterm role="variable">
45653 <primary><varname>$port</varname></primary>
45654 </indexterm>
45655 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
45656 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
45657 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
45658 deliveries into closed message stores. Exim also has support for running LMTP
45659 over a pipe to a local process &ndash; see chapter <xref linkend="CHAPLMTP"/>.
45660 </para>
45661 <para>
45662 If this option is set to <quote>smtps</quote>, the default vaule for the <option>port</option> option
45663 changes to <quote>smtps</quote>, and the transport initiates TLS immediately after
45664 connecting, as an outbound SSL-on-connect, instead of using STARTTLS to upgrade.
45665 The Internet standards bodies strongly discourage use of this mode.
45666 </para>
45667 <para>
45668 <indexterm role="option">
45669 <primary><option>retry_include_ip_address</option></primary>
45670 </indexterm>
45671 </para>
45672 <informaltable frame="all">
45673 <tgroup cols="4" colsep="0" rowsep="0">
45674 <colspec colwidth="8*" align="left"/>
45675 <colspec colwidth="6*" align="center"/>
45676 <colspec colwidth="6*" align="center"/>
45677 <colspec colwidth="6*" align="right"/>
45678 <tbody>
45679 <row>
45680 <entry><option>retry_include_ip_address</option></entry>
45681 <entry>Use: <emphasis>smtp</emphasis></entry>
45682 <entry>Type: <emphasis>boolean</emphasis></entry>
45683 <entry>Default: <emphasis>true</emphasis></entry>
45684 </row>
45685 </tbody>
45686 </tgroup>
45687 </informaltable>
45688 <para>
45689 Exim normally includes both the host name and the IP address in the key it
45690 constructs for indexing retry data after a temporary delivery failure. This
45691 means that when one of several IP addresses for a host is failing, it gets
45692 tried periodically (controlled by the retry rules), but use of the other IP
45693 addresses is not affected.
45694 </para>
45695 <para>
45696 However, in some dialup environments hosts are assigned a different IP address
45697 each time they connect. In this situation the use of the IP address as part of
45698 the retry key leads to undesirable behaviour. Setting this option false causes
45699 Exim to use only the host name. This should normally be done on a separate
45700 instance of the <command>smtp</command> transport, set up specially to handle the dialup
45701 hosts.
45702 </para>
45703 <para>
45704 <indexterm role="option">
45705 <primary><option>serialize_hosts</option></primary>
45706 </indexterm>
45707 </para>
45708 <informaltable frame="all">
45709 <tgroup cols="4" colsep="0" rowsep="0">
45710 <colspec colwidth="8*" align="left"/>
45711 <colspec colwidth="6*" align="center"/>
45712 <colspec colwidth="6*" align="center"/>
45713 <colspec colwidth="6*" align="right"/>
45714 <tbody>
45715 <row>
45716 <entry><option>serialize_hosts</option></entry>
45717 <entry>Use: <emphasis>smtp</emphasis></entry>
45718 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45719 <entry>Default: <emphasis>unset</emphasis></entry>
45720 </row>
45721 </tbody>
45722 </tgroup>
45723 </informaltable>
45724 <para>
45725 <indexterm role="concept">
45726 <primary>serializing connections</primary>
45727 </indexterm>
45728 <indexterm role="concept">
45729 <primary>host</primary>
45730 <secondary>serializing connections</secondary>
45731 </indexterm>
45732 Because Exim operates in a distributed manner, if several messages for the same
45733 host arrive at around the same time, more than one simultaneous connection to
45734 the remote host can occur. This is not usually a problem except when there is a
45735 slow link between the hosts. In that situation it may be helpful to restrict
45736 Exim to one connection at a time. This can be done by setting
45737 <option>serialize_hosts</option> to match the relevant hosts.
45738 </para>
45739 <para>
45740 <indexterm role="concept">
45741 <primary>hints database</primary>
45742 <secondary>serializing deliveries to a host</secondary>
45743 </indexterm>
45744 Exim implements serialization by means of a hints database in which a record is
45745 written whenever a process connects to one of the restricted hosts. The record
45746 is deleted when the connection is completed. Obviously there is scope for
45747 records to get left lying around if there is a system or program crash. To
45748 guard against this, Exim ignores any records that are more than six hours old.
45749 </para>
45750 <para>
45751 If you set up this kind of serialization, you should also arrange to delete the
45752 relevant hints database whenever your system reboots. The names of the files
45753 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
45754 may be one or two files, depending on the type of DBM in use. The same files
45755 are used for ETRN serialization.
45756 </para>
45757 <para>
45758 <indexterm role="option">
45759 <primary><option>size_addition</option></primary>
45760 </indexterm>
45761 </para>
45762 <informaltable frame="all">
45763 <tgroup cols="4" colsep="0" rowsep="0">
45764 <colspec colwidth="8*" align="left"/>
45765 <colspec colwidth="6*" align="center"/>
45766 <colspec colwidth="6*" align="center"/>
45767 <colspec colwidth="6*" align="right"/>
45768 <tbody>
45769 <row>
45770 <entry><option>size_addition</option></entry>
45771 <entry>Use: <emphasis>smtp</emphasis></entry>
45772 <entry>Type: <emphasis>integer</emphasis></entry>
45773 <entry>Default: <emphasis>1024</emphasis></entry>
45774 </row>
45775 </tbody>
45776 </tgroup>
45777 </informaltable>
45778 <para>
45779 <indexterm role="concept">
45780 <primary>SMTP</primary>
45781 <secondary>SIZE</secondary>
45782 </indexterm>
45783 <indexterm role="concept">
45784 <primary>message</primary>
45785 <secondary>size issue for transport filter</secondary>
45786 </indexterm>
45787 <indexterm role="concept">
45788 <primary>size</primary>
45789 <secondary>of message</secondary>
45790 </indexterm>
45791 <indexterm role="concept">
45792 <primary>transport</primary>
45793 <secondary>filter</secondary>
45794 </indexterm>
45795 <indexterm role="concept">
45796 <primary>filter</primary>
45797 <secondary>transport filter</secondary>
45798 </indexterm>
45799 If a remote SMTP server indicates that it supports the SIZE option of the
45800 MAIL command, Exim uses this to pass over the message size at the start of
45801 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
45802 sends, to allow for headers and other text that may be added during delivery by
45803 configuration options or in a transport filter. It may be necessary to increase
45804 this if a lot of text is added to messages.
45805 </para>
45806 <para>
45807 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
45808 the use of the SIZE option altogether.
45809 </para>
45810 <para>
45811 <indexterm role="option">
45812 <primary><option>tls_certificate</option></primary>
45813 </indexterm>
45814 </para>
45815 <informaltable frame="all">
45816 <tgroup cols="4" colsep="0" rowsep="0">
45817 <colspec colwidth="8*" align="left"/>
45818 <colspec colwidth="6*" align="center"/>
45819 <colspec colwidth="6*" align="center"/>
45820 <colspec colwidth="6*" align="right"/>
45821 <tbody>
45822 <row>
45823 <entry><option>tls_certificate</option></entry>
45824 <entry>Use: <emphasis>smtp</emphasis></entry>
45825 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45826 <entry>Default: <emphasis>unset</emphasis></entry>
45827 </row>
45828 </tbody>
45829 </tgroup>
45830 </informaltable>
45831 <para>
45832 <indexterm role="concept">
45833 <primary>TLS</primary>
45834 <secondary>client certificate, location of</secondary>
45835 </indexterm>
45836 <indexterm role="concept">
45837 <primary>certificate</primary>
45838 <secondary>client, location of</secondary>
45839 </indexterm>
45840 <indexterm role="variable">
45841 <primary><varname>$host</varname></primary>
45842 </indexterm>
45843 <indexterm role="variable">
45844 <primary><varname>$host_address</varname></primary>
45845 </indexterm>
45846 The value of this option must be the absolute path to a file which contains the
45847 client&#x2019;s certificate, for possible use when sending a message over an encrypted
45848 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
45849 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
45850 details of TLS.
45851 </para>
45852 <para>
45853 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
45854 certificate when sending messages as a client. The global option of the same
45855 name specifies the certificate for Exim as a server; it is not automatically
45856 assumed that the same certificate should be used when Exim is operating as a
45857 client.
45858 </para>
45859 <para>
45860 <indexterm role="option">
45861 <primary><option>tls_crl</option></primary>
45862 </indexterm>
45863 </para>
45864 <informaltable frame="all">
45865 <tgroup cols="4" colsep="0" rowsep="0">
45866 <colspec colwidth="8*" align="left"/>
45867 <colspec colwidth="6*" align="center"/>
45868 <colspec colwidth="6*" align="center"/>
45869 <colspec colwidth="6*" align="right"/>
45870 <tbody>
45871 <row>
45872 <entry><option>tls_crl</option></entry>
45873 <entry>Use: <emphasis>smtp</emphasis></entry>
45874 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45875 <entry>Default: <emphasis>unset</emphasis></entry>
45876 </row>
45877 </tbody>
45878 </tgroup>
45879 </informaltable>
45880 <para>
45881 <indexterm role="concept">
45882 <primary>TLS</primary>
45883 <secondary>client certificate revocation list</secondary>
45884 </indexterm>
45885 <indexterm role="concept">
45886 <primary>certificate</primary>
45887 <secondary>revocation list for client</secondary>
45888 </indexterm>
45889 This option specifies a certificate revocation list. The expanded value must
45890 be the name of a file that contains a CRL in PEM format.
45891 </para>
45892 <para>
45893 <indexterm role="option">
45894 <primary><option>tls_dh_min_bits</option></primary>
45895 </indexterm>
45896 </para>
45897 <informaltable frame="all">
45898 <tgroup cols="4" colsep="0" rowsep="0">
45899 <colspec colwidth="8*" align="left"/>
45900 <colspec colwidth="6*" align="center"/>
45901 <colspec colwidth="6*" align="center"/>
45902 <colspec colwidth="6*" align="right"/>
45903 <tbody>
45904 <row>
45905 <entry><option>tls_dh_min_bits</option></entry>
45906 <entry>Use: <emphasis>smtp</emphasis></entry>
45907 <entry>Type: <emphasis>integer</emphasis></entry>
45908 <entry>Default: <emphasis>1024</emphasis></entry>
45909 </row>
45910 </tbody>
45911 </tgroup>
45912 </informaltable>
45913 <para>
45914 <indexterm role="concept">
45915 <primary>TLS</primary>
45916 <secondary>Diffie-Hellman minimum acceptable size</secondary>
45917 </indexterm>
45918 When establishing a TLS session, if a ciphersuite which uses Diffie-Hellman
45919 key agreement is negotiated, the server will provide a large prime number
45920 for use.  This option establishes the minimum acceptable size of that number.
45921 If the parameter offered by the server is too small, then the TLS handshake
45922 will fail.
45923 </para>
45924 <para>
45925 Only supported when using GnuTLS.
45926 </para>
45927 <para>
45928 <indexterm role="option">
45929 <primary><option>tls_privatekey</option></primary>
45930 </indexterm>
45931 </para>
45932 <informaltable frame="all">
45933 <tgroup cols="4" colsep="0" rowsep="0">
45934 <colspec colwidth="8*" align="left"/>
45935 <colspec colwidth="6*" align="center"/>
45936 <colspec colwidth="6*" align="center"/>
45937 <colspec colwidth="6*" align="right"/>
45938 <tbody>
45939 <row>
45940 <entry><option>tls_privatekey</option></entry>
45941 <entry>Use: <emphasis>smtp</emphasis></entry>
45942 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45943 <entry>Default: <emphasis>unset</emphasis></entry>
45944 </row>
45945 </tbody>
45946 </tgroup>
45947 </informaltable>
45948 <para>
45949 <indexterm role="concept">
45950 <primary>TLS</primary>
45951 <secondary>client private key, location of</secondary>
45952 </indexterm>
45953 <indexterm role="variable">
45954 <primary><varname>$host</varname></primary>
45955 </indexterm>
45956 <indexterm role="variable">
45957 <primary><varname>$host_address</varname></primary>
45958 </indexterm>
45959 The value of this option must be the absolute path to a file which contains the
45960 client&#x2019;s private key. This is used when sending a message over an encrypted
45961 connection using a client certificate. The values of <varname>$host</varname> and
45962 <varname>$host_address</varname> are set to the name and address of the server during the
45963 expansion. If this option is unset, or the expansion is forced to fail, or the
45964 result is an empty string, the private key is assumed to be in the same file as
45965 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
45966 </para>
45967 <para>
45968 <indexterm role="option">
45969 <primary><option>tls_require_ciphers</option></primary>
45970 </indexterm>
45971 </para>
45972 <informaltable frame="all">
45973 <tgroup cols="4" colsep="0" rowsep="0">
45974 <colspec colwidth="8*" align="left"/>
45975 <colspec colwidth="6*" align="center"/>
45976 <colspec colwidth="6*" align="center"/>
45977 <colspec colwidth="6*" align="right"/>
45978 <tbody>
45979 <row>
45980 <entry><option>tls_require_ciphers</option></entry>
45981 <entry>Use: <emphasis>smtp</emphasis></entry>
45982 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45983 <entry>Default: <emphasis>unset</emphasis></entry>
45984 </row>
45985 </tbody>
45986 </tgroup>
45987 </informaltable>
45988 <para>
45989 <indexterm role="concept">
45990 <primary>TLS</primary>
45991 <secondary>requiring specific ciphers</secondary>
45992 </indexterm>
45993 <indexterm role="concept">
45994 <primary>cipher</primary>
45995 <secondary>requiring specific</secondary>
45996 </indexterm>
45997 <indexterm role="variable">
45998 <primary><varname>$host</varname></primary>
45999 </indexterm>
46000 <indexterm role="variable">
46001 <primary><varname>$host_address</varname></primary>
46002 </indexterm>
46003 The value of this option must be a list of permitted cipher suites, for use
46004 when setting up an outgoing encrypted connection. (There is a global option of
46005 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
46006 <varname>$host_address</varname> are set to the name and address of the server during the
46007 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
46008 is used in different ways by OpenSSL and GnuTLS (see sections
46009 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
46010 ciphers is a preference order.
46011 </para>
46012 <para>
46013 <indexterm role="option">
46014 <primary><option>tls_sni</option></primary>
46015 </indexterm>
46016 </para>
46017 <informaltable frame="all">
46018 <tgroup cols="4" colsep="0" rowsep="0">
46019 <colspec colwidth="8*" align="left"/>
46020 <colspec colwidth="6*" align="center"/>
46021 <colspec colwidth="6*" align="center"/>
46022 <colspec colwidth="6*" align="right"/>
46023 <tbody>
46024 <row>
46025 <entry><option>tls_sni</option></entry>
46026 <entry>Use: <emphasis>smtp</emphasis></entry>
46027 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46028 <entry>Default: <emphasis>unset</emphasis></entry>
46029 </row>
46030 </tbody>
46031 </tgroup>
46032 </informaltable>
46033 <para>
46034 <indexterm role="concept">
46035 <primary>TLS</primary>
46036 <secondary>Server Name Indication</secondary>
46037 </indexterm>
46038 <indexterm role="variable">
46039 <primary><varname>$tls_sni</varname></primary>
46040 </indexterm>
46041 If this option is set then it sets the $tls_out_sni variable and causes any
46042 TLS session to pass this value as the Server Name Indication extension to
46043 the remote side, which can be used by the remote side to select an appropriate
46044 certificate and private key for the session.
46045 </para>
46046 <para>
46047 See <xref linkend="SECTtlssni"/> for more information.
46048 </para>
46049 <para>
46050 Note that for OpenSSL, this feature requires a build of OpenSSL that supports
46051 TLS extensions.
46052 </para>
46053 <para>
46054 <indexterm role="option">
46055 <primary><option>tls_tempfail_tryclear</option></primary>
46056 </indexterm>
46057 </para>
46058 <informaltable frame="all">
46059 <tgroup cols="4" colsep="0" rowsep="0">
46060 <colspec colwidth="8*" align="left"/>
46061 <colspec colwidth="6*" align="center"/>
46062 <colspec colwidth="6*" align="center"/>
46063 <colspec colwidth="6*" align="right"/>
46064 <tbody>
46065 <row>
46066 <entry><option>tls_tempfail_tryclear</option></entry>
46067 <entry>Use: <emphasis>smtp</emphasis></entry>
46068 <entry>Type: <emphasis>boolean</emphasis></entry>
46069 <entry>Default: <emphasis>true</emphasis></entry>
46070 </row>
46071 </tbody>
46072 </tgroup>
46073 </informaltable>
46074 <para>
46075 <indexterm role="concept">
46076 <primary>4<emphasis>xx</emphasis> responses</primary>
46077 <secondary>to STARTTLS</secondary>
46078 </indexterm>
46079 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
46080 setting up a TLS session, this option determines whether or not Exim should try
46081 to deliver the message unencrypted. If it is set false, delivery to the
46082 current host is deferred; if there are other hosts, they are tried. If this
46083 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
46084 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
46085 TLS negotiation fails, Exim closes the current connection (because it is in an
46086 unknown state), opens a new one to the same host, and then tries the delivery
46087 in clear.
46088 </para>
46089 <para>
46090 <indexterm role="option">
46091 <primary><option>tls_try_verify_hosts</option></primary>
46092 </indexterm>
46093 </para>
46094 <informaltable frame="all">
46095 <tgroup cols="4" colsep="0" rowsep="0">
46096 <colspec colwidth="8*" align="left"/>
46097 <colspec colwidth="6*" align="center"/>
46098 <colspec colwidth="6*" align="center"/>
46099 <colspec colwidth="6*" align="right"/>
46100 <tbody>
46101 <row>
46102 <entry><option>tls_try_verify_hosts</option></entry>
46103 <entry>Use: <emphasis>smtp</emphasis></entry>
46104 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46105 <entry>Default: <emphasis>unset</emphasis></entry>
46106 </row>
46107 </tbody>
46108 </tgroup>
46109 </informaltable>
46110 <para>
46111 <indexterm role="concept">
46112 <primary>TLS</primary>
46113 <secondary>server certificate verification</secondary>
46114 </indexterm>
46115 <indexterm role="concept">
46116 <primary>certificate</primary>
46117 <secondary>verification of server</secondary>
46118 </indexterm>
46119 This option gives a list of hosts for which, on encrypted connections,
46120 certificate verification will be tried but need not succeed.
46121 The <option>tls_verify_certificates</option> option must also be set.
46122 Note that unless the host is in this list
46123 TLS connections will be denied to hosts using self-signed certificates
46124 when <option>tls_verify_certificates</option> is matched.
46125 The <varname>$tls_out_certificate_verified</varname> variable is set when
46126 certificate verification succeeds.
46127 </para>
46128 <para>
46129 <indexterm role="option">
46130 <primary><option>tls_verify_certificates</option></primary>
46131 </indexterm>
46132 </para>
46133 <informaltable frame="all">
46134 <tgroup cols="4" colsep="0" rowsep="0">
46135 <colspec colwidth="8*" align="left"/>
46136 <colspec colwidth="6*" align="center"/>
46137 <colspec colwidth="6*" align="center"/>
46138 <colspec colwidth="6*" align="right"/>
46139 <tbody>
46140 <row>
46141 <entry><option>tls_verify_certificates</option></entry>
46142 <entry>Use: <emphasis>smtp</emphasis></entry>
46143 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46144 <entry>Default: <emphasis>unset</emphasis></entry>
46145 </row>
46146 </tbody>
46147 </tgroup>
46148 </informaltable>
46149 <para>
46150 <indexterm role="concept">
46151 <primary>TLS</primary>
46152 <secondary>server certificate verification</secondary>
46153 </indexterm>
46154 <indexterm role="concept">
46155 <primary>certificate</primary>
46156 <secondary>verification of server</secondary>
46157 </indexterm>
46158 <indexterm role="variable">
46159 <primary><varname>$host</varname></primary>
46160 </indexterm>
46161 <indexterm role="variable">
46162 <primary><varname>$host_address</varname></primary>
46163 </indexterm>
46164 The value of this option must be the absolute path to a file containing
46165 permitted server certificates, for use when setting up an encrypted connection.
46166 Alternatively,
46167 if you are using either GnuTLS version 3.3.6 (or later) or OpenSSL,
46168 you can set
46169 <option>tls_verify_certificates</option> to the name of a directory containing certificate
46170 files.
46171 For earlier versions of GnuTLS the option must be set to the name of a
46172 single file.
46173 </para>
46174 <para>
46175 With OpenSSL the certificates specified
46176 explicitly
46177 either by file or directory
46178 are added to those given by the system default location.
46179 </para>
46180 <para>
46181 The values of <varname>$host</varname> and
46182 <varname>$host_address</varname> are set to the name and address of the server during the
46183 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
46184 </para>
46185 <para>
46186 For back-compatability,
46187 if neither tls_verify_hosts nor tls_try_verify_hosts are set
46188 and certificate verification fails the TLS connection is closed.
46189 </para>
46190 <para>
46191 <indexterm role="option">
46192 <primary><option>tls_verify_hosts</option></primary>
46193 </indexterm>
46194 </para>
46195 <informaltable frame="all">
46196 <tgroup cols="4" colsep="0" rowsep="0">
46197 <colspec colwidth="8*" align="left"/>
46198 <colspec colwidth="6*" align="center"/>
46199 <colspec colwidth="6*" align="center"/>
46200 <colspec colwidth="6*" align="right"/>
46201 <tbody>
46202 <row>
46203 <entry><option>tls_verify_hosts</option></entry>
46204 <entry>Use: <emphasis>smtp</emphasis></entry>
46205 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46206 <entry>Default: <emphasis>unset</emphasis></entry>
46207 </row>
46208 </tbody>
46209 </tgroup>
46210 </informaltable>
46211 <para>
46212 <indexterm role="concept">
46213 <primary>TLS</primary>
46214 <secondary>server certificate verification</secondary>
46215 </indexterm>
46216 <indexterm role="concept">
46217 <primary>certificate</primary>
46218 <secondary>verification of server</secondary>
46219 </indexterm>
46220 This option gives a list of hosts for which. on encrypted connections,
46221 certificate verification must succeed.
46222 The <option>tls_verify_certificates</option> option must also be set.
46223 If both this option and <option>tls_try_verify_hosts</option> are unset
46224 operation is as if this option selected all hosts.
46225 </para>
46226 </section>
46227 <section id="SECTvalhosmax">
46228 <title>How the limits for the number of hosts to try are used</title>
46229 <para>
46230 <indexterm role="concept">
46231 <primary>host</primary>
46232 <secondary>maximum number to try</secondary>
46233 </indexterm>
46234 <indexterm role="concept">
46235 <primary>limit</primary>
46236 <secondary>hosts; maximum number tried</secondary>
46237 </indexterm>
46238 There are two options that are concerned with the number of hosts that are
46239 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
46240 <option>hosts_max_try_hardlimit</option>.
46241 </para>
46242 <para>
46243 The <option>hosts_max_try</option> option limits the number of hosts that are tried
46244 for a single delivery. However, despite the term <quote>host</quote> in its name, the
46245 option actually applies to each IP address independently. In other words, a
46246 multihomed host is treated as several independent hosts, just as it is for
46247 retrying.
46248 </para>
46249 <para>
46250 Many of the larger ISPs have multiple MX records which often point to
46251 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
46252 created as a result of routing one of these domains.
46253 </para>
46254 <para>
46255 Trying every single IP address on such a long list does not seem sensible; if
46256 several at the top of the list fail, it is reasonable to assume there is some
46257 problem that is likely to affect all of them. Roughly speaking, the value of
46258 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
46259 delivery. However, the logic cannot be quite that simple.
46260 </para>
46261 <para>
46262 Firstly, IP addresses that are skipped because their retry times have not
46263 arrived do not count, and in addition, addresses that are past their retry
46264 limits are also not counted, even when they are tried. This means that when
46265 some IP addresses are past their retry limits, more than the value of
46266 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
46267 that all IP addresses are considered before timing out an email address (but
46268 see below for an exception).
46269 </para>
46270 <para>
46271 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
46272 list to see if there is a subsequent host with a different (higher valued) MX.
46273 If there is, that host is considered next, and the current IP address is used
46274 but not counted. This behaviour helps in the case of a domain with a retry rule
46275 that hardly ever delays any hosts, as is now explained:
46276 </para>
46277 <para>
46278 Consider the case of a long list of hosts with one MX value, and a few with a
46279 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
46280 hosts at the top of the list are tried at first. With the default retry rule,
46281 which specifies increasing retry times, the higher MX hosts are eventually
46282 tried when those at the top of the list are skipped because they have not
46283 reached their retry times.
46284 </para>
46285 <para>
46286 However, it is common practice to put a fixed short retry time on domains for
46287 large ISPs, on the grounds that their servers are rarely down for very long.
46288 Unfortunately, these are exactly the domains that tend to resolve to long lists
46289 of hosts. The short retry time means that the lowest MX hosts are tried every
46290 time. The attempts may be in a different order because of random sorting, but
46291 without the special MX check, the higher MX hosts would never be tried until
46292 all the lower MX hosts had timed out (which might be several days), because
46293 there are always some lower MX hosts that have reached their retry times. With
46294 the special check, Exim considers at least one IP address from each MX value at
46295 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
46296 reached.
46297 </para>
46298 <para>
46299 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
46300 particular, Exim normally eventually tries all the IP addresses before timing
46301 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
46302 reasonable thing to do. Recently, however, some lunatic DNS configurations have
46303 been set up with hundreds of IP addresses for some domains. It can
46304 take a very long time indeed for an address to time out in these cases.
46305 </para>
46306 <para>
46307 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
46308 Exim never tries more than this number of IP addresses; if it hits this limit
46309 and they are all timed out, the email address is bounced, even though not all
46310 possible IP addresses have been tried.
46311 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
46312 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
46313 </para>
46314 </section>
46315 </chapter>
46316
46317 <chapter id="CHAPrewrite">
46318 <title>Address rewriting</title>
46319 <para>
46320 <indexterm role="concept" id="IIDaddrew" class="startofrange">
46321 <primary>rewriting</primary>
46322 <secondary>addresses</secondary>
46323 </indexterm>
46324 There are some circumstances in which Exim automatically rewrites domains in
46325 addresses. The two most common are when an address is given without a domain
46326 (referred to as an <quote>unqualified address</quote>) or when an address contains an
46327 abbreviated domain that is expanded by DNS lookup.
46328 </para>
46329 <para>
46330 Unqualified envelope addresses are accepted only for locally submitted
46331 messages, or for messages that are received from hosts matching
46332 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
46333 appropriate. Unqualified addresses in header lines are qualified if they are in
46334 locally submitted messages, or messages from hosts that are permitted to send
46335 unqualified envelope addresses. Otherwise, unqualified addresses in header
46336 lines are neither qualified nor rewritten.
46337 </para>
46338 <para>
46339 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
46340 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
46341 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
46342 do this. The new RFCs do not contain this suggestion.
46343 </para>
46344 <section id="SECID147">
46345 <title>Explicitly configured address rewriting</title>
46346 <para>
46347 This chapter describes the rewriting rules that can be used in the
46348 main rewrite section of the configuration file, and also in the generic
46349 <option>headers_rewrite</option> option that can be set on any transport.
46350 </para>
46351 <para>
46352 Some people believe that configured address rewriting is a Mortal Sin.
46353 Others believe that life is not possible without it. Exim provides the
46354 facility; you do not have to use it.
46355 </para>
46356 <para>
46357 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
46358 configuration file are applied to addresses in incoming messages, both envelope
46359 addresses and addresses in header lines. Each rule specifies the types of
46360 address to which it applies.
46361 </para>
46362 <para>
46363 Whether or not addresses in header lines are rewritten depends on the origin of
46364 the headers and the type of rewriting. Global rewriting, that is, rewriting
46365 rules from the rewrite section of the configuration file, is applied only to
46366 those headers that were received with the message. Header lines that are added
46367 by ACLs or by a system filter or by individual routers or transports (which
46368 are specific to individual recipient addresses) are not rewritten by the global
46369 rules.
46370 </para>
46371 <para>
46372 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
46373 applies all headers except those added by routers and transports. That is, as
46374 well as the headers that were received with the message, it also applies to
46375 headers that were added by an ACL or a system filter.
46376 </para>
46377 <para>
46378 In general, rewriting addresses from your own system or domain has some
46379 legitimacy. Rewriting other addresses should be done only with great care and
46380 in special circumstances. The author of Exim believes that rewriting should be
46381 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
46382 Although it can sometimes be used as a routing tool, this is very strongly
46383 discouraged.
46384 </para>
46385 <para>
46386 There are two commonly encountered circumstances where rewriting is used, as
46387 illustrated by these examples:
46388 </para>
46389 <itemizedlist>
46390 <listitem>
46391 <para>
46392 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
46393 exchange mail with each other behind a firewall, but there is only a single
46394 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
46395 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
46396 </para>
46397 </listitem>
46398 <listitem>
46399 <para>
46400 A host rewrites the local parts of its own users so that, for example,
46401 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
46402 </para>
46403 </listitem>
46404 </itemizedlist>
46405 </section>
46406 <section id="SECID148">
46407 <title>When does rewriting happen?</title>
46408 <para>
46409 <indexterm role="concept">
46410 <primary>rewriting</primary>
46411 <secondary>timing of</secondary>
46412 </indexterm>
46413 <indexterm role="concept">
46414 <primary>access control lists (ACLs)</primary>
46415 <secondary>rewriting addresses in</secondary>
46416 </indexterm>
46417 Configured address rewriting can take place at several different stages of a
46418 message&#x2019;s processing.
46419 </para>
46420 <para>
46421 <indexterm role="variable">
46422 <primary><varname>$sender_address</varname></primary>
46423 </indexterm>
46424 At the start of an ACL for MAIL, the sender address may have been rewritten
46425 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
46426 ordinary rewrite rules have yet been applied. If, however, the sender address
46427 is verified in the ACL, it is rewritten before verification, and remains
46428 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
46429 rewritten address. This also applies if sender verification happens in a
46430 RCPT ACL. Otherwise, when the sender address is not verified, it is
46431 rewritten as soon as a message&#x2019;s header lines have been received.
46432 </para>
46433 <para>
46434 <indexterm role="variable">
46435 <primary><varname>$domain</varname></primary>
46436 </indexterm>
46437 <indexterm role="variable">
46438 <primary><varname>$local_part</varname></primary>
46439 </indexterm>
46440 Similarly, at the start of an ACL for RCPT, the current recipient&#x2019;s address
46441 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
46442 rewrite rules have yet been applied to it. However, the behaviour is different
46443 from the sender address when a recipient is verified. The address is rewritten
46444 for the verification, but the rewriting is not remembered at this stage. The
46445 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
46446 as they were before (that is, they contain the unrewritten &ndash; except for
46447 SMTP-time rewriting &ndash; address).
46448 </para>
46449 <para>
46450 As soon as a message&#x2019;s header lines have been received, all the envelope
46451 recipient addresses are permanently rewritten, and rewriting is also applied to
46452 the addresses in the header lines (if configured). This happens before adding
46453 any header lines that were specified in MAIL or RCPT ACLs, and
46454 <indexterm role="concept">
46455 <primary><function>local_scan()</function> function</primary>
46456 <secondary>address rewriting; timing of</secondary>
46457 </indexterm>
46458 before the DATA ACL and <function>local_scan()</function> functions are run.
46459 </para>
46460 <para>
46461 When an address is being routed, either for delivery or for verification,
46462 rewriting is applied immediately to child addresses that are generated by
46463 redirection, unless <option>no_rewrite</option> is set on the router.
46464 </para>
46465 <para>
46466 <indexterm role="concept">
46467 <primary>envelope sender</primary>
46468 <secondary>rewriting at transport time</secondary>
46469 </indexterm>
46470 <indexterm role="concept">
46471 <primary>rewriting</primary>
46472 <secondary>at transport time</secondary>
46473 </indexterm>
46474 <indexterm role="concept">
46475 <primary>header lines</primary>
46476 <secondary>rewriting at transport time</secondary>
46477 </indexterm>
46478 At transport time, additional rewriting of addresses in header lines can be
46479 specified by setting the generic <option>headers_rewrite</option> option on a transport.
46480 This option contains rules that are identical in form to those in the rewrite
46481 section of the configuration file. They are applied to the original message
46482 header lines and any that were added by ACLs or a system filter. They are not
46483 applied to header lines that are added by routers or the transport.
46484 </para>
46485 <para>
46486 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
46487 transport option. However, it is not possible to rewrite envelope recipients at
46488 transport time.
46489 </para>
46490 </section>
46491 <section id="SECID149">
46492 <title>Testing the rewriting rules that apply on input</title>
46493 <para>
46494 <indexterm role="concept">
46495 <primary>rewriting</primary>
46496 <secondary>testing</secondary>
46497 </indexterm>
46498 <indexterm role="concept">
46499 <primary>testing</primary>
46500 <secondary>rewriting</secondary>
46501 </indexterm>
46502 Exim&#x2019;s input rewriting configuration appears in a part of the run time
46503 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
46504 <option>-brw</option> command line option. This takes an address (which can be a full RFC
46505 2822 address) as its argument. The output is a list of how the address would be
46506 transformed by the rewriting rules for each of the different places it might
46507 appear in an incoming message, that is, for each different header and for the
46508 envelope sender and recipient fields. For example,
46509 </para>
46510 <literallayout class="monospaced">
46511 exim -brw ph10@exim.workshop.example
46512 </literallayout>
46513 <para>
46514 might produce the output
46515 </para>
46516 <literallayout class="monospaced">
46517 sender: Philip.Hazel@exim.workshop.example
46518 from: Philip.Hazel@exim.workshop.example
46519 to: ph10@exim.workshop.example
46520 cc: ph10@exim.workshop.example
46521 bcc: ph10@exim.workshop.example
46522 reply-to: Philip.Hazel@exim.workshop.example
46523 env-from: Philip.Hazel@exim.workshop.example
46524 env-to: ph10@exim.workshop.example
46525 </literallayout>
46526 <para>
46527 which shows that rewriting has been set up for that address when used in any of
46528 the source fields, but not when it appears as a recipient address. At the
46529 present time, there is no equivalent way of testing rewriting rules that are
46530 set for a particular transport.
46531 </para>
46532 </section>
46533 <section id="SECID150">
46534 <title>Rewriting rules</title>
46535 <para>
46536 <indexterm role="concept">
46537 <primary>rewriting</primary>
46538 <secondary>rules</secondary>
46539 </indexterm>
46540 The rewrite section of the configuration file consists of lines of rewriting
46541 rules in the form
46542 </para>
46543 <literallayout>
46544 &lt;<emphasis>source pattern</emphasis>&gt;  &lt;<emphasis>replacement</emphasis>&gt;  &lt;<emphasis>flags</emphasis>&gt;
46545 </literallayout>
46546 <para>
46547 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
46548 transport option are given as a colon-separated list. Each item in the list
46549 takes the same form as a line in the main rewriting configuration (except that
46550 any colons must be doubled, of course).
46551 </para>
46552 <para>
46553 The formats of source patterns and replacement strings are described below.
46554 Each is terminated by white space, unless enclosed in double quotes, in which
46555 case normal quoting conventions apply inside the quotes. The flags are single
46556 characters which may appear in any order. Spaces and tabs between them are
46557 ignored.
46558 </para>
46559 <para>
46560 For each address that could potentially be rewritten, the rules are scanned in
46561 order, and replacements for the address from earlier rules can themselves be
46562 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
46563 </para>
46564 <para>
46565 The order in which addresses are rewritten is undefined, may change between
46566 releases, and must not be relied on, with one exception: when a message is
46567 received, the envelope sender is always rewritten first, before any header
46568 lines are rewritten. For example, the replacement string for a rewrite of an
46569 address in <emphasis>To:</emphasis> must not assume that the message&#x2019;s address in <emphasis>From:</emphasis> has
46570 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
46571 that the envelope sender has already been rewritten.
46572 </para>
46573 <para>
46574 <indexterm role="variable">
46575 <primary><varname>$domain</varname></primary>
46576 </indexterm>
46577 <indexterm role="variable">
46578 <primary><varname>$local_part</varname></primary>
46579 </indexterm>
46580 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
46581 string to refer to the address that is being rewritten. Note that lookup-driven
46582 rewriting can be done by a rule of the form
46583 </para>
46584 <literallayout class="monospaced">
46585 *@*   ${lookup ...
46586 </literallayout>
46587 <para>
46588 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
46589 refer to the address that is being rewritten.
46590 </para>
46591 </section>
46592 <section id="SECID151">
46593 <title>Rewriting patterns</title>
46594 <para>
46595 <indexterm role="concept">
46596 <primary>rewriting</primary>
46597 <secondary>patterns</secondary>
46598 </indexterm>
46599 <indexterm role="concept">
46600 <primary>address list</primary>
46601 <secondary>in a rewriting pattern</secondary>
46602 </indexterm>
46603 The source pattern in a rewriting rule is any item which may appear in an
46604 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
46605 single-item address list, which means that it is expanded before being tested
46606 against the address. As always, if you use a regular expression as a pattern,
46607 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
46608 facility to suppress string expansion within the regular expression.
46609 </para>
46610 <para>
46611 Domains in patterns should be given in lower case. Local parts in patterns are
46612 case-sensitive. If you want to do case-insensitive matching of local parts, you
46613 can use a regular expression that starts with <literal>^(?i)</literal>.
46614 </para>
46615 <para>
46616 <indexterm role="concept">
46617 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
46618 <secondary>in rewriting rules</secondary>
46619 </indexterm>
46620 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
46621 depending on the type of match which occurred. These can be used in the
46622 replacement string to insert portions of the incoming address. <varname>$0</varname> always
46623 refers to the complete incoming address. When a regular expression is used, the
46624 numerical variables are set from its capturing subexpressions. For other types
46625 of pattern they are set as follows:
46626 </para>
46627 <itemizedlist>
46628 <listitem>
46629 <para>
46630 If a local part or domain starts with an asterisk, the numerical variables
46631 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
46632 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
46633 pattern
46634 </para>
46635 <literallayout class="monospaced">
46636 *queen@*.fict.example
46637 </literallayout>
46638 <para>
46639 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
46640 </para>
46641 <literallayout class="monospaced">
46642 $0 = hearts-queen@wonderland.fict.example
46643 $1 = hearts-
46644 $2 = wonderland
46645 </literallayout>
46646 <para>
46647 Note that if the local part does not start with an asterisk, but the domain
46648 does, it is <varname>$1</varname> that contains the wild part of the domain.
46649 </para>
46650 </listitem>
46651 <listitem>
46652 <para>
46653 If the domain part of the pattern is a partial lookup, the wild and fixed parts
46654 of the domain are placed in the next available numerical variables. Suppose,
46655 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
46656 rewriting rule of the form
46657 </para>
46658 <literallayout>
46659 <literal>*@partial-dbm;/some/dbm/file</literal>    &lt;<emphasis>replacement string</emphasis>&gt;
46660 </literallayout>
46661 <para>
46662 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
46663 </para>
46664 <literallayout class="monospaced">
46665 $1 = foo
46666 $2 = bar
46667 $3 = baz.example
46668 </literallayout>
46669 <para>
46670 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
46671 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
46672 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
46673 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
46674 whole domain. For non-partial domain lookups, no numerical variables are set.
46675 </para>
46676 </listitem>
46677 </itemizedlist>
46678 </section>
46679 <section id="SECID152">
46680 <title>Rewriting replacements</title>
46681 <para>
46682 <indexterm role="concept">
46683 <primary>rewriting</primary>
46684 <secondary>replacements</secondary>
46685 </indexterm>
46686 If the replacement string for a rule is a single asterisk, addresses that
46687 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
46688 rewriting rules are scanned. For example,
46689 </para>
46690 <literallayout class="monospaced">
46691 hatta@lookingglass.fict.example  *  f
46692 </literallayout>
46693 <para>
46694 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
46695 <emphasis>From:</emphasis> headers.
46696 </para>
46697 <para>
46698 <indexterm role="variable">
46699 <primary><varname>$domain</varname></primary>
46700 </indexterm>
46701 <indexterm role="variable">
46702 <primary><varname>$local_part</varname></primary>
46703 </indexterm>
46704 If the replacement string is not a single asterisk, it is expanded, and must
46705 yield a fully qualified address. Within the expansion, the variables
46706 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
46707 Any letters they contain retain their original case &ndash; they are not lower
46708 cased. The numerical variables are set up according to the type of pattern that
46709 matched the address, as described above. If the expansion is forced to fail by
46710 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
46711 current rule is abandoned, but subsequent rules may take effect. Any other
46712 expansion failure causes the entire rewriting operation to be abandoned, and an
46713 entry written to the panic log.
46714 </para>
46715 </section>
46716 <section id="SECID153">
46717 <title>Rewriting flags</title>
46718 <para>
46719 There are three different kinds of flag that may appear on rewriting rules:
46720 </para>
46721 <itemizedlist>
46722 <listitem>
46723 <para>
46724 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
46725 c, f, h, r, s, t.
46726 </para>
46727 </listitem>
46728 <listitem>
46729 <para>
46730 A flag that specifies rewriting at SMTP time: S.
46731 </para>
46732 </listitem>
46733 <listitem>
46734 <para>
46735 Flags that control the rewriting process: Q, q, R, w.
46736 </para>
46737 </listitem>
46738 </itemizedlist>
46739 <para>
46740 For rules that are part of the <option>headers_rewrite</option> generic transport option,
46741 E, F, T, and S are not permitted.
46742 </para>
46743 </section>
46744 <section id="SECID154">
46745 <title>Flags specifying which headers and envelope addresses to rewrite</title>
46746 <para>
46747 <indexterm role="concept">
46748 <primary>rewriting</primary>
46749 <secondary>flags</secondary>
46750 </indexterm>
46751 If none of the following flag letters, nor the <quote>S</quote> flag (see section
46752 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
46753 and to both the sender and recipient fields of the envelope, whereas a
46754 transport-time rewriting rule just applies to all headers. Otherwise, the
46755 rewriting rule is skipped unless the relevant addresses are being processed.
46756 </para>
46757 <literallayout>
46758 <literal>E</literal>       rewrite all envelope fields
46759 <literal>F</literal>       rewrite the envelope From field
46760 <literal>T</literal>       rewrite the envelope To field
46761 <literal>b</literal>       rewrite the <emphasis>Bcc:</emphasis> header
46762 <literal>c</literal>       rewrite the <emphasis>Cc:</emphasis> header
46763 <literal>f</literal>       rewrite the <emphasis>From:</emphasis> header
46764 <literal>h</literal>       rewrite all headers
46765 <literal>r</literal>       rewrite the <emphasis>Reply-To:</emphasis> header
46766 <literal>s</literal>       rewrite the <emphasis>Sender:</emphasis> header
46767 <literal>t</literal>       rewrite the <emphasis>To:</emphasis> header
46768 </literallayout>
46769 <para>
46770 "All headers" means all of the headers listed above that can be selected
46771 individually, plus their <emphasis>Resent-</emphasis> versions. It does not include
46772 other headers such as <emphasis>Subject:</emphasis> etc.
46773 </para>
46774 <para>
46775 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
46776 restrict this to special known cases in your own domains.
46777 </para>
46778 </section>
46779 <section id="SECTrewriteS">
46780 <title>The SMTP-time rewriting flag</title>
46781 <para>
46782 <indexterm role="concept">
46783 <primary>SMTP</primary>
46784 <secondary>rewriting malformed addresses</secondary>
46785 </indexterm>
46786 <indexterm role="concept">
46787 <primary>RCPT</primary>
46788 <secondary>rewriting argument of</secondary>
46789 </indexterm>
46790 <indexterm role="concept">
46791 <primary>MAIL</primary>
46792 <secondary>rewriting argument of</secondary>
46793 </indexterm>
46794 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
46795 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
46796 before any other processing; even before syntax checking. The pattern is
46797 required to be a regular expression, and it is matched against the whole of the
46798 data for the command, including any surrounding angle brackets.
46799 </para>
46800 <para>
46801 <indexterm role="variable">
46802 <primary><varname>$domain</varname></primary>
46803 </indexterm>
46804 <indexterm role="variable">
46805 <primary><varname>$local_part</varname></primary>
46806 </indexterm>
46807 This form of rewrite rule allows for the handling of addresses that are not
46808 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
46809 input). Because the input is not required to be a syntactically valid address,
46810 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
46811 expansion of the replacement string. The result of rewriting replaces the
46812 original address in the MAIL or RCPT command.
46813 </para>
46814 </section>
46815 <section id="SECID155">
46816 <title>Flags controlling the rewriting process</title>
46817 <para>
46818 There are four flags which control the way the rewriting process works. These
46819 take effect only when a rule is invoked, that is, when the address is of the
46820 correct type (matches the flags) and matches the pattern:
46821 </para>
46822 <itemizedlist>
46823 <listitem>
46824 <para>
46825 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
46826 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
46827 absence of <quote>Q</quote> the rewritten address must always include a domain.
46828 </para>
46829 </listitem>
46830 <listitem>
46831 <para>
46832 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
46833 even if no rewriting actually takes place because of a <quote>fail</quote> in the
46834 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
46835 (does not match the flags) or does not match the pattern.
46836 </para>
46837 </listitem>
46838 <listitem>
46839 <para>
46840 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
46841 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
46842 rewriting once it fails to match (after at least one successful rewrite).
46843 </para>
46844 </listitem>
46845 <listitem>
46846 <para>
46847 <indexterm role="concept">
46848 <primary>rewriting</primary>
46849 <secondary>whole addresses</secondary>
46850 </indexterm>
46851 When an address in a header is rewritten, the rewriting normally applies only
46852 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
46853 left unchanged. For example, rewriting might change
46854 </para>
46855 <literallayout class="monospaced">
46856 From: Ford Prefect &lt;fp42@restaurant.hitch.fict.example&gt;
46857 </literallayout>
46858 <para>
46859 into
46860 </para>
46861 <literallayout class="monospaced">
46862 From: Ford Prefect &lt;prefectf@hitch.fict.example&gt;
46863 </literallayout>
46864 <para>
46865 <indexterm role="concept">
46866 <primary>RFC 2047</primary>
46867 </indexterm>
46868 Sometimes there is a need to replace the whole address item, and this can be
46869 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
46870 causes an address in a header line to be rewritten, the entire address is
46871 replaced, not just the working part. The replacement must be a complete RFC
46872 2822 address, including the angle brackets if necessary. If text outside angle
46873 brackets contains a character whose value is greater than 126 or less than 32
46874 (except for tab), the text is encoded according to RFC 2047. The character set
46875 is taken from <option>headers_charset</option>, which defaults to ISO-8859-1.
46876 </para>
46877 <para>
46878 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
46879 rewritten, all but the working part of the replacement address is discarded.
46880 </para>
46881 </listitem>
46882 </itemizedlist>
46883 </section>
46884 <section id="SECID156">
46885 <title>Rewriting examples</title>
46886 <para>
46887 Here is an example of the two common rewriting paradigms:
46888 </para>
46889 <literallayout class="monospaced">
46890 *@*.hitch.fict.example  $1@hitch.fict.example
46891 *@hitch.fict.example    ${lookup{$1}dbm{/etc/realnames}\
46892                      {$value}fail}@hitch.fict.example bctfrF
46893 </literallayout>
46894 <para>
46895 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
46896 the string expansion to fail if the lookup does not succeed. In this context it
46897 has the effect of leaving the original address unchanged, but Exim goes on to
46898 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
46899 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
46900 explicitly, which would cause the rewritten address to be the same as before,
46901 at the cost of a small bit of processing. Not supplying either of these is an
46902 error, since the rewritten address would then contain no local part.
46903 </para>
46904 <para>
46905 The first example above replaces the domain with a superior, more general
46906 domain. This may not be desirable for certain local parts. If the rule
46907 </para>
46908 <literallayout class="monospaced">
46909 root@*.hitch.fict.example  *
46910 </literallayout>
46911 <para>
46912 were inserted before the first rule, rewriting would be suppressed for the
46913 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
46914 </para>
46915 <para>
46916 Rewriting can be made conditional on a number of tests, by making use of
46917 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
46918 messages that originate outside the local host:
46919 </para>
46920 <literallayout class="monospaced">
46921 *@*.hitch.fict.example  "${if !eq {$sender_host_address}{}\
46922                          {$1@hitch.fict.example}fail}"
46923 </literallayout>
46924 <para>
46925 The replacement string is quoted in this example because it contains white
46926 space.
46927 </para>
46928 <para>
46929 <indexterm role="concept">
46930 <primary>rewriting</primary>
46931 <secondary>bang paths</secondary>
46932 </indexterm>
46933 <indexterm role="concept">
46934 <primary>bang paths</primary>
46935 <secondary>rewriting</secondary>
46936 </indexterm>
46937 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
46938 an address it treats it as an unqualified local part which it qualifies with
46939 the local qualification domain (if the source of the message is local or if the
46940 remote host is permitted to send unqualified addresses). Rewriting can
46941 sometimes be used to handle simple bang paths with a fixed number of
46942 components. For example, the rule
46943 </para>
46944 <literallayout class="monospaced">
46945 \N^([^!]+)!(.*)@your.domain.example$\N   $2@$1
46946 </literallayout>
46947 <para>
46948 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
46949 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
46950 a global rewriting rule for envelope addresses. It can provide a backdoor
46951 method for using your system as a relay, because the incoming addresses appear
46952 to be local. If the bang path addresses are received via SMTP, it is safer to
46953 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
46954 can be done on the rewritten addresses.
46955 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
46956 </para>
46957 </section>
46958 </chapter>
46959
46960 <chapter id="CHAPretry">
46961 <title>Retry configuration</title>
46962 <para>
46963 <indexterm role="concept" id="IIDretconf1" class="startofrange">
46964 <primary>retry</primary>
46965 <secondary>configuration, description of</secondary>
46966 </indexterm>
46967 <indexterm role="concept" id="IIDregconf2" class="startofrange">
46968 <primary>configuration file</primary>
46969 <secondary>retry section</secondary>
46970 </indexterm>
46971 The <quote>retry</quote> section of the runtime configuration file contains a list of
46972 retry rules that control how often Exim tries to deliver messages that cannot
46973 be delivered at the first attempt. If there are no retry rules (the section is
46974 empty or not present), there are no retries. In this situation, temporary
46975 errors are treated as permanent. The default configuration contains a single,
46976 general-purpose retry rule (see section <xref linkend="SECID57"/>). The <option>-brt</option> command
46977 line option can be used to test which retry rule will be used for a given
46978 address, domain and error.
46979 </para>
46980 <para>
46981 The most common cause of retries is temporary failure to deliver to a remote
46982 host because the host is down, or inaccessible because of a network problem.
46983 Exim&#x2019;s retry processing in this case is applied on a per-host (strictly, per IP
46984 address) basis, not on a per-message basis. Thus, if one message has recently
46985 been delayed, delivery of a new message to the same host is not immediately
46986 tried, but waits for the host&#x2019;s retry time to arrive. If the <option>retry_defer</option>
46987 log selector is set, the message
46988 <indexterm role="concept">
46989 <primary>retry</primary>
46990 <secondary>time not reached</secondary>
46991 </indexterm>
46992 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
46993 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
46994 the handling of errors during remote deliveries.
46995 </para>
46996 <para>
46997 Retry processing applies to routing as well as to delivering, except as covered
46998 in the next paragraph. The retry rules do not distinguish between these
46999 actions. It is not possible, for example, to specify different behaviour for
47000 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
47001 the host <emphasis>snark.fict.example</emphasis>. I didn&#x2019;t think anyone would ever need this
47002 added complication, so did not implement it. However, although they share the
47003 same retry rule, the actual retry times for routing and transporting a given
47004 domain are maintained independently.
47005 </para>
47006 <para>
47007 When a delivery is not part of a queue run (typically an immediate delivery on
47008 receipt of a message), the routers are always run, and local deliveries are
47009 always attempted, even if retry times are set for them. This makes for better
47010 behaviour if one particular message is causing problems (for example, causing
47011 quota overflow, or provoking an error in a filter file). If such a delivery
47012 suffers a temporary failure, the retry data is updated as normal, and
47013 subsequent delivery attempts from queue runs occur only when the retry time for
47014 the local address is reached.
47015 </para>
47016 <section id="SECID157">
47017 <title>Changing retry rules</title>
47018 <para>
47019 If you change the retry rules in your configuration, you should consider
47020 whether or not to delete the retry data that is stored in Exim&#x2019;s spool area in
47021 files with names like <filename>db/retry</filename>. Deleting any of Exim&#x2019;s hints files is
47022 always safe; that is why they are called <quote>hints</quote>.
47023 </para>
47024 <para>
47025 The hints retry data contains suggested retry times based on the previous
47026 rules. In the case of a long-running problem with a remote host, it might
47027 record the fact that the host has timed out. If your new rules increase the
47028 timeout time for such a host, you should definitely remove the old retry data
47029 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
47030 messages that it should now be retaining.
47031 </para>
47032 </section>
47033 <section id="SECID158">
47034 <title>Format of retry rules</title>
47035 <para>
47036 <indexterm role="concept">
47037 <primary>retry</primary>
47038 <secondary>rules</secondary>
47039 </indexterm>
47040 Each retry rule occupies one line and consists of three or four parts,
47041 separated by white space: a pattern, an error name, an optional list of sender
47042 addresses, and a list of retry parameters. The pattern and sender lists must be
47043 enclosed in double quotes if they contain white space. The rules are searched
47044 in order until one is found where the pattern, error name, and sender list (if
47045 present) match the failing host or address, the error that occurred, and the
47046 message&#x2019;s sender, respectively.
47047 </para>
47048 <para>
47049 The pattern is any single item that may appear in an address list (see section
47050 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
47051 which means that it is expanded before being tested against the address that
47052 has been delayed. A negated address list item is permitted. Address
47053 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
47054 which makes it possible for many retry rules to start with just a domain. For
47055 example,
47056 </para>
47057 <literallayout class="monospaced">
47058 lookingglass.fict.example        *  F,24h,30m;
47059 </literallayout>
47060 <para>
47061 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
47062 whereas
47063 </para>
47064 <literallayout class="monospaced">
47065 alice@lookingglass.fict.example  *  F,24h,30m;
47066 </literallayout>
47067 <para>
47068 applies only to temporary failures involving the local part <option>alice</option>.
47069 In practice, almost all rules start with a domain name pattern without a local
47070 part.
47071 </para>
47072 <para>
47073 <indexterm role="concept">
47074 <primary>regular expressions</primary>
47075 <secondary>in retry rules</secondary>
47076 </indexterm>
47077 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a retry rule pattern, it
47078 must match a complete address, not just a domain, because that is how regular
47079 expressions work in address lists.
47080 </para>
47081 <literallayout>
47082 <literal>^\Nxyz\d+\.abc\.example$\N        *  G,1h,10m,2</literal>     <option>Wrong</option>
47083 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N  *  G,1h,10m,2</literal>     <option>Right</option>
47084 </literallayout>
47085 </section>
47086 <section id="SECID159">
47087 <title>Choosing which retry rule to use for address errors</title>
47088 <para>
47089 When Exim is looking for a retry rule after a routing attempt has failed (for
47090 example, after a DNS timeout), each line in the retry configuration is tested
47091 against the complete address only if <option>retry_use_local_part</option> is set for the
47092 router. Otherwise, only the domain is used, except when matching against a
47093 regular expression, when the local part of the address is replaced with <quote>*</quote>.
47094 A domain on its own can match a domain pattern, or a pattern that starts with
47095 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
47096 <option>check_local_user</option> is true, and false for other routers.
47097 </para>
47098 <para>
47099 Similarly, when Exim is looking for a retry rule after a local delivery has
47100 failed (for example, after a mailbox full error), each line in the retry
47101 configuration is tested against the complete address only if
47102 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
47103 local transports).
47104 </para>
47105 <para>
47106 <indexterm role="concept">
47107 <primary>4<emphasis>xx</emphasis> responses</primary>
47108 <secondary>retry rules for</secondary>
47109 </indexterm>
47110 However, when Exim is looking for a retry rule after a remote delivery attempt
47111 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
47112 whole address is always used as the key when searching the retry rules. The
47113 rule that is found is used to create a retry time for the combination of the
47114 failing address and the message&#x2019;s sender. It is the combination of sender and
47115 recipient that is delayed in subsequent queue runs until its retry time is
47116 reached. You can delay the recipient without regard to the sender by setting
47117 <option>address_retry_include_sender</option> false in the <command>smtp</command> transport but this can
47118 lead to problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT
47119 commands.
47120 </para>
47121 </section>
47122 <section id="SECID160">
47123 <title>Choosing which retry rule to use for host and message errors</title>
47124 <para>
47125 For a temporary error that is not related to an individual address (for
47126 example, a connection timeout), each line in the retry configuration is checked
47127 twice. First, the name of the remote host is used as a domain name (preceded by
47128 <quote>*@</quote> when matching a regular expression). If this does not match the line,
47129 the domain from the email address is tried in a similar fashion. For example,
47130 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
47131 </para>
47132 <literallayout class="monospaced">
47133 a.b.c.example  MX  5  x.y.z.example
47134                MX  6  p.q.r.example
47135                MX  7  m.n.o.example
47136 </literallayout>
47137 <para>
47138 and the retry rules are
47139 </para>
47140 <literallayout class="monospaced">
47141 p.q.r.example    *      F,24h,30m;
47142 a.b.c.example    *      F,4d,45m;
47143 </literallayout>
47144 <para>
47145 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
47146 first rule matches neither the host nor the domain, so Exim looks at the second
47147 rule. This does not match the host, but it does match the domain, so it is used
47148 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
47149 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
47150 first retry rule is used, because it matches the host.
47151 </para>
47152 <para>
47153 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
47154 first rule to determine retry times, but for all the other hosts for the domain
47155 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
47156 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
47157 </para>
47158 <para>
47159 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
47160 However, if a message is routed directly to an IP address without the use of a
47161 host name, for example, if a <command>manualroute</command> router contains a setting such as:
47162 </para>
47163 <literallayout class="monospaced">
47164 route_list = *.a.example  192.168.34.23
47165 </literallayout>
47166 <para>
47167 then the <quote>host name</quote> that is used when searching for a retry rule is the
47168 textual form of the IP address.
47169 </para>
47170 </section>
47171 <section id="SECID161">
47172 <title>Retry rules for specific errors</title>
47173 <para>
47174 <indexterm role="concept">
47175 <primary>retry</primary>
47176 <secondary>specific errors; specifying</secondary>
47177 </indexterm>
47178 The second field in a retry rule is the name of a particular error, or an
47179 asterisk, which matches any error. The errors that can be tested for are:
47180 </para>
47181 <variablelist>
47182 <varlistentry>
47183 <term><option>auth_failed</option></term>
47184 <listitem>
47185 <para>
47186 Authentication failed when trying to send to a host in the
47187 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
47188 </para>
47189 </listitem></varlistentry>
47190 <varlistentry>
47191 <term><option>data_4xx</option></term>
47192 <listitem>
47193 <para>
47194 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
47195 after the command, or after sending the message&#x2019;s data.
47196 </para>
47197 </listitem></varlistentry>
47198 <varlistentry>
47199 <term><option>mail_4xx</option></term>
47200 <listitem>
47201 <para>
47202 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
47203 </para>
47204 </listitem></varlistentry>
47205 <varlistentry>
47206 <term><option>rcpt_4xx</option></term>
47207 <listitem>
47208 <para>
47209 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
47210 </para>
47211 </listitem></varlistentry>
47212 </variablelist>
47213 <para>
47214 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x&#x2019;s can be given
47215 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
47216 recognize 452 errors given to RCPT commands for addresses in a certain domain,
47217 and have retries every ten minutes with a one-hour timeout, you could set up a
47218 retry rule of this form:
47219 </para>
47220 <literallayout class="monospaced">
47221 the.domain.name  rcpt_452   F,1h,10m
47222 </literallayout>
47223 <para>
47224 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
47225 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
47226 </para>
47227 <variablelist>
47228 <varlistentry>
47229 <term><option>lost_connection</option></term>
47230 <listitem>
47231 <para>
47232 A server unexpectedly closed the SMTP connection. There may, of course,
47233 legitimate reasons for this (host died, network died), but if it repeats a lot
47234 for the same host, it indicates something odd.
47235 </para>
47236 </listitem></varlistentry>
47237 <varlistentry>
47238 <term><option>refused_MX</option></term>
47239 <listitem>
47240 <para>
47241 A connection to a host obtained from an MX record was refused.
47242 </para>
47243 </listitem></varlistentry>
47244 <varlistentry>
47245 <term><option>refused_A</option></term>
47246 <listitem>
47247 <para>
47248 A connection to a host not obtained from an MX record was refused.
47249 </para>
47250 </listitem></varlistentry>
47251 <varlistentry>
47252 <term><option>refused</option></term>
47253 <listitem>
47254 <para>
47255 A connection was refused.
47256 </para>
47257 </listitem></varlistentry>
47258 <varlistentry>
47259 <term><option>timeout_connect_MX</option></term>
47260 <listitem>
47261 <para>
47262 A connection attempt to a host obtained from an MX record timed out.
47263 </para>
47264 </listitem></varlistentry>
47265 <varlistentry>
47266 <term><option>timeout_connect_A</option></term>
47267 <listitem>
47268 <para>
47269 A connection attempt to a host not obtained from an MX record timed out.
47270 </para>
47271 </listitem></varlistentry>
47272 <varlistentry>
47273 <term><option>timeout_connect</option></term>
47274 <listitem>
47275 <para>
47276 A connection attempt timed out.
47277 </para>
47278 </listitem></varlistentry>
47279 <varlistentry>
47280 <term><option>timeout_MX</option></term>
47281 <listitem>
47282 <para>
47283 There was a timeout while connecting or during an SMTP session with a host
47284 obtained from an MX record.
47285 </para>
47286 </listitem></varlistentry>
47287 <varlistentry>
47288 <term><option>timeout_A</option></term>
47289 <listitem>
47290 <para>
47291 There was a timeout while connecting or during an SMTP session with a host not
47292 obtained from an MX record.
47293 </para>
47294 </listitem></varlistentry>
47295 <varlistentry>
47296 <term><option>timeout</option></term>
47297 <listitem>
47298 <para>
47299 There was a timeout while connecting or during an SMTP session.
47300 </para>
47301 </listitem></varlistentry>
47302 <varlistentry>
47303 <term><option>tls_required</option></term>
47304 <listitem>
47305 <para>
47306 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
47307 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
47308 to STARTTLS, or there was a problem setting up the TLS connection.
47309 </para>
47310 </listitem></varlistentry>
47311 <varlistentry>
47312 <term><option>quota</option></term>
47313 <listitem>
47314 <para>
47315 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
47316 transport.
47317 </para>
47318 </listitem></varlistentry>
47319 <varlistentry>
47320 <term><option>quota_</option>&lt;<emphasis>time</emphasis>&gt;</term>
47321 <listitem>
47322 <para>
47323 <indexterm role="concept">
47324 <primary>quota</primary>
47325 <secondary>error testing in retry rule</secondary>
47326 </indexterm>
47327 <indexterm role="concept">
47328 <primary>retry</primary>
47329 <secondary>quota error testing</secondary>
47330 </indexterm>
47331 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
47332 transport, and the mailbox has not been accessed for &lt;<emphasis>time</emphasis>&gt;. For example,
47333 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
47334 for four days.
47335 </para>
47336 </listitem></varlistentry>
47337 </variablelist>
47338 <para>
47339 <indexterm role="concept">
47340 <primary>mailbox</primary>
47341 <secondary>time of last read</secondary>
47342 </indexterm>
47343 The idea of <option>quota_</option>&lt;<emphasis>time</emphasis>&gt; is to make it possible to have shorter
47344 timeouts when the mailbox is full and is not being read by its owner. Ideally,
47345 it should be based on the last time that the user accessed the mailbox.
47346 However, it is not always possible to determine this. Exim uses the following
47347 heuristic rules:
47348 </para>
47349 <itemizedlist>
47350 <listitem>
47351 <para>
47352 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
47353 used. As no new messages are being delivered (because the mailbox is over
47354 quota), Exim does not access the file, so this is the time of last user access.
47355 </para>
47356 </listitem>
47357 <listitem>
47358 <para>
47359 <indexterm role="concept">
47360 <primary>maildir format</primary>
47361 <secondary>time of last read</secondary>
47362 </indexterm>
47363 For a maildir delivery, the time of last modification of the <filename>new</filename>
47364 subdirectory is used. As the mailbox is over quota, no new files are created in
47365 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
47366 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
47367 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
47368 time that is used is therefore the last time that the user read a new message.
47369 </para>
47370 </listitem>
47371 <listitem>
47372 <para>
47373 For other kinds of multi-file mailbox, the time of last access cannot be
47374 obtained, so a retry rule that uses this type of error field is never matched.
47375 </para>
47376 </listitem>
47377 </itemizedlist>
47378 <para>
47379 The quota errors apply both to system-enforced quotas and to Exim&#x2019;s own quota
47380 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
47381 when a local delivery is deferred because a partition is full (the ENOSPC
47382 error).
47383 </para>
47384 </section>
47385 <section id="SECID162">
47386 <title>Retry rules for specified senders</title>
47387 <para>
47388 <indexterm role="concept">
47389 <primary>retry</primary>
47390 <secondary>rules; sender-specific</secondary>
47391 </indexterm>
47392 You can specify retry rules that apply only when the failing message has a
47393 specific sender. In particular, this can be used to define retry rules that
47394 apply only to bounce messages. The third item in a retry rule can be of this
47395 form:
47396 </para>
47397 <literallayout>
47398 <literal>senders=</literal>&lt;<emphasis>address list</emphasis>&gt;
47399 </literallayout>
47400 <para>
47401 The retry timings themselves are then the fourth item. For example:
47402 </para>
47403 <literallayout class="monospaced">
47404 *   rcpt_4xx   senders=:   F,1h,30m
47405 </literallayout>
47406 <para>
47407 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
47408 host. If the address list contains white space, it must be enclosed in quotes.
47409 For example:
47410 </para>
47411 <literallayout class="monospaced">
47412 a.domain  rcpt_452  senders="xb.dom : yc.dom"  G,8h,10m,1.5
47413 </literallayout>
47414 <para>
47415 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
47416 (which do not depend on the recipient). The reason is that the sender is used
47417 only to match the retry rule. Once the rule has been found for a host error,
47418 its contents are used to set a retry time for the host, and this will apply to
47419 all messages, not just those with specific senders.
47420 </para>
47421 <para>
47422 When testing retry rules using <option>-brt</option>, you can supply a sender using the
47423 <option>-f</option> command line option, like this:
47424 </para>
47425 <literallayout class="monospaced">
47426 exim -f "" -brt user@dom.ain
47427 </literallayout>
47428 <para>
47429 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
47430 list is never matched.
47431 </para>
47432 </section>
47433 <section id="SECID163">
47434 <title>Retry parameters</title>
47435 <para>
47436 <indexterm role="concept">
47437 <primary>retry</primary>
47438 <secondary>parameters in rules</secondary>
47439 </indexterm>
47440 The third (or fourth, if a senders list is present) field in a retry rule is a
47441 sequence of retry parameter sets, separated by semicolons. Each set consists of
47442 </para>
47443 <literallayout>
47444 &lt;<emphasis>letter</emphasis>&gt;,&lt;<emphasis>cutoff time</emphasis>&gt;,&lt;<emphasis>arguments</emphasis>&gt;
47445 </literallayout>
47446 <para>
47447 The letter identifies the algorithm for computing a new retry time; the cutoff
47448 time is the time beyond which this algorithm no longer applies, and the
47449 arguments vary the algorithm&#x2019;s action. The cutoff time is measured from the
47450 time that the first failure for the domain (combined with the local part if
47451 relevant) was detected, not from the time the message was received.
47452 </para>
47453 <para>
47454 <indexterm role="concept">
47455 <primary>retry</primary>
47456 <secondary>algorithms</secondary>
47457 </indexterm>
47458 <indexterm role="concept">
47459 <primary>retry</primary>
47460 <secondary>fixed intervals</secondary>
47461 </indexterm>
47462 <indexterm role="concept">
47463 <primary>retry</primary>
47464 <secondary>increasing intervals</secondary>
47465 </indexterm>
47466 <indexterm role="concept">
47467 <primary>retry</primary>
47468 <secondary>random intervals</secondary>
47469 </indexterm>
47470 The available algorithms are:
47471 </para>
47472 <itemizedlist>
47473 <listitem>
47474 <para>
47475 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
47476 the interval.
47477 </para>
47478 </listitem>
47479 <listitem>
47480 <para>
47481 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
47482 specifies a starting value for the interval, and the second a multiplier, which
47483 is used to increase the size of the interval at each retry.
47484 </para>
47485 </listitem>
47486 <listitem>
47487 <para>
47488 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
47489 retry, the previous interval is multiplied by the factor in order to get a
47490 maximum for the next interval. The minimum interval is the first argument of
47491 the parameter, and an actual interval is chosen randomly between them. Such a
47492 rule has been found to be helpful in cluster configurations when all the
47493 members of the cluster restart at once, and may therefore synchronize their
47494 queue processing times.
47495 </para>
47496 </listitem>
47497 </itemizedlist>
47498 <para>
47499 When computing the next retry time, the algorithm definitions are scanned in
47500 order until one whose cutoff time has not yet passed is reached. This is then
47501 used to compute a new retry time that is later than the current time. In the
47502 case of fixed interval retries, this simply means adding the interval to the
47503 current time. For geometrically increasing intervals, retry intervals are
47504 computed from the rule&#x2019;s parameters until one that is greater than the previous
47505 interval is found. The main configuration variable
47506 <indexterm role="concept">
47507 <primary>limit</primary>
47508 <secondary>retry interval</secondary>
47509 </indexterm>
47510 <indexterm role="concept">
47511 <primary>retry</primary>
47512 <secondary>interval, maximum</secondary>
47513 </indexterm>
47514 <indexterm role="option">
47515 <primary><option>retry_interval_max</option></primary>
47516 </indexterm>
47517 <option>retry_interval_max</option> limits the maximum interval between retries. It
47518 cannot be set greater than <literal>24h</literal>, which is its default value.
47519 </para>
47520 <para>
47521 A single remote domain may have a number of hosts associated with it, and each
47522 host may have more than one IP address. Retry algorithms are selected on the
47523 basis of the domain name, but are applied to each IP address independently. If,
47524 for example, a host has two IP addresses and one is unusable, Exim will
47525 generate retry times for it and will not try to use it until its next retry
47526 time comes. Thus the good IP address is likely to be tried first most of the
47527 time.
47528 </para>
47529 <para>
47530 <indexterm role="concept">
47531 <primary>hints database</primary>
47532 <secondary>use for retrying</secondary>
47533 </indexterm>
47534 Retry times are hints rather than promises. Exim does not make any attempt to
47535 run deliveries exactly at the computed times. Instead, a queue runner process
47536 starts delivery processes for delayed messages periodically, and these attempt
47537 new deliveries only for those addresses that have passed their next retry time.
47538 If a new message arrives for a deferred address, an immediate delivery attempt
47539 occurs only if the address has passed its retry time. In the absence of new
47540 messages, the minimum time between retries is the interval between queue runner
47541 processes. There is not much point in setting retry times of five minutes if
47542 your queue runners happen only once an hour, unless there are a significant
47543 number of incoming messages (which might be the case on a system that is
47544 sending everything to a smart host, for example).
47545 </para>
47546 <para>
47547 The data in the retry hints database can be inspected by using the
47548 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
47549 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
47550 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
47551 are for the hosts associated with a particular mail domain, and also for local
47552 deliveries that have been deferred.
47553 </para>
47554 </section>
47555 <section id="SECID164">
47556 <title>Retry rule examples</title>
47557 <para>
47558 Here are some example retry rules:
47559 </para>
47560 <literallayout class="monospaced">
47561 alice@wonderland.fict.example quota_5d  F,7d,3h
47562 wonderland.fict.example       quota_5d
47563 wonderland.fict.example       *         F,1h,15m; G,2d,1h,2;
47564 lookingglass.fict.example     *         F,24h,30m;
47565 *                 refused_A   F,2h,20m;
47566 *                 *           F,2h,15m; G,16h,1h,1.5; F,5d,8h
47567 </literallayout>
47568 <para>
47569 The first rule sets up special handling for mail to
47570 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
47571 mailbox has not been read for at least 5 days. Retries continue every three
47572 hours for 7 days. The second rule handles over-quota errors for all other local
47573 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
47574 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
47575 fail are bounced immediately if the mailbox has not been read for at least 5
47576 days.
47577 </para>
47578 <para>
47579 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
47580 happen every 15 minutes for an hour, then with geometrically increasing
47581 intervals until two days have passed since a delivery first failed. After the
47582 first hour there is a delay of one hour, then two hours, then four hours, and
47583 so on (this is a rather extreme example).
47584 </para>
47585 <para>
47586 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
47587 They happen every 30 minutes for 24 hours only. The remaining two rules handle
47588 all other domains, with special action for connection refusal from hosts that
47589 were not obtained from an MX record.
47590 </para>
47591 <para>
47592 The final rule in a retry configuration should always have asterisks in the
47593 first two fields so as to provide a general catch-all for any addresses that do
47594 not have their own special handling. This example tries every 15 minutes for 2
47595 hours, then with intervals starting at one hour and increasing by a factor of
47596 1.5 up to 16 hours, then every 8 hours up to 5 days.
47597 </para>
47598 </section>
47599 <section id="SECID165">
47600 <title>Timeout of retry data</title>
47601 <para>
47602 <indexterm role="concept">
47603 <primary>timeout</primary>
47604 <secondary>of retry data</secondary>
47605 </indexterm>
47606 <indexterm role="option">
47607 <primary><option>retry_data_expire</option></primary>
47608 </indexterm>
47609 <indexterm role="concept">
47610 <primary>hints database</primary>
47611 <secondary>data expiry</secondary>
47612 </indexterm>
47613 <indexterm role="concept">
47614 <primary>retry</primary>
47615 <secondary>timeout of data</secondary>
47616 </indexterm>
47617 Exim timestamps the data that it writes to its retry hints database. When it
47618 consults the data during a delivery it ignores any that is older than the value
47619 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn&#x2019;t
47620 been tried for 7 days, Exim will try to deliver to it immediately a message
47621 arrives, and if that fails, it will calculate a retry time as if it were
47622 failing for the first time.
47623 </para>
47624 <para>
47625 This improves the behaviour for messages routed to rarely-used hosts such as MX
47626 backups. If such a host was down at one time, and happens to be down again when
47627 Exim tries a month later, using the old retry data would imply that it had been
47628 down all the time, which is not a justified assumption.
47629 </para>
47630 <para>
47631 If a host really is permanently dead, this behaviour causes a burst of retries
47632 every now and again, but only if messages routed to it are rare. If there is a
47633 message at least once every 7 days the retry data never expires.
47634 </para>
47635 </section>
47636 <section id="SECID166">
47637 <title>Long-term failures</title>
47638 <para>
47639 <indexterm role="concept">
47640 <primary>delivery failure, long-term</primary>
47641 </indexterm>
47642 <indexterm role="concept">
47643 <primary>retry</primary>
47644 <secondary>after long-term failure</secondary>
47645 </indexterm>
47646 Special processing happens when an email address has been failing for so long
47647 that the cutoff time for the last algorithm is reached. For example, using the
47648 default retry rule:
47649 </para>
47650 <literallayout class="monospaced">
47651 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
47652 </literallayout>
47653 <para>
47654 the cutoff time is four days. Reaching the retry cutoff is independent of how
47655 long any specific message has been failing; it is the length of continuous
47656 failure for the recipient address that counts.
47657 </para>
47658 <para>
47659 When the cutoff time is reached for a local delivery, or for all the IP
47660 addresses associated with a remote delivery, a subsequent delivery failure
47661 causes Exim to give up on the address, and a bounce message is generated.
47662 In order to cater for new messages that use the failing address, a next retry
47663 time is still computed from the final algorithm, and is used as follows:
47664 </para>
47665 <para>
47666 For local deliveries, one delivery attempt is always made for any subsequent
47667 messages. If this delivery fails, the address fails immediately. The
47668 post-cutoff retry time is not used.
47669 </para>
47670 <para>
47671 If the delivery is remote, there are two possibilities, controlled by the
47672 <indexterm role="option">
47673 <primary><option>delay_after_cutoff</option></primary>
47674 </indexterm>
47675 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
47676 default. Until the post-cutoff retry time for one of the IP addresses is
47677 reached, the failing email address is bounced immediately, without a delivery
47678 attempt taking place. After that time, one new delivery attempt is made to
47679 those IP addresses that are past their retry times, and if that still fails,
47680 the address is bounced and new retry times are computed.
47681 </para>
47682 <para>
47683 In other words, when all the hosts for a given email address have been failing
47684 for a long time, Exim bounces rather then defers until one of the hosts&#x2019; retry
47685 times is reached. Then it tries once, and bounces if that attempt fails. This
47686 behaviour ensures that few resources are wasted in repeatedly trying to deliver
47687 to a broken destination, but if the host does recover, Exim will eventually
47688 notice.
47689 </para>
47690 <para>
47691 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
47692 addresses are past their final cutoff time, Exim tries to deliver to those IP
47693 addresses that have not been tried since the message arrived. If there are
47694 no suitable IP addresses, or if they all fail, the address is bounced. In other
47695 words, it does not delay when a new message arrives, but tries the expired
47696 addresses immediately, unless they have been tried since the message arrived.
47697 If there is a continuous stream of messages for the failing domains, setting
47698 <option>delay_after_cutoff</option> false means that there will be many more attempts to
47699 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
47700 true.
47701 </para>
47702 </section>
47703 <section id="SECID167">
47704 <title>Deliveries that work intermittently</title>
47705 <para>
47706 <indexterm role="concept">
47707 <primary>retry</primary>
47708 <secondary>intermittently working deliveries</secondary>
47709 </indexterm>
47710 Some additional logic is needed to cope with cases where a host is
47711 intermittently available, or when a message has some attribute that prevents
47712 its delivery when others to the same address get through. In this situation,
47713 because some messages are successfully delivered, the <quote>retry clock</quote> for the
47714 host or address keeps getting reset by the successful deliveries, and so
47715 failing messages remain on the queue for ever because the cutoff time is never
47716 reached.
47717 </para>
47718 <para>
47719 Two exceptional actions are applied to prevent this happening. The first
47720 applies to errors that are related to a message rather than a remote host.
47721 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
47722 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
47723 commands, and quota failures. For this type of error, if a message&#x2019;s arrival
47724 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
47725 is used when scanning the retry rules to decide when to try next and when to
47726 time out the address.
47727 </para>
47728 <para>
47729 The exceptional second action applies in all cases. If a message has been on
47730 the queue for longer than the cutoff time of any applicable retry rule for a
47731 given address, a delivery is attempted for that address, even if it is not yet
47732 time, and if this delivery fails, the address is timed out. A new retry time is
47733 not computed in this case, so that other messages for the same address are
47734 considered immediately.
47735 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
47736 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
47737 </para>
47738 </section>
47739 </chapter>
47740
47741 <chapter id="CHAPSMTPAUTH">
47742 <title>SMTP authentication</title>
47743 <para>
47744 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
47745 <primary>SMTP</primary>
47746 <secondary>authentication configuration</secondary>
47747 </indexterm>
47748 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
47749 <primary>authentication</primary>
47750 </indexterm>
47751 The <quote>authenticators</quote> section of Exim&#x2019;s run time configuration is concerned
47752 with SMTP authentication. This facility is an extension to the SMTP protocol,
47753 described in RFC 2554, which allows a client SMTP host to authenticate itself
47754 to a server. This is a common way for a server to recognize clients that are
47755 permitted to use it as a relay. SMTP authentication is not of relevance to the
47756 transfer of mail between servers that have no managerial connection with each
47757 other.
47758 </para>
47759 <para>
47760 <indexterm role="concept">
47761 <primary>AUTH</primary>
47762 <secondary>description of</secondary>
47763 </indexterm>
47764 Very briefly, the way SMTP authentication works is as follows:
47765 </para>
47766 <itemizedlist>
47767 <listitem>
47768 <para>
47769 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
47770 the client&#x2019;s EHLO command.
47771 </para>
47772 </listitem>
47773 <listitem>
47774 <para>
47775 The client issues an AUTH command, naming a specific mechanism. The command
47776 may, optionally, contain some authentication data.
47777 </para>
47778 </listitem>
47779 <listitem>
47780 <para>
47781 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
47782 appropriate responses. In simple authentication mechanisms, the challenges are
47783 just prompts for user names and passwords. The server does not have to issue
47784 any challenges &ndash; in some mechanisms the relevant data may all be transmitted
47785 with the AUTH command.
47786 </para>
47787 </listitem>
47788 <listitem>
47789 <para>
47790 The server either accepts or denies authentication.
47791 </para>
47792 </listitem>
47793 <listitem>
47794 <para>
47795 If authentication succeeds, the client may optionally make use of the AUTH
47796 option on the MAIL command to pass an authenticated sender in subsequent
47797 mail transactions. Authentication lasts for the remainder of the SMTP
47798 connection.
47799 </para>
47800 </listitem>
47801 <listitem>
47802 <para>
47803 If authentication fails, the client may give up, or it may try a different
47804 authentication mechanism, or it may try transferring mail over the
47805 unauthenticated connection.
47806 </para>
47807 </listitem>
47808 </itemizedlist>
47809 <para>
47810 If you are setting up a client, and want to know which authentication
47811 mechanisms the server supports, you can use Telnet to connect to port 25 (the
47812 SMTP port) on the server, and issue an EHLO command. The response to this
47813 includes the list of supported mechanisms. For example:
47814 </para>
47815 <literallayout>
47816 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
47817 <literal>Trying 192.168.34.25...</literal>
47818 <literal>Connected to server.example.</literal>
47819 <literal>Escape character is &#x0027;^]&#x0027;.</literal>
47820 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
47821 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
47822 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
47823 <literal>250-SIZE 52428800</literal>
47824 <literal>250-PIPELINING</literal>
47825 <literal>250-AUTH PLAIN</literal>
47826 <literal>250 HELP</literal>
47827 </literallayout>
47828 <para>
47829 The second-last line of this example output shows that the server supports
47830 authentication using the PLAIN mechanism. In Exim, the different authentication
47831 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
47832 routers and transports, which authenticators are included in the binary is
47833 controlled by build-time definitions. The following are currently available,
47834 included by setting
47835 </para>
47836 <literallayout class="monospaced">
47837 AUTH_CRAM_MD5=yes
47838 AUTH_CYRUS_SASL=yes
47839 AUTH_DOVECOT=yes
47840 AUTH_GSASL=yes
47841 AUTH_HEIMDAL_GSSAPI=yes
47842 AUTH_PLAINTEXT=yes
47843 AUTH_SPA=yes
47844 </literallayout>
47845 <para>
47846 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
47847 authentication mechanism (RFC 2195), and the second provides an interface to
47848 the Cyrus SASL authentication library.
47849 The third is an interface to Dovecot&#x2019;s authentication system, delegating the
47850 work via a socket interface.
47851 The fourth provides an interface to the GNU SASL authentication library, which
47852 provides mechanisms but typically not data sources.
47853 The fifth provides direct access to Heimdal GSSAPI, geared for Kerberos, but
47854 supporting setting a server keytab.
47855 The sixth can be configured to support
47856 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
47857 not formally documented, but used by several MUAs. The seventh authenticator
47858 supports Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> mechanism.
47859 </para>
47860 <para>
47861 The authenticators are configured using the same syntax as other drivers (see
47862 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
47863 authentication section need be present in the configuration file. Each
47864 authenticator can in principle have both server and client functions. When Exim
47865 is receiving SMTP mail, it is acting as a server; when it is sending out
47866 messages over SMTP, it is acting as a client. Authenticator configuration
47867 options are provided for use in both these circumstances.
47868 </para>
47869 <para>
47870 To make it clear which options apply to which situation, the prefixes
47871 <option>server_</option> and <option>client_</option> are used on option names that are specific to
47872 either the server or the client function, respectively. Server and client
47873 functions are disabled if none of their options are set. If an authenticator is
47874 to be used for both server and client functions, a single definition, using
47875 both sets of options, is required. For example:
47876 </para>
47877 <literallayout class="monospaced">
47878 cram:
47879   driver = cram_md5
47880   public_name = CRAM-MD5
47881   server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
47882   client_name = ph10
47883   client_secret = secret2
47884 </literallayout>
47885 <para>
47886 The <option>server_</option> option is used when Exim is acting as a server, and the
47887 <option>client_</option> options when it is acting as a client.
47888 </para>
47889 <para>
47890 Descriptions of the individual authenticators are given in subsequent chapters.
47891 The remainder of this chapter covers the generic options for the
47892 authenticators, followed by general discussion of the way authentication works
47893 in Exim.
47894 </para>
47895 <para>
47896 <emphasis role="bold">Beware:</emphasis> the meaning of <varname>$auth1</varname>, <varname>$auth2</varname>, ... varies on a per-driver and
47897 per-mechanism basis.  Please read carefully to determine which variables hold
47898 account labels such as usercodes and which hold passwords or other
47899 authenticating data.
47900 </para>
47901 <para>
47902 Note that some mechanisms support two different identifiers for accounts: the
47903 <emphasis>authentication id</emphasis> and the <emphasis>authorization id</emphasis>.  The contractions <emphasis>authn</emphasis>
47904 and <emphasis>authz</emphasis> are commonly encountered.  The American spelling is standard here.
47905 Conceptually, authentication data such as passwords are tied to the identifier
47906 used to authenticate; servers may have rules to permit one user to act as a
47907 second user, so that after login the session is treated as though that second
47908 user had logged in.  That second user is the <emphasis>authorization id</emphasis>.  A robust
47909 configuration might confirm that the <emphasis>authz</emphasis> field is empty or matches the
47910 <emphasis>authn</emphasis> field.  Often this is just ignored.  The <emphasis>authn</emphasis> can be considered
47911 as verified data, the <emphasis>authz</emphasis> as an unverified request which the server might
47912 choose to honour.
47913 </para>
47914 <para>
47915 A <emphasis>realm</emphasis> is a text string, typically a domain name, presented by a server
47916 to a client to help it select an account and credentials to use.  In some
47917 mechanisms, the client and server provably agree on the realm, but clients
47918 typically can not treat the realm as secure data to be blindly trusted.
47919 </para>
47920 <section id="SECID168">
47921 <title>Generic options for authenticators</title>
47922 <para>
47923 <indexterm role="concept">
47924 <primary>authentication</primary>
47925 <secondary>generic options</secondary>
47926 </indexterm>
47927 <indexterm role="concept">
47928 <primary>options</primary>
47929 <secondary>generic; for authenticators</secondary>
47930 </indexterm>
47931 </para>
47932 <para>
47933 <indexterm role="option">
47934 <primary><option>client_condition</option></primary>
47935 </indexterm>
47936 </para>
47937 <informaltable frame="all">
47938 <tgroup cols="4" colsep="0" rowsep="0">
47939 <colspec colwidth="8*" align="left"/>
47940 <colspec colwidth="6*" align="center"/>
47941 <colspec colwidth="6*" align="center"/>
47942 <colspec colwidth="6*" align="right"/>
47943 <tbody>
47944 <row>
47945 <entry><option>client_condition</option></entry>
47946 <entry>Use: <emphasis>authenticators</emphasis></entry>
47947 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47948 <entry>Default: <emphasis>unset</emphasis></entry>
47949 </row>
47950 </tbody>
47951 </tgroup>
47952 </informaltable>
47953 <para>
47954 When Exim is authenticating as a client, it skips any authenticator whose
47955 <option>client_condition</option> expansion yields <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>. This can be
47956 used, for example, to skip plain text authenticators when the connection is not
47957 encrypted by a setting such as:
47958 </para>
47959 <literallayout class="monospaced">
47960 client_condition = ${if !eq{$tls_out_cipher}{}}
47961 </literallayout>
47962 <para>
47963 <indexterm role="option">
47964 <primary><option>client_set_id</option></primary>
47965 </indexterm>
47966 </para>
47967 <informaltable frame="all">
47968 <tgroup cols="4" colsep="0" rowsep="0">
47969 <colspec colwidth="8*" align="left"/>
47970 <colspec colwidth="6*" align="center"/>
47971 <colspec colwidth="6*" align="center"/>
47972 <colspec colwidth="6*" align="right"/>
47973 <tbody>
47974 <row>
47975 <entry><option>client_set_id</option></entry>
47976 <entry>Use: <emphasis>authenticators</emphasis></entry>
47977 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47978 <entry>Default: <emphasis>unset</emphasis></entry>
47979 </row>
47980 </tbody>
47981 </tgroup>
47982 </informaltable>
47983 <para>
47984 When client authentication succeeds, this condition is expanded; the
47985 result is used in the log lines for outbound messasges.
47986 Typically it will be the user name used for authentication.
47987 </para>
47988 <para>
47989 <indexterm role="option">
47990 <primary><option>driver</option></primary>
47991 </indexterm>
47992 </para>
47993 <informaltable frame="all">
47994 <tgroup cols="4" colsep="0" rowsep="0">
47995 <colspec colwidth="8*" align="left"/>
47996 <colspec colwidth="6*" align="center"/>
47997 <colspec colwidth="6*" align="center"/>
47998 <colspec colwidth="6*" align="right"/>
47999 <tbody>
48000 <row>
48001 <entry><option>driver</option></entry>
48002 <entry>Use: <emphasis>authenticators</emphasis></entry>
48003 <entry>Type: <emphasis>string</emphasis></entry>
48004 <entry>Default: <emphasis>unset</emphasis></entry>
48005 </row>
48006 </tbody>
48007 </tgroup>
48008 </informaltable>
48009 <para>
48010 This option must always be set. It specifies which of the available
48011 authenticators is to be used.
48012 </para>
48013 <para>
48014 <indexterm role="option">
48015 <primary><option>public_name</option></primary>
48016 </indexterm>
48017 </para>
48018 <informaltable frame="all">
48019 <tgroup cols="4" colsep="0" rowsep="0">
48020 <colspec colwidth="8*" align="left"/>
48021 <colspec colwidth="6*" align="center"/>
48022 <colspec colwidth="6*" align="center"/>
48023 <colspec colwidth="6*" align="right"/>
48024 <tbody>
48025 <row>
48026 <entry><option>public_name</option></entry>
48027 <entry>Use: <emphasis>authenticators</emphasis></entry>
48028 <entry>Type: <emphasis>string</emphasis></entry>
48029 <entry>Default: <emphasis>unset</emphasis></entry>
48030 </row>
48031 </tbody>
48032 </tgroup>
48033 </informaltable>
48034 <para>
48035 This option specifies the name of the authentication mechanism that the driver
48036 implements, and by which it is known to the outside world. These names should
48037 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
48038 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
48039 defaults to the driver&#x2019;s instance name.
48040 </para>
48041 <para>
48042 <indexterm role="option">
48043 <primary><option>server_advertise_condition</option></primary>
48044 </indexterm>
48045 </para>
48046 <informaltable frame="all">
48047 <tgroup cols="4" colsep="0" rowsep="0">
48048 <colspec colwidth="8*" align="left"/>
48049 <colspec colwidth="6*" align="center"/>
48050 <colspec colwidth="6*" align="center"/>
48051 <colspec colwidth="6*" align="right"/>
48052 <tbody>
48053 <row>
48054 <entry><option>server_advertise_condition</option></entry>
48055 <entry>Use: <emphasis>authenticators</emphasis></entry>
48056 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48057 <entry>Default: <emphasis>unset</emphasis></entry>
48058 </row>
48059 </tbody>
48060 </tgroup>
48061 </informaltable>
48062 <para>
48063 When a server is about to advertise an authentication mechanism, the condition
48064 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
48065 mechanism is not advertised.
48066 If the expansion fails, the mechanism is not advertised. If the failure was not
48067 forced, and was not caused by a lookup defer, the incident is logged.
48068 See section <xref linkend="SECTauthexiser"/> below for further discussion.
48069 </para>
48070 <para>
48071 <indexterm role="option">
48072 <primary><option>server_condition</option></primary>
48073 </indexterm>
48074 </para>
48075 <informaltable frame="all">
48076 <tgroup cols="4" colsep="0" rowsep="0">
48077 <colspec colwidth="8*" align="left"/>
48078 <colspec colwidth="6*" align="center"/>
48079 <colspec colwidth="6*" align="center"/>
48080 <colspec colwidth="6*" align="right"/>
48081 <tbody>
48082 <row>
48083 <entry><option>server_condition</option></entry>
48084 <entry>Use: <emphasis>authenticators</emphasis></entry>
48085 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48086 <entry>Default: <emphasis>unset</emphasis></entry>
48087 </row>
48088 </tbody>
48089 </tgroup>
48090 </informaltable>
48091 <para>
48092 This option must be set for a <option>plaintext</option> server authenticator, where it
48093 is used directly to control authentication. See section <xref linkend="SECTplainserver"/>
48094 for details.
48095 </para>
48096 <para>
48097 For the <command>gsasl</command> authenticator, this option is required for various
48098 mechanisms; see chapter <xref linkend="CHAPgsasl"/> for details.
48099 </para>
48100 <para>
48101 For the other authenticators, <option>server_condition</option> can be used as an additional
48102 authentication or authorization mechanism that is applied after the other
48103 authenticator conditions succeed. If it is set, it is expanded when the
48104 authenticator would otherwise return a success code. If the expansion is forced
48105 to fail, authentication fails. Any other expansion failure causes a temporary
48106 error code to be returned. If the result of a successful expansion is an empty
48107 string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
48108 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds. For any
48109 other result, a temporary error code is returned, with the expanded string as
48110 the error text.
48111 </para>
48112 <para>
48113 <indexterm role="option">
48114 <primary><option>server_debug_print</option></primary>
48115 </indexterm>
48116 </para>
48117 <informaltable frame="all">
48118 <tgroup cols="4" colsep="0" rowsep="0">
48119 <colspec colwidth="8*" align="left"/>
48120 <colspec colwidth="6*" align="center"/>
48121 <colspec colwidth="6*" align="center"/>
48122 <colspec colwidth="6*" align="right"/>
48123 <tbody>
48124 <row>
48125 <entry><option>server_debug_print</option></entry>
48126 <entry>Use: <emphasis>authenticators</emphasis></entry>
48127 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48128 <entry>Default: <emphasis>unset</emphasis></entry>
48129 </row>
48130 </tbody>
48131 </tgroup>
48132 </informaltable>
48133 <para>
48134 If this option is set and authentication debugging is enabled (see the <option>-d</option>
48135 command line option), the string is expanded and included in the debugging
48136 output when the authenticator is run as a server. This can help with checking
48137 out the values of variables.
48138 If expansion of the string fails, the error message is written to the debugging
48139 output, and Exim carries on processing.
48140 </para>
48141 <para>
48142 <indexterm role="option">
48143 <primary><option>server_set_id</option></primary>
48144 </indexterm>
48145 </para>
48146 <informaltable frame="all">
48147 <tgroup cols="4" colsep="0" rowsep="0">
48148 <colspec colwidth="8*" align="left"/>
48149 <colspec colwidth="6*" align="center"/>
48150 <colspec colwidth="6*" align="center"/>
48151 <colspec colwidth="6*" align="right"/>
48152 <tbody>
48153 <row>
48154 <entry><option>server_set_id</option></entry>
48155 <entry>Use: <emphasis>authenticators</emphasis></entry>
48156 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48157 <entry>Default: <emphasis>unset</emphasis></entry>
48158 </row>
48159 </tbody>
48160 </tgroup>
48161 </informaltable>
48162 <para>
48163 <indexterm role="variable">
48164 <primary><varname>$authenticated_id</varname></primary>
48165 </indexterm>
48166 When an Exim server successfully authenticates a client, this string is
48167 expanded using data from the authentication, and preserved for any incoming
48168 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
48169 lines for incoming messages. For example, a user/password authenticator
48170 configuration might preserve the user name that was used to authenticate, and
48171 refer to it subsequently during delivery of the message.
48172 If expansion fails, the option is ignored.
48173 </para>
48174 <para>
48175 <indexterm role="option">
48176 <primary><option>server_mail_auth_condition</option></primary>
48177 </indexterm>
48178 </para>
48179 <informaltable frame="all">
48180 <tgroup cols="4" colsep="0" rowsep="0">
48181 <colspec colwidth="8*" align="left"/>
48182 <colspec colwidth="6*" align="center"/>
48183 <colspec colwidth="6*" align="center"/>
48184 <colspec colwidth="6*" align="right"/>
48185 <tbody>
48186 <row>
48187 <entry><option>server_mail_auth_condition</option></entry>
48188 <entry>Use: <emphasis>authenticators</emphasis></entry>
48189 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48190 <entry>Default: <emphasis>unset</emphasis></entry>
48191 </row>
48192 </tbody>
48193 </tgroup>
48194 </informaltable>
48195 <para>
48196 This option allows a server to discard authenticated sender addresses supplied
48197 as part of MAIL commands in SMTP connections that are authenticated by the
48198 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
48199 as part of the authentication process; instead its (unexpanded) value is
48200 remembered for later use.
48201 How it is used is described in the following section.
48202 </para>
48203 </section>
48204 <section id="SECTauthparamail">
48205 <title>The AUTH parameter on MAIL commands</title>
48206 <para>
48207 <indexterm role="concept">
48208 <primary>authentication</primary>
48209 <secondary>sender; authenticated</secondary>
48210 </indexterm>
48211 <indexterm role="concept">
48212 <primary>AUTH</primary>
48213 <secondary>on MAIL command</secondary>
48214 </indexterm>
48215 When a client supplied an AUTH= item on a MAIL command, Exim applies
48216 the following checks before accepting it as the authenticated sender of the
48217 message:
48218 </para>
48219 <itemizedlist>
48220 <listitem>
48221 <para>
48222 If the connection is not using extended SMTP (that is, HELO was used rather
48223 than EHLO), the use of AUTH= is a syntax error.
48224 </para>
48225 </listitem>
48226 <listitem>
48227 <para>
48228 If the value of the AUTH= parameter is <quote>&lt;&gt;</quote>, it is ignored.
48229 </para>
48230 </listitem>
48231 <listitem>
48232 <para>
48233 <indexterm role="variable">
48234 <primary><varname>$authenticated_sender</varname></primary>
48235 </indexterm>
48236 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
48237 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
48238 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
48239 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
48240 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
48241 given for the MAIL command.
48242 </para>
48243 </listitem>
48244 <listitem>
48245 <para>
48246 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
48247 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
48248 authenticated.
48249 </para>
48250 </listitem>
48251 <listitem>
48252 <para>
48253 If the AUTH= value was accepted by either of the two previous rules, and
48254 the client has authenticated, and the authenticator has a setting for the
48255 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
48256 valued that was saved from the authenticator is expanded. If the expansion
48257 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
48258 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
48259 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
48260 message.
48261 </para>
48262 </listitem>
48263 </itemizedlist>
48264 <para>
48265 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
48266 hosts to which Exim authenticates as a client. Do not confuse this value with
48267 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
48268 process, and which is not usually a complete email address.
48269 </para>
48270 <para>
48271 <indexterm role="variable">
48272 <primary><varname>$sender_address</varname></primary>
48273 </indexterm>
48274 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
48275 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
48276 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
48277 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
48278 ACL is run.
48279 </para>
48280 </section>
48281 <section id="SECTauthexiser">
48282 <title>Authentication on an Exim server</title>
48283 <para>
48284 <indexterm role="concept">
48285 <primary>authentication</primary>
48286 <secondary>on an Exim server</secondary>
48287 </indexterm>
48288 When Exim receives an EHLO command, it advertises the public names of those
48289 authenticators that are configured as servers, subject to the following
48290 conditions:
48291 </para>
48292 <itemizedlist>
48293 <listitem>
48294 <para>
48295 The client host must match <option>auth_advertise_hosts</option> (default *).
48296 </para>
48297 </listitem>
48298 <listitem>
48299 <para>
48300 It the <option>server_advertise_condition</option> option is set, its expansion must not
48301 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
48302 </para>
48303 </listitem>
48304 </itemizedlist>
48305 <para>
48306 The order in which the authenticators are defined controls the order in which
48307 the mechanisms are advertised.
48308 </para>
48309 <para>
48310 Some mail clients (for example, some versions of Netscape) require the user to
48311 provide a name and password for authentication whenever AUTH is advertised,
48312 even though authentication may not in fact be needed (for example, Exim may be
48313 set up to allow unconditional relaying from the client by an IP address check).
48314 You can make such clients more friendly by not advertising AUTH to them.
48315 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
48316 that runs for RCPT) to relay without authentication, you should set
48317 </para>
48318 <literallayout class="monospaced">
48319 auth_advertise_hosts = ! 10.9.8.0/24
48320 </literallayout>
48321 <para>
48322 so that no authentication mechanisms are advertised to them.
48323 </para>
48324 <para>
48325 The <option>server_advertise_condition</option> controls the advertisement of individual
48326 authentication mechanisms. For example, it can be used to restrict the
48327 advertisement of a particular mechanism to encrypted connections, by a setting
48328 such as:
48329 </para>
48330 <literallayout class="monospaced">
48331 server_advertise_condition = ${if eq{$tls_in_cipher}{}{no}{yes}}
48332 </literallayout>
48333 <para>
48334 <indexterm role="variable">
48335 <primary><varname>$tls_in_cipher</varname></primary>
48336 </indexterm>
48337 If the session is encrypted, <varname>$tls_in_cipher</varname> is not empty, and so the expansion
48338 yields <quote>yes</quote>, which allows the advertisement to happen.
48339 </para>
48340 <para>
48341 When an Exim server receives an AUTH command from a client, it rejects it
48342 immediately if AUTH was not advertised in response to an earlier EHLO
48343 command. This is the case if
48344 </para>
48345 <itemizedlist>
48346 <listitem>
48347 <para>
48348 The client host does not match <option>auth_advertise_hosts</option>; or
48349 </para>
48350 </listitem>
48351 <listitem>
48352 <para>
48353 No authenticators are configured with server options; or
48354 </para>
48355 </listitem>
48356 <listitem>
48357 <para>
48358 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
48359 server authenticators.
48360 </para>
48361 </listitem>
48362 </itemizedlist>
48363 <para>
48364 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
48365 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
48366 AUTH is accepted from any client host.
48367 </para>
48368 <para>
48369 If AUTH is not rejected by the ACL, Exim searches its configuration for a
48370 server authentication mechanism that was advertised in response to EHLO and
48371 that matches the one named in the AUTH command. If it finds one, it runs
48372 the appropriate authentication protocol, and authentication either succeeds or
48373 fails. If there is no matching advertised mechanism, the AUTH command is
48374 rejected with a 504 error.
48375 </para>
48376 <para>
48377 <indexterm role="variable">
48378 <primary><varname>$received_protocol</varname></primary>
48379 </indexterm>
48380 <indexterm role="variable">
48381 <primary><varname>$sender_host_authenticated</varname></primary>
48382 </indexterm>
48383 When a message is received from an authenticated host, the value of
48384 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
48385 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
48386 public name) of the authenticator driver that successfully authenticated the
48387 client from which the message was received. This variable is empty if there was
48388 no successful authentication.
48389 </para>
48390 </section>
48391 <section id="SECID169">
48392 <title>Testing server authentication</title>
48393 <para>
48394 <indexterm role="concept">
48395 <primary>authentication</primary>
48396 <secondary>testing a server</secondary>
48397 </indexterm>
48398 <indexterm role="concept">
48399 <primary>AUTH</primary>
48400 <secondary>testing a server</secondary>
48401 </indexterm>
48402 <indexterm role="concept">
48403 <primary>base64 encoding</primary>
48404 <secondary>creating authentication test data</secondary>
48405 </indexterm>
48406 Exim&#x2019;s <option>-bh</option> option can be useful for testing server authentication
48407 configurations. The data for the AUTH command has to be sent using base64
48408 encoding. A quick way to produce such data for testing is the following Perl
48409 script:
48410 </para>
48411 <literallayout class="monospaced">
48412 use MIME::Base64;
48413 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
48414 </literallayout>
48415 <para>
48416 <indexterm role="concept">
48417 <primary>binary zero</primary>
48418 <secondary>in authentication data</secondary>
48419 </indexterm>
48420 This interprets its argument as a Perl string, and then encodes it. The
48421 interpretation as a Perl string allows binary zeros, which are required for
48422 some kinds of authentication, to be included in the data. For example, a
48423 command line to run this script on such data might be
48424 </para>
48425 <literallayout class="monospaced">
48426 encode '\0user\0password'
48427 </literallayout>
48428 <para>
48429 Note the use of single quotes to prevent the shell interpreting the
48430 backslashes, so that they can be interpreted by Perl to specify characters
48431 whose code value is zero.
48432 </para>
48433 <para>
48434 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
48435 digit, you must use three zeros instead of one after the leading backslash. If
48436 you do not, the octal digit that starts your string will be incorrectly
48437 interpreted as part of the code for the first character.
48438 </para>
48439 <para>
48440 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
48441 specially, you must use a Perl escape to prevent them being misinterpreted. For
48442 example, a command such as
48443 </para>
48444 <literallayout class="monospaced">
48445 encode '\0user@domain.com\0pas$$word'
48446 </literallayout>
48447 <para>
48448 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
48449 </para>
48450 <para>
48451 If you have the <option>mimencode</option> command installed, another way to do produce
48452 base64-encoded strings is to run the command
48453 </para>
48454 <literallayout class="monospaced">
48455 echo -e -n `\0user\0password' | mimencode
48456 </literallayout>
48457 <para>
48458 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
48459 in the argument, and the <option>-n</option> option specifies no newline at the end of its
48460 output. However, not all versions of <option>echo</option> recognize these options, so you
48461 should check your version before relying on this suggestion.
48462 </para>
48463 </section>
48464 <section id="SECID170">
48465 <title>Authentication by an Exim client</title>
48466 <para>
48467 <indexterm role="concept">
48468 <primary>authentication</primary>
48469 <secondary>on an Exim client</secondary>
48470 </indexterm>
48471 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
48472 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
48473 announces support for authentication, and the host matches an entry in either
48474 of these options, Exim (as a client) tries to authenticate as follows:
48475 </para>
48476 <itemizedlist>
48477 <listitem>
48478 <para>
48479 For each authenticator that is configured as a client, in the order in which
48480 they are defined in the configuration, it searches the authentication
48481 mechanisms announced by the server for one whose name matches the public name
48482 of the authenticator.
48483 </para>
48484 </listitem>
48485 <listitem>
48486 <para>
48487 <indexterm role="variable">
48488 <primary><varname>$host</varname></primary>
48489 </indexterm>
48490 <indexterm role="variable">
48491 <primary><varname>$host_address</varname></primary>
48492 </indexterm>
48493 When it finds one that matches, it runs the authenticator&#x2019;s client code. The
48494 variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string expansions
48495 that the client might do. They are set to the server&#x2019;s name and IP address. If
48496 any expansion is forced to fail, the authentication attempt is abandoned, and
48497 Exim moves on to the next authenticator. Otherwise an expansion failure causes
48498 delivery to be deferred.
48499 </para>
48500 </listitem>
48501 <listitem>
48502 <para>
48503 If the result of the authentication attempt is a temporary error or a timeout,
48504 Exim abandons trying to send the message to the host for the moment. It will
48505 try again later. If there are any backup hosts available, they are tried in the
48506 usual way.
48507 </para>
48508 </listitem>
48509 <listitem>
48510 <para>
48511 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
48512 carries on searching the list of authenticators and tries another one if
48513 possible. If all authentication attempts give permanent errors, or if there are
48514 no attempts because no mechanisms match (or option expansions force failure),
48515 what happens depends on whether the host matches <option>hosts_require_auth</option> or
48516 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
48517 delivery is deferred. The error can be detected in the retry rules, and thereby
48518 turned into a permanent error if you wish. In the second case, Exim tries to
48519 deliver the message unauthenticated.
48520 </para>
48521 </listitem>
48522 </itemizedlist>
48523 <para>
48524 <indexterm role="concept">
48525 <primary>AUTH</primary>
48526 <secondary>on MAIL command</secondary>
48527 </indexterm>
48528 When Exim has authenticated itself to a remote server, it adds the AUTH
48529 parameter to the MAIL commands it sends, if it has an authenticated sender for
48530 the message. If the message came from a remote host, the authenticated sender
48531 is the one that was receiving on an incoming MAIL command, provided that the
48532 incoming connection was authenticated and the <option>server_mail_auth</option> condition
48533 allowed the authenticated sender to be retained. If a local process calls Exim
48534 to send a message, the sender address that is built from the login name and
48535 <option>qualify_domain</option> is treated as authenticated. However, if the
48536 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
48537 the authenticated sender that was received with the message.
48538 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
48539 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
48540 </para>
48541 </section>
48542 </chapter>
48543
48544 <chapter id="CHAPplaintext">
48545 <title>The plaintext authenticator</title>
48546 <para>
48547 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
48548 <primary><command>plaintext</command> authenticator</primary>
48549 </indexterm>
48550 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
48551 <primary>authenticators</primary>
48552 <secondary><command>plaintext</command></secondary>
48553 </indexterm>
48554 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
48555 LOGIN authentication mechanisms, both of which transfer authentication data as
48556 plain (unencrypted) text (though base64 encoded). The use of plain text is a
48557 security risk; you are strongly advised to insist on the use of SMTP encryption
48558 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
48559 use unencrypted plain text, you should not use the same passwords for SMTP
48560 connections as you do for login accounts.
48561 </para>
48562 <section id="SECID171">
48563 <title>Plaintext options</title>
48564 <para>
48565 <indexterm role="concept">
48566 <primary>options</primary>
48567 <secondary><command>plaintext</command> authenticator (server)</secondary>
48568 </indexterm>
48569 When configured as a server, <command>plaintext</command> uses the following options:
48570 </para>
48571 <para>
48572 <indexterm role="option">
48573 <primary><option>server_condition</option></primary>
48574 </indexterm>
48575 </para>
48576 <informaltable frame="all">
48577 <tgroup cols="4" colsep="0" rowsep="0">
48578 <colspec colwidth="8*" align="left"/>
48579 <colspec colwidth="6*" align="center"/>
48580 <colspec colwidth="6*" align="center"/>
48581 <colspec colwidth="6*" align="right"/>
48582 <tbody>
48583 <row>
48584 <entry><option>server_condition</option></entry>
48585 <entry>Use: <emphasis>authenticators</emphasis></entry>
48586 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48587 <entry>Default: <emphasis>unset</emphasis></entry>
48588 </row>
48589 </tbody>
48590 </tgroup>
48591 </informaltable>
48592 <para>
48593 This is actually a global authentication option, but it must be set in order to
48594 configure the <command>plaintext</command> driver as a server. Its use is described below.
48595 </para>
48596 <para>
48597 <indexterm role="option">
48598 <primary><option>server_prompts</option></primary>
48599 </indexterm>
48600 </para>
48601 <informaltable frame="all">
48602 <tgroup cols="4" colsep="0" rowsep="0">
48603 <colspec colwidth="8*" align="left"/>
48604 <colspec colwidth="6*" align="center"/>
48605 <colspec colwidth="6*" align="center"/>
48606 <colspec colwidth="6*" align="right"/>
48607 <tbody>
48608 <row>
48609 <entry><option>server_prompts</option></entry>
48610 <entry>Use: <emphasis>plaintext</emphasis></entry>
48611 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48612 <entry>Default: <emphasis>unset</emphasis></entry>
48613 </row>
48614 </tbody>
48615 </tgroup>
48616 </informaltable>
48617 <para>
48618 The contents of this option, after expansion, must be a colon-separated list of
48619 prompt strings. If expansion fails, a temporary authentication rejection is
48620 given.
48621 </para>
48622 </section>
48623 <section id="SECTplainserver">
48624 <title>Using plaintext in a server</title>
48625 <para>
48626 <indexterm role="concept">
48627 <primary>AUTH</primary>
48628 <secondary>in <command>plaintext</command> authenticator</secondary>
48629 </indexterm>
48630 <indexterm role="concept">
48631 <primary>binary zero</primary>
48632 <secondary>in <command>plaintext</command> authenticator</secondary>
48633 </indexterm>
48634 <indexterm role="concept">
48635 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
48636 <secondary>in <command>plaintext</command> authenticator</secondary>
48637 </indexterm>
48638 <indexterm role="variable">
48639 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
48640 </indexterm>
48641 <indexterm role="concept">
48642 <primary>base64 encoding</primary>
48643 <secondary>in <command>plaintext</command> authenticator</secondary>
48644 </indexterm>
48645 </para>
48646 <para>
48647 When running as a server, <command>plaintext</command> performs the authentication test by
48648 expanding a string. The data sent by the client with the AUTH command, or in
48649 response to subsequent prompts, is base64 encoded, and so may contain any byte
48650 values when decoded. If any data is supplied with the command, it is treated as
48651 a list of strings, separated by NULs (binary zeros), the first three of which
48652 are placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname>
48653 (neither LOGIN nor PLAIN uses more than three strings).
48654 </para>
48655 <para>
48656 For compatibility with previous releases of Exim, the values are also placed in
48657 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
48658 variables for this purpose is now deprecated, as it can lead to confusion in
48659 string expansions that also use them for other things.
48660 </para>
48661 <para>
48662 If there are more strings in <option>server_prompts</option> than the number of strings
48663 supplied with the AUTH command, the remaining prompts are used to obtain more
48664 data. Each response from the client may be a list of NUL-separated strings.
48665 </para>
48666 <para>
48667 <indexterm role="variable">
48668 <primary><varname>$authenticated_id</varname></primary>
48669 </indexterm>
48670 Once a sufficient number of data strings have been received,
48671 <option>server_condition</option> is expanded. If the expansion is forced to fail,
48672 authentication fails. Any other expansion failure causes a temporary error code
48673 to be returned. If the result of a successful expansion is an empty string,
48674 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
48675 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
48676 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
48677 For any other result, a temporary error code is returned, with the expanded
48678 string as the error text
48679 </para>
48680 <para>
48681 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user&#x2019;s
48682 password, be sure to make the authentication fail if the user is unknown.
48683 There are good and bad examples at the end of the next section.
48684 </para>
48685 </section>
48686 <section id="SECID172">
48687 <title>The PLAIN authentication mechanism</title>
48688 <para>
48689 <indexterm role="concept">
48690 <primary>PLAIN authentication mechanism</primary>
48691 </indexterm>
48692 <indexterm role="concept">
48693 <primary>authentication</primary>
48694 <secondary>PLAIN mechanism</secondary>
48695 </indexterm>
48696 <indexterm role="concept">
48697 <primary>binary zero</primary>
48698 <secondary>in <command>plaintext</command> authenticator</secondary>
48699 </indexterm>
48700 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
48701 sent as one item of data (that is, one combined string containing two NUL
48702 separators). The data is sent either as part of the AUTH command, or
48703 subsequently in response to an empty prompt from the server.
48704 </para>
48705 <para>
48706 The second and third strings are a user name and a corresponding password.
48707 Using a single fixed user name and password as an example, this could be
48708 configured as follows:
48709 </para>
48710 <literallayout class="monospaced">
48711 fixed_plain:
48712   driver = plaintext
48713   public_name = PLAIN
48714   server_prompts = :
48715   server_condition = \
48716     ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
48717   server_set_id = $auth2
48718 </literallayout>
48719 <para>
48720 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
48721 are exactly what we want here, so they need not be specified. Obviously, if the
48722 password contains expansion-significant characters such as dollar, backslash,
48723 or closing brace, they have to be escaped.
48724 </para>
48725 <para>
48726 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
48727 the end of a string list are ignored). If all the data comes as part of the
48728 AUTH command, as is commonly the case, the prompt is not used. This
48729 authenticator is advertised in the response to EHLO as
48730 </para>
48731 <literallayout class="monospaced">
48732 250-AUTH PLAIN
48733 </literallayout>
48734 <para>
48735 and a client host can authenticate itself by sending the command
48736 </para>
48737 <literallayout class="monospaced">
48738 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
48739 </literallayout>
48740 <para>
48741 As this contains three strings (more than the number of prompts), no further
48742 data is required from the client. Alternatively, the client may just send
48743 </para>
48744 <literallayout class="monospaced">
48745 AUTH PLAIN
48746 </literallayout>
48747 <para>
48748 to initiate authentication, in which case the server replies with an empty
48749 prompt. The client must respond with the combined data string.
48750 </para>
48751 <para>
48752 The data string is base64 encoded, as required by the RFC. This example,
48753 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;
48754 represents a zero byte. This is split up into three strings, the first of which
48755 is empty. The <option>server_condition</option> option in the authenticator checks that the
48756 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
48757 </para>
48758 <para>
48759 Having just one fixed user name and password, as in this example, is not very
48760 realistic, though for a small organization with only a handful of
48761 authenticating clients it could make sense.
48762 </para>
48763 <para>
48764 A more sophisticated instance of this authenticator could use the user name in
48765 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
48766 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
48767 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
48768 This is an incorrect example:
48769 </para>
48770 <literallayout class="monospaced">
48771 server_condition = \
48772   ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
48773 </literallayout>
48774 <para>
48775 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
48776 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
48777 incorrect? It works fine for existing users, but consider what happens if a
48778 non-existent user name is given. The lookup fails, but as no success/failure
48779 strings are given for the lookup, it yields an empty string. Thus, to defeat
48780 the authentication, all a client has to do is to supply a non-existent user
48781 name and an empty password. The correct way of writing this test is:
48782 </para>
48783 <literallayout class="monospaced">
48784 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
48785   {${if eq{$value}{$auth3}}} {false}}
48786 </literallayout>
48787 <para>
48788 In this case, if the lookup succeeds, the result is checked; if the lookup
48789 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
48790 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
48791 always fails if its second argument is empty. However, the second way of
48792 writing the test makes the logic clearer.
48793 </para>
48794 </section>
48795 <section id="SECID173">
48796 <title>The LOGIN authentication mechanism</title>
48797 <para>
48798 <indexterm role="concept">
48799 <primary>LOGIN authentication mechanism</primary>
48800 </indexterm>
48801 <indexterm role="concept">
48802 <primary>authentication</primary>
48803 <secondary>LOGIN mechanism</secondary>
48804 </indexterm>
48805 The LOGIN authentication mechanism is not documented in any RFC, but is in use
48806 in a number of programs. No data is sent with the AUTH command. Instead, a
48807 user name and password are supplied separately, in response to prompts. The
48808 plaintext authenticator can be configured to support this as in this example:
48809 </para>
48810 <literallayout class="monospaced">
48811 fixed_login:
48812   driver = plaintext
48813   public_name = LOGIN
48814   server_prompts = User Name : Password
48815   server_condition = \
48816     ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
48817   server_set_id = $auth1
48818 </literallayout>
48819 <para>
48820 Because of the way plaintext operates, this authenticator accepts data supplied
48821 with the AUTH command (in contravention of the specification of LOGIN), but
48822 if the client does not supply it (as is the case for LOGIN clients), the prompt
48823 strings are used to obtain two data items.
48824 </para>
48825 <para>
48826 Some clients are very particular about the precise text of the prompts. For
48827 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
48828 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
48829 strings. It uses the <option>ldapauth</option> expansion condition to check the user
48830 name and password by binding to an LDAP server:
48831 </para>
48832 <literallayout class="monospaced">
48833 login:
48834   driver = plaintext
48835   public_name = LOGIN
48836   server_prompts = Username:: : Password::
48837   server_condition = ${if and{{ \
48838     !eq{}{$auth1} }{ \
48839     ldapauth{\
48840       user="uid=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
48841       pass=${quote:$auth2} \
48842       ldap://ldap.example.org/} }} }
48843   server_set_id = uid=$auth1,ou=people,o=example.org
48844 </literallayout>
48845 <para>
48846 We have to check that the username is not empty before using it, because LDAP
48847 does not permit empty DN components. We must also use the <option>quote_ldap_dn</option>
48848 operator to correctly quote the DN for authentication. However, the basic
48849 <option>quote</option> operator, rather than any of the LDAP quoting operators, is the
48850 correct one to use for the password, because quoting is needed only to make
48851 the password conform to the Exim syntax. At the LDAP level, the password is an
48852 uninterpreted string.
48853 </para>
48854 </section>
48855 <section id="SECID174">
48856 <title>Support for different kinds of authentication</title>
48857 <para>
48858 A number of string expansion features are provided for the purpose of
48859 interfacing to different ways of user authentication. These include checking
48860 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
48861 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
48862 <xref linkend="SECTexpcond"/>.
48863 </para>
48864 </section>
48865 <section id="SECID175">
48866 <title>Using plaintext in a client</title>
48867 <para>
48868 <indexterm role="concept">
48869 <primary>options</primary>
48870 <secondary><command>plaintext</command> authenticator (client)</secondary>
48871 </indexterm>
48872 The <command>plaintext</command> authenticator has two client options:
48873 </para>
48874 <para>
48875 <indexterm role="option">
48876 <primary><option>client_ignore_invalid_base64</option></primary>
48877 </indexterm>
48878 </para>
48879 <informaltable frame="all">
48880 <tgroup cols="4" colsep="0" rowsep="0">
48881 <colspec colwidth="8*" align="left"/>
48882 <colspec colwidth="6*" align="center"/>
48883 <colspec colwidth="6*" align="center"/>
48884 <colspec colwidth="6*" align="right"/>
48885 <tbody>
48886 <row>
48887 <entry><option>client_ignore_invalid_base64</option></entry>
48888 <entry>Use: <emphasis>plaintext</emphasis></entry>
48889 <entry>Type: <emphasis>boolean</emphasis></entry>
48890 <entry>Default: <emphasis>false</emphasis></entry>
48891 </row>
48892 </tbody>
48893 </tgroup>
48894 </informaltable>
48895 <para>
48896 If the client receives a server prompt that is not a valid base64 string,
48897 authentication is abandoned by default. However, if this option is set true,
48898 the error in the challenge is ignored and the client sends the response as
48899 usual.
48900 </para>
48901 <para>
48902 <indexterm role="option">
48903 <primary><option>client_send</option></primary>
48904 </indexterm>
48905 </para>
48906 <informaltable frame="all">
48907 <tgroup cols="4" colsep="0" rowsep="0">
48908 <colspec colwidth="8*" align="left"/>
48909 <colspec colwidth="6*" align="center"/>
48910 <colspec colwidth="6*" align="center"/>
48911 <colspec colwidth="6*" align="right"/>
48912 <tbody>
48913 <row>
48914 <entry><option>client_send</option></entry>
48915 <entry>Use: <emphasis>plaintext</emphasis></entry>
48916 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48917 <entry>Default: <emphasis>unset</emphasis></entry>
48918 </row>
48919 </tbody>
48920 </tgroup>
48921 </informaltable>
48922 <para>
48923 The string is a colon-separated list of authentication data strings. Each
48924 string is independently expanded before being sent to the server. The first
48925 string is sent with the AUTH command; any more strings are sent in response
48926 to prompts from the server. Before each string is expanded, the value of the
48927 most recent prompt is placed in the next <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable, starting
48928 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
48929 way. Thus, the prompt that is received in response to sending the first string
48930 (with the AUTH command) can be used in the expansion of the second string, and
48931 so on. If an invalid base64 string is received when
48932 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
48933 <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable.
48934 </para>
48935 <para>
48936 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
48937 splitting takes priority and happens first.
48938 </para>
48939 <para>
48940 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
48941 the data, further processing is applied to each string before it is sent. If
48942 there are any single circumflex characters in the string, they are converted to
48943 NULs. Should an actual circumflex be required as data, it must be doubled in
48944 the string.
48945 </para>
48946 <para>
48947 This is an example of a client configuration that implements the PLAIN
48948 authentication mechanism with a fixed user name and password:
48949 </para>
48950 <literallayout class="monospaced">
48951 fixed_plain:
48952   driver = plaintext
48953   public_name = PLAIN
48954   client_send = ^username^mysecret
48955 </literallayout>
48956 <para>
48957 The lack of colons means that the entire text is sent with the AUTH
48958 command, with the circumflex characters converted to NULs. A similar example
48959 that uses the LOGIN mechanism is:
48960 </para>
48961 <literallayout class="monospaced">
48962 fixed_login:
48963   driver = plaintext
48964   public_name = LOGIN
48965   client_send = : username : mysecret
48966 </literallayout>
48967 <para>
48968 The initial colon means that the first string is empty, so no data is sent with
48969 the AUTH command itself. The remaining strings are sent in response to
48970 prompts.
48971 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
48972 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
48973 </para>
48974 </section>
48975 </chapter>
48976
48977 <chapter id="CHID9">
48978 <title>The cram_md5 authenticator</title>
48979 <para>
48980 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
48981 <primary><command>cram_md5</command> authenticator</primary>
48982 </indexterm>
48983 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
48984 <primary>authenticators</primary>
48985 <secondary><command>cram_md5</command></secondary>
48986 </indexterm>
48987 <indexterm role="concept">
48988 <primary>CRAM-MD5 authentication mechanism</primary>
48989 </indexterm>
48990 <indexterm role="concept">
48991 <primary>authentication</primary>
48992 <secondary>CRAM-MD5 mechanism</secondary>
48993 </indexterm>
48994 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
48995 sends a challenge string to the client, and the response consists of a user
48996 name and the CRAM-MD5 digest of the challenge string combined with a secret
48997 string (password) which is known to both server and client. Thus, the secret
48998 is not sent over the network as plain text, which makes this authenticator more
48999 secure than <command>plaintext</command>. However, the downside is that the secret has to be
49000 available in plain text at either end.
49001 </para>
49002 <section id="SECID176">
49003 <title>Using cram_md5 as a server</title>
49004 <para>
49005 <indexterm role="concept">
49006 <primary>options</primary>
49007 <secondary><command>cram_md5</command> authenticator (server)</secondary>
49008 </indexterm>
49009 This authenticator has one server option, which must be set to configure the
49010 authenticator as a server:
49011 </para>
49012 <para>
49013 <indexterm role="option">
49014 <primary><option>server_secret</option></primary>
49015 </indexterm>
49016 </para>
49017 <informaltable frame="all">
49018 <tgroup cols="4" colsep="0" rowsep="0">
49019 <colspec colwidth="8*" align="left"/>
49020 <colspec colwidth="6*" align="center"/>
49021 <colspec colwidth="6*" align="center"/>
49022 <colspec colwidth="6*" align="right"/>
49023 <tbody>
49024 <row>
49025 <entry><option>server_secret</option></entry>
49026 <entry>Use: <emphasis>cram_md5</emphasis></entry>
49027 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49028 <entry>Default: <emphasis>unset</emphasis></entry>
49029 </row>
49030 </tbody>
49031 </tgroup>
49032 </informaltable>
49033 <para>
49034 <indexterm role="concept">
49035 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
49036 <secondary>in <command>cram_md5</command> authenticator</secondary>
49037 </indexterm>
49038 When the server receives the client&#x2019;s response, the user name is placed in
49039 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
49040 obtain the password for that user. The server then computes the CRAM-MD5 digest
49041 that the client should have sent, and checks that it received the correct
49042 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
49043 fails. If the expansion fails for some other reason, a temporary error code is
49044 returned to the client.
49045 </para>
49046 <para>
49047 For compatibility with previous releases of Exim, the user name is also placed
49048 in <varname>$1</varname>. However, the use of this variables for this purpose is now
49049 deprecated, as it can lead to confusion in string expansions that also use
49050 numeric variables for other things.
49051 </para>
49052 <para>
49053 For example, the following authenticator checks that the user name given by the
49054 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
49055 user name, authentication fails.
49056 </para>
49057 <literallayout class="monospaced">
49058 fixed_cram:
49059   driver = cram_md5
49060   public_name = CRAM-MD5
49061   server_secret = ${if eq{$auth1}{ph10}{secret}fail}
49062   server_set_id = $auth1
49063 </literallayout>
49064 <para>
49065 <indexterm role="variable">
49066 <primary><varname>$authenticated_id</varname></primary>
49067 </indexterm>
49068 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
49069 name in <varname>$authenticated_id</varname>. A more typical configuration might look up the
49070 secret string in a file, using the user name as the key. For example:
49071 </para>
49072 <literallayout class="monospaced">
49073 lookup_cram:
49074   driver = cram_md5
49075   public_name = CRAM-MD5
49076   server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}\
49077                   {$value}fail}
49078   server_set_id = $auth1
49079 </literallayout>
49080 <para>
49081 Note that this expansion explicitly forces failure if the lookup fails
49082 because <varname>$auth1</varname> contains an unknown user name.
49083 </para>
49084 <para>
49085 As another example, if you wish to re-use a Cyrus SASL sasldb2 file without
49086 using the relevant libraries, you need to know the realm to specify in the
49087 lookup and then ask for the <quote>userPassword</quote> attribute for that user in that
49088 realm, with:
49089 </para>
49090 <literallayout class="monospaced">
49091 cyrusless_crammd5:
49092   driver = cram_md5
49093   public_name = CRAM-MD5
49094   server_secret = ${lookup{$auth1:mail.example.org:userPassword}\
49095                   dbmjz{/etc/sasldb2}}
49096   server_set_id = $auth1
49097 </literallayout>
49098 </section>
49099 <section id="SECID177">
49100 <title>Using cram_md5 as a client</title>
49101 <para>
49102 <indexterm role="concept">
49103 <primary>options</primary>
49104 <secondary><command>cram_md5</command> authenticator (client)</secondary>
49105 </indexterm>
49106 When used as a client, the <command>cram_md5</command> authenticator has two options:
49107 </para>
49108 <para>
49109 <indexterm role="option">
49110 <primary><option>client_name</option></primary>
49111 </indexterm>
49112 </para>
49113 <informaltable frame="all">
49114 <tgroup cols="4" colsep="0" rowsep="0">
49115 <colspec colwidth="8*" align="left"/>
49116 <colspec colwidth="6*" align="center"/>
49117 <colspec colwidth="6*" align="center"/>
49118 <colspec colwidth="6*" align="right"/>
49119 <tbody>
49120 <row>
49121 <entry><option>client_name</option></entry>
49122 <entry>Use: <emphasis>cram_md5</emphasis></entry>
49123 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49124 <entry>Default: <emphasis>the primary host name</emphasis></entry>
49125 </row>
49126 </tbody>
49127 </tgroup>
49128 </informaltable>
49129 <para>
49130 This string is expanded, and the result used as the user name data when
49131 computing the response to the server&#x2019;s challenge.
49132 </para>
49133 <para>
49134 <indexterm role="option">
49135 <primary><option>client_secret</option></primary>
49136 </indexterm>
49137 </para>
49138 <informaltable frame="all">
49139 <tgroup cols="4" colsep="0" rowsep="0">
49140 <colspec colwidth="8*" align="left"/>
49141 <colspec colwidth="6*" align="center"/>
49142 <colspec colwidth="6*" align="center"/>
49143 <colspec colwidth="6*" align="right"/>
49144 <tbody>
49145 <row>
49146 <entry><option>client_secret</option></entry>
49147 <entry>Use: <emphasis>cram_md5</emphasis></entry>
49148 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49149 <entry>Default: <emphasis>unset</emphasis></entry>
49150 </row>
49151 </tbody>
49152 </tgroup>
49153 </informaltable>
49154 <para>
49155 This option must be set for the authenticator to work as a client. Its value is
49156 expanded and the result used as the secret string when computing the response.
49157 </para>
49158 <para>
49159 <indexterm role="variable">
49160 <primary><varname>$host</varname></primary>
49161 </indexterm>
49162 <indexterm role="variable">
49163 <primary><varname>$host_address</varname></primary>
49164 </indexterm>
49165 Different user names and secrets can be used for different servers by referring
49166 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
49167 expansion string is treated as an indication that this authenticator is not
49168 prepared to handle this case. Exim moves on to the next configured client
49169 authenticator. Any other expansion failure causes Exim to give up trying to
49170 send the message to the current server.
49171 </para>
49172 <para>
49173 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
49174 strings, is:
49175 </para>
49176 <literallayout class="monospaced">
49177 fixed_cram:
49178   driver = cram_md5
49179   public_name = CRAM-MD5
49180   client_name = ph10
49181   client_secret = secret
49182 </literallayout>
49183 <para>
49184 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
49185 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
49186 </para>
49187 </section>
49188 </chapter>
49189
49190 <chapter id="CHID10">
49191 <title>The cyrus_sasl authenticator</title>
49192 <para>
49193 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
49194 <primary><command>cyrus_sasl</command> authenticator</primary>
49195 </indexterm>
49196 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
49197 <primary>authenticators</primary>
49198 <secondary><command>cyrus_sasl</command></secondary>
49199 </indexterm>
49200 <indexterm role="concept">
49201 <primary>Cyrus</primary>
49202 <secondary>SASL library</secondary>
49203 </indexterm>
49204 <indexterm role="concept">
49205 <primary>Kerberos</primary>
49206 </indexterm>
49207 The code for this authenticator was provided by Matthew Byng-Maddick of A L
49208 Digital Ltd (<emphasis role="bold"><ulink url="http://www.aldigital.co.uk">http://www.aldigital.co.uk</ulink></emphasis>).
49209 </para>
49210 <para>
49211 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
49212 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
49213 Layer</quote>). This library supports a number of authentication mechanisms,
49214 including PLAIN and LOGIN, but also several others that Exim does not support
49215 directly. In particular, there is support for Kerberos authentication.
49216 </para>
49217 <para>
49218 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
49219 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
49220 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
49221 name of the driver to determine which mechanism to support.
49222 </para>
49223 <para>
49224 Where access to some kind of secret file is required, for example in GSSAPI
49225 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
49226 user, and that the Cyrus SASL library has no way of escalating privileges
49227 by default. You may also find you need to set environment variables,
49228 depending on the driver you are using.
49229 </para>
49230 <para>
49231 The application name provided by Exim is <quote>exim</quote>, so various SASL options may
49232 be set in <filename>exim.conf</filename> in your SASL directory. If you are using GSSAPI for
49233 Kerberos, note that because of limitations in the GSSAPI interface,
49234 changing the server keytab might need to be communicated down to the Kerberos
49235 layer independently. The mechanism for doing so is dependent upon the Kerberos
49236 implementation.
49237 </para>
49238 <para>
49239 For example, for older releases of Heimdal, the environment variable KRB5_KTNAME
49240 may be set to point to an alternative keytab file. Exim will pass this
49241 variable through from its own inherited environment when started as root or the
49242 Exim user. The keytab file needs to be readable by the Exim user.
49243 With newer releases of Heimdal, a setuid Exim may cause Heimdal to discard the
49244 environment variable.  In practice, for those releases, the Cyrus authenticator
49245 is not a suitable interface for GSSAPI (Kerberos) support.  Instead, consider
49246 the <command>heimdal_gssapi</command> authenticator, described in chapter <xref linkend="CHAPheimdalgss"/>
49247 </para>
49248 <section id="SECID178">
49249 <title>Using cyrus_sasl as a server</title>
49250 <para>
49251 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
49252 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
49253 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
49254 use of this variable for this purpose is now deprecated, as it can lead to
49255 confusion in string expansions that also use numeric variables for other
49256 things.
49257 </para>
49258 <para>
49259 <indexterm role="option">
49260 <primary><option>server_hostname</option></primary>
49261 </indexterm>
49262 </para>
49263 <informaltable frame="all">
49264 <tgroup cols="4" colsep="0" rowsep="0">
49265 <colspec colwidth="8*" align="left"/>
49266 <colspec colwidth="6*" align="center"/>
49267 <colspec colwidth="6*" align="center"/>
49268 <colspec colwidth="6*" align="right"/>
49269 <tbody>
49270 <row>
49271 <entry><option>server_hostname</option></entry>
49272 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
49273 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49274 <entry>Default: <emphasis>see below</emphasis></entry>
49275 </row>
49276 </tbody>
49277 </tgroup>
49278 </informaltable>
49279 <para>
49280 This option selects the hostname that is used when communicating with the
49281 library. The default value is <literal>$primary_hostname</literal>. It is up to the underlying
49282 SASL plug-in what it does with this data.
49283 </para>
49284 <para>
49285 <indexterm role="option">
49286 <primary><option>server_mech</option></primary>
49287 </indexterm>
49288 </para>
49289 <informaltable frame="all">
49290 <tgroup cols="4" colsep="0" rowsep="0">
49291 <colspec colwidth="8*" align="left"/>
49292 <colspec colwidth="6*" align="center"/>
49293 <colspec colwidth="6*" align="center"/>
49294 <colspec colwidth="6*" align="right"/>
49295 <tbody>
49296 <row>
49297 <entry><option>server_mech</option></entry>
49298 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
49299 <entry>Type: <emphasis>string</emphasis></entry>
49300 <entry>Default: <emphasis>see below</emphasis></entry>
49301 </row>
49302 </tbody>
49303 </tgroup>
49304 </informaltable>
49305 <para>
49306 This option selects the authentication mechanism this driver should use. The
49307 default is the value of the generic <option>public_name</option> option. This option allows
49308 you to use a different underlying mechanism from the advertised name. For
49309 example:
49310 </para>
49311 <literallayout class="monospaced">
49312 sasl:
49313   driver = cyrus_sasl
49314   public_name = X-ANYTHING
49315   server_mech = CRAM-MD5
49316   server_set_id = $auth1
49317 </literallayout>
49318 <para>
49319 <indexterm role="option">
49320 <primary><option>server_realm</option></primary>
49321 </indexterm>
49322 </para>
49323 <informaltable frame="all">
49324 <tgroup cols="4" colsep="0" rowsep="0">
49325 <colspec colwidth="8*" align="left"/>
49326 <colspec colwidth="6*" align="center"/>
49327 <colspec colwidth="6*" align="center"/>
49328 <colspec colwidth="6*" align="right"/>
49329 <tbody>
49330 <row>
49331 <entry><option>server_realm</option></entry>
49332 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
49333 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49334 <entry>Default: <emphasis>unset</emphasis></entry>
49335 </row>
49336 </tbody>
49337 </tgroup>
49338 </informaltable>
49339 <para>
49340 This specifies the SASL realm that the server claims to be in.
49341 </para>
49342 <para>
49343 <indexterm role="option">
49344 <primary><option>server_service</option></primary>
49345 </indexterm>
49346 </para>
49347 <informaltable frame="all">
49348 <tgroup cols="4" colsep="0" rowsep="0">
49349 <colspec colwidth="8*" align="left"/>
49350 <colspec colwidth="6*" align="center"/>
49351 <colspec colwidth="6*" align="center"/>
49352 <colspec colwidth="6*" align="right"/>
49353 <tbody>
49354 <row>
49355 <entry><option>server_service</option></entry>
49356 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
49357 <entry>Type: <emphasis>string</emphasis></entry>
49358 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
49359 </row>
49360 </tbody>
49361 </tgroup>
49362 </informaltable>
49363 <para>
49364 This is the SASL service that the server claims to implement.
49365 </para>
49366 <para>
49367 For straightforward cases, you do not need to set any of the authenticator&#x2019;s
49368 private options. All you need to do is to specify an appropriate mechanism as
49369 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
49370 PLAIN, you could have two authenticators as follows:
49371 </para>
49372 <literallayout class="monospaced">
49373 sasl_cram_md5:
49374   driver = cyrus_sasl
49375   public_name = CRAM-MD5
49376   server_set_id = $auth1
49377
49378 sasl_plain:
49379   driver = cyrus_sasl
49380   public_name = PLAIN
49381   server_set_id = $auth2
49382 </literallayout>
49383 <para>
49384 Cyrus SASL does implement the LOGIN authentication method, even though it is
49385 not a standard method. It is disabled by default in the source distribution,
49386 but it is present in many binary distributions.
49387 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
49388 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
49389 </para>
49390 </section>
49391 </chapter>
49392
49393 <chapter id="CHAPdovecot">
49394 <title>The dovecot authenticator</title>
49395 <para>
49396 <indexterm role="concept" id="IIDdcotauth1" class="startofrange">
49397 <primary><command>dovecot</command> authenticator</primary>
49398 </indexterm>
49399 <indexterm role="concept" id="IIDdcotauth2" class="startofrange">
49400 <primary>authenticators</primary>
49401 <secondary><command>dovecot</command></secondary>
49402 </indexterm>
49403 This authenticator is an interface to the authentication facility of the
49404 Dovecot POP/IMAP server, which can support a number of authentication methods.
49405 Note that Dovecot must be configured to use auth-client not auth-userdb.
49406 If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful
49407 to use the same mechanisms for SMTP authentication. This is a server
49408 authenticator only. There is only one option:
49409 </para>
49410 <para>
49411 <indexterm role="option">
49412 <primary><option>server_socket</option></primary>
49413 </indexterm>
49414 </para>
49415 <informaltable frame="all">
49416 <tgroup cols="4" colsep="0" rowsep="0">
49417 <colspec colwidth="8*" align="left"/>
49418 <colspec colwidth="6*" align="center"/>
49419 <colspec colwidth="6*" align="center"/>
49420 <colspec colwidth="6*" align="right"/>
49421 <tbody>
49422 <row>
49423 <entry><option>server_socket</option></entry>
49424 <entry>Use: <emphasis>dovecot</emphasis></entry>
49425 <entry>Type: <emphasis>string</emphasis></entry>
49426 <entry>Default: <emphasis>unset</emphasis></entry>
49427 </row>
49428 </tbody>
49429 </tgroup>
49430 </informaltable>
49431 <para>
49432 This option must specify the socket that is the interface to Dovecot
49433 authentication. The <option>public_name</option> option must specify an authentication
49434 mechanism that Dovecot is configured to support. You can have several
49435 authenticators for different mechanisms. For example:
49436 </para>
49437 <literallayout class="monospaced">
49438 dovecot_plain:
49439   driver = dovecot
49440   public_name = PLAIN
49441   server_socket = /var/run/dovecot/auth-client
49442   server_set_id = $auth1
49443
49444 dovecot_ntlm:
49445   driver = dovecot
49446   public_name = NTLM
49447   server_socket = /var/run/dovecot/auth-client
49448   server_set_id = $auth1
49449 </literallayout>
49450 <para>
49451 If the SMTP connection is encrypted, or if <varname>$sender_host_address</varname> is equal to
49452 <varname>$received_ip_address</varname> (that is, the connection is local), the <quote>secured</quote>
49453 option is passed in the Dovecot authentication command. If, for a TLS
49454 connection, a client certificate has been verified, the <quote>valid-client-cert</quote>
49455 option is passed. When authentication succeeds, the identity of the user
49456 who authenticated is placed in <varname>$auth1</varname>.
49457 <indexterm role="concept" startref="IIDdcotauth1" class="endofrange"/>
49458 <indexterm role="concept" startref="IIDdcotauth2" class="endofrange"/>
49459 </para>
49460 </chapter>
49461
49462 <chapter id="CHAPgsasl">
49463 <title>The gsasl authenticator</title>
49464 <para>
49465 <indexterm role="concept" id="IIDgsaslauth1" class="startofrange">
49466 <primary><command>gsasl</command> authenticator</primary>
49467 </indexterm>
49468 <indexterm role="concept" id="IIDgsaslauth2" class="startofrange">
49469 <primary>authenticators</primary>
49470 <secondary><command>gsasl</command></secondary>
49471 </indexterm>
49472 <indexterm role="concept">
49473 <primary>authentication</primary>
49474 <secondary>GNU SASL</secondary>
49475 </indexterm>
49476 <indexterm role="concept">
49477 <primary>authentication</primary>
49478 <secondary>SASL</secondary>
49479 </indexterm>
49480 <indexterm role="concept">
49481 <primary>authentication</primary>
49482 <secondary>EXTERNAL</secondary>
49483 </indexterm>
49484 <indexterm role="concept">
49485 <primary>authentication</primary>
49486 <secondary>ANONYMOUS</secondary>
49487 </indexterm>
49488 <indexterm role="concept">
49489 <primary>authentication</primary>
49490 <secondary>PLAIN</secondary>
49491 </indexterm>
49492 <indexterm role="concept">
49493 <primary>authentication</primary>
49494 <secondary>LOGIN</secondary>
49495 </indexterm>
49496 <indexterm role="concept">
49497 <primary>authentication</primary>
49498 <secondary>DIGEST-MD5</secondary>
49499 </indexterm>
49500 <indexterm role="concept">
49501 <primary>authentication</primary>
49502 <secondary>CRAM-MD5</secondary>
49503 </indexterm>
49504 <indexterm role="concept">
49505 <primary>authentication</primary>
49506 <secondary>SCRAM-SHA-1</secondary>
49507 </indexterm>
49508 The <command>gsasl</command> authenticator provides server integration for the GNU SASL
49509 library and the mechanisms it provides.  This is new as of the 4.80 release
49510 and there are a few areas where the library does not let Exim smoothly
49511 scale to handle future authentication mechanisms, so no guarantee can be
49512 made that any particular new authentication mechanism will be supported
49513 without code changes in Exim.
49514 </para>
49515 <para>
49516 <indexterm role="option">
49517 <primary><option>server_channelbinding</option></primary>
49518 </indexterm>
49519 </para>
49520 <informaltable frame="all">
49521 <tgroup cols="4" colsep="0" rowsep="0">
49522 <colspec colwidth="8*" align="left"/>
49523 <colspec colwidth="6*" align="center"/>
49524 <colspec colwidth="6*" align="center"/>
49525 <colspec colwidth="6*" align="right"/>
49526 <tbody>
49527 <row>
49528 <entry><option>server_channelbinding</option></entry>
49529 <entry>Use: <emphasis>gsasl</emphasis></entry>
49530 <entry>Type: <emphasis>boolean</emphasis></entry>
49531 <entry>Default: <emphasis>false</emphasis></entry>
49532 </row>
49533 </tbody>
49534 </tgroup>
49535 </informaltable>
49536 <para>
49537 Some authentication mechanisms are able to use external context at both ends
49538 of the session to bind the authentication to that context, and fail the
49539 authentication process if that context differs.  Specifically, some TLS
49540 ciphersuites can provide identifying information about the cryptographic
49541 context.
49542 </para>
49543 <para>
49544 This means that certificate identity and verification becomes a non-issue,
49545 as a man-in-the-middle attack will cause the correct client and server to
49546 see different identifiers and authentication will fail.
49547 </para>
49548 <para>
49549 This is currently only supported when using the GnuTLS library.  This is
49550 only usable by mechanisms which support "channel binding"; at time of
49551 writing, that&#x2019;s the SCRAM family.
49552 </para>
49553 <para>
49554 This defaults off to ensure smooth upgrade across Exim releases, in case
49555 this option causes some clients to start failing.  Some future release
49556 of Exim may switch the default to be true.
49557 </para>
49558 <para>
49559 <indexterm role="option">
49560 <primary><option>server_hostname</option></primary>
49561 </indexterm>
49562 </para>
49563 <informaltable frame="all">
49564 <tgroup cols="4" colsep="0" rowsep="0">
49565 <colspec colwidth="8*" align="left"/>
49566 <colspec colwidth="6*" align="center"/>
49567 <colspec colwidth="6*" align="center"/>
49568 <colspec colwidth="6*" align="right"/>
49569 <tbody>
49570 <row>
49571 <entry><option>server_hostname</option></entry>
49572 <entry>Use: <emphasis>gsasl</emphasis></entry>
49573 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49574 <entry>Default: <emphasis>see below</emphasis></entry>
49575 </row>
49576 </tbody>
49577 </tgroup>
49578 </informaltable>
49579 <para>
49580 This option selects the hostname that is used when communicating with the
49581 library. The default value is <literal>$primary_hostname</literal>.
49582 Some mechanisms will use this data.
49583 </para>
49584 <para>
49585 <indexterm role="option">
49586 <primary><option>server_mech</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_mech</option></entry>
49598 <entry>Use: <emphasis>gsasl</emphasis></entry>
49599 <entry>Type: <emphasis>string</emphasis></entry>
49600 <entry>Default: <emphasis>see below</emphasis></entry>
49601 </row>
49602 </tbody>
49603 </tgroup>
49604 </informaltable>
49605 <para>
49606 This option selects the authentication mechanism this driver should use. The
49607 default is the value of the generic <option>public_name</option> option. This option allows
49608 you to use a different underlying mechanism from the advertised name. For
49609 example:
49610 </para>
49611 <literallayout class="monospaced">
49612 sasl:
49613   driver = gsasl
49614   public_name = X-ANYTHING
49615   server_mech = CRAM-MD5
49616   server_set_id = $auth1
49617 </literallayout>
49618 <para>
49619 <indexterm role="option">
49620 <primary><option>server_password</option></primary>
49621 </indexterm>
49622 </para>
49623 <informaltable frame="all">
49624 <tgroup cols="4" colsep="0" rowsep="0">
49625 <colspec colwidth="8*" align="left"/>
49626 <colspec colwidth="6*" align="center"/>
49627 <colspec colwidth="6*" align="center"/>
49628 <colspec colwidth="6*" align="right"/>
49629 <tbody>
49630 <row>
49631 <entry><option>server_password</option></entry>
49632 <entry>Use: <emphasis>gsasl</emphasis></entry>
49633 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49634 <entry>Default: <emphasis>unset</emphasis></entry>
49635 </row>
49636 </tbody>
49637 </tgroup>
49638 </informaltable>
49639 <para>
49640 Various mechanisms need access to the cleartext password on the server, so
49641 that proof-of-possession can be demonstrated on the wire, without sending
49642 the password itself.
49643 </para>
49644 <para>
49645 The data available for lookup varies per mechanism.
49646 In all cases, <varname>$auth1</varname> is set to the <emphasis>authentication id</emphasis>.
49647 The <varname>$auth2</varname> variable will always be the <emphasis>authorization id</emphasis> (<emphasis>authz</emphasis>)
49648 if available, else the empty string.
49649 The <varname>$auth3</varname> variable will always be the <emphasis>realm</emphasis> if available,
49650 else the empty string.
49651 </para>
49652 <para>
49653 A forced failure will cause authentication to defer.
49654 </para>
49655 <para>
49656 If using this option, it may make sense to set the <option>server_condition</option>
49657 option to be simply "true".
49658 </para>
49659 <para>
49660 <indexterm role="option">
49661 <primary><option>server_realm</option></primary>
49662 </indexterm>
49663 </para>
49664 <informaltable frame="all">
49665 <tgroup cols="4" colsep="0" rowsep="0">
49666 <colspec colwidth="8*" align="left"/>
49667 <colspec colwidth="6*" align="center"/>
49668 <colspec colwidth="6*" align="center"/>
49669 <colspec colwidth="6*" align="right"/>
49670 <tbody>
49671 <row>
49672 <entry><option>server_realm</option></entry>
49673 <entry>Use: <emphasis>gsasl</emphasis></entry>
49674 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49675 <entry>Default: <emphasis>unset</emphasis></entry>
49676 </row>
49677 </tbody>
49678 </tgroup>
49679 </informaltable>
49680 <para>
49681 This specifies the SASL realm that the server claims to be in.
49682 Some mechanisms will use this data.
49683 </para>
49684 <para>
49685 <indexterm role="option">
49686 <primary><option>server_scram_iter</option></primary>
49687 </indexterm>
49688 </para>
49689 <informaltable frame="all">
49690 <tgroup cols="4" colsep="0" rowsep="0">
49691 <colspec colwidth="8*" align="left"/>
49692 <colspec colwidth="6*" align="center"/>
49693 <colspec colwidth="6*" align="center"/>
49694 <colspec colwidth="6*" align="right"/>
49695 <tbody>
49696 <row>
49697 <entry><option>server_scram_iter</option></entry>
49698 <entry>Use: <emphasis>gsasl</emphasis></entry>
49699 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49700 <entry>Default: <emphasis>unset</emphasis></entry>
49701 </row>
49702 </tbody>
49703 </tgroup>
49704 </informaltable>
49705 <para>
49706 This option provides data for the SCRAM family of mechanisms.
49707 <varname>$auth1</varname> is not available at evaluation time.
49708 (This may change, as we receive feedback on use)
49709 </para>
49710 <para>
49711 <indexterm role="option">
49712 <primary><option>server_scram_salt</option></primary>
49713 </indexterm>
49714 </para>
49715 <informaltable frame="all">
49716 <tgroup cols="4" colsep="0" rowsep="0">
49717 <colspec colwidth="8*" align="left"/>
49718 <colspec colwidth="6*" align="center"/>
49719 <colspec colwidth="6*" align="center"/>
49720 <colspec colwidth="6*" align="right"/>
49721 <tbody>
49722 <row>
49723 <entry><option>server_scram_salt</option></entry>
49724 <entry>Use: <emphasis>gsasl</emphasis></entry>
49725 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49726 <entry>Default: <emphasis>unset</emphasis></entry>
49727 </row>
49728 </tbody>
49729 </tgroup>
49730 </informaltable>
49731 <para>
49732 This option provides data for the SCRAM family of mechanisms.
49733 <varname>$auth1</varname> is not available at evaluation time.
49734 (This may change, as we receive feedback on use)
49735 </para>
49736 <para>
49737 <indexterm role="option">
49738 <primary><option>server_service</option></primary>
49739 </indexterm>
49740 </para>
49741 <informaltable frame="all">
49742 <tgroup cols="4" colsep="0" rowsep="0">
49743 <colspec colwidth="8*" align="left"/>
49744 <colspec colwidth="6*" align="center"/>
49745 <colspec colwidth="6*" align="center"/>
49746 <colspec colwidth="6*" align="right"/>
49747 <tbody>
49748 <row>
49749 <entry><option>server_service</option></entry>
49750 <entry>Use: <emphasis>gsasl</emphasis></entry>
49751 <entry>Type: <emphasis>string</emphasis></entry>
49752 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
49753 </row>
49754 </tbody>
49755 </tgroup>
49756 </informaltable>
49757 <para>
49758 This is the SASL service that the server claims to implement.
49759 Some mechanisms will use this data.
49760 </para>
49761 <section id="SECTgsaslauthvar">
49762 <title><command>gsasl</command> auth variables</title>
49763 <para>
49764 <indexterm role="variable">
49765 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
49766 </indexterm>
49767 These may be set when evaluating specific options, as detailed above.
49768 They will also be set when evaluating <option>server_condition</option>.
49769 </para>
49770 <para>
49771 Unless otherwise stated below, the <command>gsasl</command> integration will use the following
49772 meanings for these variables:
49773 </para>
49774 <itemizedlist>
49775 <listitem>
49776 <para>
49777 <indexterm role="variable">
49778 <primary><varname>$auth1</varname></primary>
49779 </indexterm>
49780 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>
49781 </para>
49782 </listitem>
49783 <listitem>
49784 <para>
49785 <indexterm role="variable">
49786 <primary><varname>$auth2</varname></primary>
49787 </indexterm>
49788 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>
49789 </para>
49790 </listitem>
49791 <listitem>
49792 <para>
49793 <indexterm role="variable">
49794 <primary><varname>$auth3</varname></primary>
49795 </indexterm>
49796 <varname>$auth3</varname>: the <emphasis>realm</emphasis>
49797 </para>
49798 </listitem>
49799 </itemizedlist>
49800 <para>
49801 On a per-mechanism basis:
49802 </para>
49803 <itemizedlist>
49804 <listitem>
49805 <para>
49806 <indexterm role="concept">
49807 <primary>authentication</primary>
49808 <secondary>EXTERNAL</secondary>
49809 </indexterm>
49810 EXTERNAL: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>authorization id</emphasis>;
49811 the <option>server_condition</option> option must be present.
49812 </para>
49813 </listitem>
49814 <listitem>
49815 <para>
49816 <indexterm role="concept">
49817 <primary>authentication</primary>
49818 <secondary>ANONYMOUS</secondary>
49819 </indexterm>
49820 ANONYMOUS: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>anonymous token</emphasis>;
49821 the <option>server_condition</option> option must be present.
49822 </para>
49823 </listitem>
49824 <listitem>
49825 <para>
49826 <indexterm role="concept">
49827 <primary>authentication</primary>
49828 <secondary>GSSAPI</secondary>
49829 </indexterm>
49830 GSSAPI: <varname>$auth1</varname> will be set to the <emphasis>GSSAPI Display Name</emphasis>;
49831 <varname>$auth2</varname> will be set to the <emphasis>authorization id</emphasis>,
49832 the <option>server_condition</option> option must be present.
49833 </para>
49834 </listitem>
49835 </itemizedlist>
49836 <para>
49837 An <emphasis>anonymous token</emphasis> is something passed along as an unauthenticated
49838 identifier; this is analogous to FTP anonymous authentication passing an
49839 email address, or software-identifier@, as the "password".
49840 </para>
49841 <para>
49842 An example showing the password having the realm specified in the callback
49843 and demonstrating a Cyrus SASL to GSASL migration approach is:
49844 </para>
49845 <literallayout class="monospaced">
49846 gsasl_cyrusless_crammd5:
49847   driver = gsasl
49848   public_name = CRAM-MD5
49849   server_realm = imap.example.org
49850   server_password = ${lookup{$auth1:$auth3:userPassword}\
49851                     dbmjz{/etc/sasldb2}{$value}fail}
49852   server_set_id = ${quote:$auth1}
49853   server_condition = yes
49854 </literallayout>
49855 </section>
49856 </chapter>
49857
49858 <chapter id="CHAPheimdalgss">
49859 <title>The heimdal_gssapi authenticator</title>
49860 <para>
49861 <indexterm role="concept" id="IIDheimdalgssauth1" class="startofrange">
49862 <primary><command>heimdal_gssapi</command> authenticator</primary>
49863 </indexterm>
49864 <indexterm role="concept" id="IIDheimdalgssauth2" class="startofrange">
49865 <primary>authenticators</primary>
49866 <secondary><command>heimdal_gssapi</command></secondary>
49867 </indexterm>
49868 <indexterm role="concept">
49869 <primary>authentication</primary>
49870 <secondary>GSSAPI</secondary>
49871 </indexterm>
49872 <indexterm role="concept">
49873 <primary>authentication</primary>
49874 <secondary>Kerberos</secondary>
49875 </indexterm>
49876 The <command>heimdal_gssapi</command> authenticator provides server integration for the
49877 Heimdal GSSAPI/Kerberos library, permitting Exim to set a keytab pathname
49878 reliably.
49879 </para>
49880 <para>
49881 <indexterm role="option">
49882 <primary><option>server_hostname</option></primary>
49883 </indexterm>
49884 </para>
49885 <informaltable frame="all">
49886 <tgroup cols="4" colsep="0" rowsep="0">
49887 <colspec colwidth="8*" align="left"/>
49888 <colspec colwidth="6*" align="center"/>
49889 <colspec colwidth="6*" align="center"/>
49890 <colspec colwidth="6*" align="right"/>
49891 <tbody>
49892 <row>
49893 <entry><option>server_hostname</option></entry>
49894 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
49895 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49896 <entry>Default: <emphasis>see below</emphasis></entry>
49897 </row>
49898 </tbody>
49899 </tgroup>
49900 </informaltable>
49901 <para>
49902 This option selects the hostname that is used, with <option>server_service</option>,
49903 for constructing the GSS server name, as a <emphasis>GSS_C_NT_HOSTBASED_SERVICE</emphasis>
49904 identifier.  The default value is <literal>$primary_hostname</literal>.
49905 </para>
49906 <para>
49907 <indexterm role="option">
49908 <primary><option>server_keytab</option></primary>
49909 </indexterm>
49910 </para>
49911 <informaltable frame="all">
49912 <tgroup cols="4" colsep="0" rowsep="0">
49913 <colspec colwidth="8*" align="left"/>
49914 <colspec colwidth="6*" align="center"/>
49915 <colspec colwidth="6*" align="center"/>
49916 <colspec colwidth="6*" align="right"/>
49917 <tbody>
49918 <row>
49919 <entry><option>server_keytab</option></entry>
49920 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
49921 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49922 <entry>Default: <emphasis>unset</emphasis></entry>
49923 </row>
49924 </tbody>
49925 </tgroup>
49926 </informaltable>
49927 <para>
49928 If set, then Heimdal will not use the system default keytab (typically
49929 <filename>/etc/krb5.keytab</filename>) but instead the pathname given in this option.
49930 The value should be a pathname, with no <quote>file:</quote> prefix.
49931 </para>
49932 <para>
49933 <indexterm role="option">
49934 <primary><option>server_service</option></primary>
49935 </indexterm>
49936 </para>
49937 <informaltable frame="all">
49938 <tgroup cols="4" colsep="0" rowsep="0">
49939 <colspec colwidth="8*" align="left"/>
49940 <colspec colwidth="6*" align="center"/>
49941 <colspec colwidth="6*" align="center"/>
49942 <colspec colwidth="6*" align="right"/>
49943 <tbody>
49944 <row>
49945 <entry><option>server_service</option></entry>
49946 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
49947 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49948 <entry>Default: <emphasis>smtp</emphasis></entry>
49949 </row>
49950 </tbody>
49951 </tgroup>
49952 </informaltable>
49953 <para>
49954 This option specifies the service identifier used, in conjunction with
49955 <option>server_hostname</option>, for building the identifer for finding credentials
49956 from the keytab.
49957 </para>
49958 <section id="SECTheimdalgssauthvar">
49959 <title><command>heimdal_gssapi</command> auth variables</title>
49960 <para>
49961 Beware that these variables will typically include a realm, thus will appear
49962 to be roughly like an email address already.  The <emphasis>authzid</emphasis> in <varname>$auth2</varname> is
49963 not verified, so a malicious client can set it to anything.
49964 </para>
49965 <para>
49966 The <varname>$auth1</varname> field should be safely trustable as a value from the Key
49967 Distribution Center.  Note that these are not quite email addresses.
49968 Each identifier is for a role, and so the left-hand-side may include a
49969 role suffix.  For instance, <quote>joe/admin@EXAMPLE.ORG</quote>.
49970 </para>
49971 <para>
49972 <indexterm role="variable">
49973 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
49974 </indexterm>
49975 </para>
49976 <itemizedlist>
49977 <listitem>
49978 <para>
49979 <indexterm role="variable">
49980 <primary><varname>$auth1</varname></primary>
49981 </indexterm>
49982 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>, set to the GSS Display Name.
49983 </para>
49984 </listitem>
49985 <listitem>
49986 <para>
49987 <indexterm role="variable">
49988 <primary><varname>$auth2</varname></primary>
49989 </indexterm>
49990 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>, sent within SASL encapsulation after
49991 authentication.  If that was empty, this will also be set to the
49992 GSS Display Name.
49993 </para>
49994 </listitem>
49995 </itemizedlist>
49996 </section>
49997 </chapter>
49998
49999 <chapter id="CHAPspa">
50000 <title>The spa authenticator</title>
50001 <para>
50002 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
50003 <primary><command>spa</command> authenticator</primary>
50004 </indexterm>
50005 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
50006 <primary>authenticators</primary>
50007 <secondary><command>spa</command></secondary>
50008 </indexterm>
50009 <indexterm role="concept">
50010 <primary>authentication</primary>
50011 <secondary>Microsoft Secure Password</secondary>
50012 </indexterm>
50013 <indexterm role="concept">
50014 <primary>authentication</primary>
50015 <secondary>NTLM</secondary>
50016 </indexterm>
50017 <indexterm role="concept">
50018 <primary>Microsoft Secure Password Authentication</primary>
50019 </indexterm>
50020 <indexterm role="concept">
50021 <primary>NTLM authentication</primary>
50022 </indexterm>
50023 The <command>spa</command> authenticator provides client support for Microsoft&#x2019;s <emphasis>Secure
50024 Password Authentication</emphasis> mechanism,
50025 which is also sometimes known as NTLM (NT LanMan). The code for client side of
50026 this authenticator was contributed by Marc Prud&#x2019;hommeaux, and much of it is
50027 taken from the Samba project (<emphasis role="bold"><ulink url="http://www.samba.org">http://www.samba.org</ulink></emphasis>). The code for the
50028 server side was subsequently contributed by Tom Kistner. The mechanism works as
50029 follows:
50030 </para>
50031 <itemizedlist>
50032 <listitem>
50033 <para>
50034 After the AUTH command has been accepted, the client sends an SPA
50035 authentication request based on the user name and optional domain.
50036 </para>
50037 </listitem>
50038 <listitem>
50039 <para>
50040 The server sends back a challenge.
50041 </para>
50042 </listitem>
50043 <listitem>
50044 <para>
50045 The client builds a challenge response which makes use of the user&#x2019;s password
50046 and sends it to the server, which then accepts or rejects it.
50047 </para>
50048 </listitem>
50049 </itemizedlist>
50050 <para>
50051 Encryption is used to protect the password in transit.
50052 </para>
50053 <section id="SECID179">
50054 <title>Using spa as a server</title>
50055 <para>
50056 <indexterm role="concept">
50057 <primary>options</primary>
50058 <secondary><command>spa</command> authenticator (server)</secondary>
50059 </indexterm>
50060 The <command>spa</command> authenticator has just one server option:
50061 </para>
50062 <para>
50063 <indexterm role="option">
50064 <primary><option>server_password</option></primary>
50065 </indexterm>
50066 </para>
50067 <informaltable frame="all">
50068 <tgroup cols="4" colsep="0" rowsep="0">
50069 <colspec colwidth="8*" align="left"/>
50070 <colspec colwidth="6*" align="center"/>
50071 <colspec colwidth="6*" align="center"/>
50072 <colspec colwidth="6*" align="right"/>
50073 <tbody>
50074 <row>
50075 <entry><option>server_password</option></entry>
50076 <entry>Use: <emphasis>spa</emphasis></entry>
50077 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50078 <entry>Default: <emphasis>unset</emphasis></entry>
50079 </row>
50080 </tbody>
50081 </tgroup>
50082 </informaltable>
50083 <para>
50084 <indexterm role="concept">
50085 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
50086 <secondary>in <command>spa</command> authenticator</secondary>
50087 </indexterm>
50088 This option is expanded, and the result must be the cleartext password for the
50089 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
50090 compatibility with previous releases of Exim, the user name is also placed in
50091 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
50092 it can lead to confusion in string expansions that also use numeric variables
50093 for other things. For example:
50094 </para>
50095 <literallayout class="monospaced">
50096 spa:
50097   driver = spa
50098   public_name = NTLM
50099   server_password = \
50100     ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
50101 </literallayout>
50102 <para>
50103 If the expansion is forced to fail, authentication fails. Any other expansion
50104 failure causes a temporary error code to be returned.
50105 </para>
50106 </section>
50107 <section id="SECID180">
50108 <title>Using spa as a client</title>
50109 <para>
50110 <indexterm role="concept">
50111 <primary>options</primary>
50112 <secondary><command>spa</command> authenticator (client)</secondary>
50113 </indexterm>
50114 The <command>spa</command> authenticator has the following client options:
50115 </para>
50116 <para>
50117 <indexterm role="option">
50118 <primary><option>client_domain</option></primary>
50119 </indexterm>
50120 </para>
50121 <informaltable frame="all">
50122 <tgroup cols="4" colsep="0" rowsep="0">
50123 <colspec colwidth="8*" align="left"/>
50124 <colspec colwidth="6*" align="center"/>
50125 <colspec colwidth="6*" align="center"/>
50126 <colspec colwidth="6*" align="right"/>
50127 <tbody>
50128 <row>
50129 <entry><option>client_domain</option></entry>
50130 <entry>Use: <emphasis>spa</emphasis></entry>
50131 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50132 <entry>Default: <emphasis>unset</emphasis></entry>
50133 </row>
50134 </tbody>
50135 </tgroup>
50136 </informaltable>
50137 <para>
50138 This option specifies an optional domain for the authentication.
50139 </para>
50140 <para>
50141 <indexterm role="option">
50142 <primary><option>client_password</option></primary>
50143 </indexterm>
50144 </para>
50145 <informaltable frame="all">
50146 <tgroup cols="4" colsep="0" rowsep="0">
50147 <colspec colwidth="8*" align="left"/>
50148 <colspec colwidth="6*" align="center"/>
50149 <colspec colwidth="6*" align="center"/>
50150 <colspec colwidth="6*" align="right"/>
50151 <tbody>
50152 <row>
50153 <entry><option>client_password</option></entry>
50154 <entry>Use: <emphasis>spa</emphasis></entry>
50155 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50156 <entry>Default: <emphasis>unset</emphasis></entry>
50157 </row>
50158 </tbody>
50159 </tgroup>
50160 </informaltable>
50161 <para>
50162 This option specifies the user&#x2019;s password, and must be set.
50163 </para>
50164 <para>
50165 <indexterm role="option">
50166 <primary><option>client_username</option></primary>
50167 </indexterm>
50168 </para>
50169 <informaltable frame="all">
50170 <tgroup cols="4" colsep="0" rowsep="0">
50171 <colspec colwidth="8*" align="left"/>
50172 <colspec colwidth="6*" align="center"/>
50173 <colspec colwidth="6*" align="center"/>
50174 <colspec colwidth="6*" align="right"/>
50175 <tbody>
50176 <row>
50177 <entry><option>client_username</option></entry>
50178 <entry>Use: <emphasis>spa</emphasis></entry>
50179 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50180 <entry>Default: <emphasis>unset</emphasis></entry>
50181 </row>
50182 </tbody>
50183 </tgroup>
50184 </informaltable>
50185 <para>
50186 This option specifies the user name, and must be set. Here is an example of a
50187 configuration of this authenticator for use with the mail servers at
50188 <emphasis>msn.com</emphasis>:
50189 </para>
50190 <literallayout class="monospaced">
50191 msn:
50192   driver = spa
50193   public_name = MSN
50194   client_username = msn/msn_username
50195   client_password = msn_plaintext_password
50196   client_domain = DOMAIN_OR_UNSET
50197 </literallayout>
50198 <para>
50199 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
50200 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
50201 </para>
50202 </section>
50203 </chapter>
50204
50205 <chapter id="CHAPTLS">
50206 <title>Encrypted SMTP connections using TLS/SSL</title>
50207 <titleabbrev>Encrypted SMTP connections</titleabbrev>
50208 <para>
50209 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
50210 <primary>encryption</primary>
50211 <secondary>on SMTP connection</secondary>
50212 </indexterm>
50213 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
50214 <primary>SMTP</primary>
50215 <secondary>encryption</secondary>
50216 </indexterm>
50217 <indexterm role="concept">
50218 <primary>TLS</primary>
50219 <secondary>on SMTP connection</secondary>
50220 </indexterm>
50221 <indexterm role="concept">
50222 <primary>OpenSSL</primary>
50223 </indexterm>
50224 <indexterm role="concept">
50225 <primary>GnuTLS</primary>
50226 </indexterm>
50227 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
50228 Sockets Layer), is implemented by making use of the OpenSSL library or the
50229 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
50230 cryptographic code in the Exim distribution itself for implementing TLS. In
50231 order to use this feature you must install OpenSSL or GnuTLS, and then build a
50232 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
50233 You also need to understand the basic concepts of encryption at a managerial
50234 level, and in particular, the way that public keys, private keys, and
50235 certificates are used.
50236 </para>
50237 <para>
50238 RFC 3207 defines how SMTP connections can make use of encryption. Once a
50239 connection is established, the client issues a STARTTLS command. If the
50240 server accepts this, the client and the server negotiate an encryption
50241 mechanism. If the negotiation succeeds, the data that subsequently passes
50242 between them is encrypted.
50243 </para>
50244 <para>
50245 Exim&#x2019;s ACLs can detect whether the current SMTP session is encrypted or not,
50246 and if so, what cipher suite is in use, whether the client supplied a
50247 certificate, and whether or not that certificate was verified. This makes it
50248 possible for an Exim server to deny or accept certain commands based on the
50249 encryption state.
50250 </para>
50251 <para>
50252 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
50253 disrupt TLS connections. You need to turn off SMTP scanning for these products
50254 in order to get TLS to work.
50255 </para>
50256 <section id="SECID284">
50257 <title>Support for the legacy <quote>ssmtp</quote> (aka <quote>smtps</quote>) protocol</title>
50258 <para>
50259 <indexterm role="concept">
50260 <primary>ssmtp protocol</primary>
50261 </indexterm>
50262 <indexterm role="concept">
50263 <primary>smtps protocol</primary>
50264 </indexterm>
50265 <indexterm role="concept">
50266 <primary>SMTP</primary>
50267 <secondary>ssmtp protocol</secondary>
50268 </indexterm>
50269 <indexterm role="concept">
50270 <primary>SMTP</primary>
50271 <secondary>smtps protocol</secondary>
50272 </indexterm>
50273 Early implementations of encrypted SMTP used a different TCP port from normal
50274 SMTP, and expected an encryption negotiation to start immediately, instead of
50275 waiting for a STARTTLS command from the client using the standard SMTP
50276 port. The protocol was called <quote>ssmtp</quote> or <quote>smtps</quote>, and port 465 was
50277 allocated for this purpose.
50278 </para>
50279 <para>
50280 This approach was abandoned when encrypted SMTP was standardized, but there are
50281 still some legacy clients that use it. Exim supports these clients by means of
50282 the <option>tls_on_connect_ports</option> global option. Its value must be a list of port
50283 numbers; the most common use is expected to be:
50284 </para>
50285 <literallayout class="monospaced">
50286 tls_on_connect_ports = 465
50287 </literallayout>
50288 <para>
50289 The port numbers specified by this option apply to all SMTP connections, both
50290 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
50291 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
50292 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
50293 an extra port &ndash; rather, it specifies different behaviour on a port that is
50294 defined elsewhere.
50295 </para>
50296 <para>
50297 There is also a <option>-tls-on-connect</option> command line option. This overrides
50298 <option>tls_on_connect_ports</option>; it forces the legacy behaviour for all ports.
50299 </para>
50300 </section>
50301 <section id="SECTopenvsgnu">
50302 <title>OpenSSL vs GnuTLS</title>
50303 <para>
50304 <indexterm role="concept">
50305 <primary>TLS</primary>
50306 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
50307 </indexterm>
50308 The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS
50309 followed later, when the first versions of GnuTLS were released. To build Exim
50310 to use GnuTLS, you need to set
50311 </para>
50312 <literallayout class="monospaced">
50313 USE_GNUTLS=yes
50314 </literallayout>
50315 <para>
50316 in Local/Makefile, in addition to
50317 </para>
50318 <literallayout class="monospaced">
50319 SUPPORT_TLS=yes
50320 </literallayout>
50321 <para>
50322 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
50323 include files and libraries for GnuTLS can be found.
50324 </para>
50325 <para>
50326 There are some differences in usage when using GnuTLS instead of OpenSSL:
50327 </para>
50328 <itemizedlist>
50329 <listitem>
50330 <para>
50331 The <option>tls_verify_certificates</option> option must contain the name of a file, not the
50332 name of a directory for GnuTLS versions before 3.3.6
50333 (for later versions, or OpenSSL, it can be either).
50334 </para>
50335 </listitem>
50336 <listitem>
50337 <para>
50338 The default value for <option>tls_dhparam</option> differs for historical reasons.
50339 </para>
50340 </listitem>
50341 <listitem>
50342 <para>
50343 <indexterm role="variable">
50344 <primary><varname>$tls_in_peerdn</varname></primary>
50345 </indexterm>
50346 <indexterm role="variable">
50347 <primary><varname>$tls_out_peerdn</varname></primary>
50348 </indexterm>
50349 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
50350 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
50351 affects the value of the <varname>$tls_in_peerdn</varname> and <varname>$tls_out_peerdn</varname> variables.
50352 </para>
50353 </listitem>
50354 <listitem>
50355 <para>
50356 OpenSSL identifies cipher suites using hyphens as separators, for example:
50357 DES-CBC3-SHA. GnuTLS historically used underscores, for example:
50358 RSA_ARCFOUR_SHA. What is more, OpenSSL complains if underscores are present
50359 in a cipher list. To make life simpler, Exim changes underscores to hyphens
50360 for OpenSSL and passes the string unchanged to GnuTLS (expecting the library
50361 to handle its own older variants) when processing lists of cipher suites in the
50362 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
50363 option).
50364 </para>
50365 </listitem>
50366 <listitem>
50367 <para>
50368 The <option>tls_require_ciphers</option> options operate differently, as described in the
50369 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
50370 </para>
50371 </listitem>
50372 <listitem>
50373 <para>
50374 The <option>tls_dh_min_bits</option> SMTP transport option is only honoured by GnuTLS.
50375 When using OpenSSL, this option is ignored.
50376 (If an API is found to let OpenSSL be configured in this way,
50377 let the Exim Maintainers know and we&#x2019;ll likely use it).
50378 </para>
50379 </listitem>
50380 <listitem>
50381 <para>
50382 Some other recently added features may only be available in one or the other.
50383 This should be documented with the feature.  If the documentation does not
50384 explicitly state that the feature is infeasible in the other TLS
50385 implementation, then patches are welcome.
50386 </para>
50387 </listitem>
50388 </itemizedlist>
50389 </section>
50390 <section id="SECTgnutlsparam">
50391 <title>GnuTLS parameter computation</title>
50392 <para>
50393 This section only applies if <option>tls_dhparam</option> is set to <literal>historic</literal> or to
50394 an explicit path; if the latter, then the text about generation still applies,
50395 but not the chosen filename.
50396 By default, as of Exim 4.80 a hard-coded D-H prime is used.
50397 See the documentation of <option>tls_dhparam</option> for more information.
50398 </para>
50399 <para>
50400 GnuTLS uses D-H parameters that may take a substantial amount of time
50401 to compute. It is unreasonable to re-compute them for every TLS session.
50402 Therefore, Exim keeps this data in a file in its spool directory, called
50403 <filename>gnutls-params-NNNN</filename> for some value of NNNN, corresponding to the number
50404 of bits requested.
50405 The file is owned by the Exim user and is readable only by
50406 its owner. Every Exim process that start up GnuTLS reads the D-H
50407 parameters from this file. If the file does not exist, the first Exim process
50408 that needs it computes the data and writes it to a temporary file which is
50409 renamed once it is complete. It does not matter if several Exim processes do
50410 this simultaneously (apart from wasting a few resources). Once a file is in
50411 place, new Exim processes immediately start using it.
50412 </para>
50413 <para>
50414 For maximum security, the parameters that are stored in this file should be
50415 recalculated periodically, the frequency depending on your paranoia level.
50416 If you are avoiding using the fixed D-H primes published in RFCs, then you
50417 are concerned about some advanced attacks and will wish to do this; if you do
50418 not regenerate then you might as well stick to the standard primes.
50419 </para>
50420 <para>
50421 Arranging this is easy in principle; just delete the file when you want new
50422 values to be computed. However, there may be a problem. The calculation of new
50423 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
50424 If the system is not very active, <filename>/dev/random</filename> may delay returning data
50425 until enough randomness (entropy) is available. This may cause Exim to hang for
50426 a substantial amount of time, causing timeouts on incoming connections.
50427 </para>
50428 <para>
50429 The solution is to generate the parameters externally to Exim. They are stored
50430 in <filename>gnutls-params-N</filename> in PEM format, which means that they can be
50431 generated externally using the <command>certtool</command> command that is part of GnuTLS.
50432 </para>
50433 <para>
50434 To replace the parameters with new ones, instead of deleting the file
50435 and letting Exim re-create it, you can generate new parameters using
50436 <command>certtool</command> and, when this has been done, replace Exim&#x2019;s cache file by
50437 renaming. The relevant commands are something like this:
50438 </para>
50439 <literallayout class="monospaced">
50440 # ls
50441 [ look for file; assume gnutls-params-2236 is the most recent ]
50442 # rm -f new-params
50443 # touch new-params
50444 # chown exim:exim new-params
50445 # chmod 0600 new-params
50446 # certtool --generate-dh-params --bits 2236 &gt;&gt;new-params
50447 # openssl dhparam -noout -text -in new-params | head
50448 [ check the first line, make sure it's not more than 2236;
50449   if it is, then go back to the start ("rm") and repeat
50450   until the size generated is at most the size requested ]
50451 # chmod 0400 new-params
50452 # mv new-params gnutls-params-2236
50453 </literallayout>
50454 <para>
50455 If Exim never has to generate the parameters itself, the possibility of
50456 stalling is removed.
50457 </para>
50458 <para>
50459 The filename changed in Exim 4.80, to gain the -bits suffix.  The value which
50460 Exim will choose depends upon the version of GnuTLS in use.  For older GnuTLS,
50461 the value remains hard-coded in Exim as 1024.  As of GnuTLS 2.12.x, there is
50462 a way for Exim to ask for the "normal" number of bits for D-H public-key usage,
50463 and Exim does so.  This attempt to remove Exim from TLS policy decisions
50464 failed, as GnuTLS 2.12 returns a value higher than the current hard-coded limit
50465 of the NSS library.  Thus Exim gains the <option>tls_dh_max_bits</option> global option,
50466 which applies to all D-H usage, client or server.  If the value returned by
50467 GnuTLS is greater than <option>tls_dh_max_bits</option> then the value will be clamped down
50468 to <option>tls_dh_max_bits</option>.  The default value has been set at the current NSS
50469 limit, which is still much higher than Exim historically used.
50470 </para>
50471 <para>
50472 The filename and bits used will change as the GnuTLS maintainers change the
50473 value for their parameter <literal>GNUTLS_SEC_PARAM_NORMAL</literal>, as clamped by
50474 <option>tls_dh_max_bits</option>.  At the time of writing (mid 2012), GnuTLS 2.12 recommends
50475 2432 bits, while NSS is limited to 2236 bits.
50476 </para>
50477 <para>
50478 In fact, the requested value will be *lower* than <option>tls_dh_max_bits</option>, to
50479 increase the chance of the generated prime actually being within acceptable
50480 bounds, as GnuTLS has been observed to overshoot.  Note the check step in the
50481 procedure above.  There is no sane procedure available to Exim to double-check
50482 the size of the generated prime, so it might still be too large.
50483 </para>
50484 </section>
50485 <section id="SECTreqciphssl">
50486 <title>Requiring specific ciphers in OpenSSL</title>
50487 <para>
50488 <indexterm role="concept">
50489 <primary>TLS</primary>
50490 <secondary>requiring specific ciphers (OpenSSL)</secondary>
50491 </indexterm>
50492 <indexterm role="option">
50493 <primary><option>tls_require_ciphers</option></primary>
50494 <secondary>OpenSSL</secondary>
50495 </indexterm>
50496 There is a function in the OpenSSL library that can be passed a list of cipher
50497 suites before the cipher negotiation takes place. This specifies which ciphers
50498 are acceptable. The list is colon separated and may contain names like
50499 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
50500 directly to this function call.
50501 Many systems will install the OpenSSL manual-pages, so you may have
50502 <emphasis>ciphers(1)</emphasis> available to you.
50503 The following quotation from the OpenSSL
50504 documentation specifies what forms of item are allowed in the cipher string:
50505 </para>
50506 <itemizedlist>
50507 <listitem>
50508 <para>
50509 It can consist of a single cipher suite such as RC4-SHA.
50510 </para>
50511 </listitem>
50512 <listitem>
50513 <para>
50514 It can represent a list of cipher suites containing a certain algorithm,
50515 or cipher suites of a certain type. For example SHA1 represents all
50516 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
50517 SSL v3 algorithms.
50518 </para>
50519 </listitem>
50520 <listitem>
50521 <para>
50522 Lists of cipher suites can be combined in a single cipher string using
50523 the + character. This is used as a logical and operation. For example
50524 SHA1+DES represents all cipher suites containing the SHA1 and the DES
50525 algorithms.
50526 </para>
50527 </listitem>
50528 </itemizedlist>
50529 <para>
50530 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
50531 <literal>-</literal> or <literal>+</literal>.
50532 </para>
50533 <itemizedlist>
50534 <listitem>
50535 <para>
50536 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
50537 ciphers deleted can never reappear in the list even if they are explicitly
50538 stated.
50539 </para>
50540 </listitem>
50541 <listitem>
50542 <para>
50543 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
50544 of the ciphers can be added again by later options.
50545 </para>
50546 </listitem>
50547 <listitem>
50548 <para>
50549 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
50550 option does not add any new ciphers; it just moves matching existing ones.
50551 </para>
50552 </listitem>
50553 </itemizedlist>
50554 <para>
50555 If none of these characters is present, the string is interpreted as
50556 a list of ciphers to be appended to the current preference list. If the list
50557 includes any ciphers already present they will be ignored: that is, they will
50558 not be moved to the end of the list.
50559 </para>
50560 <para>
50561 The OpenSSL <emphasis>ciphers(1)</emphasis> command may be used to test the results of a given
50562 string:
50563 </para>
50564 <literallayout class="monospaced">
50565 # note single-quotes to get ! past any shell history expansion
50566 $ openssl ciphers 'HIGH:!MD5:!SHA1'
50567 </literallayout>
50568 <para>
50569 This example will let the library defaults be permitted on the MX port, where
50570 there&#x2019;s probably no identity verification anyway, but ups the ante on the
50571 submission ports where the administrator might have some influence on the
50572 choice of clients used:
50573 </para>
50574 <literallayout class="monospaced">
50575 # OpenSSL variant; see man ciphers(1)
50576 tls_require_ciphers = ${if =={$received_port}{25}\
50577                            {DEFAULT}\
50578                            {HIGH:!MD5:!SHA1}}
50579 </literallayout>
50580 </section>
50581 <section id="SECTreqciphgnu">
50582 <title>Requiring specific ciphers or other parameters in GnuTLS</title>
50583 <para>
50584 <indexterm role="concept">
50585 <primary>GnuTLS</primary>
50586 <secondary>specifying parameters for</secondary>
50587 </indexterm>
50588 <indexterm role="concept">
50589 <primary>TLS</primary>
50590 <secondary>specifying ciphers (GnuTLS)</secondary>
50591 </indexterm>
50592 <indexterm role="concept">
50593 <primary>TLS</primary>
50594 <secondary>specifying key exchange methods (GnuTLS)</secondary>
50595 </indexterm>
50596 <indexterm role="concept">
50597 <primary>TLS</primary>
50598 <secondary>specifying MAC algorithms (GnuTLS)</secondary>
50599 </indexterm>
50600 <indexterm role="concept">
50601 <primary>TLS</primary>
50602 <secondary>specifying protocols (GnuTLS)</secondary>
50603 </indexterm>
50604 <indexterm role="concept">
50605 <primary>TLS</primary>
50606 <secondary>specifying priority string (GnuTLS)</secondary>
50607 </indexterm>
50608 <indexterm role="option">
50609 <primary><option>tls_require_ciphers</option></primary>
50610 <secondary>GnuTLS</secondary>
50611 </indexterm>
50612 The GnuTLS library allows the caller to provide a "priority string", documented
50613 as part of the <function>gnutls_priority_init</function> function.  This is very similar to the
50614 ciphersuite specification in OpenSSL.
50615 </para>
50616 <para>
50617 The <option>tls_require_ciphers</option> option is treated as the GnuTLS priority string
50618 and controls both protocols and ciphers.
50619 </para>
50620 <para>
50621 The <option>tls_require_ciphers</option> option is available both as an global option,
50622 controlling how Exim behaves as a server, and also as an option of the
50623 <command>smtp</command> transport, controlling how Exim behaves as a client.  In both cases
50624 the value is string expanded.  The resulting string is not an Exim list and
50625 the string is given to the GnuTLS library, so that Exim does not need to be
50626 aware of future feature enhancements of GnuTLS.
50627 </para>
50628 <para>
50629 Documentation of the strings accepted may be found in the GnuTLS manual, under
50630 "Priority strings".  This is online as
50631 <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>,
50632 but beware that this relates to GnuTLS 3, which may be newer than the version
50633 installed on your system.  If you are using GnuTLS 3,
50634 <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>
50635 on that site can be used to test a given string.
50636 </para>
50637 <para>
50638 For example:
50639 </para>
50640 <literallayout class="monospaced">
50641 # Disable older versions of protocols
50642 tls_require_ciphers = NORMAL:%LATEST_RECORD_VERSION:-VERS-SSL3.0
50643 </literallayout>
50644 <para>
50645 Prior to Exim 4.80, an older API of GnuTLS was used, and Exim supported three
50646 additional options, "<option>gnutls_require_kx</option>", "<option>gnutls_require_mac</option>" and
50647 "<option>gnutls_require_protocols</option>".  <option>tls_require_ciphers</option> was an Exim list.
50648 </para>
50649 <para>
50650 This example will let the library defaults be permitted on the MX port, where
50651 there&#x2019;s probably no identity verification anyway, and lowers security further
50652 by increasing compatibility; but this ups the ante on the submission ports
50653 where the administrator might have some influence on the choice of clients
50654 used:
50655 </para>
50656 <literallayout class="monospaced">
50657 # GnuTLS variant
50658 tls_require_ciphers = ${if =={$received_port}{25}\
50659                            {NORMAL:%COMPAT}\
50660                            {SECURE128}}
50661 </literallayout>
50662 </section>
50663 <section id="SECID182">
50664 <title>Configuring an Exim server to use TLS</title>
50665 <para>
50666 <indexterm role="concept">
50667 <primary>TLS</primary>
50668 <secondary>configuring an Exim server</secondary>
50669 </indexterm>
50670 When Exim has been built with TLS support, it advertises the availability of
50671 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
50672 but not to any others. The default value of this option is unset, which means
50673 that STARTTLS is not advertised at all. This default is chosen because you
50674 need to set some other options in order to make TLS available, and also it is
50675 sensible for systems that want to use TLS only as a client.
50676 </para>
50677 <para>
50678 If a client issues a STARTTLS command and there is some configuration
50679 problem in the server, the command is rejected with a 454 error. If the client
50680 persists in trying to issue SMTP commands, all except QUIT are rejected
50681 with the error
50682 </para>
50683 <literallayout class="monospaced">
50684 554 Security failure
50685 </literallayout>
50686 <para>
50687 If a STARTTLS command is issued within an existing TLS session, it is
50688 rejected with a 554 error code.
50689 </para>
50690 <para>
50691 To enable TLS operations on a server, you must set <option>tls_advertise_hosts</option> to
50692 match some hosts. You can, of course, set it to * to match all hosts.
50693 However, this is not all you need to do. TLS sessions to a server won&#x2019;t work
50694 without some further configuration at the server end.
50695 </para>
50696 <para>
50697 It is rumoured that all existing clients that support TLS/SSL use RSA
50698 encryption. To make this work you need to set, in the server,
50699 </para>
50700 <literallayout class="monospaced">
50701 tls_certificate = /some/file/name
50702 tls_privatekey = /some/file/name
50703 </literallayout>
50704 <para>
50705 These options are, in fact, expanded strings, so you can make them depend on
50706 the identity of the client that is connected if you wish. The first file
50707 contains the server&#x2019;s X509 certificate, and the second contains the private key
50708 that goes with it. These files need to be
50709 PEM format and readable by the Exim user, and must
50710 always be given as full path names.
50711 The key must not be password-protected.
50712 They can be the same file if both the
50713 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
50714 set, or if its expansion is forced to fail or results in an empty string, this
50715 is assumed to be the case. The certificate file may also contain intermediate
50716 certificates that need to be sent to the client to enable it to authenticate
50717 the server&#x2019;s certificate.
50718 </para>
50719 <para>
50720 If you do not understand about certificates and keys, please try to find a
50721 source of this background information, which is not Exim-specific. (There are a
50722 few comments below in section <xref linkend="SECTcerandall"/>.)
50723 </para>
50724 <para>
50725 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client &ndash;
50726 they apply only in the case of a server. If you need to use a certificate in an
50727 Exim client, you must set the options of the same names in an <command>smtp</command>
50728 transport.
50729 </para>
50730 <para>
50731 With just these options, an Exim server will be able to use TLS. It does not
50732 require the client to have a certificate (but see below for how to insist on
50733 this). There is one other option that may be needed in other situations. If
50734 </para>
50735 <literallayout class="monospaced">
50736 tls_dhparam = /some/file/name
50737 </literallayout>
50738 <para>
50739 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
50740 with the parameters contained in the file.
50741 Set this to <literal>none</literal> to disable use of DH entirely, by making no prime
50742 available:
50743 </para>
50744 <literallayout class="monospaced">
50745 tls_dhparam = none
50746 </literallayout>
50747 <para>
50748 This may also be set to a string identifying a standard prime to be used for
50749 DH; if it is set to <literal>default</literal> or, for OpenSSL, is unset, then the prime
50750 used is <literal>ike23</literal>.  There are a few standard primes available, see the
50751 documentation for <option>tls_dhparam</option> for the complete list.
50752 </para>
50753 <para>
50754 See the command
50755 </para>
50756 <literallayout class="monospaced">
50757 openssl dhparam
50758 </literallayout>
50759 <para>
50760 for a way of generating file data.
50761 </para>
50762 <para>
50763 The strings supplied for these three options are expanded every time a client
50764 host connects. It is therefore possible to use different certificates and keys
50765 for different hosts, if you so wish, by making use of the client&#x2019;s IP address
50766 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
50767 forced to fail, Exim behaves as if the option is not set.
50768 </para>
50769 <para>
50770 <indexterm role="concept">
50771 <primary>cipher</primary>
50772 <secondary>logging</secondary>
50773 </indexterm>
50774 <indexterm role="concept">
50775 <primary>log</primary>
50776 <secondary>TLS cipher</secondary>
50777 </indexterm>
50778 <indexterm role="variable">
50779 <primary><varname>$tls_in_cipher</varname></primary>
50780 </indexterm>
50781 The variable <varname>$tls_in_cipher</varname> is set to the cipher suite that was negotiated for
50782 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
50783 incoming message (by default &ndash; you can, of course, change this), and it is
50784 also included in the log line that records a message&#x2019;s arrival, keyed by
50785 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
50786 condition can be used to test for specific cipher suites in ACLs.
50787 </para>
50788 <para>
50789 Once TLS has been established, the ACLs that run for subsequent SMTP commands
50790 can check the name of the cipher suite and vary their actions accordingly. The
50791 cipher suite names vary, depending on which TLS library is being used. For
50792 example, OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other
50793 contexts is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL or GnuTLS
50794 documentation for more details.
50795 </para>
50796 <para>
50797 For outgoing SMTP deliveries, <varname>$tls_out_cipher</varname> is used and logged
50798 (again depending on the <option>tls_cipher</option> log selector).
50799 </para>
50800 </section>
50801 <section id="SECID183">
50802 <title>Requesting and verifying client certificates</title>
50803 <para>
50804 <indexterm role="concept">
50805 <primary>certificate</primary>
50806 <secondary>verification of client</secondary>
50807 </indexterm>
50808 <indexterm role="concept">
50809 <primary>TLS</primary>
50810 <secondary>client certificate verification</secondary>
50811 </indexterm>
50812 If you want an Exim server to request a certificate when negotiating a TLS
50813 session with a client, you must set either <option>tls_verify_hosts</option> or
50814 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
50815 apply to all TLS connections. For any host that matches one of these options,
50816 Exim requests a certificate as part of the setup of the TLS session. The
50817 contents of the certificate are verified by comparing it with a list of
50818 expected certificates. These must be available in a file or,
50819 for OpenSSL only (not GnuTLS), a directory, identified by
50820 <option>tls_verify_certificates</option>.
50821 </para>
50822 <para>
50823 A file can contain multiple certificates, concatenated end to end. If a
50824 directory is used
50825 (OpenSSL only),
50826 each certificate must be in a separate file, with a name (or a symbolic link)
50827 of the form &lt;<emphasis>hash</emphasis>&gt;.0, where &lt;<emphasis>hash</emphasis>&gt; is a hash value constructed from the
50828 certificate. You can compute the relevant hash by running the command
50829 </para>
50830 <literallayout class="monospaced">
50831 openssl x509 -hash -noout -in /cert/file
50832 </literallayout>
50833 <para>
50834 where <filename>/cert/file</filename> contains a single certificate.
50835 </para>
50836 <para>
50837 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
50838 what happens if the client does not supply a certificate, or if the certificate
50839 does not match any of the certificates in the collection named by
50840 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
50841 attempt to set up a TLS session is aborted, and the incoming connection is
50842 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
50843 session continues. ACLs that run for subsequent SMTP commands can detect the
50844 fact that no certificate was verified, and vary their actions accordingly. For
50845 example, you can insist on a certificate before accepting a message for
50846 relaying, but not when the message is destined for local delivery.
50847 </para>
50848 <para>
50849 <indexterm role="variable">
50850 <primary><varname>$tls_in_peerdn</varname></primary>
50851 </indexterm>
50852 When a client supplies a certificate (whether it verifies or not), the value of
50853 the Distinguished Name of the certificate is made available in the variable
50854 <varname>$tls_in_peerdn</varname> during subsequent processing of the message.
50855 </para>
50856 <para>
50857 <indexterm role="concept">
50858 <primary>log</primary>
50859 <secondary>distinguished name</secondary>
50860 </indexterm>
50861 Because it is often a long text string, it is not included in the log line or
50862 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
50863 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
50864 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
50865 certificate is supplied, <varname>$tls_in_peerdn</varname> is empty.
50866 </para>
50867 </section>
50868 <section id="SECID184">
50869 <title>Revoked certificates</title>
50870 <para>
50871 <indexterm role="concept">
50872 <primary>TLS</primary>
50873 <secondary>revoked certificates</secondary>
50874 </indexterm>
50875 <indexterm role="concept">
50876 <primary>revocation list</primary>
50877 </indexterm>
50878 <indexterm role="concept">
50879 <primary>certificate</primary>
50880 <secondary>revocation list</secondary>
50881 </indexterm>
50882 <indexterm role="concept">
50883 <primary>OCSP</primary>
50884 <secondary>stapling</secondary>
50885 </indexterm>
50886 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
50887 certificates are revoked. If you have such a list, you can pass it to an Exim
50888 server using the global option called <option>tls_crl</option> and to an Exim client using
50889 an identically named option for the <command>smtp</command> transport. In each case, the value
50890 of the option is expanded and must then be the name of a file that contains a
50891 CRL in PEM format.
50892 The downside is that clients have to periodically re-download a potentially huge
50893 file from every certificate authority they know of.
50894 </para>
50895 <para>
50896 The way with most moving parts at query time is Online Certificate
50897 Status Protocol (OCSP), where the client verifies the certificate
50898 against an OCSP server run by the CA.  This lets the CA track all
50899 usage of the certs.  It requires running software with access to the
50900 private key of the CA, to sign the responses to the OCSP queries.  OCSP
50901 is based on HTTP and can be proxied accordingly.
50902 </para>
50903 <para>
50904 The only widespread OCSP server implementation (known to this writer)
50905 comes as part of OpenSSL and aborts on an invalid request, such as
50906 connecting to the port and then disconnecting.  This requires
50907 re-entering the passphrase each time some random client does this.
50908 </para>
50909 <para>
50910 The third way is OCSP Stapling; in this, the server using a certificate
50911 issued by the CA periodically requests an OCSP proof of validity from
50912 the OCSP server, then serves it up inline as part of the TLS
50913 negotiation.   This approach adds no extra round trips, does not let the
50914 CA track users, scales well with number of certs issued by the CA and is
50915 resilient to temporary OCSP server failures, as long as the server
50916 starts retrying to fetch an OCSP proof some time before its current
50917 proof expires.  The downside is that it requires server support.
50918 </para>
50919 <para>
50920 Unless Exim is built with the support disabled,
50921 or with GnuTLS earlier than version 3.1.3,
50922 support for OCSP stapling is included.
50923 </para>
50924 <para>
50925 There is a global option called <option>tls_ocsp_file</option>.
50926 The file specified therein is expected to be in DER format, and contain
50927 an OCSP proof.  Exim will serve it as part of the TLS handshake.  This
50928 option will be re-expanded for SNI, if the <option>tls_certificate</option> option
50929 contains <literal>tls_in_sni</literal>, as per other TLS options.
50930 </para>
50931 <para>
50932 Exim does not at this time implement any support for fetching a new OCSP
50933 proof.  The burden is on the administrator to handle this, outside of
50934 Exim.  The file specified should be replaced atomically, so that the
50935 contents are always valid.  Exim will expand the <option>tls_ocsp_file</option> option
50936 on each connection, so a new file will be handled transparently on the
50937 next connection.
50938 </para>
50939 <para>
50940 When built with OpenSSL Exim will check for a valid next update timestamp
50941 in the OCSP proof; if not present, or if the proof has expired, it will be
50942 ignored.
50943 </para>
50944 <para>
50945 For the client to be able to verify the stapled OCSP the server must
50946 also supply, in its stapled information, any intermediate
50947 certificates for the chain leading to the OCSP proof from the signer
50948 of the server certificate.  There may be zero or one such. These
50949 intermediate certificates should be added to the server OCSP stapling
50950 file named by <option>tls_ocsp_file</option>.
50951 </para>
50952 <para>
50953 Note that the proof only covers the terminal server certificate,
50954 not any of the chain from CA to it.
50955 </para>
50956 <para>
50957 There is no current way to staple a proof for a client certificate.
50958 </para>
50959 <literallayout class="monospaced">
50960   A helper script "ocsp_fetch.pl" for fetching a proof from a CA
50961   OCSP server is supplied.  The server URL may be included in the
50962   server certificate, if the CA is helpful.
50963
50964   One failure mode seen was the OCSP Signer cert expiring before the end
50965   of validity of the OCSP proof. The checking done by Exim/OpenSSL
50966   noted this as invalid overall, but the re-fetch script did not.
50967 </literallayout>
50968 </section>
50969 <section id="SECID185">
50970 <title>Configuring an Exim client to use TLS</title>
50971 <para>
50972 <indexterm role="concept">
50973 <primary>cipher</primary>
50974 <secondary>logging</secondary>
50975 </indexterm>
50976 <indexterm role="concept">
50977 <primary>log</primary>
50978 <secondary>TLS cipher</secondary>
50979 </indexterm>
50980 <indexterm role="concept">
50981 <primary>log</primary>
50982 <secondary>distinguished name</secondary>
50983 </indexterm>
50984 <indexterm role="concept">
50985 <primary>TLS</primary>
50986 <secondary>configuring an Exim client</secondary>
50987 </indexterm>
50988 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
50989 deliveries as well as to incoming, the latter one causing logging of the
50990 server certificate&#x2019;s DN. The remaining client configuration for TLS is all
50991 within the <command>smtp</command> transport.
50992 </para>
50993 <para>
50994 It is not necessary to set any options to have TLS work in the <command>smtp</command>
50995 transport. If Exim is built with TLS support, and TLS is advertised by a
50996 server, the <command>smtp</command> transport always tries to start a TLS session. However,
50997 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
50998 transport) to a list of server hosts for which TLS should not be used.
50999 </para>
51000 <para>
51001 If you do not want Exim to attempt to send messages unencrypted when an attempt
51002 to set up an encrypted connection fails in any way, you can set
51003 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
51004 those hosts, delivery is always deferred if an encrypted connection cannot be
51005 set up. If there are any other hosts for the address, they are tried in the
51006 usual way.
51007 </para>
51008 <para>
51009 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
51010 the message unencrypted. It always does this if the response to STARTTLS is
51011 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
51012 session after a success response code, what happens is controlled by the
51013 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
51014 delivery to this host is deferred, and other hosts (if available) are tried. If
51015 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
51016 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
51017 negotiation fails, Exim closes the current connection (because it is in an
51018 unknown state), opens a new one to the same host, and then tries the delivery
51019 unencrypted.
51020 </para>
51021 <para>
51022 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
51023 transport provide the client with a certificate, which is passed to the server
51024 if it requests it. If the server is Exim, it will request a certificate only if
51025 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client.
51026 </para>
51027 <para>
51028 If the <option>tls_verify_certificates</option> option is set on the <command>smtp</command> transport, it
51029 must name a file or,
51030 for OpenSSL only (not GnuTLS), a directory, that contains a collection of
51031 expected server certificates. The client verifies the server&#x2019;s certificate
51032 against this collection, taking into account any revoked certificates that are
51033 in the list defined by <option>tls_crl</option>.
51034 Failure to verify fails the TLS connection unless either of the
51035 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> options are set.
51036 </para>
51037 <para>
51038 The <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> options restrict
51039 certificate verification to the listed servers.  Verification either must
51040 or need not succeed respectively.
51041 </para>
51042 <para>
51043 The <command>smtp</command> transport has two OCSP-related options:
51044 <option>hosts_require_ocsp</option>; a host-list for which a Certificate Status
51045 is requested and required for the connection to proceed.  The default
51046 value is empty.
51047 <option>hosts_request_ocsp</option>; a host-list for which (additionally)
51048 a Certificate Status is requested (but not necessarily verified).  The default
51049 value is "*" meaning that requests are made unless configured
51050 otherwise.
51051 </para>
51052 <para>
51053 The host(s) should also be in <option>hosts_require_tls</option>, and
51054 <option>tls_verify_certificates</option> configured for the transport,
51055 for OCSP to be relevant.
51056 </para>
51057 <para>
51058 If
51059 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
51060 list of permitted cipher suites. If either of these checks fails, delivery to
51061 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
51062 alternative hosts, if any.
51063 </para>
51064 <para>
51065  <emphasis role="bold">Note</emphasis>:
51066 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
51067 is operating as a client. Exim does not assume that a server certificate (set
51068 by the global options of the same name) should also be used when operating as a
51069 client.
51070 </para>
51071 <para>
51072 <indexterm role="variable">
51073 <primary><varname>$host</varname></primary>
51074 </indexterm>
51075 <indexterm role="variable">
51076 <primary><varname>$host_address</varname></primary>
51077 </indexterm>
51078 All the TLS options in the <command>smtp</command> transport are expanded before use, with
51079 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
51080 which the client is connected. Forced failure of an expansion causes Exim to
51081 behave as if the relevant option were unset.
51082 </para>
51083 <para>
51084 <indexterm role="variable">
51085 <primary><varname>$tls_out_bits</varname></primary>
51086 </indexterm>
51087 <indexterm role="variable">
51088 <primary><varname>$tls_out_cipher</varname></primary>
51089 </indexterm>
51090 <indexterm role="variable">
51091 <primary><varname>$tls_out_peerdn</varname></primary>
51092 </indexterm>
51093 <indexterm role="variable">
51094 <primary><varname>$tls_out_sni</varname></primary>
51095 </indexterm>
51096 Before an SMTP connection is established, the
51097 <varname>$tls_out_bits</varname>, <varname>$tls_out_cipher</varname>, <varname>$tls_out_peerdn</varname> and <varname>$tls_out_sni</varname>
51098 variables are emptied. (Until the first connection, they contain the values
51099 that were set when the message was received.) If STARTTLS is subsequently
51100 successfully obeyed, these variables are set to the relevant values for the
51101 outgoing connection.
51102 </para>
51103 </section>
51104 <section id="SECTtlssni">
51105 <title>Use of TLS Server Name Indication</title>
51106 <para>
51107 <indexterm role="concept">
51108 <primary>TLS</primary>
51109 <secondary>Server Name Indication</secondary>
51110 </indexterm>
51111 <indexterm role="variable">
51112 <primary><varname>$tls_in_sni</varname></primary>
51113 </indexterm>
51114 <indexterm role="option">
51115 <primary><option>tls_in_sni</option></primary>
51116 </indexterm>
51117 With TLS1.0 or above, there is an extension mechanism by which extra
51118 information can be included at various points in the protocol.  One of these
51119 extensions, documented in RFC 6066 (and before that RFC 4366) is
51120 <quote>Server Name Indication</quote>, commonly <quote>SNI</quote>.  This extension is sent by the
51121 client in the initial handshake, so that the server can examine the servername
51122 within and possibly choose to use different certificates and keys (and more)
51123 for this session.
51124 </para>
51125 <para>
51126 This is analagous to HTTP&#x2019;s <quote>Host:</quote> header, and is the main mechanism by
51127 which HTTPS-enabled web-sites can be virtual-hosted, many sites to one IP
51128 address.
51129 </para>
51130 <para>
51131 With SMTP to MX, there are the same problems here as in choosing the identity
51132 against which to validate a certificate: you can&#x2019;t rely on insecure DNS to
51133 provide the identity which you then cryptographically verify.  So this will
51134 be of limited use in that environment.
51135 </para>
51136 <para>
51137 With SMTP to Submission, there is a well-defined hostname which clients are
51138 connecting to and can validate certificates against.  Thus clients <emphasis role="bold">can</emphasis>
51139 choose to include this information in the TLS negotiation.  If this becomes
51140 wide-spread, then hosters can choose to present different certificates to
51141 different clients.  Or even negotiate different cipher suites.
51142 </para>
51143 <para>
51144 The <option>tls_sni</option> option on an SMTP transport is an expanded string; the result,
51145 if not empty, will be sent on a TLS session as part of the handshake.  There&#x2019;s
51146 nothing more to it.  Choosing a sensible value not derived insecurely is the
51147 only point of caution.  The <varname>$tls_out_sni</varname> variable will be set to this string
51148 for the lifetime of the client connection (including during authentication).
51149 </para>
51150 <para>
51151 Except during SMTP client sessions, if <varname>$tls_in_sni</varname> is set then it is a string
51152 received from a client.
51153 It can be logged with the <option>log_selector</option> item <literal>+tls_sni</literal>.
51154 </para>
51155 <para>
51156 If the string <literal>tls_in_sni</literal> appears in the main section&#x2019;s <option>tls_certificate</option>
51157 option (prior to expansion) then the following options will be re-expanded
51158 during TLS session handshake, to permit alternative values to be chosen:
51159 </para>
51160 <itemizedlist>
51161 <listitem>
51162 <para>
51163 <indexterm role="variable">
51164 <primary><option>tls_certificate</option></primary>
51165 </indexterm>
51166 <option>tls_certificate</option>
51167 </para>
51168 </listitem>
51169 <listitem>
51170 <para>
51171 <indexterm role="variable">
51172 <primary><option>tls_crl</option></primary>
51173 </indexterm>
51174 <option>tls_crl</option>
51175 </para>
51176 </listitem>
51177 <listitem>
51178 <para>
51179 <indexterm role="variable">
51180 <primary><option>tls_privatekey</option></primary>
51181 </indexterm>
51182 <option>tls_privatekey</option>
51183 </para>
51184 </listitem>
51185 <listitem>
51186 <para>
51187 <indexterm role="variable">
51188 <primary><option>tls_verify_certificates</option></primary>
51189 </indexterm>
51190 <option>tls_verify_certificates</option>
51191 </para>
51192 </listitem>
51193 <listitem>
51194 <para>
51195 <indexterm role="variable">
51196 <primary><option>tls_ocsp_file</option></primary>
51197 </indexterm>
51198 <option>tls_ocsp_file</option>
51199 </para>
51200 </listitem>
51201 </itemizedlist>
51202 <para>
51203 Great care should be taken to deal with matters of case, various injection
51204 attacks in the string (<literal>../</literal> or SQL), and ensuring that a valid filename
51205 can always be referenced; it is important to remember that <varname>$tls_sni</varname> is
51206 arbitrary unverified data provided prior to authentication.
51207 </para>
51208 <para>
51209 The Exim developers are proceeding cautiously and so far no other TLS options
51210 are re-expanded.
51211 </para>
51212 <para>
51213 When Exim is built againt OpenSSL, OpenSSL must have been built with support
51214 for TLS Extensions.  This holds true for OpenSSL 1.0.0+ and 0.9.8+ with
51215 enable-tlsext in EXTRACONFIGURE.  If you invoke <command>openssl s_client -h</command> and
51216 see <literal>-servername</literal> in the output, then OpenSSL has support.
51217 </para>
51218 <para>
51219 When Exim is built against GnuTLS, SNI support is available as of GnuTLS
51220 0.5.10.  (Its presence predates the current API which Exim uses, so if Exim
51221 built, then you have SNI support).
51222 </para>
51223 </section>
51224 <section id="SECTmulmessam">
51225 <title>Multiple messages on the same encrypted TCP/IP connection</title>
51226 <para>
51227 <indexterm role="concept">
51228 <primary>multiple SMTP deliveries with TLS</primary>
51229 </indexterm>
51230 <indexterm role="concept">
51231 <primary>TLS</primary>
51232 <secondary>multiple message deliveries</secondary>
51233 </indexterm>
51234 Exim sends multiple messages down the same TCP/IP connection by starting up
51235 an entirely new delivery process for each message, passing the socket from
51236 one process to the next. This implementation does not fit well with the use
51237 of TLS, because there is quite a lot of state information associated with a TLS
51238 connection, not just a socket identification. Passing all the state information
51239 to a new process is not feasible. Consequently, Exim shuts down an existing TLS
51240 session before passing the socket to a new process. The new process may then
51241 try to start a new TLS session, and if successful, may try to re-authenticate
51242 if AUTH is in use, before sending the next message.
51243 </para>
51244 <para>
51245 The RFC is not clear as to whether or not an SMTP session continues in clear
51246 after TLS has been shut down, or whether TLS may be restarted again later, as
51247 just described. However, if the server is Exim, this shutdown and
51248 reinitialization works. It is not known which (if any) other servers operate
51249 successfully if the client closes a TLS session and continues with unencrypted
51250 SMTP, but there are certainly some that do not work. For such servers, Exim
51251 should not pass the socket to another process, because the failure of the
51252 subsequent attempt to use it would cause Exim to record a temporary host error,
51253 and delay other deliveries to that host.
51254 </para>
51255 <para>
51256 To test for this case, Exim sends an EHLO command to the server after
51257 closing down the TLS session. If this fails in any way, the connection is
51258 closed instead of being passed to a new delivery process, but no retry
51259 information is recorded.
51260 </para>
51261 <para>
51262 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
51263 <command>smtp</command> transport to match those hosts for which Exim should not pass
51264 connections to new processes if TLS has been used.
51265 </para>
51266 </section>
51267 <section id="SECTcerandall">
51268 <title>Certificates and all that</title>
51269 <para>
51270 <indexterm role="concept">
51271 <primary>certificate</primary>
51272 <secondary>references to discussion</secondary>
51273 </indexterm>
51274 In order to understand fully how TLS works, you need to know about
51275 certificates, certificate signing, and certificate authorities. This is not the
51276 place to give a tutorial, especially as I do not know very much about it
51277 myself. Some helpful introduction can be found in the FAQ for the SSL addition
51278 to Apache, currently at
51279 </para>
51280 <literallayout>
51281 <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>
51282 </literallayout>
51283 <para>
51284 Other parts of the <emphasis>modssl</emphasis> documentation are also helpful, and have
51285 links to further files.
51286 Eric Rescorla&#x2019;s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
51287 0-201-61598-3), contains both introductory and more in-depth descriptions.
51288 Some sample programs taken from the book are available from
51289 </para>
51290 <literallayout>
51291 <emphasis role="bold"><ulink url="http://www.rtfm.com/openssl-examples/">http://www.rtfm.com/openssl-examples/</ulink></emphasis>
51292 </literallayout>
51293 </section>
51294 <section id="SECID186">
51295 <title>Certificate chains</title>
51296 <para>
51297 The file named by <option>tls_certificate</option> may contain more than one
51298 certificate. This is useful in the case where the certificate that is being
51299 sent is validated by an intermediate certificate which the other end does
51300 not have. Multiple certificates must be in the correct order in the file.
51301 First the host&#x2019;s certificate itself, then the first intermediate
51302 certificate to validate the issuer of the host certificate, then the next
51303 intermediate certificate to validate the issuer of the first intermediate
51304 certificate, and so on, until finally (optionally) the root certificate.
51305 The root certificate must already be trusted by the recipient for
51306 validation to succeed, of course, but if it&#x2019;s not preinstalled, sending the
51307 root certificate along with the rest makes it available for the user to
51308 install if the receiving end is a client MUA that can interact with a user.
51309 </para>
51310 <para>
51311 Note that certificates using MD5 are unlikely to work on today&#x2019;s Internet;
51312 even if your libraries allow loading them for use in Exim when acting as a
51313 server, increasingly clients will not accept such certificates.  The error
51314 diagnostics in such a case can be frustratingly vague.
51315 </para>
51316 </section>
51317 <section id="SECID187">
51318 <title>Self-signed certificates</title>
51319 <para>
51320 <indexterm role="concept">
51321 <primary>certificate</primary>
51322 <secondary>self-signed</secondary>
51323 </indexterm>
51324 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
51325 with OpenSSL, like this:
51326 </para>
51327 <literallayout class="monospaced">
51328 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
51329             -days 9999 -nodes
51330 </literallayout>
51331 <para>
51332 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
51333 delimited and so can be identified independently. The <option>-days</option> option
51334 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
51335 important: if you do not set it, the key is encrypted with a passphrase
51336 that you are prompted for, and any use that is made of the key causes more
51337 prompting for the passphrase. This is not helpful if you are going to use
51338 this certificate and key in an MTA, where prompting is not possible.
51339 </para>
51340 <para>
51341 NB: we are now past the point where 9999 days takes us past the 32-bit Unix
51342 epoch.  If your system uses unsigned time_t (most do) and is 32-bit, then
51343 the above command might produce a date in the past.  Think carefully about
51344 the lifetime of the systems you&#x2019;re deploying, and either reduce the duration
51345 of the certificate or reconsider your platform deployment.  (At time of
51346 writing, reducing the duration is the most likely choice, but the inexorable
51347 progression of time takes us steadily towards an era where this will not
51348 be a sensible resolution).
51349 </para>
51350 <para>
51351 A self-signed certificate made in this way is sufficient for testing, and
51352 may be adequate for all your requirements if you are mainly interested in
51353 encrypting transfers, and not in secure identification.
51354 </para>
51355 <para>
51356 However, many clients require that the certificate presented by the server be a
51357 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
51358 certificate. In this situation, the self-signed certificate described above
51359 must be installed on the client host as a trusted root <emphasis>certification
51360 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
51361 signed with that self-signed certificate.
51362 </para>
51363 <para>
51364 For information on creating self-signed CA certificates and using them to sign
51365 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
51366 Open-source PKI book, available online at
51367 <emphasis role="bold"><ulink url="http://ospkibook.sourceforge.net/">http://ospkibook.sourceforge.net/</ulink></emphasis>.
51368 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
51369 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
51370 </para>
51371 </section>
51372 </chapter>
51373
51374 <chapter id="CHAPACL">
51375 <title>Access control lists</title>
51376 <para>
51377 <indexterm role="concept" id="IIDacl" class="startofrange">
51378 <primary>access control lists (ACLs)</primary>
51379 <secondary>description</secondary>
51380 </indexterm>
51381 <indexterm role="concept">
51382 <primary>control of incoming mail</primary>
51383 </indexterm>
51384 <indexterm role="concept">
51385 <primary>message</primary>
51386 <secondary>controlling incoming</secondary>
51387 </indexterm>
51388 <indexterm role="concept">
51389 <primary>policy control</primary>
51390 <secondary>access control lists</secondary>
51391 </indexterm>
51392 Access Control Lists (ACLs) are defined in a separate section of the run time
51393 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
51394 name, terminated by a colon. Here is a complete ACL section that contains just
51395 one very small ACL:
51396 </para>
51397 <literallayout class="monospaced">
51398 begin acl
51399 small_acl:
51400   accept   hosts = one.host.only
51401 </literallayout>
51402 <para>
51403 You can have as many lists as you like in the ACL section, and the order in
51404 which they appear does not matter. The lists are self-terminating.
51405 </para>
51406 <para>
51407 The majority of ACLs are used to control Exim&#x2019;s behaviour when it receives
51408 certain SMTP commands. This applies both to incoming TCP/IP connections, and
51409 when a local process submits a message using SMTP by specifying the <option>-bs</option>
51410 option. The most common use is for controlling which recipients are accepted
51411 in incoming messages. In addition, you can define an ACL that is used to check
51412 local non-SMTP messages. The default configuration file contains an example of
51413 a realistic ACL for checking RCPT commands. This is discussed in chapter
51414 <xref linkend="CHAPdefconfil"/>.
51415 </para>
51416 <section id="SECID188">
51417 <title>Testing ACLs</title>
51418 <para>
51419 The <option>-bh</option> command line option provides a way of testing your ACL
51420 configuration locally by running a fake SMTP session with which you interact.
51421 The host <emphasis>relay-test.mail-abuse.org</emphasis> provides a service for checking your
51422 relaying configuration (see section <xref linkend="SECTcheralcon"/> for more details).
51423 </para>
51424 </section>
51425 <section id="SECID189">
51426 <title>Specifying when ACLs are used</title>
51427 <para>
51428 <indexterm role="concept">
51429 <primary>access control lists (ACLs)</primary>
51430 <secondary>options for specifying</secondary>
51431 </indexterm>
51432 In order to cause an ACL to be used, you have to name it in one of the relevant
51433 options in the main part of the configuration. These options are:
51434 <indexterm role="concept">
51435 <primary>AUTH</primary>
51436 <secondary>ACL for</secondary>
51437 </indexterm>
51438 <indexterm role="concept">
51439 <primary>DATA</primary>
51440 <secondary>ACLs for</secondary>
51441 </indexterm>
51442 <indexterm role="concept">
51443 <primary>ETRN</primary>
51444 <secondary>ACL for</secondary>
51445 </indexterm>
51446 <indexterm role="concept">
51447 <primary>EXPN</primary>
51448 <secondary>ACL for</secondary>
51449 </indexterm>
51450 <indexterm role="concept">
51451 <primary>HELO</primary>
51452 <secondary>ACL for</secondary>
51453 </indexterm>
51454 <indexterm role="concept">
51455 <primary>EHLO</primary>
51456 <secondary>ACL for</secondary>
51457 </indexterm>
51458 <indexterm role="concept">
51459 <primary>MAIL</primary>
51460 <secondary>ACL for</secondary>
51461 </indexterm>
51462 <indexterm role="concept">
51463 <primary>QUIT, ACL for</primary>
51464 </indexterm>
51465 <indexterm role="concept">
51466 <primary>RCPT</primary>
51467 <secondary>ACL for</secondary>
51468 </indexterm>
51469 <indexterm role="concept">
51470 <primary>STARTTLS, ACL for</primary>
51471 </indexterm>
51472 <indexterm role="concept">
51473 <primary>VRFY</primary>
51474 <secondary>ACL for</secondary>
51475 </indexterm>
51476 <indexterm role="concept">
51477 <primary>SMTP</primary>
51478 <secondary>connection, ACL for</secondary>
51479 </indexterm>
51480 <indexterm role="concept">
51481 <primary>non-SMTP messages</primary>
51482 <secondary>ACLs for</secondary>
51483 </indexterm>
51484 <indexterm role="concept">
51485 <primary>MIME content scanning</primary>
51486 <secondary>ACL for</secondary>
51487 </indexterm>
51488 <indexterm role="concept">
51489 <primary>PRDR</primary>
51490 <secondary>ACL for</secondary>
51491 </indexterm>
51492 </para>
51493 <informaltable frame="none">
51494 <tgroup cols="2" colsep="0" rowsep="0">
51495 <colspec colwidth="140pt" align="left"/>
51496 <colspec colwidth="254pt" align="left"/>
51497 <tbody>
51498 <row>
51499 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp</option></entry>
51500 <entry>ACL for non-SMTP messages</entry>
51501 </row>
51502 <row>
51503 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_mime</option></entry>
51504 <entry>ACL for non-SMTP MIME parts</entry>
51505 </row>
51506 <row>
51507 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_start</option></entry>
51508 <entry>ACL at start of non-SMTP message</entry>
51509 </row>
51510 <row>
51511 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_auth</option></entry>
51512 <entry>ACL for AUTH</entry>
51513 </row>
51514 <row>
51515 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_connect</option></entry>
51516 <entry>ACL for start of SMTP connection</entry>
51517 </row>
51518 <row>
51519 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data</option></entry>
51520 <entry>ACL after DATA is complete</entry>
51521 </row>
51522 <row>
51523 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data_prdr</option></entry>
51524 <entry>ACL for each recipient, after DATA is complete</entry>
51525 </row>
51526 <row>
51527 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_etrn</option></entry>
51528 <entry>ACL for ETRN</entry>
51529 </row>
51530 <row>
51531 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_expn</option></entry>
51532 <entry>ACL for EXPN</entry>
51533 </row>
51534 <row>
51535 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_helo</option></entry>
51536 <entry>ACL for HELO or EHLO</entry>
51537 </row>
51538 <row>
51539 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mail</option></entry>
51540 <entry>ACL for MAIL</entry>
51541 </row>
51542 <row>
51543 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mailauth</option></entry>
51544 <entry>ACL for the AUTH parameter of MAIL</entry>
51545 </row>
51546 <row>
51547 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mime</option></entry>
51548 <entry>ACL for content-scanning MIME parts</entry>
51549 </row>
51550 <row>
51551 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_notquit</option></entry>
51552 <entry>ACL for non-QUIT terminations</entry>
51553 </row>
51554 <row>
51555 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_predata</option></entry>
51556 <entry>ACL at start of DATA command</entry>
51557 </row>
51558 <row>
51559 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_quit</option></entry>
51560 <entry>ACL for QUIT</entry>
51561 </row>
51562 <row>
51563 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_rcpt</option></entry>
51564 <entry>ACL for RCPT</entry>
51565 </row>
51566 <row>
51567 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_starttls</option></entry>
51568 <entry>ACL for STARTTLS</entry>
51569 </row>
51570 <row>
51571 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_vrfy</option></entry>
51572 <entry>ACL for VRFY</entry>
51573 </row>
51574 </tbody>
51575 </tgroup>
51576 </informaltable>
51577 <para>
51578 For example, if you set
51579 </para>
51580 <literallayout class="monospaced">
51581 acl_smtp_rcpt = small_acl
51582 </literallayout>
51583 <para>
51584 the little ACL defined above is used whenever Exim receives a RCPT command
51585 in an SMTP dialogue. The majority of policy tests on incoming messages can be
51586 done when RCPT commands arrive. A rejection of RCPT should cause the
51587 sending MTA to give up on the recipient address contained in the RCPT
51588 command, whereas rejection at other times may cause the client MTA to keep on
51589 trying to deliver the message. It is therefore recommended that you do as much
51590 testing as possible at RCPT time.
51591 </para>
51592 </section>
51593 <section id="SECID190">
51594 <title>The non-SMTP ACLs</title>
51595 <para>
51596 <indexterm role="concept">
51597 <primary>non-SMTP messages</primary>
51598 <secondary>ACLs for</secondary>
51599 </indexterm>
51600 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
51601 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
51602 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
51603 the state of the SMTP connection such as encryption and authentication) are not
51604 relevant and are forbidden in these ACLs. However, the sender and recipients
51605 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
51606 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
51607 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
51608 in any of these ACLs.
51609 </para>
51610 <para>
51611 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
51612 non-SMTP message, before any of the message has been read. (This is the
51613 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) In the case of
51614 batched SMTP input, it runs after the DATA command has been reached. The
51615 result of this ACL is ignored; it cannot be used to reject a message. If you
51616 really need to, you could set a value in an ACL variable here and reject based
51617 on that in the <option>acl_not_smtp</option> ACL. However, this ACL can be used to set
51618 controls, and in particular, it can be used to set
51619 </para>
51620 <literallayout class="monospaced">
51621 control = suppress_local_fixups
51622 </literallayout>
51623 <para>
51624 This cannot be used in the other non-SMTP ACLs because by the time they are
51625 run, it is too late.
51626 </para>
51627 <para>
51628 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
51629 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
51630 </para>
51631 <para>
51632 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
51633 kind of rejection is treated as permanent, because there is no way of sending a
51634 temporary error for these kinds of message.
51635 </para>
51636 </section>
51637 <section id="SECID191">
51638 <title>The SMTP connect ACL</title>
51639 <para>
51640 <indexterm role="concept">
51641 <primary>SMTP</primary>
51642 <secondary>connection, ACL for</secondary>
51643 </indexterm>
51644 <indexterm role="option">
51645 <primary><option>smtp_banner</option></primary>
51646 </indexterm>
51647 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
51648 session, after the test specified by <option>host_reject_connection</option> (which is now
51649 an anomaly) and any TCP Wrappers testing (if configured). If the connection is
51650 accepted by an <option>accept</option> verb that has a <option>message</option> modifier, the contents of
51651 the message override the banner message that is otherwise specified by the
51652 <option>smtp_banner</option> option.
51653 </para>
51654 </section>
51655 <section id="SECID192">
51656 <title>The EHLO/HELO ACL</title>
51657 <para>
51658 <indexterm role="concept">
51659 <primary>EHLO</primary>
51660 <secondary>ACL for</secondary>
51661 </indexterm>
51662 <indexterm role="concept">
51663 <primary>HELO</primary>
51664 <secondary>ACL for</secondary>
51665 </indexterm>
51666 The ACL test specified by <option>acl_smtp_helo</option> happens when the client issues an
51667 EHLO or HELO command, after the tests specified by <option>helo_accept_junk_hosts</option>,
51668 <option>helo_allow_chars</option>, <option>helo_verify_hosts</option>, and <option>helo_try_verify_hosts</option>.
51669 Note that a client may issue more than one EHLO or HELO command in an SMTP
51670 session, and indeed is required to issue a new EHLO or HELO after successfully
51671 setting up encryption following a STARTTLS command.
51672 </para>
51673 <para>
51674 If the command is accepted by an <option>accept</option> verb that has a <option>message</option>
51675 modifier, the message may not contain more than one line (it will be truncated
51676 at the first newline and a panic logged if it does). Such a message cannot
51677 affect the EHLO options that are listed on the second and subsequent lines of
51678 an EHLO response.
51679 </para>
51680 </section>
51681 <section id="SECID193">
51682 <title>The DATA ACLs</title>
51683 <para>
51684 <indexterm role="concept">
51685 <primary>DATA</primary>
51686 <secondary>ACLs for</secondary>
51687 </indexterm>
51688 Two ACLs are associated with the DATA command, because it is two-stage
51689 command, with two responses being sent to the client.
51690 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
51691 is obeyed. This gives you control after all the RCPT commands, but before
51692 the message itself is received. It offers the opportunity to give a negative
51693 response to the DATA command before the data is transmitted. Header lines
51694 added by MAIL or RCPT ACLs are not visible at this time, but any that
51695 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
51696 </para>
51697 <para>
51698 You cannot test the contents of the message, for example, to verify addresses
51699 in the headers, at RCPT time or when the DATA command is received. Such
51700 tests have to appear in the ACL that is run after the message itself has been
51701 received, before the final response to the DATA command is sent. This is
51702 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
51703 associated with the DATA command.
51704 </para>
51705 <para>
51706 For both of these ACLs, it is not possible to reject individual recipients. An
51707 error response rejects the entire message. Unfortunately, it is known that some
51708 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
51709 before or after the data) correctly &ndash; they keep the message on their queues
51710 and try again later, but that is their problem, though it does waste some of
51711 your resources.
51712 </para>
51713 <para>
51714 The <option>acl_smtp_data</option> ACL is run after
51715 the <option>acl_smtp_data_prdr</option>,
51716 the <option>acl_smtp_dkim</option>
51717 and the <option>acl_smtp_mime</option> ACLs.
51718 </para>
51719 </section>
51720 <section id="SECTDKIMACL">
51721 <title>The SMTP DKIM ACL</title>
51722 <para>
51723 The <option>acl_smtp_dkim</option> ACL is available only when Exim is compiled with DKIM support
51724 enabled (which is the default).
51725 </para>
51726 <para>
51727 The ACL test specified by <option>acl_smtp_dkim</option> happens after a message has been
51728 received, and is executed for each DKIM signature found in a message.  If not
51729 otherwise specified, the default action is to accept.
51730 </para>
51731 <para>
51732 This ACL is evaluated before <option>acl_smtp_mime</option> and <option>acl_smtp_data</option>.
51733 </para>
51734 <para>
51735 For details on the operation of DKIM, see chapter <xref linkend="CHAPdkim"/>.
51736 </para>
51737 </section>
51738 <section id="SECID194">
51739 <title>The SMTP MIME ACL</title>
51740 <para>
51741 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
51742 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
51743 </para>
51744 <para>
51745 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
51746 </para>
51747 </section>
51748 <section id="SECTPRDRACL">
51749 <title>The SMTP PRDR ACL</title>
51750 <para>
51751 <indexterm role="option">
51752 <primary><option>prdr_enable</option></primary>
51753 </indexterm>
51754 The <option>acl_smtp_data_prdr</option> ACL is available only when Exim is compiled
51755 with PRDR support enabled (which is the default).
51756 It becomes active only when the PRDR feature is negotiated between
51757 client and server for a message, and more than one recipient
51758 has been accepted.
51759 </para>
51760 <para>
51761 The ACL test specfied by <option>acl_smtp_data_prdr</option> happens after a message
51762 has been recieved, and is executed for each recipient of the message.
51763 The test may accept or deny for inividual recipients.
51764 The <option>acl_smtp_data</option> will still be called after this ACL and
51765 can reject the message overall, even if this ACL has accepted it
51766 for some or all recipients.
51767 </para>
51768 <para>
51769 PRDR may be used to support per-user content filtering.  Without it
51770 one must defer any recipient after the first that has a different
51771 content-filter configuration.  With PRDR, the RCPT-time check
51772 for this can be disabled when the MAIL-time $smtp_command included
51773 "PRDR".  Any required difference in behaviour of the main DATA-time
51774 ACL should however depend on the PRDR-time ACL having run, as Exim
51775 will avoid doing so in some situations (eg.  single-recipient mails).
51776 </para>
51777 <para>
51778 See also the <option>prdr_enable</option> global option
51779 and the <option>hosts_try_prdr</option> smtp transport option.
51780 </para>
51781 <para>
51782 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
51783 If the ACL is not defined, processing completes as if
51784 the feature was not requested by the client.
51785 </para>
51786 </section>
51787 <section id="SECTQUITACL">
51788 <title>The QUIT ACL</title>
51789 <para>
51790 <indexterm role="concept">
51791 <primary>QUIT, ACL for</primary>
51792 </indexterm>
51793 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
51794 does not affect the response code to QUIT, which is always 221. Thus, the ACL
51795 does not in fact control any access. For this reason, the only verbs that are
51796 permitted are <option>accept</option> and <option>warn</option>.
51797 </para>
51798 <para>
51799 This ACL can be used for tasks such as custom logging at the end of an SMTP
51800 session. For example, you can use ACL variables in other ACLs to count
51801 messages, recipients, etc., and log the totals at QUIT time using one or
51802 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
51803 </para>
51804 <para>
51805 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
51806 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
51807 </para>
51808 <para>
51809 You do not need to have a final <option>accept</option>, but if you do, you can use a
51810 <option>message</option> modifier to specify custom text that is sent as part of the 221
51811 response to QUIT.
51812 </para>
51813 <para>
51814 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
51815 failure (for example, failure to open a log file, or when Exim is bombing out
51816 because it has detected an unrecoverable error), all SMTP commands from the
51817 client are given temporary error responses until QUIT is received or the
51818 connection is closed. In these special cases, the QUIT ACL does not run.
51819 </para>
51820 </section>
51821 <section id="SECTNOTQUITACL">
51822 <title>The not-QUIT ACL</title>
51823 <para>
51824 <indexterm role="variable">
51825 <primary><varname>$acl_smtp_notquit</varname></primary>
51826 </indexterm>
51827 The not-QUIT ACL, specified by <option>acl_smtp_notquit</option>, is run in most cases when
51828 an SMTP session ends without sending QUIT. However, when Exim itself is in bad
51829 trouble, such as being unable to write to its log files, this ACL is not run,
51830 because it might try to do things (such as write to log files) that make the
51831 situation even worse.
51832 </para>
51833 <para>
51834 Like the QUIT ACL, this ACL is provided to make it possible to do customized
51835 logging or to gather statistics, and its outcome is ignored. The <option>delay</option>
51836 modifier is forbidden in this ACL, and the only permitted verbs are <option>accept</option>
51837 and <option>warn</option>.
51838 </para>
51839 <para>
51840 <indexterm role="variable">
51841 <primary><varname>$smtp_notquit_reason</varname></primary>
51842 </indexterm>
51843 When the not-QUIT ACL is running, the variable <varname>$smtp_notquit_reason</varname> is set
51844 to a string that indicates the reason for the termination of the SMTP
51845 connection. The possible values are:
51846 </para>
51847 <informaltable frame="none">
51848 <tgroup cols="2" colsep="0" rowsep="0">
51849 <colspec colwidth="196pt" align="left"/>
51850 <colspec colwidth="254pt" align="left"/>
51851 <tbody>
51852 <row>
51853 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>acl-drop</literal></entry>
51854 <entry>Another ACL issued a <option>drop</option> command</entry>
51855 </row>
51856 <row>
51857 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>bad-commands</literal></entry>
51858 <entry>Too many unknown or non-mail commands</entry>
51859 </row>
51860 <row>
51861 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>command-timeout</literal></entry>
51862 <entry>Timeout while reading SMTP commands</entry>
51863 </row>
51864 <row>
51865 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>connection-lost</literal></entry>
51866 <entry>The SMTP connection has been lost</entry>
51867 </row>
51868 <row>
51869 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>data-timeout</literal></entry>
51870 <entry>Timeout while reading message data</entry>
51871 </row>
51872 <row>
51873 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-error</literal></entry>
51874 <entry>The <function>local_scan()</function> function crashed</entry>
51875 </row>
51876 <row>
51877 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-timeout</literal></entry>
51878 <entry>The <function>local_scan()</function> function timed out</entry>
51879 </row>
51880 <row>
51881 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>signal-exit</literal></entry>
51882 <entry>SIGTERM or SIGINT</entry>
51883 </row>
51884 <row>
51885 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>synchronization-error</literal></entry>
51886 <entry>SMTP synchronization error</entry>
51887 </row>
51888 <row>
51889 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls-failed</literal></entry>
51890 <entry>TLS failed to start</entry>
51891 </row>
51892 </tbody>
51893 </tgroup>
51894 </informaltable>
51895 <para>
51896 In most cases when an SMTP connection is closed without having received QUIT,
51897 Exim sends an SMTP response message before actually closing the connection.
51898 With the exception of the <literal>acl-drop</literal> case, the default message can be
51899 overridden by the <option>message</option> modifier in the not-QUIT ACL. In the case of a
51900 <option>drop</option> verb in another ACL, it is the message from the other ACL that is
51901 used.
51902 </para>
51903 </section>
51904 <section id="SECID195">
51905 <title>Finding an ACL to use</title>
51906 <para>
51907 <indexterm role="concept">
51908 <primary>access control lists (ACLs)</primary>
51909 <secondary>finding which to use</secondary>
51910 </indexterm>
51911 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
51912 you can use different ACLs in different circumstances. For example,
51913 </para>
51914 <literallayout class="monospaced">
51915 acl_smtp_rcpt = ${if ={25}{$interface_port} \
51916                      {acl_check_rcpt} {acl_check_rcpt_submit} }
51917 </literallayout>
51918 <para>
51919 In the default configuration file there are some example settings for
51920 providing an RFC 4409 message submission service on port 587 and a
51921 non-standard <quote>smtps</quote> service on port 465. You can use a string
51922 expansion like this to choose an ACL for MUAs on these ports which is
51923 more appropriate for this purpose than the default ACL on port 25.
51924 </para>
51925 <para>
51926 The expanded string does not have to be the name of an ACL in the
51927 configuration file; there are other possibilities. Having expanded the
51928 string, Exim searches for an ACL as follows:
51929 </para>
51930 <itemizedlist>
51931 <listitem>
51932 <para>
51933 If the string begins with a slash, Exim uses it as a file name, and reads its
51934 contents as an ACL. The lines are processed in the same way as lines in the
51935 Exim configuration file. In particular, continuation lines are supported, blank
51936 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
51937 If the file does not exist or cannot be read, an error occurs (typically
51938 causing a temporary failure of whatever caused the ACL to be run). For example:
51939 </para>
51940 <literallayout class="monospaced">
51941 acl_smtp_data = /etc/acls/\
51942   ${lookup{$sender_host_address}lsearch\
51943   {/etc/acllist}{$value}{default}}
51944 </literallayout>
51945 <para>
51946 This looks up an ACL file to use on the basis of the host&#x2019;s IP address, falling
51947 back to a default if the lookup fails. If an ACL is successfully read from a
51948 file, it is retained in memory for the duration of the Exim process, so that it
51949 can be re-used without having to re-read the file.
51950 </para>
51951 </listitem>
51952 <listitem>
51953 <para>
51954 If the string does not start with a slash, and does not contain any spaces,
51955 Exim searches the ACL section of the configuration for an ACL whose name
51956 matches the string.
51957 </para>
51958 </listitem>
51959 <listitem>
51960 <para>
51961 If no named ACL is found, or if the string contains spaces, Exim parses
51962 the string as an inline ACL. This can save typing in cases where you just
51963 want to have something like
51964 </para>
51965 <literallayout class="monospaced">
51966 acl_smtp_vrfy = accept
51967 </literallayout>
51968 <para>
51969 in order to allow free use of the VRFY command. Such a string may contain
51970 newlines; it is processed in the same way as an ACL that is read from a file.
51971 </para>
51972 </listitem>
51973 </itemizedlist>
51974 </section>
51975 <section id="SECID196">
51976 <title>ACL return codes</title>
51977 <para>
51978 <indexterm role="concept">
51979 <primary>access control lists (ACLs)</primary>
51980 <secondary>return codes</secondary>
51981 </indexterm>
51982 Except for the QUIT ACL, which does not affect the SMTP return code (see
51983 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
51984 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
51985 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
51986 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
51987 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
51988 This also causes a 4<emphasis>xx</emphasis> return code.
51989 </para>
51990 <para>
51991 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
51992 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
51993 submitters of non-SMTP messages.
51994 </para>
51995 <para>
51996 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
51997 has the effect of <quote>accept</quote>, but causes either the entire message or an
51998 individual recipient address to be discarded. In other words, it is a
51999 blackholing facility. Use it with care.
52000 </para>
52001 <para>
52002 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
52003 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
52004 RCPT ACL is to discard just the one recipient address. If there are no
52005 recipients left when the message&#x2019;s data is received, the DATA ACL is not
52006 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
52007 remaining recipients. The <quote>discard</quote> return is not permitted for the
52008 <option>acl_smtp_predata</option> ACL.
52009 </para>
52010 <para>
52011 <indexterm role="concept">
52012 <primary><function>local_scan()</function> function</primary>
52013 <secondary>when all recipients discarded</secondary>
52014 </indexterm>
52015 The <function>local_scan()</function> function is always run, even if there are no remaining
52016 recipients; it may create new recipients.
52017 </para>
52018 </section>
52019 <section id="SECID197">
52020 <title>Unset ACL options</title>
52021 <para>
52022 <indexterm role="concept">
52023 <primary>access control lists (ACLs)</primary>
52024 <secondary>unset options</secondary>
52025 </indexterm>
52026 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
52027 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
52028 not defined at all. For any defined ACL, the default action when control
52029 reaches the end of the ACL statements is <quote>deny</quote>.
52030 </para>
52031 <para>
52032 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
52033 these two are ACLs that are used only for their side effects. They cannot be
52034 used to accept or reject anything.
52035 </para>
52036 <para>
52037 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
52038 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
52039 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
52040 when the ACL is not defined is <quote>accept</quote>.
52041 </para>
52042 <para>
52043 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
52044 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
52045 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
52046 messages over an SMTP connection. For an example, see the ACL in the default
52047 configuration file.
52048 </para>
52049 </section>
52050 <section id="SECID198">
52051 <title>Data for message ACLs</title>
52052 <para>
52053 <indexterm role="concept">
52054 <primary>access control lists (ACLs)</primary>
52055 <secondary>data for message ACL</secondary>
52056 </indexterm>
52057 <indexterm role="variable">
52058 <primary><varname>$domain</varname></primary>
52059 </indexterm>
52060 <indexterm role="variable">
52061 <primary><varname>$local_part</varname></primary>
52062 </indexterm>
52063 <indexterm role="variable">
52064 <primary><varname>$sender_address</varname></primary>
52065 </indexterm>
52066 <indexterm role="variable">
52067 <primary><varname>$sender_host_address</varname></primary>
52068 </indexterm>
52069 <indexterm role="variable">
52070 <primary><varname>$smtp_command</varname></primary>
52071 </indexterm>
52072 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
52073 that contain information about the host and the message&#x2019;s sender (for example,
52074 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
52075 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
52076 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
52077 is available in <varname>$smtp_command</varname>.
52078 </para>
52079 <para>
52080 When an ACL for the AUTH parameter of MAIL is running, the variables that
52081 contain information about the host are set, but <varname>$sender_address</varname> is not yet
52082 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
52083 how it is used.
52084 </para>
52085 <para>
52086 <indexterm role="variable">
52087 <primary><varname>$message_size</varname></primary>
52088 </indexterm>
52089 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
52090 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
52091 that parameter is not given. The value is updated to the true message size by
52092 the time the final DATA ACL is run (after the message data has been
52093 received).
52094 </para>
52095 <para>
52096 <indexterm role="variable">
52097 <primary><varname>$rcpt_count</varname></primary>
52098 </indexterm>
52099 <indexterm role="variable">
52100 <primary><varname>$recipients_count</varname></primary>
52101 </indexterm>
52102 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
52103 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
52104 accepted, so while an ACL for RCPT is being processed, it contains the number
52105 of previously accepted recipients. At DATA time (for both the DATA ACLs),
52106 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
52107 <varname>$recipients_count</varname> contains the total number of accepted recipients.
52108 </para>
52109 </section>
52110 <section id="SECTdatfornon">
52111 <title>Data for non-message ACLs</title>
52112 <para>
52113 <indexterm role="concept">
52114 <primary>access control lists (ACLs)</primary>
52115 <secondary>data for non-message ACL</secondary>
52116 </indexterm>
52117 <indexterm role="variable">
52118 <primary><varname>$smtp_command_argument</varname></primary>
52119 </indexterm>
52120 <indexterm role="variable">
52121 <primary><varname>$smtp_command</varname></primary>
52122 </indexterm>
52123 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
52124 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
52125 and the entire SMTP command is available in <varname>$smtp_command</varname>.
52126 These variables can be tested using a <option>condition</option> condition. For example,
52127 here is an ACL for use with AUTH, which insists that either the session is
52128 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
52129 does not permit authentication methods that use cleartext passwords on
52130 unencrypted connections.
52131 </para>
52132 <literallayout class="monospaced">
52133 acl_check_auth:
52134   accept encrypted = *
52135   accept condition = ${if eq{${uc:$smtp_command_argument}}\
52136                      {CRAM-MD5}}
52137   deny   message   = TLS encryption or CRAM-MD5 required
52138 </literallayout>
52139 <para>
52140 (Another way of applying this restriction is to arrange for the authenticators
52141 that use cleartext passwords not to be advertised when the connection is not
52142 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
52143 option to do this.)
52144 </para>
52145 </section>
52146 <section id="SECID199">
52147 <title>Format of an ACL</title>
52148 <para>
52149 <indexterm role="concept">
52150 <primary>access control lists (ACLs)</primary>
52151 <secondary>format of</secondary>
52152 </indexterm>
52153 <indexterm role="concept">
52154 <primary>access control lists (ACLs)</primary>
52155 <secondary>verbs, definition of</secondary>
52156 </indexterm>
52157 An individual ACL consists of a number of statements. Each statement starts
52158 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
52159 Modifiers can change the way the verb operates, define error and log messages,
52160 set variables, insert delays, and vary the processing of accepted messages.
52161 </para>
52162 <para>
52163 If all the conditions are met, the verb is obeyed. The same condition may be
52164 used (with different arguments) more than once in the same statement. This
52165 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
52166 example:
52167 </para>
52168 <literallayout class="monospaced">
52169 deny  dnslists = list1.example
52170 dnslists = list2.example
52171 </literallayout>
52172 <para>
52173 If there are no conditions, the verb is always obeyed. Exim stops evaluating
52174 the conditions and modifiers when it reaches a condition that fails. What
52175 happens then depends on the verb (and in one case, on a special modifier). Not
52176 all the conditions make sense at every testing point. For example, you cannot
52177 test a sender address in the ACL that is run for a VRFY command.
52178 </para>
52179 </section>
52180 <section id="SECID200">
52181 <title>ACL verbs</title>
52182 <para>
52183 The ACL verbs are as follows:
52184 </para>
52185 <itemizedlist>
52186 <listitem>
52187 <para>
52188 <indexterm role="concept">
52189 <primary><option>accept</option> ACL verb</primary>
52190 </indexterm>
52191 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
52192 of the conditions are not met, what happens depends on whether <option>endpass</option>
52193 appears among the conditions (for syntax see below). If the failing condition
52194 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
52195 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
52196 check a RCPT command:
52197 </para>
52198 <literallayout class="monospaced">
52199 accept domains = +local_domains
52200 endpass
52201 verify = recipient
52202 </literallayout>
52203 <para>
52204 If the recipient domain does not match the <option>domains</option> condition, control
52205 passes to the next statement. If it does match, the recipient is verified, and
52206 the command is accepted if verification succeeds. However, if verification
52207 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
52208 <option>endpass</option>.
52209 </para>
52210 <para>
52211 The <option>endpass</option> feature has turned out to be confusing to many people, so its
52212 use is not recommended nowadays. It is always possible to rewrite an ACL so
52213 that <option>endpass</option> is not needed, and it is no longer used in the default
52214 configuration.
52215 </para>
52216 <para>
52217 <indexterm role="concept">
52218 <primary><option>message</option> ACL modifier</primary>
52219 <secondary>with <option>accept</option></secondary>
52220 </indexterm>
52221 If a <option>message</option> modifier appears on an <option>accept</option> statement, its action
52222 depends on whether or not <option>endpass</option> is present. In the absence of <option>endpass</option>
52223 (when an <option>accept</option> verb either accepts or passes control to the next
52224 statement), <option>message</option> can be used to vary the message that is sent when an
52225 SMTP command is accepted. For example, in a RCPT ACL you could have:
52226 </para>
52227 <literallayout>
52228 <literal>accept  </literal>&lt;<emphasis>some conditions</emphasis>&gt;
52229 <literal>        message = OK, I will allow you through today</literal>
52230 </literallayout>
52231 <para>
52232 You can specify an SMTP response code, optionally followed by an <quote>extended
52233 response code</quote> at the start of the message, but the first digit must be the
52234 same as would be sent by default, which is 2 for an <option>accept</option> verb.
52235 </para>
52236 <para>
52237 If <option>endpass</option> is present in an <option>accept</option> statement, <option>message</option> specifies
52238 an error message that is used when access is denied. This behaviour is retained
52239 for backward compatibility, but current <quote>best practice</quote> is to avoid the use
52240 of <option>endpass</option>.
52241 </para>
52242 </listitem>
52243 <listitem>
52244 <para>
52245 <indexterm role="concept">
52246 <primary><option>defer</option> ACL verb</primary>
52247 </indexterm>
52248 <option>defer</option>: If all the conditions are true, the ACL returns <quote>defer</quote> which, in
52249 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
52250 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
52251 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
52252 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
52253 be used in any ACL, and even for a recipient it might be a simpler approach.
52254 </para>
52255 </listitem>
52256 <listitem>
52257 <para>
52258 <indexterm role="concept">
52259 <primary><option>deny</option> ACL verb</primary>
52260 </indexterm>
52261 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
52262 the conditions are not met, control is passed to the next ACL statement. For
52263 example,
52264 </para>
52265 <literallayout class="monospaced">
52266 deny dnslists = blackholes.mail-abuse.org
52267 </literallayout>
52268 <para>
52269 rejects commands from hosts that are on a DNS black list.
52270 </para>
52271 </listitem>
52272 <listitem>
52273 <para>
52274 <indexterm role="concept">
52275 <primary><option>discard</option> ACL verb</primary>
52276 </indexterm>
52277 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
52278 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
52279 that are concerned with receiving messages. When all the conditions are true,
52280 the sending entity receives a <quote>success</quote> response. However, <option>discard</option> causes
52281 recipients to be discarded. If it is used in an ACL for RCPT, just the one
52282 recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
52283 message&#x2019;s recipients are discarded. Recipients that are discarded before DATA
52284 do not appear in the log line when the <option>received_recipients</option> log selector is set.
52285 </para>
52286 <para>
52287 If the <option>log_message</option> modifier is set when <option>discard</option> operates,
52288 its contents are added to the line that is automatically written to the log.
52289 The <option>message</option> modifier operates exactly as it does for <option>accept</option>.
52290 </para>
52291 </listitem>
52292 <listitem>
52293 <para>
52294 <indexterm role="concept">
52295 <primary><option>drop</option> ACL verb</primary>
52296 </indexterm>
52297 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
52298 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
52299 </para>
52300 <literallayout class="monospaced">
52301 drop   message   = I don't take more than 20 RCPTs
52302        condition = ${if &gt; {$rcpt_count}{20}}
52303 </literallayout>
52304 <para>
52305 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
52306 The connection is always dropped after sending a 550 response.
52307 </para>
52308 </listitem>
52309 <listitem>
52310 <para>
52311 <indexterm role="concept">
52312 <primary><option>require</option> ACL verb</primary>
52313 </indexterm>
52314 <option>require</option>: If all the conditions are met, control is passed to the next ACL
52315 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
52316 example, when checking a RCPT command,
52317 </para>
52318 <literallayout class="monospaced">
52319 require message = Sender did not verify
52320         verify  = sender
52321 </literallayout>
52322 <para>
52323 passes control to subsequent statements only if the message&#x2019;s sender can be
52324 verified. Otherwise, it rejects the command. Note the positioning of the
52325 <option>message</option> modifier, before the <option>verify</option> condition. The reason for this is
52326 discussed in section <xref linkend="SECTcondmodproc"/>.
52327 </para>
52328 </listitem>
52329 <listitem>
52330 <para>
52331 <indexterm role="concept">
52332 <primary><option>warn</option> ACL verb</primary>
52333 </indexterm>
52334 <option>warn</option>: If all the conditions are true, a line specified by the
52335 <option>log_message</option> modifier is written to Exim&#x2019;s main log. Control always passes
52336 to the next ACL statement. If any condition is false, the log line is not
52337 written. If an identical log line is requested several times in the same
52338 message, only one copy is actually written to the log. If you want to force
52339 duplicates to be written, use the <option>logwrite</option> modifier instead.
52340 </para>
52341 <para>
52342 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
52343 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
52344 <option>logwrite</option>, <option>add_header</option>, and <option>remove_header</option>) that appear before the
52345 first failing condition. There is more about adding header lines in section
52346 <xref linkend="SECTaddheadacl"/>.
52347 </para>
52348 <para>
52349 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
52350 some sort of defer), the log line specified by <option>log_message</option> is not written.
52351 This does not include the case of a forced failure from a lookup, which
52352 is considered to be a successful completion. After a defer, no further
52353 conditions or modifiers in the <option>warn</option> statement are processed. The incident
52354 is logged, and the ACL continues to be processed, from the next statement
52355 onwards.
52356 </para>
52357 <para>
52358 <indexterm role="variable">
52359 <primary><varname>$acl_verify_message</varname></primary>
52360 </indexterm>
52361 When one of the <option>warn</option> conditions is an address verification that fails, the
52362 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
52363 want this logged, you must set it up explicitly. For example:
52364 </para>
52365 <literallayout class="monospaced">
52366 warn   !verify = sender
52367        log_message = sender verify failed: $acl_verify_message
52368 </literallayout>
52369 </listitem>
52370 </itemizedlist>
52371 <para>
52372 At the end of each ACL there is an implicit unconditional <option>deny</option>.
52373 </para>
52374 <para>
52375 As you can see from the examples above, the conditions and modifiers are
52376 written one to a line, with the first one on the same line as the verb, and
52377 subsequent ones on following lines. If you have a very long condition, you can
52378 continue it onto several physical lines by the usual backslash continuation
52379 mechanism. It is conventional to align the conditions vertically.
52380 </para>
52381 </section>
52382 <section id="SECTaclvariables">
52383 <title>ACL variables</title>
52384 <para>
52385 <indexterm role="concept">
52386 <primary>access control lists (ACLs)</primary>
52387 <secondary>variables</secondary>
52388 </indexterm>
52389 There are some special variables that can be set during ACL processing. They
52390 can be used to pass information between different ACLs, different invocations
52391 of the same ACL in the same SMTP connection, and between ACLs and the routers,
52392 transports, and filters that are used to deliver a message. The names of these
52393 variables must begin with <varname>$acl_c</varname> or <varname>$acl_m</varname>, followed either by a digit or
52394 an underscore, but the remainder of the name can be any sequence of
52395 alphanumeric characters and underscores that you choose. There is no limit on
52396 the number of ACL variables. The two sets act as follows:
52397 </para>
52398 <itemizedlist>
52399 <listitem>
52400 <para>
52401 The values of those variables whose names begin with <varname>$acl_c</varname> persist
52402 throughout an SMTP connection. They are never reset. Thus, a value that is set
52403 while receiving one message is still available when receiving the next message
52404 on the same SMTP connection.
52405 </para>
52406 </listitem>
52407 <listitem>
52408 <para>
52409 The values of those variables whose names begin with <varname>$acl_m</varname> persist only
52410 while a message is being received. They are reset afterwards. They are also
52411 reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session.
52412 </para>
52413 </listitem>
52414 </itemizedlist>
52415 <para>
52416 When a message is accepted, the current values of all the ACL variables are
52417 preserved with the message and are subsequently made available at delivery
52418 time. The ACL variables are set by a modifier called <option>set</option>. For example:
52419 </para>
52420 <literallayout class="monospaced">
52421 accept hosts = whatever
52422        set acl_m4 = some value
52423 accept authenticated = *
52424        set acl_c_auth = yes
52425 </literallayout>
52426 <para>
52427 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
52428 be set. If you want to set a variable without taking any action, you can use a
52429 <option>warn</option> verb without any other modifiers or conditions.
52430 </para>
52431 <para>
52432 <indexterm role="option">
52433 <primary><option>strict_acl_vars</option></primary>
52434 </indexterm>
52435 What happens if a syntactically valid but undefined ACL variable is
52436 referenced depends on the setting of the <option>strict_acl_vars</option> option. If it is
52437 false (the default), an empty string is substituted; if it is true, an
52438 error is generated.
52439 </para>
52440 <para>
52441 Versions of Exim before 4.64 have a limited set of numbered variables, but
52442 their names are compatible, so there is no problem with upgrading.
52443 </para>
52444 </section>
52445 <section id="SECTcondmodproc">
52446 <title>Condition and modifier processing</title>
52447 <para>
52448 <indexterm role="concept">
52449 <primary>access control lists (ACLs)</primary>
52450 <secondary>conditions; processing</secondary>
52451 </indexterm>
52452 <indexterm role="concept">
52453 <primary>access control lists (ACLs)</primary>
52454 <secondary>modifiers; processing</secondary>
52455 </indexterm>
52456 An exclamation mark preceding a condition negates its result. For example:
52457 </para>
52458 <literallayout class="monospaced">
52459 deny   domains = *.dom.example
52460       !verify  = recipient
52461 </literallayout>
52462 <para>
52463 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
52464 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
52465 negation can be used on the right-hand side of a condition. For example, these
52466 two statements are equivalent:
52467 </para>
52468 <literallayout class="monospaced">
52469 deny  hosts = !192.168.3.4
52470 deny !hosts =  192.168.3.4
52471 </literallayout>
52472 <para>
52473 However, for many conditions (<option>verify</option> being a good example), only left-hand
52474 side negation of the whole condition is possible.
52475 </para>
52476 <para>
52477 The arguments of conditions and modifiers are expanded. A forced failure
52478 of an expansion causes a condition to be ignored, that is, it behaves as if the
52479 condition is true. Consider these two statements:
52480 </para>
52481 <literallayout class="monospaced">
52482 accept  senders = ${lookup{$host_name}lsearch\
52483                   {/some/file}{$value}fail}
52484 accept  senders = ${lookup{$host_name}lsearch\
52485                   {/some/file}{$value}{}}
52486 </literallayout>
52487 <para>
52488 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
52489 the returned list is searched, but if the lookup fails the behaviour is
52490 different in the two cases. The <option>fail</option> in the first statement causes the
52491 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
52492 therefore succeeds. The second statement, however, generates an empty list when
52493 the lookup fails. No sender can match an empty list, so the condition fails,
52494 and therefore the <option>accept</option> also fails.
52495 </para>
52496 <para>
52497 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
52498 specify actions that are taken as the conditions for a statement are checked;
52499 others specify text for messages that are used when access is denied or a
52500 warning is generated. The <option>control</option> modifier affects the way an incoming
52501 message is handled.
52502 </para>
52503 <para>
52504 The positioning of the modifiers in an ACL statement is important, because the
52505 processing of a verb ceases as soon as its outcome is known. Only those
52506 modifiers that have already been encountered will take effect. For example,
52507 consider this use of the <option>message</option> modifier:
52508 </para>
52509 <literallayout class="monospaced">
52510 require message = Can't verify sender
52511         verify  = sender
52512         message = Can't verify recipient
52513         verify  = recipient
52514         message = This message cannot be used
52515 </literallayout>
52516 <para>
52517 If sender verification fails, Exim knows that the result of the statement is
52518 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
52519 so its text is used as the error message. If sender verification succeeds, but
52520 recipient verification fails, the second message is used. If recipient
52521 verification succeeds, the third message becomes <quote>current</quote>, but is never used
52522 because there are no more conditions to cause failure.
52523 </para>
52524 <para>
52525 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
52526 modifier that is used, because all the conditions must be true for rejection to
52527 happen. Specifying more than one <option>message</option> modifier does not make sense, and
52528 the message can even be specified after all the conditions. For example:
52529 </para>
52530 <literallayout class="monospaced">
52531 deny   hosts = ...
52532       !senders = *@my.domain.example
52533        message = Invalid sender from client host
52534 </literallayout>
52535 <para>
52536 The <quote>deny</quote> result does not happen until the end of the statement is reached,
52537 by which time Exim has set up the message.
52538 </para>
52539 </section>
52540 <section id="SECTACLmodi">
52541 <title>ACL modifiers</title>
52542 <para>
52543 <indexterm role="concept">
52544 <primary>access control lists (ACLs)</primary>
52545 <secondary>modifiers; list of</secondary>
52546 </indexterm>
52547 The ACL modifiers are as follows:
52548 </para>
52549 <variablelist>
52550 <varlistentry>
52551 <term><emphasis role="bold">add_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
52552 <listitem>
52553 <para>
52554 This modifier specifies one or more header lines that are to be added to an
52555 incoming message, assuming, of course, that the message is ultimately
52556 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
52557 </para>
52558 </listitem></varlistentry>
52559 <varlistentry>
52560 <term><emphasis role="bold">continue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
52561 <listitem>
52562 <para>
52563 <indexterm role="concept">
52564 <primary><option>continue</option> ACL modifier</primary>
52565 </indexterm>
52566 <indexterm role="concept">
52567 <primary>database</primary>
52568 <secondary>updating in ACL</secondary>
52569 </indexterm>
52570 This modifier does nothing of itself, and processing of the ACL always
52571 continues with the next condition or modifier. The value of <option>continue</option> is in
52572 the side effects of expanding its argument. Typically this could be used to
52573 update a database. It is really just a syntactic tidiness, to avoid having to
52574 write rather ugly lines like this:
52575 </para>
52576 <literallayout>
52577 <literal>condition = ${if eq{0}{</literal>&lt;<emphasis>some expansion</emphasis>&gt;<literal>}{true}{true}}</literal>
52578 </literallayout>
52579 <para>
52580 Instead, all you need is
52581 </para>
52582 <literallayout>
52583 <literal>continue = </literal>&lt;<emphasis>some expansion</emphasis>&gt;
52584 </literallayout>
52585 </listitem></varlistentry>
52586 <varlistentry>
52587 <term><emphasis role="bold">control</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
52588 <listitem>
52589 <para>
52590 <indexterm role="concept">
52591 <primary><option>control</option> ACL modifier</primary>
52592 </indexterm>
52593 This modifier affects the subsequent processing of the SMTP connection or of an
52594 incoming message that is accepted. The effect of the first type of control
52595 lasts for the duration of the connection, whereas the effect of the second type
52596 lasts only until the current message has been received. The message-specific
52597 controls always apply to the whole message, not to individual recipients,
52598 even if the <option>control</option> modifier appears in a RCPT ACL.
52599 </para>
52600 <para>
52601 As there are now quite a few controls that can be applied, they are described
52602 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
52603 in several different ways. For example:
52604 </para>
52605 <itemizedlist>
52606 <listitem>
52607 <para>
52608 It can be at the end of an <option>accept</option> statement:
52609 </para>
52610 <literallayout class="monospaced">
52611     accept  ...some conditions
52612             control = queue_only
52613 </literallayout>
52614 <para>
52615 In this case, the control is applied when this statement yields <quote>accept</quote>, in
52616 other words, when the conditions are all true.
52617 </para>
52618 </listitem>
52619 <listitem>
52620 <para>
52621 It can be in the middle of an <option>accept</option> statement:
52622 </para>
52623 <literallayout class="monospaced">
52624     accept  ...some conditions...
52625             control = queue_only
52626             ...some more conditions...
52627 </literallayout>
52628 <para>
52629 If the first set of conditions are true, the control is applied, even if the
52630 statement does not accept because one of the second set of conditions is false.
52631 In this case, some subsequent statement must yield <quote>accept</quote> for the control
52632 to be relevant.
52633 </para>
52634 </listitem>
52635 <listitem>
52636 <para>
52637 It can be used with <option>warn</option> to apply the control, leaving the
52638 decision about accepting or denying to a subsequent verb. For
52639 example:
52640 </para>
52641 <literallayout class="monospaced">
52642     warn    ...some conditions...
52643             control = freeze
52644     accept  ...
52645 </literallayout>
52646 <para>
52647 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
52648 <option>logwrite</option>, so it does not add anything to the message and does not write a
52649 log entry.
52650 </para>
52651 </listitem>
52652 <listitem>
52653 <para>
52654 If you want to apply a control unconditionally, you can use it with a
52655 <option>require</option> verb. For example:
52656 </para>
52657 <literallayout class="monospaced">
52658     require  control = no_multiline_responses
52659 </literallayout>
52660 </listitem>
52661 </itemizedlist>
52662 </listitem></varlistentry>
52663 <varlistentry>
52664 <term><emphasis role="bold">delay</emphasis>&nbsp;=&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
52665 <listitem>
52666 <para>
52667 <indexterm role="concept">
52668 <primary><option>delay</option> ACL modifier</primary>
52669 </indexterm>
52670 <indexterm role="option">
52671 <primary><option>-bh</option></primary>
52672 </indexterm>
52673 This modifier may appear in any ACL except notquit. It causes Exim to wait for
52674 the time interval before proceeding. However, when testing Exim using the
52675 <option>-bh</option> option, the delay is not actually imposed (an appropriate message is
52676 output instead). The time is given in the usual Exim notation, and the delay
52677 happens as soon as the modifier is processed. In an SMTP session, pending
52678 output is flushed before the delay is imposed.
52679 </para>
52680 <para>
52681 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
52682 example:
52683 </para>
52684 <literallayout class="monospaced">
52685 deny    ...some conditions...
52686         delay = 30s
52687 </literallayout>
52688 <para>
52689 The delay happens if all the conditions are true, before the statement returns
52690 <quote>deny</quote>. Compare this with:
52691 </para>
52692 <literallayout class="monospaced">
52693 deny    delay = 30s
52694         ...some conditions...
52695 </literallayout>
52696 <para>
52697 which waits for 30s before processing the conditions. The <option>delay</option> modifier
52698 can also be used with <option>warn</option> and together with <option>control</option>:
52699 </para>
52700 <literallayout class="monospaced">
52701 warn    ...some conditions...
52702         delay = 2m
52703         control = freeze
52704 accept  ...
52705 </literallayout>
52706 <para>
52707 If <option>delay</option> is encountered when the SMTP PIPELINING extension is in use,
52708 responses to several commands are no longer buffered and sent in one packet (as
52709 they would normally be) because all output is flushed before imposing the
52710 delay. This optimization is disabled so that a number of small delays do not
52711 appear to the client as one large aggregated delay that might provoke an
52712 unwanted timeout. You can, however, disable output flushing for <option>delay</option> by
52713 using a <option>control</option> modifier to set <option>no_delay_flush</option>.
52714 </para>
52715 </listitem></varlistentry>
52716 <varlistentry>
52717 <term><emphasis role="bold">endpass</emphasis></term>
52718 <listitem>
52719 <para>
52720 <indexterm role="concept">
52721 <primary><option>endpass</option> ACL modifier</primary>
52722 </indexterm>
52723 This modifier, which has no argument, is recognized only in <option>accept</option> and
52724 <option>discard</option> statements. It marks the boundary between the conditions whose
52725 failure causes control to pass to the next statement, and the conditions whose
52726 failure causes the ACL to return <quote>deny</quote>. This concept has proved to be
52727 confusing to some people, so the use of <option>endpass</option> is no longer recommended as
52728 <quote>best practice</quote>. See the description of <option>accept</option> above for more details.
52729 </para>
52730 </listitem></varlistentry>
52731 <varlistentry>
52732 <term><emphasis role="bold">log_message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
52733 <listitem>
52734 <para>
52735 <indexterm role="concept">
52736 <primary><option>log_message</option> ACL modifier</primary>
52737 </indexterm>
52738 This modifier sets up a message that is used as part of the log message if the
52739 ACL denies access or a <option>warn</option> statement&#x2019;s conditions are true. For example:
52740 </para>
52741 <literallayout class="monospaced">
52742 require log_message = wrong cipher suite $tls_in_cipher
52743         encrypted   = DES-CBC3-SHA
52744 </literallayout>
52745 <para>
52746 <option>log_message</option> is also used when recipients are discarded by <option>discard</option>. For
52747 example:
52748 </para>
52749 <literallayout>
52750 <literal>discard </literal>&lt;<emphasis>some conditions</emphasis>&gt;
52751 <literal>        log_message = Discarded $local_part@$domain because...</literal>
52752 </literallayout>
52753 <para>
52754 When access is denied, <option>log_message</option> adds to any underlying error message
52755 that may exist because of a condition failure. For example, while verifying a
52756 recipient address, a <emphasis>:fail:</emphasis> redirection might have already set up a
52757 message.
52758 </para>
52759 <para>
52760 The message may be defined before the conditions to which it applies, because
52761 the string expansion does not happen until Exim decides that access is to be
52762 denied. This means that any variables that are set by the condition are
52763 available for inclusion in the message. For example, the <varname>$dnslist_</varname>&lt;<emphasis>xxx</emphasis>&gt;
52764 variables are set after a DNS black list lookup succeeds. If the expansion of
52765 <option>log_message</option> fails, or if the result is an empty string, the modifier is
52766 ignored.
52767 </para>
52768 <para>
52769 <indexterm role="variable">
52770 <primary><varname>$acl_verify_message</varname></primary>
52771 </indexterm>
52772 If you want to use a <option>warn</option> statement to log the result of an address
52773 verification, you can use <varname>$acl_verify_message</varname> to include the verification
52774 error message.
52775 </para>
52776 <para>
52777 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
52778 the start of the logged message. If the same warning log message is requested
52779 more than once while receiving  a single email message, only one copy is
52780 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
52781 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
52782 is logged for a successful <option>warn</option> statement.
52783 </para>
52784 <para>
52785 If <option>log_message</option> is not present and there is no underlying error message (for
52786 example, from the failure of address verification), but <option>message</option> is present,
52787 the <option>message</option> text is used for logging rejections. However, if any text for
52788 logging contains newlines, only the first line is logged. In the absence of
52789 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
52790 logging rejections.
52791 </para>
52792 </listitem></varlistentry>
52793 <varlistentry>
52794 <term><emphasis role="bold">log_reject_target</emphasis>&nbsp;=&nbsp;&lt;<emphasis>log name list</emphasis>&gt;</term>
52795 <listitem>
52796 <para>
52797 <indexterm role="concept">
52798 <primary><option>log_reject_target</option> ACL modifier</primary>
52799 </indexterm>
52800 <indexterm role="concept">
52801 <primary>logging in ACL</primary>
52802 <secondary>specifying which log</secondary>
52803 </indexterm>
52804 This modifier makes it possible to specify which logs are used for messages
52805 about ACL rejections. Its argument is a colon-separated list of words that can
52806 be <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote>. The default is <literal>main:reject</literal>. The list
52807 may be empty, in which case a rejection is not logged at all. For example, this
52808 ACL fragment writes no logging information when access is denied:
52809 </para>
52810 <literallayout>
52811 <literal>deny </literal>&lt;<emphasis>some conditions</emphasis>&gt;
52812 <literal>     log_reject_target =</literal>
52813 </literallayout>
52814 <para>
52815 This modifier can be used in SMTP and non-SMTP ACLs. It applies to both
52816 permanent and temporary rejections. Its effect lasts for the rest of the
52817 current ACL.
52818 </para>
52819 </listitem></varlistentry>
52820 <varlistentry>
52821 <term><emphasis role="bold">logwrite</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
52822 <listitem>
52823 <para>
52824 <indexterm role="concept">
52825 <primary><option>logwrite</option> ACL modifier</primary>
52826 </indexterm>
52827 <indexterm role="concept">
52828 <primary>logging in ACL</primary>
52829 <secondary>immediate</secondary>
52830 </indexterm>
52831 This modifier writes a message to a log file as soon as it is encountered when
52832 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
52833 <option>warn</option> and <option>discard</option>, is used only if the ACL statement denies
52834 access.) The <option>logwrite</option> modifier can be used to log special incidents in
52835 ACLs. For example:
52836 </para>
52837 <literallayout>
52838 <literal>accept </literal>&lt;<emphasis>some special conditions</emphasis>&gt;
52839 <literal>       control  = freeze</literal>
52840 <literal>       logwrite = froze message because ...</literal>
52841 </literallayout>
52842 <para>
52843 By default, the message is written to the main log. However, it may begin
52844 with a colon, followed by a comma-separated list of log names, and then
52845 another colon, to specify exactly which logs are to be written. For
52846 example:
52847 </para>
52848 <literallayout class="monospaced">
52849 logwrite = :main,reject: text for main and reject logs
52850 logwrite = :panic: text for panic log only
52851 </literallayout>
52852 </listitem></varlistentry>
52853 <varlistentry>
52854 <term><emphasis role="bold">message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
52855 <listitem>
52856 <para>
52857 <indexterm role="concept">
52858 <primary><option>message</option> ACL modifier</primary>
52859 </indexterm>
52860 This modifier sets up a text string that is expanded and used as a response
52861 message when an ACL statement terminates the ACL with an <quote>accept</quote>, <quote>deny</quote>,
52862 or <quote>defer</quote> response. (In the case of the <option>accept</option> and <option>discard</option> verbs,
52863 there is some complication if <option>endpass</option> is involved; see the description of
52864 <option>accept</option> for details.)
52865 </para>
52866 <para>
52867 The expansion of the message happens at the time Exim decides that the ACL is
52868 to end, not at the time it processes <option>message</option>. If the expansion fails, or
52869 generates an empty string, the modifier is ignored. Here is an example where
52870 <option>message</option> must be specified first, because the ACL ends with a rejection if
52871 the <option>hosts</option> condition fails:
52872 </para>
52873 <literallayout class="monospaced">
52874 require  message = Host not recognized
52875          hosts = 10.0.0.0/8
52876 </literallayout>
52877 <para>
52878 (Once a condition has failed, no further conditions or modifiers are
52879 processed.)
52880 </para>
52881 <para>
52882 <indexterm role="concept">
52883 <primary>SMTP</primary>
52884 <secondary>error codes</secondary>
52885 </indexterm>
52886 <indexterm role="option">
52887 <primary><option>smtp_banner</option></primary>
52888 </indexterm>
52889 For ACLs that are triggered by SMTP commands, the message is returned as part
52890 of the SMTP response. The use of <option>message</option> with <option>accept</option> (or <option>discard</option>)
52891 is meaningful only for SMTP, as no message is returned when a non-SMTP message
52892 is accepted. In the case of the connect ACL, accepting with a message modifier
52893 overrides the value of <option>smtp_banner</option>. For the EHLO/HELO ACL, a customized
52894 accept message may not contain more than one line (otherwise it will be
52895 truncated at the first newline and a panic logged), and it cannot affect the
52896 EHLO options.
52897 </para>
52898 <para>
52899 When SMTP is involved, the message may begin with an overriding response code,
52900 consisting of three digits optionally followed by an <quote>extended response code</quote>
52901 of the form <emphasis>n.n.n</emphasis>, each code being followed by a space. For example:
52902 </para>
52903 <literallayout class="monospaced">
52904 deny  message = 599 1.2.3 Host not welcome
52905       hosts = 192.168.34.0/24
52906 </literallayout>
52907 <para>
52908 The first digit of the supplied response code must be the same as would be sent
52909 by default. A panic occurs if it is not. Exim uses a 550 code when it denies
52910 access, but for the predata ACL, note that the default success code is 354, not
52911 2<emphasis>xx</emphasis>.
52912 </para>
52913 <para>
52914 Notwithstanding the previous paragraph, for the QUIT ACL, unlike the others,
52915 the message modifier cannot override the 221 response code.
52916 </para>
52917 <para>
52918 The text in a <option>message</option> modifier is literal; any quotes are taken as
52919 literals, but because the string is expanded, backslash escapes are processed
52920 anyway. If the message contains newlines, this gives rise to a multi-line SMTP
52921 response.
52922 </para>
52923 <para>
52924 <indexterm role="variable">
52925 <primary><varname>$acl_verify_message</varname></primary>
52926 </indexterm>
52927 </para>
52928 <para revisionflag="changed">
52929 For ACLs that are called by an <option>acl =</option> ACL condition, the message is
52930 stored in <varname>$acl_verify_message</varname>, from which the calling ACL may use it.
52931 </para>
52932 <para>
52933 If <option>message</option> is used on a statement that verifies an address, the message
52934 specified overrides any message that is generated by the verification process.
52935 However, the original message is available in the variable
52936 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
52937 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
52938 routers to be passed back as part of the SMTP response, you should either not
52939 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
52940 </para>
52941 <para>
52942 For compatibility with previous releases of Exim, a <option>message</option> modifier that
52943 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
52944 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
52945 all the conditions are true, wherever it appears in an ACL command, whereas
52946 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
52947 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
52948 effect.
52949 </para>
52950 </listitem></varlistentry>
52951 <varlistentry>
52952 <term><emphasis role="bold">remove_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
52953 <listitem>
52954 <para>
52955 This modifier specifies one or more header names in a colon-separated list
52956  that are to be removed from an incoming message, assuming, of course, that
52957 the message is ultimately accepted. For details, see section <xref linkend="SECTremoveheadacl"/>.
52958 </para>
52959 </listitem></varlistentry>
52960 <varlistentry>
52961 <term><emphasis role="bold">set</emphasis>&nbsp;&lt;<emphasis>acl_name</emphasis>&gt;&nbsp;=&nbsp;&lt;<emphasis>value</emphasis>&gt;</term>
52962 <listitem>
52963 <para>
52964 <indexterm role="concept">
52965 <primary><option>set</option> ACL modifier</primary>
52966 </indexterm>
52967 This modifier puts a value into one of the ACL variables (see section
52968 <xref linkend="SECTaclvariables"/>).
52969 </para>
52970 </listitem></varlistentry>
52971 <varlistentry>
52972 <term><emphasis role="bold">udpsend</emphasis>&nbsp;=&nbsp;&lt;<emphasis>parameters</emphasis>&gt;</term>
52973 <listitem>
52974 <para>
52975 This modifier sends a UDP packet, for purposes such as statistics
52976 collection or behaviour monitoring. The parameters are expanded, and
52977 the result of the expansion must be a colon-separated list consisting
52978 of a destination server, port number, and the packet contents. The
52979 server can be specified as a host name or IPv4 or IPv6 address. The
52980 separator can be changed with the usual angle bracket syntax. For
52981 example, you might want to collect information on which hosts connect
52982 when:
52983 </para>
52984 <literallayout class="monospaced">
52985 udpsend = &lt;; 2001:dB8::dead:beef ; 1234 ;\
52986              $tod_zulu $sender_host_address
52987 </literallayout>
52988 </listitem></varlistentry>
52989 </variablelist>
52990 </section>
52991 <section id="SECTcontrols">
52992 <title>Use of the control modifier</title>
52993 <para>
52994 <indexterm role="concept">
52995 <primary><option>control</option> ACL modifier</primary>
52996 </indexterm>
52997 The <option>control</option> modifier supports the following settings:
52998 </para>
52999 <variablelist>
53000 <varlistentry>
53001 <term><emphasis role="bold">control&nbsp;=&nbsp;allow_auth_unadvertised</emphasis></term>
53002 <listitem>
53003 <para>
53004 This modifier allows a client host to use the SMTP AUTH command even when it
53005 has not been advertised in response to EHLO. Furthermore, because there are
53006 apparently some really broken clients that do this, Exim will accept AUTH after
53007 HELO (rather than EHLO) when this control is set. It should be used only if you
53008 really need it, and you should limit its use to those broken clients that do
53009 not work without it. For example:
53010 </para>
53011 <literallayout class="monospaced">
53012 warn hosts   = 192.168.34.25
53013      control = allow_auth_unadvertised
53014 </literallayout>
53015 <para>
53016 Normally, when an Exim server receives an AUTH command, it checks the name of
53017 the authentication mechanism that is given in the command to ensure that it
53018 matches an advertised mechanism. When this control is set, the check that a
53019 mechanism has been advertised is bypassed. Any configured mechanism can be used
53020 by the client. This control is permitted only in the connection and HELO ACLs.
53021 </para>
53022 </listitem></varlistentry>
53023 <varlistentry>
53024 <term><emphasis role="bold">control&nbsp;=&nbsp;caseful_local_part</emphasis></term>
53025 <term><emphasis role="bold">control&nbsp;=&nbsp;caselower_local_part</emphasis></term>
53026 <listitem>
53027 <para>
53028 <indexterm role="concept">
53029 <primary>access control lists (ACLs)</primary>
53030 <secondary>case of local part in</secondary>
53031 </indexterm>
53032 <indexterm role="concept">
53033 <primary>case of local parts</primary>
53034 </indexterm>
53035 <indexterm role="variable">
53036 <primary><varname>$local_part</varname></primary>
53037 </indexterm>
53038 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
53039 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
53040 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
53041 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
53042 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
53043 is encountered.
53044 </para>
53045 <para>
53046 These controls affect only the current recipient. Moreover, they apply only to
53047 local part handling that takes place directly in the ACL (for example, as a key
53048 in lookups). If a test to verify the recipient is obeyed, the case-related
53049 handling of the local part during the verification is controlled by the router
53050 configuration (see the <option>caseful_local_part</option> generic router option).
53051 </para>
53052 <para>
53053 This facility could be used, for example, to add a spam score to local parts
53054 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
53055 spam score:
53056 </para>
53057 <literallayout class="monospaced">
53058 warn  control = caseful_local_part
53059       set acl_m4 = ${eval:\
53060                      $acl_m4 + \
53061                      ${if match{$local_part}{[A-Z]}{1}{0}}\
53062                     }
53063       control = caselower_local_part
53064 </literallayout>
53065 <para>
53066 Notice that we put back the lower cased version afterwards, assuming that
53067 is what is wanted for subsequent tests.
53068 </para>
53069 </listitem></varlistentry>
53070 <varlistentry>
53071 <term><emphasis role="bold">control&nbsp;=&nbsp;cutthrough_delivery</emphasis></term>
53072 <listitem>
53073 <para>
53074 <indexterm role="concept">
53075 <primary>access control lists (ACLs)</primary>
53076 <secondary>cutthrough routing</secondary>
53077 </indexterm>
53078 <indexterm role="concept">
53079 <primary>cutthrough</primary>
53080 <secondary>requesting</secondary>
53081 </indexterm>
53082 This option requests delivery be attempted while the item is being received.
53083 </para>
53084 <para>
53085 The option usable in the RCPT ACL.
53086 If enabled for a message recieved via smtp and routed to an smtp transport,
53087 and the message has only one recipient,
53088 then the delivery connection is made while the receiving connection is open
53089 and data is copied from one to the other.
53090 </para>
53091 <para>
53092 If a recipient-verify callout connection is subsequently
53093 requested in the same ACL it is held open and used for the data,
53094 otherwise one is made after the initial RCPT ACL completes.
53095 </para>
53096 <para>
53097 Note that routers are used in verify mode,
53098 and cannot depend on content of received headers.
53099 Note also that headers cannot be
53100 modified by any of the post-data ACLs (DATA, MIME and DKIM).
53101 Headers may be modified by routers (subject to the above) and transports.
53102 </para>
53103 <para>
53104 Cutthrough delivery is not supported via transport-filters or when DKIM signing
53105 of outgoing messages is done, because it sends data to the ultimate destination
53106 before the entire message has been received from the source.
53107 </para>
53108 <para>
53109 Should the ultimate destination system positively accept or reject the mail,
53110 a corresponding indication is given to the source system and nothing is queued.
53111 If there is a temporary error the item is queued for later delivery in the
53112 usual fashion. If the item is successfully delivered in cutthrough mode
53113 the log line is tagged with "&gt;&gt;" rather than "=&gt;" and appears
53114 before the acceptance "&lt;=" line.
53115 </para>
53116 <para>
53117 Delivery in this mode avoids the generation of a bounce mail to a
53118 (possibly faked)
53119 sender when the destination system is doing content-scan based rejection.
53120 </para>
53121 </listitem></varlistentry>
53122 <varlistentry>
53123 <term><emphasis role="bold">control&nbsp;=&nbsp;debug/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
53124 <listitem>
53125 <para>
53126 <indexterm role="concept">
53127 <primary>access control lists (ACLs)</primary>
53128 <secondary>enabling debug logging</secondary>
53129 </indexterm>
53130 <indexterm role="concept">
53131 <primary>debugging</primary>
53132 <secondary>enabling from an ACL</secondary>
53133 </indexterm>
53134 This control turns on debug logging, almost as though Exim had been invoked
53135 with <literal>-d</literal>, with the output going to a new logfile, by default called
53136 <emphasis>debuglog</emphasis>.  The filename can be adjusted with the <emphasis>tag</emphasis> option, which
53137 may access any variables already defined.  The logging may be adjusted with
53138 the <emphasis>opts</emphasis> option, which takes the same values as the <literal>-d</literal> command-line
53139 option.  Some examples (which depend on variables that don&#x2019;t exist in all
53140 contexts):
53141 </para>
53142 <literallayout class="monospaced">
53143       control = debug
53144       control = debug/tag=.$sender_host_address
53145       control = debug/opts=+expand+acl
53146       control = debug/tag=.$message_exim_id/opts=+expand
53147 </literallayout>
53148 </listitem></varlistentry>
53149 <varlistentry>
53150 <term><emphasis role="bold">control&nbsp;=&nbsp;dkim_disable_verify</emphasis></term>
53151 <listitem>
53152 <para>
53153 <indexterm role="concept">
53154 <primary>disable DKIM verify</primary>
53155 </indexterm>
53156 <indexterm role="concept">
53157 <primary>DKIM</primary>
53158 <secondary>disable verify</secondary>
53159 </indexterm>
53160 This control turns off DKIM verification processing entirely.  For details on
53161 the operation and configuration of DKIM, see chapter <xref linkend="CHAPdkim"/>.
53162 </para>
53163 </listitem></varlistentry>
53164 <varlistentry>
53165 <term><emphasis role="bold">control&nbsp;=&nbsp;dscp/</emphasis>&lt;<emphasis>value</emphasis>&gt;</term>
53166 <listitem>
53167 <para>
53168 <indexterm role="concept">
53169 <primary>access control lists (ACLs)</primary>
53170 <secondary>setting DSCP value</secondary>
53171 </indexterm>
53172 <indexterm role="concept">
53173 <primary>DSCP</primary>
53174 <secondary>inbound</secondary>
53175 </indexterm>
53176 This option causes the DSCP value associated with the socket for the inbound
53177 connection to be adjusted to a given value, given as one of a number of fixed
53178 strings or to numeric value.
53179 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
53180 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
53181 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
53182 </para>
53183 <para>
53184 The outbound packets from Exim will be marked with this value in the header
53185 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
53186 that these values will have any effect, not be stripped by networking
53187 equipment, or do much of anything without cooperation with your Network
53188 Engineer and those of all network operators between the source and destination.
53189 </para>
53190 </listitem></varlistentry>
53191 <varlistentry>
53192 <term><emphasis role="bold">control&nbsp;=&nbsp;enforce_sync</emphasis></term>
53193 <term><emphasis role="bold">control&nbsp;=&nbsp;no_enforce_sync</emphasis></term>
53194 <listitem>
53195 <para>
53196 <indexterm role="concept">
53197 <primary>SMTP</primary>
53198 <secondary>synchronization checking</secondary>
53199 </indexterm>
53200 <indexterm role="concept">
53201 <primary>synchronization checking in SMTP</primary>
53202 </indexterm>
53203 These controls make it possible to be selective about when SMTP synchronization
53204 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
53205 state of the switch (it is true by default). See the description of this option
53206 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
53207 </para>
53208 <para>
53209 The effect of these two controls lasts for the remainder of the SMTP
53210 connection. They can appear in any ACL except the one for the non-SMTP
53211 messages. The most straightforward place to put them is in the ACL defined by
53212 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
53213 before the first synchronization check. The expected use is to turn off the
53214 synchronization checks for badly-behaved hosts that you nevertheless need to
53215 work with.
53216 </para>
53217 </listitem></varlistentry>
53218 <varlistentry>
53219 <term><emphasis role="bold">control&nbsp;=&nbsp;fakedefer/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
53220 <listitem>
53221 <para>
53222 <indexterm role="concept">
53223 <primary>fake defer</primary>
53224 </indexterm>
53225 <indexterm role="concept">
53226 <primary>defer, fake</primary>
53227 </indexterm>
53228 This control works in exactly the same way as <option>fakereject</option> (described below)
53229 except that it causes an SMTP 450 response after the message data instead of a
53230 550 response. You must take care when using <option>fakedefer</option> because it causes the
53231 messages to be duplicated when the sender retries. Therefore, you should not
53232 use <option>fakedefer</option> if the message is to be delivered normally.
53233 </para>
53234 </listitem></varlistentry>
53235 <varlistentry>
53236 <term><emphasis role="bold">control&nbsp;=&nbsp;fakereject/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
53237 <listitem>
53238 <para>
53239 <indexterm role="concept">
53240 <primary>fake rejection</primary>
53241 </indexterm>
53242 <indexterm role="concept">
53243 <primary>rejection, fake</primary>
53244 </indexterm>
53245 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
53246 words, only when an SMTP message is being received. If Exim accepts the
53247 message, instead the final 250 response, a 550 rejection message is sent.
53248 However, Exim proceeds to deliver the message as normal. The control applies
53249 only to the current message, not to any subsequent ones that may be received in
53250 the same SMTP connection.
53251 </para>
53252 <para>
53253 The text for the 550 response is taken from the <option>control</option> modifier. If no
53254 message is supplied, the following is used:
53255 </para>
53256 <literallayout class="monospaced">
53257 550-Your message has been rejected but is being
53258 550-kept for evaluation.
53259 550-If it was a legitimate message, it may still be
53260 550 delivered to the target recipient(s).
53261 </literallayout>
53262 <para>
53263 This facility should be used with extreme caution.
53264 </para>
53265 </listitem></varlistentry>
53266 <varlistentry>
53267 <term><emphasis role="bold">control&nbsp;=&nbsp;freeze</emphasis></term>
53268 <listitem>
53269 <para>
53270 <indexterm role="concept">
53271 <primary>frozen messages</primary>
53272 <secondary>forcing in ACL</secondary>
53273 </indexterm>
53274 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
53275 other words, only when a message is being received. If the message is accepted,
53276 it is placed on Exim&#x2019;s queue and frozen. The control applies only to the
53277 current message, not to any subsequent ones that may be received in the same
53278 SMTP connection.
53279 </para>
53280 <para>
53281 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
53282 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
53283 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
53284 are obeyed for the current message have the <literal>/no_tell</literal> option.
53285 </para>
53286 </listitem></varlistentry>
53287 <varlistentry>
53288 <term><emphasis role="bold">control&nbsp;=&nbsp;no_delay_flush</emphasis></term>
53289 <listitem>
53290 <para>
53291 <indexterm role="concept">
53292 <primary>SMTP</primary>
53293 <secondary>output flushing, disabling for delay</secondary>
53294 </indexterm>
53295 Exim normally flushes SMTP output before implementing a delay in an ACL, to
53296 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
53297 use. This control, as long as it is encountered before the <option>delay</option> modifier,
53298 disables such output flushing.
53299 </para>
53300 </listitem></varlistentry>
53301 <varlistentry>
53302 <term><emphasis role="bold">control&nbsp;=&nbsp;no_callout_flush</emphasis></term>
53303 <listitem>
53304 <para>
53305 <indexterm role="concept">
53306 <primary>SMTP</primary>
53307 <secondary>output flushing, disabling for callout</secondary>
53308 </indexterm>
53309 Exim normally flushes SMTP output before performing a callout in an ACL, to
53310 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
53311 use. This control, as long as it is encountered before the <option>verify</option> condition
53312 that causes the callout, disables such output flushing.
53313 </para>
53314 </listitem></varlistentry>
53315 <varlistentry>
53316 <term><emphasis role="bold">control&nbsp;=&nbsp;no_mbox_unspool</emphasis></term>
53317 <listitem>
53318 <para>
53319 This control is available when Exim is compiled with the content scanning
53320 extension. Content scanning may require a copy of the current message, or parts
53321 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
53322 or spam scanner. Normally, such copies are deleted when they are no longer
53323 needed. If this control is set, the copies are not deleted. The control applies
53324 only to the current message, not to any subsequent ones that may be received in
53325 the same SMTP connection. It is provided for debugging purposes and is unlikely
53326 to be useful in production.
53327 </para>
53328 </listitem></varlistentry>
53329 <varlistentry>
53330 <term><emphasis role="bold">control&nbsp;=&nbsp;no_multiline_responses</emphasis></term>
53331 <listitem>
53332 <para>
53333 <indexterm role="concept">
53334 <primary>multiline responses, suppressing</primary>
53335 </indexterm>
53336 This control is permitted for any ACL except the one for non-SMTP messages.
53337 It seems that there are broken clients in use that cannot handle multiline
53338 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
53339 </para>
53340 <para>
53341 If this control is set, multiline SMTP responses from ACL rejections are
53342 suppressed. One way of doing this would have been to put out these responses as
53343 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
53344 (<quote>use multiline responses for more</quote> it says &ndash; ha!), and some of the
53345 responses might get close to that. So this facility, which is after all only a
53346 sop to broken clients, is implemented by doing two very easy things:
53347 </para>
53348 <itemizedlist>
53349 <listitem>
53350 <para>
53351 Extra information that is normally output as part of a rejection caused by
53352 sender verification failure is omitted. Only the final line (typically <quote>sender
53353 verification failed</quote>) is sent.
53354 </para>
53355 </listitem>
53356 <listitem>
53357 <para>
53358 If a <option>message</option> modifier supplies a multiline response, only the first
53359 line is output.
53360 </para>
53361 </listitem>
53362 </itemizedlist>
53363 <para>
53364 The setting of the switch can, of course, be made conditional on the
53365 calling host. Its effect lasts until the end of the SMTP connection.
53366 </para>
53367 </listitem></varlistentry>
53368 <varlistentry>
53369 <term><emphasis role="bold">control&nbsp;=&nbsp;no_pipelining</emphasis></term>
53370 <listitem>
53371 <para>
53372 <indexterm role="concept">
53373 <primary>PIPELINING</primary>
53374 <secondary>suppressing advertising</secondary>
53375 </indexterm>
53376 This control turns off the advertising of the PIPELINING extension to SMTP in
53377 the current session. To be useful, it must be obeyed before Exim sends its
53378 response to an EHLO command. Therefore, it should normally appear in an ACL
53379 controlled by <option>acl_smtp_connect</option> or <option>acl_smtp_helo</option>. See also
53380 <option>pipelining_advertise_hosts</option>.
53381 </para>
53382 </listitem></varlistentry>
53383 <varlistentry>
53384 <term><emphasis role="bold">control&nbsp;=&nbsp;queue_only</emphasis></term>
53385 <listitem>
53386 <para>
53387 <indexterm role="option">
53388 <primary><option>queue_only</option></primary>
53389 </indexterm>
53390 <indexterm role="concept">
53391 <primary>queueing incoming messages</primary>
53392 </indexterm>
53393 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
53394 other words, only when a message is being received. If the message is accepted,
53395 it is placed on Exim&#x2019;s queue and left there for delivery by a subsequent queue
53396 runner. No immediate delivery process is started. In other words, it has the
53397 effect as the <option>queue_only</option> global option. However, the control applies only
53398 to the current message, not to any subsequent ones that may be received in the
53399 same SMTP connection.
53400 </para>
53401 </listitem></varlistentry>
53402 <varlistentry>
53403 <term><emphasis role="bold">control&nbsp;=&nbsp;submission/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
53404 <listitem>
53405 <para>
53406 <indexterm role="concept">
53407 <primary>message</primary>
53408 <secondary>submission</secondary>
53409 </indexterm>
53410 <indexterm role="concept">
53411 <primary>submission mode</primary>
53412 </indexterm>
53413 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
53414 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
53415 the current message is a submission from a local MUA. In this case, Exim
53416 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
53417 necessary. For example, it adds a <emphasis>Date:</emphasis> header line if one is not present.
53418 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
53419 late (the message has already been created).
53420 </para>
53421 <para>
53422 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
53423 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
53424 submission mode; the available options for this control are described there.
53425 The control applies only to the current message, not to any subsequent ones
53426 that may be received in the same SMTP connection.
53427 </para>
53428 </listitem></varlistentry>
53429 <varlistentry>
53430 <term><emphasis role="bold">control&nbsp;=&nbsp;suppress_local_fixups</emphasis></term>
53431 <listitem>
53432 <para>
53433 <indexterm role="concept">
53434 <primary>submission fixups, suppressing</primary>
53435 </indexterm>
53436 This control applies to locally submitted (non TCP/IP) messages, and is the
53437 complement of <literal>control = submission</literal>. It disables the fixups that are
53438 normally applied to locally-submitted messages. Specifically:
53439 </para>
53440 <itemizedlist>
53441 <listitem>
53442 <para>
53443 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
53444 dynamic version of <option>local_sender_retain</option>).
53445 </para>
53446 </listitem>
53447 <listitem>
53448 <para>
53449 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
53450 </para>
53451 </listitem>
53452 <listitem>
53453 <para>
53454 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
53455 </para>
53456 </listitem>
53457 </itemizedlist>
53458 <para>
53459 This control may be useful when a remotely-originated message is accepted,
53460 passed to some scanning program, and then re-submitted for delivery. It can be
53461 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
53462 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message&#x2019;s
53463 data is read.
53464 </para>
53465 <para>
53466 <emphasis role="bold">Note:</emphasis> This control applies only to the current message, not to any others
53467 that are being submitted at the same time using <option>-bs</option> or <option>-bS</option>.
53468 </para>
53469 </listitem></varlistentry>
53470 </variablelist>
53471 </section>
53472 <section id="SECTsummesfix">
53473 <title>Summary of message fixup control</title>
53474 <para>
53475 All four possibilities for message fixups can be specified:
53476 </para>
53477 <itemizedlist>
53478 <listitem>
53479 <para>
53480 Locally submitted, fixups applied: the default.
53481 </para>
53482 </listitem>
53483 <listitem>
53484 <para>
53485 Locally submitted, no fixups applied: use
53486 <literal>control = suppress_local_fixups</literal>.
53487 </para>
53488 </listitem>
53489 <listitem>
53490 <para>
53491 Remotely submitted, no fixups applied: the default.
53492 </para>
53493 </listitem>
53494 <listitem>
53495 <para>
53496 Remotely submitted, fixups applied: use <literal>control = submission</literal>.
53497 </para>
53498 </listitem>
53499 </itemizedlist>
53500 </section>
53501 <section id="SECTaddheadacl">
53502 <title>Adding header lines in ACLs</title>
53503 <para>
53504 <indexterm role="concept">
53505 <primary>header lines</primary>
53506 <secondary>adding in an ACL</secondary>
53507 </indexterm>
53508 <indexterm role="concept">
53509 <primary>header lines</primary>
53510 <secondary>position of added lines</secondary>
53511 </indexterm>
53512 <indexterm role="concept">
53513 <primary><option>add_header</option> ACL modifier</primary>
53514 </indexterm>
53515 The <option>add_header</option> modifier can be used to add one or more extra header lines
53516 to an incoming message, as in this example:
53517 </para>
53518 <literallayout class="monospaced">
53519 warn dnslists = sbl.spamhaus.org : \
53520                 dialup.mail-abuse.org
53521      add_header = X-blacklisted-at: $dnslist_domain
53522 </literallayout>
53523 <para>
53524 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
53525 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
53526 receiving a message). The message must ultimately be accepted for
53527 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
53528 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
53529 RCPT ACL).
53530 </para>
53531 <para>
53532 Headers will not be added to the message if the modifier is used in
53533 DATA, MIME or DKIM ACLs for messages delivered by cutthrough routing.
53534 </para>
53535 <para>
53536 Leading and trailing newlines are removed from
53537 the data for the <option>add_header</option> modifier; if it then
53538 contains one or more newlines that
53539 are not followed by a space or a tab, it is assumed to contain multiple header
53540 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
53541 front of any line that is not a valid header line.
53542 </para>
53543 <para>
53544 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
53545 They are added to the message before processing the DATA and MIME ACLs.
53546 However, if an identical header line is requested more than once, only one copy
53547 is actually added to the message. Further header lines may be accumulated
53548 during the DATA and MIME ACLs, after which they are added to the message, again
53549 with duplicates suppressed. Thus, it is possible to add two identical header
53550 lines to an SMTP message, but only if one is added before DATA and one after.
53551 In the case of non-SMTP messages, new headers are accumulated during the
53552 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
53553 message is rejected after DATA or by the non-SMTP ACL, all added header lines
53554 are included in the entry that is written to the reject log.
53555 </para>
53556 <para>
53557 <indexterm role="concept">
53558 <primary>header lines</primary>
53559 <secondary>added; visibility of</secondary>
53560 </indexterm>
53561 Header lines are not visible in string expansions
53562 of message headers
53563 until they are added to the
53564 message. It follows that header lines defined in the MAIL, RCPT, and predata
53565 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
53566 header lines that are added by the DATA or MIME ACLs are not visible in those
53567 ACLs. Because of this restriction, you cannot use header lines as a way of
53568 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
53569 this, you can use ACL variables, as described in section
53570 <xref linkend="SECTaclvariables"/>.
53571 </para>
53572 <para>
53573 The list of headers yet to be added is given by the <option>$headers_added</option> variable.
53574 </para>
53575 <para>
53576 The <option>add_header</option> modifier acts immediately as it is encountered during the
53577 processing of an ACL. Notice the difference between these two cases:
53578 </para>
53579 <literallayout>
53580 <literal>accept add_header = ADDED: some text</literal>
53581 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
53582
53583 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
53584 <literal>       add_header = ADDED: some text</literal>
53585 </literallayout>
53586 <para>
53587 In the first case, the header line is always added, whether or not the
53588 condition is true. In the second case, the header line is added only if the
53589 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
53590 ACL statement. All those that are encountered before a condition fails are
53591 honoured.
53592 </para>
53593 <para>
53594 <indexterm role="concept">
53595 <primary><option>warn</option> ACL verb</primary>
53596 </indexterm>
53597 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
53598 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
53599 effect only if all the conditions are true, even if it appears before some of
53600 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
53601 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
53602 are present on a <option>warn</option> verb, both are processed according to their
53603 specifications.
53604 </para>
53605 <para>
53606 By default, new header lines are added to a message at the end of the existing
53607 header lines. However, you can specify that any particular header line should
53608 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
53609 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
53610 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
53611 </para>
53612 <para>
53613 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
53614 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
53615 header line, respectively. (Header text cannot start with a colon, as there has
53616 to be a header name first.) For example:
53617 </para>
53618 <literallayout class="monospaced">
53619 warn add_header = \
53620        :after_received:X-My-Header: something or other...
53621 </literallayout>
53622 <para>
53623 If more than one header line is supplied in a single <option>add_header</option> modifier,
53624 each one is treated independently and can therefore be placed differently. If
53625 you add more than one line at the start, or after the Received: block, they end
53626 up in reverse order.
53627 </para>
53628 <para>
53629 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
53630 added in an ACL. It does NOT work for header lines that are added in a
53631 system filter or in a router or transport.
53632 </para>
53633 </section>
53634 <section id="SECTremoveheadacl">
53635 <title>Removing header lines in ACLs</title>
53636 <para>
53637 <indexterm role="concept">
53638 <primary>header lines</primary>
53639 <secondary>removing in an ACL</secondary>
53640 </indexterm>
53641 <indexterm role="concept">
53642 <primary>header lines</primary>
53643 <secondary>position of removed lines</secondary>
53644 </indexterm>
53645 <indexterm role="concept">
53646 <primary><option>remove_header</option> ACL modifier</primary>
53647 </indexterm>
53648 The <option>remove_header</option> modifier can be used to remove one or more header lines
53649 from an incoming message, as in this example:
53650 </para>
53651 <literallayout class="monospaced">
53652 warn   message        = Remove internal headers
53653        remove_header  = x-route-mail1 : x-route-mail2
53654 </literallayout>
53655 <para>
53656 The <option>remove_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
53657 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
53658 receiving a message). The message must ultimately be accepted for
53659 <option>remove_header</option> to have any significant effect. You can use <option>remove_header</option>
53660 with any ACL verb, including <option>deny</option>, though this is really not useful for
53661 any verb that doesn&#x2019;t result in a delivered message.
53662 </para>
53663 <para>
53664 Headers will not be removed to the message if the modifier is used in
53665 DATA, MIME or DKIM ACLs for messages delivered by cutthrough routing.
53666 </para>
53667 <para>
53668 More than one header can be removed at the same time by using a colon separated
53669 list of header names. The header matching is case insensitive. Wildcards are
53670 not permitted, nor is list expansion performed, so you cannot use hostlists to
53671 create a list of headers, however both connection and message variable expansion
53672 are performed (<option>$acl_c_*</option> and <option>$acl_m_*</option>), illustrated in this example:
53673 </para>
53674 <literallayout class="monospaced">
53675 warn   hosts           = +internal_hosts
53676        set acl_c_ihdrs = x-route-mail1 : x-route-mail2
53677 warn   message         = Remove internal headers
53678        remove_header   = $acl_c_ihdrs
53679 </literallayout>
53680 <para>
53681 Removed header lines are accumulated during the MAIL, RCPT, and predata ACLs.
53682 They are removed from the message before processing the DATA and MIME ACLs.
53683 There is no harm in attempting to remove the same header twice nor is removing
53684 a non-existent header. Further header lines to be removed may be accumulated
53685 during the DATA and MIME ACLs, after which they are removed from the message,
53686 if present. In the case of non-SMTP messages, headers to be removed are
53687 accumulated during the non-SMTP ACLs, and are removed from the message after
53688 all the ACLs have run. If a message is rejected after DATA or by the non-SMTP
53689 ACL, there really is no effect because there is no logging of what headers
53690 would have been removed.
53691 </para>
53692 <para>
53693 <indexterm role="concept">
53694 <primary>header lines</primary>
53695 <secondary>removed; visibility of</secondary>
53696 </indexterm>
53697 Header lines are not visible in string expansions until the DATA phase when it
53698 is received. Any header lines removed in the MAIL, RCPT, and predata ACLs are
53699 not visible in the DATA ACL and MIME ACLs. Similarly, header lines that are
53700 removed by the DATA or MIME ACLs are still visible in those ACLs. Because of
53701 this restriction, you cannot use header lines as a way of controlling data
53702 passed between (for example) the MAIL and RCPT ACLs. If you want to do this,
53703 you should instead use ACL variables, as described in section
53704 <xref linkend="SECTaclvariables"/>.
53705 </para>
53706 <para>
53707 The <option>remove_header</option> modifier acts immediately as it is encountered during the
53708 processing of an ACL. Notice the difference between these two cases:
53709 </para>
53710 <literallayout>
53711 <literal>accept remove_header = X-Internal</literal>
53712 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
53713
53714 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
53715 <literal>       remove_header = X-Internal</literal>
53716 </literallayout>
53717 <para>
53718 In the first case, the header line is always removed, whether or not the
53719 condition is true. In the second case, the header line is removed only if the
53720 condition is true. Multiple occurrences of <option>remove_header</option> may occur in the
53721 same ACL statement. All those that are encountered before a condition fails
53722 are honoured.
53723 </para>
53724 <para>
53725 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
53726 present during ACL processing. It does NOT remove header lines that are added
53727 in a system filter or in a router or transport.
53728 </para>
53729 </section>
53730 <section id="SECTaclconditions">
53731 <title>ACL conditions</title>
53732 <para>
53733 <indexterm role="concept">
53734 <primary>access control lists (ACLs)</primary>
53735 <secondary>conditions; list of</secondary>
53736 </indexterm>
53737 Some of the conditions listed in this section are available only when Exim is
53738 compiled with the content-scanning extension. They are included here briefly
53739 for completeness. More detailed descriptions can be found in the discussion on
53740 content scanning in chapter <xref linkend="CHAPexiscan"/>.
53741 </para>
53742 <para>
53743 Not all conditions are relevant in all circumstances. For example, testing
53744 senders and recipients does not make sense in an ACL that is being run as the
53745 result of the arrival of an ETRN command, and checks on message headers can be
53746 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
53747 can use the same condition (with different parameters) more than once in the
53748 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
53749 The conditions are as follows:
53750 </para>
53751 <variablelist>
53752 <varlistentry>
53753 <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>
53754 <listitem>
53755 <para>
53756 <indexterm role="concept">
53757 <primary>access control lists (ACLs)</primary>
53758 <secondary>nested</secondary>
53759 </indexterm>
53760 <indexterm role="concept">
53761 <primary>access control lists (ACLs)</primary>
53762 <secondary>indirect</secondary>
53763 </indexterm>
53764 <indexterm role="concept">
53765 <primary>access control lists (ACLs)</primary>
53766 <secondary>arguments</secondary>
53767 </indexterm>
53768 <indexterm role="concept">
53769 <primary><option>acl</option> ACL condition</primary>
53770 </indexterm>
53771 The possible values of the argument are the same as for the
53772 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
53773 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
53774 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
53775 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
53776 condition false. This means that further processing of the <option>warn</option> verb
53777 ceases, but processing of the ACL continues.
53778 </para>
53779 <para>
53780 If the argument is a named ACL, up to nine space-separated optional values
53781 can be appended; they appear within the called ACL in $acl_arg1 to $acl_arg9,
53782 and $acl_narg is set to the count of values.
53783 Previous values of these variables are restored after the call returns.
53784 The name and values are expanded separately.
53785 Note that spaces in complex expansions which are used as arguments
53786 will act as argument separators.
53787 </para>
53788 <para>
53789 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
53790 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
53791 <option>accept</option> or <option>discard</option>, and the action is taken immediately &ndash; no further
53792 conditions are tested.
53793 </para>
53794 <para>
53795 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
53796 loops. This condition allows you to use different ACLs in different
53797 circumstances. For example, different ACLs can be used to handle RCPT commands
53798 for different local users or different local domains.
53799 </para>
53800 </listitem></varlistentry>
53801 <varlistentry>
53802 <term><emphasis role="bold">authenticated&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
53803 <listitem>
53804 <para>
53805 <indexterm role="concept">
53806 <primary><option>authenticated</option> ACL condition</primary>
53807 </indexterm>
53808 <indexterm role="concept">
53809 <primary>authentication</primary>
53810 <secondary>ACL checking</secondary>
53811 </indexterm>
53812 <indexterm role="concept">
53813 <primary>access control lists (ACLs)</primary>
53814 <secondary>testing for authentication</secondary>
53815 </indexterm>
53816 If the SMTP connection is not authenticated, the condition is false. Otherwise,
53817 the name of the authenticator is tested against the list. To test for
53818 authentication by any authenticator, you can set
53819 </para>
53820 <literallayout class="monospaced">
53821 authenticated = *
53822 </literallayout>
53823 </listitem></varlistentry>
53824 <varlistentry>
53825 <term><emphasis role="bold">condition&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string</emphasis>&gt;</term>
53826 <listitem>
53827 <para>
53828 <indexterm role="concept">
53829 <primary><option>condition</option> ACL condition</primary>
53830 </indexterm>
53831 <indexterm role="concept">
53832 <primary>customizing</primary>
53833 <secondary>ACL condition</secondary>
53834 </indexterm>
53835 <indexterm role="concept">
53836 <primary>access control lists (ACLs)</primary>
53837 <secondary>customized test</secondary>
53838 </indexterm>
53839 <indexterm role="concept">
53840 <primary>access control lists (ACLs)</primary>
53841 <secondary>testing, customized</secondary>
53842 </indexterm>
53843 This feature allows you to make up custom conditions. If the result of
53844 expanding the string is an empty string, the number zero, or one of the strings
53845 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
53846 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
53847 any other value, some error is assumed to have occurred, and the ACL returns
53848 <quote>defer</quote>. However, if the expansion is forced to fail, the condition is
53849 ignored. The effect is to treat it as true, whether it is positive or
53850 negative.
53851 </para>
53852 </listitem></varlistentry>
53853 <varlistentry>
53854 <term><emphasis role="bold">decode&nbsp;=&nbsp;</emphasis>&lt;<emphasis>location</emphasis>&gt;</term>
53855 <listitem>
53856 <para>
53857 <indexterm role="concept">
53858 <primary><option>decode</option> ACL condition</primary>
53859 </indexterm>
53860 This condition is available only when Exim is compiled with the
53861 content-scanning extension, and it is allowed only in the ACL defined by
53862 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
53863 If all goes well, the condition is true. It is false only if there are
53864 problems such as a syntax error or a memory shortage. For more details, see
53865 chapter <xref linkend="CHAPexiscan"/>.
53866 </para>
53867 </listitem></varlistentry>
53868 <varlistentry>
53869 <term><emphasis role="bold">demime&nbsp;=&nbsp;</emphasis>&lt;<emphasis>extension&nbsp;list</emphasis>&gt;</term>
53870 <listitem>
53871 <para>
53872 <indexterm role="concept">
53873 <primary><option>demime</option> ACL condition</primary>
53874 </indexterm>
53875 This condition is available only when Exim is compiled with the
53876 content-scanning extension. Its use is described in section
53877 <xref linkend="SECTdemimecond"/>.
53878 </para>
53879 </listitem></varlistentry>
53880 <varlistentry>
53881 <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>
53882 <listitem>
53883 <para>
53884 <indexterm role="concept">
53885 <primary><option>dnslists</option> ACL condition</primary>
53886 </indexterm>
53887 <indexterm role="concept">
53888 <primary>DNS list</primary>
53889 <secondary>in ACL</secondary>
53890 </indexterm>
53891 <indexterm role="concept">
53892 <primary>black list (DNS)</primary>
53893 </indexterm>
53894 <indexterm role="concept">
53895 <primary>access control lists (ACLs)</primary>
53896 <secondary>testing a DNS list</secondary>
53897 </indexterm>
53898 This condition checks for entries in DNS black lists. These are also known as
53899 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
53900 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
53901 different variants of this condition to describe briefly here. See sections
53902 <xref linkend="SECTmorednslists"/>&ndash;<xref linkend="SECTmorednslistslast"/> for details.
53903 </para>
53904 </listitem></varlistentry>
53905 <varlistentry>
53906 <term><emphasis role="bold">domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
53907 <listitem>
53908 <para>
53909 <indexterm role="concept">
53910 <primary><option>domains</option> ACL condition</primary>
53911 </indexterm>
53912 <indexterm role="concept">
53913 <primary>domain</primary>
53914 <secondary>ACL checking</secondary>
53915 </indexterm>
53916 <indexterm role="concept">
53917 <primary>access control lists (ACLs)</primary>
53918 <secondary>testing a recipient domain</secondary>
53919 </indexterm>
53920 <indexterm role="variable">
53921 <primary><varname>$domain_data</varname></primary>
53922 </indexterm>
53923 This condition is relevant only after a RCPT command. It checks that the domain
53924 of the recipient address is in the domain list. If percent-hack processing is
53925 enabled, it is done before this test is done. If the check succeeds with a
53926 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
53927 <option>domains</option> test.
53928 </para>
53929 <para>
53930 <emphasis role="bold">Note carefully</emphasis> (because many people seem to fall foul of this): you cannot
53931 use <option>domains</option> in a DATA ACL.
53932 </para>
53933 </listitem></varlistentry>
53934 <varlistentry>
53935 <term><emphasis role="bold">encrypted&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
53936 <listitem>
53937 <para>
53938 <indexterm role="concept">
53939 <primary><option>encrypted</option> ACL condition</primary>
53940 </indexterm>
53941 <indexterm role="concept">
53942 <primary>encryption</primary>
53943 <secondary>checking in an ACL</secondary>
53944 </indexterm>
53945 <indexterm role="concept">
53946 <primary>access control lists (ACLs)</primary>
53947 <secondary>testing for encryption</secondary>
53948 </indexterm>
53949 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
53950 name of the cipher suite in use is tested against the list. To test for
53951 encryption without testing for any specific cipher suite(s), set
53952 </para>
53953 <literallayout class="monospaced">
53954 encrypted = *
53955 </literallayout>
53956 </listitem></varlistentry>
53957 <varlistentry>
53958 <term><emphasis role="bold">hosts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>host&nbsp;list</emphasis>&gt;</term>
53959 <listitem>
53960 <para>
53961 <indexterm role="concept">
53962 <primary><option>hosts</option> ACL condition</primary>
53963 </indexterm>
53964 <indexterm role="concept">
53965 <primary>host</primary>
53966 <secondary>ACL checking</secondary>
53967 </indexterm>
53968 <indexterm role="concept">
53969 <primary>access control lists (ACLs)</primary>
53970 <secondary>testing the client host</secondary>
53971 </indexterm>
53972 This condition tests that the calling host matches the host list. If you have
53973 name lookups or wildcarded host names and IP addresses in the same host list,
53974 you should normally put the IP addresses first. For example, you could have:
53975 </para>
53976 <literallayout class="monospaced">
53977 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
53978 </literallayout>
53979 <para>
53980 The lookup in this example uses the host name for its key. This is implied by
53981 the lookup type <quote>dbm</quote>. (For a host address lookup you would use <quote>net-dbm</quote>
53982 and it wouldn&#x2019;t matter which way round you had these two items.)
53983 </para>
53984 <para>
53985 The reason for the problem with host names lies in the left-to-right way that
53986 Exim processes lists. It can test IP addresses without doing any DNS lookups,
53987 but when it reaches an item that requires a host name, it fails if it cannot
53988 find a host name to compare with the pattern. If the above list is given in the
53989 opposite order, the <option>accept</option> statement fails for a host whose name cannot be
53990 found, even if its IP address is 10.9.8.7.
53991 </para>
53992 <para>
53993 If you really do want to do the name check first, and still recognize the IP
53994 address even if the name lookup fails, you can rewrite the ACL like this:
53995 </para>
53996 <literallayout class="monospaced">
53997 accept hosts = dbm;/etc/friendly/hosts
53998 accept hosts = 10.9.8.7
53999 </literallayout>
54000 <para>
54001 The default action on failing to find the host name is to assume that the host
54002 is not in the list, so the first <option>accept</option> statement fails. The second
54003 statement can then check the IP address.
54004 </para>
54005 <para>
54006 <indexterm role="variable">
54007 <primary><varname>$host_data</varname></primary>
54008 </indexterm>
54009 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
54010 of the lookup is made available in the <varname>$host_data</varname> variable. This
54011 allows you, for example, to set up a statement like this:
54012 </para>
54013 <literallayout class="monospaced">
54014 deny  hosts = net-lsearch;/some/file
54015 message = $host_data
54016 </literallayout>
54017 <para>
54018 which gives a custom error message for each denied host.
54019 </para>
54020 </listitem></varlistentry>
54021 <varlistentry>
54022 <term><emphasis role="bold">local_parts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>local&nbsp;part&nbsp;list</emphasis>&gt;</term>
54023 <listitem>
54024 <para>
54025 <indexterm role="concept">
54026 <primary><option>local_parts</option> ACL condition</primary>
54027 </indexterm>
54028 <indexterm role="concept">
54029 <primary>local part</primary>
54030 <secondary>ACL checking</secondary>
54031 </indexterm>
54032 <indexterm role="concept">
54033 <primary>access control lists (ACLs)</primary>
54034 <secondary>testing a local part</secondary>
54035 </indexterm>
54036 <indexterm role="variable">
54037 <primary><varname>$local_part_data</varname></primary>
54038 </indexterm>
54039 This condition is relevant only after a RCPT command. It checks that the local
54040 part of the recipient address is in the list. If percent-hack processing is
54041 enabled, it is done before this test. If the check succeeds with a lookup, the
54042 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
54043 the next <option>local_parts</option> test.
54044 </para>
54045 </listitem></varlistentry>
54046 <varlistentry>
54047 <term><emphasis role="bold">malware&nbsp;=&nbsp;</emphasis>&lt;<emphasis>option</emphasis>&gt;</term>
54048 <listitem>
54049 <para>
54050 <indexterm role="concept">
54051 <primary><option>malware</option> ACL condition</primary>
54052 </indexterm>
54053 <indexterm role="concept">
54054 <primary>access control lists (ACLs)</primary>
54055 <secondary>virus scanning</secondary>
54056 </indexterm>
54057 <indexterm role="concept">
54058 <primary>access control lists (ACLs)</primary>
54059 <secondary>scanning for viruses</secondary>
54060 </indexterm>
54061 This condition is available only when Exim is compiled with the
54062 content-scanning extension. It causes the incoming message to be scanned for
54063 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
54064 </para>
54065 </listitem></varlistentry>
54066 <varlistentry>
54067 <term><emphasis role="bold">mime_regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
54068 <listitem>
54069 <para>
54070 <indexterm role="concept">
54071 <primary><option>mime_regex</option> ACL condition</primary>
54072 </indexterm>
54073 <indexterm role="concept">
54074 <primary>access control lists (ACLs)</primary>
54075 <secondary>testing by regex matching</secondary>
54076 </indexterm>
54077 This condition is available only when Exim is compiled with the
54078 content-scanning extension, and it is allowed only in the ACL defined by
54079 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
54080 with any of the regular expressions. For details, see chapter
54081 <xref linkend="CHAPexiscan"/>.
54082 </para>
54083 </listitem></varlistentry>
54084 <varlistentry>
54085 <term><emphasis role="bold">ratelimit&nbsp;=&nbsp;</emphasis>&lt;<emphasis>parameters</emphasis>&gt;</term>
54086 <listitem>
54087 <para>
54088 <indexterm role="concept">
54089 <primary>rate limiting</primary>
54090 </indexterm>
54091 This condition can be used to limit the rate at which a user or host submits
54092 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
54093 </para>
54094 </listitem></varlistentry>
54095 <varlistentry>
54096 <term><emphasis role="bold">recipients&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
54097 <listitem>
54098 <para>
54099 <indexterm role="concept">
54100 <primary><option>recipients</option> ACL condition</primary>
54101 </indexterm>
54102 <indexterm role="concept">
54103 <primary>recipient</primary>
54104 <secondary>ACL checking</secondary>
54105 </indexterm>
54106 <indexterm role="concept">
54107 <primary>access control lists (ACLs)</primary>
54108 <secondary>testing a recipient</secondary>
54109 </indexterm>
54110 This condition is relevant only after a RCPT command. It checks the entire
54111 recipient address against a list of recipients.
54112 </para>
54113 </listitem></varlistentry>
54114 <varlistentry>
54115 <term><emphasis role="bold">regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
54116 <listitem>
54117 <para>
54118 <indexterm role="concept">
54119 <primary><option>regex</option> ACL condition</primary>
54120 </indexterm>
54121 <indexterm role="concept">
54122 <primary>access control lists (ACLs)</primary>
54123 <secondary>testing by regex matching</secondary>
54124 </indexterm>
54125 This condition is available only when Exim is compiled with the
54126 content-scanning extension, and is available only in the DATA, MIME, and
54127 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
54128 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
54129 </para>
54130 </listitem></varlistentry>
54131 <varlistentry>
54132 <term><emphasis role="bold">sender_domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
54133 <listitem>
54134 <para>
54135 <indexterm role="concept">
54136 <primary><option>sender_domains</option> ACL condition</primary>
54137 </indexterm>
54138 <indexterm role="concept">
54139 <primary>sender</primary>
54140 <secondary>ACL checking</secondary>
54141 </indexterm>
54142 <indexterm role="concept">
54143 <primary>access control lists (ACLs)</primary>
54144 <secondary>testing a sender domain</secondary>
54145 </indexterm>
54146 <indexterm role="variable">
54147 <primary><varname>$domain</varname></primary>
54148 </indexterm>
54149 <indexterm role="variable">
54150 <primary><varname>$sender_address_domain</varname></primary>
54151 </indexterm>
54152 This condition tests the domain of the sender of the message against the given
54153 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
54154 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
54155 of this condition. This is an exception to the general rule for testing domain
54156 lists. It is done this way so that, if this condition is used in an ACL for a
54157 RCPT command, the recipient&#x2019;s domain (which is in <varname>$domain</varname>) can be used to
54158 influence the sender checking.
54159 </para>
54160 <para>
54161 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
54162 relaying, because sender addresses are easily, and commonly, forged.
54163 </para>
54164 </listitem></varlistentry>
54165 <varlistentry>
54166 <term><emphasis role="bold">senders&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
54167 <listitem>
54168 <para>
54169 <indexterm role="concept">
54170 <primary><option>senders</option> ACL condition</primary>
54171 </indexterm>
54172 <indexterm role="concept">
54173 <primary>sender</primary>
54174 <secondary>ACL checking</secondary>
54175 </indexterm>
54176 <indexterm role="concept">
54177 <primary>access control lists (ACLs)</primary>
54178 <secondary>testing a sender</secondary>
54179 </indexterm>
54180 This condition tests the sender of the message against the given list. To test
54181 for a bounce message, which has an empty sender, set
54182 </para>
54183 <literallayout class="monospaced">
54184 senders = :
54185 </literallayout>
54186 <para>
54187 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
54188 relaying, because sender addresses are easily, and commonly, forged.
54189 </para>
54190 </listitem></varlistentry>
54191 <varlistentry>
54192 <term><emphasis role="bold">spam&nbsp;=&nbsp;</emphasis>&lt;<emphasis>username</emphasis>&gt;</term>
54193 <listitem>
54194 <para>
54195 <indexterm role="concept">
54196 <primary><option>spam</option> ACL condition</primary>
54197 </indexterm>
54198 <indexterm role="concept">
54199 <primary>access control lists (ACLs)</primary>
54200 <secondary>scanning for spam</secondary>
54201 </indexterm>
54202 This condition is available only when Exim is compiled with the
54203 content-scanning extension. It causes the incoming message to be scanned by
54204 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
54205 </para>
54206 </listitem></varlistentry>
54207 <varlistentry>
54208 <term><emphasis role="bold">verify&nbsp;=&nbsp;certificate</emphasis></term>
54209 <listitem>
54210 <para>
54211 <indexterm role="concept">
54212 <primary><option>verify</option> ACL condition</primary>
54213 </indexterm>
54214 <indexterm role="concept">
54215 <primary>TLS</primary>
54216 <secondary>client certificate verification</secondary>
54217 </indexterm>
54218 <indexterm role="concept">
54219 <primary>certificate</primary>
54220 <secondary>verification of client</secondary>
54221 </indexterm>
54222 <indexterm role="concept">
54223 <primary>access control lists (ACLs)</primary>
54224 <secondary>certificate verification</secondary>
54225 </indexterm>
54226 <indexterm role="concept">
54227 <primary>access control lists (ACLs)</primary>
54228 <secondary>testing a TLS certificate</secondary>
54229 </indexterm>
54230 This condition is true in an SMTP session if the session is encrypted, and a
54231 certificate was received from the client, and the certificate was verified. The
54232 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
54233 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
54234 </para>
54235 </listitem></varlistentry>
54236 <varlistentry>
54237 <term><emphasis role="bold">verify&nbsp;=&nbsp;csa</emphasis></term>
54238 <listitem>
54239 <para>
54240 <indexterm role="concept">
54241 <primary>CSA verification</primary>
54242 </indexterm>
54243 This condition checks whether the sending host (the client) is authorized to
54244 send email. Details of how this works are given in section
54245 <xref linkend="SECTverifyCSA"/>.
54246 </para>
54247 </listitem></varlistentry>
54248 <varlistentry>
54249 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_names_ascii</emphasis></term>
54250 <listitem>
54251 <para>
54252 <indexterm role="concept">
54253 <primary><option>verify</option> ACL condition</primary>
54254 </indexterm>
54255 <indexterm role="concept">
54256 <primary>access control lists (ACLs)</primary>
54257 <secondary>verifying header names only ASCII</secondary>
54258 </indexterm>
54259 <indexterm role="concept">
54260 <primary>header lines</primary>
54261 <secondary>verifying header names only ASCII</secondary>
54262 </indexterm>
54263 <indexterm role="concept">
54264 <primary>verifying</primary>
54265 <secondary>header names only ASCII</secondary>
54266 </indexterm>
54267 This condition is relevant only in an ACL that is run after a message has been
54268 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
54269 <option>acl_not_smtp</option>.  It checks all header names (not the content) to make sure
54270 there are no non-ASCII characters, also excluding control characters.  The
54271 allowable characters are decimal ASCII values 33 through 126.
54272 </para>
54273 <para>
54274 Exim itself will handle headers with non-ASCII characters, but it can cause
54275 problems for downstream applications, so this option will allow their
54276 detection and rejection in the DATA ACL&#x2019;s.
54277 </para>
54278 </listitem></varlistentry>
54279 <varlistentry>
54280 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
54281 <listitem>
54282 <para>
54283 <indexterm role="concept">
54284 <primary><option>verify</option> ACL condition</primary>
54285 </indexterm>
54286 <indexterm role="concept">
54287 <primary>access control lists (ACLs)</primary>
54288 <secondary>verifying sender in the header</secondary>
54289 </indexterm>
54290 <indexterm role="concept">
54291 <primary>header lines</primary>
54292 <secondary>verifying the sender in</secondary>
54293 </indexterm>
54294 <indexterm role="concept">
54295 <primary>sender</primary>
54296 <secondary>verifying in header</secondary>
54297 </indexterm>
54298 <indexterm role="concept">
54299 <primary>verifying</primary>
54300 <secondary>sender in header</secondary>
54301 </indexterm>
54302 This condition is relevant only in an ACL that is run after a message has been
54303 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
54304 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
54305 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
54306 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
54307 However, an address that appears in one of these headers need not be an address
54308 that accepts bounce messages; only sender addresses in envelopes are required
54309 to accept bounces. Therefore, if you use the callout option on this check, you
54310 might want to arrange for a non-empty address in the MAIL command.
54311 </para>
54312 <para>
54313 Details of address verification and the options are given later, starting at
54314 section <xref linkend="SECTaddressverification"/> (callouts are described in section
54315 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
54316 condition to restrict it to bounce messages only:
54317 </para>
54318 <literallayout class="monospaced">
54319 deny    senders = :
54320         message = A valid sender header is required for bounces
54321        !verify  = header_sender
54322 </literallayout>
54323 </listitem></varlistentry>
54324 <varlistentry>
54325 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_syntax</emphasis></term>
54326 <listitem>
54327 <para>
54328 <indexterm role="concept">
54329 <primary><option>verify</option> ACL condition</primary>
54330 </indexterm>
54331 <indexterm role="concept">
54332 <primary>access control lists (ACLs)</primary>
54333 <secondary>verifying header syntax</secondary>
54334 </indexterm>
54335 <indexterm role="concept">
54336 <primary>header lines</primary>
54337 <secondary>verifying syntax</secondary>
54338 </indexterm>
54339 <indexterm role="concept">
54340 <primary>verifying</primary>
54341 <secondary>header syntax</secondary>
54342 </indexterm>
54343 This condition is relevant only in an ACL that is run after a message has been
54344 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
54345 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
54346 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
54347 and <emphasis>Bcc:</emphasis>). Unqualified addresses (local parts without domains) are
54348 permitted only in locally generated messages and from hosts that match
54349 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
54350 appropriate.
54351 </para>
54352 <para>
54353 Note that this condition is a syntax check only. However, a common spamming
54354 ploy used to be to send syntactically invalid headers such as
54355 </para>
54356 <literallayout class="monospaced">
54357 To: @
54358 </literallayout>
54359 <para>
54360 and this condition can be used to reject such messages, though they are not as
54361 common as they used to be.
54362 </para>
54363 </listitem></varlistentry>
54364 <varlistentry>
54365 <term><emphasis role="bold">verify&nbsp;=&nbsp;helo</emphasis></term>
54366 <listitem>
54367 <para>
54368 <indexterm role="concept">
54369 <primary><option>verify</option> ACL condition</primary>
54370 </indexterm>
54371 <indexterm role="concept">
54372 <primary>access control lists (ACLs)</primary>
54373 <secondary>verifying HELO/EHLO</secondary>
54374 </indexterm>
54375 <indexterm role="concept">
54376 <primary>HELO</primary>
54377 <secondary>verifying</secondary>
54378 </indexterm>
54379 <indexterm role="concept">
54380 <primary>EHLO</primary>
54381 <secondary>verifying</secondary>
54382 </indexterm>
54383 <indexterm role="concept">
54384 <primary>verifying</primary>
54385 <secondary>EHLO</secondary>
54386 </indexterm>
54387 <indexterm role="concept">
54388 <primary>verifying</primary>
54389 <secondary>HELO</secondary>
54390 </indexterm>
54391 This condition is true if a HELO or EHLO command has been received from the
54392 client host, and its contents have been verified. If there has been no previous
54393 attempt to verify the HELO/EHLO contents, it is carried out when this
54394 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
54395 <option>helo_try_verify_hosts</option> options for details of how to request verification
54396 independently of this condition.
54397 </para>
54398 <para>
54399 For SMTP input that does not come over TCP/IP (the <option>-bs</option> command line
54400 option), this condition is always true.
54401 </para>
54402 </listitem></varlistentry>
54403 <varlistentry>
54404 <term><emphasis role="bold">verify&nbsp;=&nbsp;not_blind</emphasis></term>
54405 <listitem>
54406 <para>
54407 <indexterm role="concept">
54408 <primary>verifying</primary>
54409 <secondary>not blind</secondary>
54410 </indexterm>
54411 <indexterm role="concept">
54412 <primary>bcc recipients, verifying none</primary>
54413 </indexterm>
54414 This condition checks that there are no blind (bcc) recipients in the message.
54415 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
54416 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
54417 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
54418 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
54419 used only in a DATA or non-SMTP ACL.
54420 </para>
54421 <para>
54422 There are, of course, many legitimate messages that make use of blind (bcc)
54423 recipients. This check should not be used on its own for blocking messages.
54424 </para>
54425 </listitem></varlistentry>
54426 <varlistentry>
54427 <term><emphasis role="bold">verify&nbsp;=&nbsp;recipient/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
54428 <listitem>
54429 <para>
54430 <indexterm role="concept">
54431 <primary><option>verify</option> ACL condition</primary>
54432 </indexterm>
54433 <indexterm role="concept">
54434 <primary>access control lists (ACLs)</primary>
54435 <secondary>verifying recipient</secondary>
54436 </indexterm>
54437 <indexterm role="concept">
54438 <primary>recipient</primary>
54439 <secondary>verifying</secondary>
54440 </indexterm>
54441 <indexterm role="concept">
54442 <primary>verifying</primary>
54443 <secondary>recipient</secondary>
54444 </indexterm>
54445 <indexterm role="variable">
54446 <primary><varname>$address_data</varname></primary>
54447 </indexterm>
54448 This condition is relevant only after a RCPT command. It verifies the current
54449 recipient. Details of address verification are given later, starting at section
54450 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
54451 of <varname>$address_data</varname> is the last value that was set while routing the address.
54452 This applies even if the verification fails. When an address that is being
54453 verified is redirected to a single address, verification continues with the new
54454 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
54455 value for the child address.
54456 </para>
54457 </listitem></varlistentry>
54458 <varlistentry>
54459 <term><emphasis role="bold">verify&nbsp;=&nbsp;reverse_host_lookup</emphasis></term>
54460 <listitem>
54461 <para>
54462 <indexterm role="concept">
54463 <primary><option>verify</option> ACL condition</primary>
54464 </indexterm>
54465 <indexterm role="concept">
54466 <primary>access control lists (ACLs)</primary>
54467 <secondary>verifying host reverse lookup</secondary>
54468 </indexterm>
54469 <indexterm role="concept">
54470 <primary>host</primary>
54471 <secondary>verifying reverse lookup</secondary>
54472 </indexterm>
54473 This condition ensures that a verified host name has been looked up from the IP
54474 address of the client host. (This may have happened already if the host name
54475 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
54476 Verification ensures that the host name obtained from a reverse DNS lookup, or
54477 one of its aliases, does, when it is itself looked up in the DNS, yield the
54478 original IP address.
54479 </para>
54480 <para>
54481 If this condition is used for a locally generated message (that is, when there
54482 is no client host involved), it always succeeds.
54483 </para>
54484 </listitem></varlistentry>
54485 <varlistentry>
54486 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
54487 <listitem>
54488 <para>
54489 <indexterm role="concept">
54490 <primary><option>verify</option> ACL condition</primary>
54491 </indexterm>
54492 <indexterm role="concept">
54493 <primary>access control lists (ACLs)</primary>
54494 <secondary>verifying sender</secondary>
54495 </indexterm>
54496 <indexterm role="concept">
54497 <primary>sender</primary>
54498 <secondary>verifying</secondary>
54499 </indexterm>
54500 <indexterm role="concept">
54501 <primary>verifying</primary>
54502 <secondary>sender</secondary>
54503 </indexterm>
54504 This condition is relevant only after a MAIL or RCPT command, or after a
54505 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
54506 the message&#x2019;s sender is empty (that is, this is a bounce message), the
54507 condition is true. Otherwise, the sender address is verified.
54508 </para>
54509 <para>
54510 <indexterm role="variable">
54511 <primary><varname>$address_data</varname></primary>
54512 </indexterm>
54513 <indexterm role="variable">
54514 <primary><varname>$sender_address_data</varname></primary>
54515 </indexterm>
54516 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
54517 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
54518 value can be used in subsequent conditions and modifiers in the same ACL
54519 statement. It does not persist after the end of the current statement. If you
54520 want to preserve the value for longer, you can save it in an ACL variable.
54521 </para>
54522 <para>
54523 Details of verification are given later, starting at section
54524 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
54525 to avoid doing it more than once per message.
54526 </para>
54527 </listitem></varlistentry>
54528 <varlistentry>
54529 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender=</emphasis>&lt;<emphasis>address</emphasis>&gt;<emphasis role="bold">/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
54530 <listitem>
54531 <para>
54532 <indexterm role="concept">
54533 <primary><option>verify</option> ACL condition</primary>
54534 </indexterm>
54535 This is a variation of the previous option, in which a modified address is
54536 verified as a sender.
54537 </para>
54538 </listitem></varlistentry>
54539 </variablelist>
54540 </section>
54541 <section id="SECTmorednslists">
54542 <title>Using DNS lists</title>
54543 <para>
54544 <indexterm role="concept">
54545 <primary>DNS list</primary>
54546 <secondary>in ACL</secondary>
54547 </indexterm>
54548 <indexterm role="concept">
54549 <primary>black list (DNS)</primary>
54550 </indexterm>
54551 <indexterm role="concept">
54552 <primary>access control lists (ACLs)</primary>
54553 <secondary>testing a DNS list</secondary>
54554 </indexterm>
54555 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
54556 is on at least one of a number of DNS lists by looking up the inverted IP
54557 address in one or more DNS domains. (Note that DNS list domains are not mail
54558 domains, so the <literal>+</literal> syntax for named lists doesn&#x2019;t work - it is used for
54559 special options instead.) For example, if the calling host&#x2019;s IP
54560 address is 192.168.62.43, and the ACL statement is
54561 </para>
54562 <literallayout class="monospaced">
54563 deny dnslists = blackholes.mail-abuse.org : \
54564                 dialups.mail-abuse.org
54565 </literallayout>
54566 <para>
54567 the following records are looked up:
54568 </para>
54569 <literallayout class="monospaced">
54570 43.62.168.192.blackholes.mail-abuse.org
54571 43.62.168.192.dialups.mail-abuse.org
54572 </literallayout>
54573 <para>
54574 As soon as Exim finds an existing DNS record, processing of the list stops.
54575 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
54576 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
54577 use two separate conditions:
54578 </para>
54579 <literallayout class="monospaced">
54580 deny dnslists = blackholes.mail-abuse.org
54581      dnslists = dialups.mail-abuse.org
54582 </literallayout>
54583 <para>
54584 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
54585 behaves as if the host does not match the list item, that is, as if the DNS
54586 record does not exist. If there are further items in the DNS list, they are
54587 processed.
54588 </para>
54589 <para>
54590 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
54591 (which is the most common usage), because it prevents a DNS failure from
54592 blocking mail. However, you can change this behaviour by putting one of the
54593 following special items in the list:
54594 </para>
54595 <literallayout>
54596 <literal>+include_unknown </literal>   behave as if the item is on the list
54597 <literal>+exclude_unknown </literal>   behave as if the item is not on the list (default)
54598 <literal>+defer_unknown   </literal>   give a temporary error
54599 </literallayout>
54600 <para>
54601 <indexterm role="concept">
54602 <primary><literal>+include_unknown</literal></primary>
54603 </indexterm>
54604 <indexterm role="concept">
54605 <primary><literal>+exclude_unknown</literal></primary>
54606 </indexterm>
54607 <indexterm role="concept">
54608 <primary><literal>+defer_unknown</literal></primary>
54609 </indexterm>
54610 Each of these applies to any subsequent items on the list. For example:
54611 </para>
54612 <literallayout class="monospaced">
54613 deny dnslists = +defer_unknown : foo.bar.example
54614 </literallayout>
54615 <para>
54616 Testing the list of domains stops as soon as a match is found. If you want to
54617 warn for one list and block for another, you can use two different statements:
54618 </para>
54619 <literallayout class="monospaced">
54620 deny  dnslists = blackholes.mail-abuse.org
54621 warn  message  = X-Warn: sending host is on dialups list
54622       dnslists = dialups.mail-abuse.org
54623 </literallayout>
54624 <para>
54625 DNS list lookups are cached by Exim for the duration of the SMTP session,
54626 so a lookup based on the IP address is done at most once for any incoming
54627 connection. Exim does not share information between multiple incoming
54628 connections (but your local name server cache should be active).
54629 </para>
54630 </section>
54631 <section id="SECID201">
54632 <title>Specifying the IP address for a DNS list lookup</title>
54633 <para>
54634 <indexterm role="concept">
54635 <primary>DNS list</primary>
54636 <secondary>keyed by explicit IP address</secondary>
54637 </indexterm>
54638 By default, the IP address that is used in a DNS list lookup is the IP address
54639 of the calling host. However, you can specify another IP address by listing it
54640 after the domain name, introduced by a slash. For example:
54641 </para>
54642 <literallayout class="monospaced">
54643 deny dnslists = black.list.tld/192.168.1.2
54644 </literallayout>
54645 <para>
54646 This feature is not very helpful with explicit IP addresses; it is intended for
54647 use with IP addresses that are looked up, for example, the IP addresses of the
54648 MX hosts or nameservers of an email sender address. For an example, see section
54649 <xref linkend="SECTmulkeyfor"/> below.
54650 </para>
54651 </section>
54652 <section id="SECID202">
54653 <title>DNS lists keyed on domain names</title>
54654 <para>
54655 <indexterm role="concept">
54656 <primary>DNS list</primary>
54657 <secondary>keyed by domain name</secondary>
54658 </indexterm>
54659 There are some lists that are keyed on domain names rather than inverted IP
54660 addresses (see for example the <emphasis>domain based zones</emphasis> link at
54661 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
54662 with these lists. You can change the name that is looked up in a DNS list by
54663 listing it after the domain name, introduced by a slash. For example,
54664 </para>
54665 <literallayout class="monospaced">
54666 deny  message  = Sender's domain is listed at $dnslist_domain
54667       dnslists = dsn.rfc-ignorant.org/$sender_address_domain
54668 </literallayout>
54669 <para>
54670 This particular example is useful only in ACLs that are obeyed after the
54671 RCPT or DATA commands, when a sender address is available. If (for
54672 example) the message&#x2019;s sender is <emphasis>user@tld.example</emphasis> the name that is looked
54673 up by this example is
54674 </para>
54675 <literallayout class="monospaced">
54676 tld.example.dsn.rfc-ignorant.org
54677 </literallayout>
54678 <para>
54679 A single <option>dnslists</option> condition can contain entries for both names and IP
54680 addresses. For example:
54681 </para>
54682 <literallayout class="monospaced">
54683 deny dnslists = sbl.spamhaus.org : \
54684                 dsn.rfc-ignorant.org/$sender_address_domain
54685 </literallayout>
54686 <para>
54687 The first item checks the sending host&#x2019;s IP address; the second checks a domain
54688 name. The whole condition is true if either of the DNS lookups succeeds.
54689 </para>
54690 </section>
54691 <section id="SECTmulkeyfor">
54692 <title>Multiple explicit keys for a DNS list</title>
54693 <para>
54694 <indexterm role="concept">
54695 <primary>DNS list</primary>
54696 <secondary>multiple keys for</secondary>
54697 </indexterm>
54698 The syntax described above for looking up explicitly-defined values (either
54699 names or IP addresses) in a DNS blacklist is a simplification. After the domain
54700 name for the DNS list, what follows the slash can in fact be a list of items.
54701 As with all lists in Exim, the default separator is a colon. However, because
54702 this is a sublist within the list of DNS blacklist domains, it is necessary
54703 either to double the separators like this:
54704 </para>
54705 <literallayout class="monospaced">
54706 dnslists = black.list.tld/name.1::name.2
54707 </literallayout>
54708 <para>
54709 or to change the separator character, like this:
54710 </para>
54711 <literallayout class="monospaced">
54712 dnslists = black.list.tld/&lt;;name.1;name.2
54713 </literallayout>
54714 <para>
54715 If an item in the list is an IP address, it is inverted before the DNS
54716 blacklist domain is appended. If it is not an IP address, no inversion
54717 occurs. Consider this condition:
54718 </para>
54719 <literallayout class="monospaced">
54720 dnslists = black.list.tld/&lt;;192.168.1.2;a.domain
54721 </literallayout>
54722 <para>
54723 The DNS lookups that occur are:
54724 </para>
54725 <literallayout class="monospaced">
54726 2.1.168.192.black.list.tld
54727 a.domain.black.list.tld
54728 </literallayout>
54729 <para>
54730 Once a DNS record has been found (that matches a specific IP return
54731 address, if specified &ndash; see section <xref linkend="SECTaddmatcon"/>), no further lookups
54732 are done. If there is a temporary DNS error, the rest of the sublist of domains
54733 or IP addresses is tried. A temporary error for the whole dnslists item occurs
54734 only if no other DNS lookup in this sublist succeeds. In other words, a
54735 successful lookup for any of the items in the sublist overrides a temporary
54736 error for a previous item.
54737 </para>
54738 <para>
54739 The ability to supply a list of items after the slash is in some sense just a
54740 syntactic convenience. These two examples have the same effect:
54741 </para>
54742 <literallayout class="monospaced">
54743 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
54744 dnslists = black.list.tld/a.domain::b.domain
54745 </literallayout>
54746 <para>
54747 However, when the data for the list is obtained from a lookup, the second form
54748 is usually much more convenient. Consider this example:
54749 </para>
54750 <literallayout class="monospaced">
54751 deny message  = The mail servers for the domain \
54752                 $sender_address_domain \
54753                 are listed at $dnslist_domain ($dnslist_value); \
54754                 see $dnslist_text.
54755      dnslists = sbl.spamhaus.org/&lt;|${lookup dnsdb {&gt;|a=&lt;|\
54756                                    ${lookup dnsdb {&gt;|mxh=\
54757                                    $sender_address_domain} }} }
54758 </literallayout>
54759 <para>
54760 Note the use of <literal>&gt;|</literal> in the dnsdb lookup to specify the separator for
54761 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
54762 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
54763 of expanding the condition might be something like this:
54764 </para>
54765 <literallayout class="monospaced">
54766 dnslists = sbl.spahmaus.org/&lt;|192.168.2.3|192.168.5.6|...
54767 </literallayout>
54768 <para>
54769 Thus, this example checks whether or not the IP addresses of the sender
54770 domain&#x2019;s mail servers are on the Spamhaus black list.
54771 </para>
54772 <para>
54773 The key that was used for a successful DNS list lookup is put into the variable
54774 <varname>$dnslist_matched</varname> (see section <xref linkend="SECID204"/>).
54775 </para>
54776 </section>
54777 <section id="SECID203">
54778 <title>Data returned by DNS lists</title>
54779 <para>
54780 <indexterm role="concept">
54781 <primary>DNS list</primary>
54782 <secondary>data returned from</secondary>
54783 </indexterm>
54784 DNS lists are constructed using address records in the DNS. The original RBL
54785 just used the address 127.0.0.1 on the right hand side of each record, but the
54786 RBL+ list and some other lists use a number of values with different meanings.
54787 The values used on the RBL+ list are:
54788 </para>
54789 <literallayout>
54790 127.1.0.1  RBL
54791 127.1.0.2  DUL
54792 127.1.0.3  DUL and RBL
54793 127.1.0.4  RSS
54794 127.1.0.5  RSS and RBL
54795 127.1.0.6  RSS and DUL
54796 127.1.0.7  RSS and DUL and RBL
54797 </literallayout>
54798 <para>
54799 Section <xref linkend="SECTaddmatcon"/> below describes how you can distinguish between
54800 different values. Some DNS lists may return more than one address record;
54801 see section <xref linkend="SECThanmuldnsrec"/> for details of how they are checked.
54802 </para>
54803 </section>
54804 <section id="SECID204">
54805 <title>Variables set from DNS lists</title>
54806 <para>
54807 <indexterm role="concept">
54808 <primary>expansion</primary>
54809 <secondary>variables, set from DNS list</secondary>
54810 </indexterm>
54811 <indexterm role="concept">
54812 <primary>DNS list</primary>
54813 <secondary>variables set from</secondary>
54814 </indexterm>
54815 <indexterm role="variable">
54816 <primary><varname>$dnslist_domain</varname></primary>
54817 </indexterm>
54818 <indexterm role="variable">
54819 <primary><varname>$dnslist_matched</varname></primary>
54820 </indexterm>
54821 <indexterm role="variable">
54822 <primary><varname>$dnslist_text</varname></primary>
54823 </indexterm>
54824 <indexterm role="variable">
54825 <primary><varname>$dnslist_value</varname></primary>
54826 </indexterm>
54827 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname> contains
54828 the name of the overall domain that matched (for example,
54829 <literal>spamhaus.example</literal>), <varname>$dnslist_matched</varname> contains the key within that domain
54830 (for example, <literal>192.168.5.3</literal>), and <varname>$dnslist_value</varname> contains the data from
54831 the DNS record. When the key is an IP address, it is not reversed in
54832 <varname>$dnslist_matched</varname> (though it is, of course, in the actual lookup). In simple
54833 cases, for example:
54834 </para>
54835 <literallayout class="monospaced">
54836 deny dnslists = spamhaus.example
54837 </literallayout>
54838 <para>
54839 the key is also available in another variable (in this case,
54840 <varname>$sender_host_address</varname>). In more complicated cases, however, this is not true.
54841 For example, using a data lookup (as described in section <xref linkend="SECTmulkeyfor"/>)
54842 might generate a dnslists lookup like this:
54843 </para>
54844 <literallayout class="monospaced">
54845 deny dnslists = spamhaus.example/&lt;|192.168.1.2|192.168.6.7|...
54846 </literallayout>
54847 <para>
54848 If this condition succeeds, the value in <varname>$dnslist_matched</varname> might be
54849 <literal>192.168.6.7</literal> (for example).
54850 </para>
54851 <para>
54852 If more than one address record is returned by the DNS lookup, all the IP
54853 addresses are included in <varname>$dnslist_value</varname>, separated by commas and spaces.
54854 The variable <varname>$dnslist_text</varname> contains the contents of any associated TXT
54855 record. For lists such as RBL+ the TXT record for a merged entry is often not
54856 very meaningful. See section <xref linkend="SECTmordetinf"/> for a way of obtaining more
54857 information.
54858 </para>
54859 <para>
54860 You can use the DNS list variables in <option>message</option> or <option>log_message</option> modifiers
54861 &ndash; although these appear before the condition in the ACL, they are not
54862 expanded until after it has failed. For example:
54863 </para>
54864 <literallayout class="monospaced">
54865 deny    hosts = !+local_networks
54866         message = $sender_host_address is listed \
54867                   at $dnslist_domain
54868         dnslists = rbl-plus.mail-abuse.example
54869 </literallayout>
54870 </section>
54871 <section id="SECTaddmatcon">
54872 <title>Additional matching conditions for DNS lists</title>
54873 <para>
54874 <indexterm role="concept">
54875 <primary>DNS list</primary>
54876 <secondary>matching specific returned data</secondary>
54877 </indexterm>
54878 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
54879 in order to restrict its action to DNS records with a matching right hand side.
54880 For example,
54881 </para>
54882 <literallayout class="monospaced">
54883 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
54884 </literallayout>
54885 <para>
54886 rejects only those hosts that yield 127.0.0.2. Without this additional data,
54887 any address record is considered to be a match. For the moment, we assume
54888 that the DNS lookup returns just one record. Section <xref linkend="SECThanmuldnsrec"/>
54889 describes how multiple records are handled.
54890 </para>
54891 <para>
54892 More than one IP address may be given for checking, using a comma as a
54893 separator. These are alternatives &ndash; if any one of them matches, the
54894 <option>dnslists</option> condition is true. For example:
54895 </para>
54896 <literallayout class="monospaced">
54897 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
54898 </literallayout>
54899 <para>
54900 If you want to specify a constraining address list and also specify names or IP
54901 addresses to be looked up, the constraining address list must be specified
54902 first. For example:
54903 </para>
54904 <literallayout class="monospaced">
54905 deny dnslists = dsn.rfc-ignorant.org\
54906                 =127.0.0.2/$sender_address_domain
54907 </literallayout>
54908 <para>
54909 If the character <literal>&amp;</literal> is used instead of <literal>=</literal>, the comparison for each
54910 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
54911 In other words, the listed addresses are used as bit masks. The comparison is
54912 true if all the bits in the mask are present in the address that is being
54913 tested. For example:
54914 </para>
54915 <literallayout class="monospaced">
54916 dnslists = a.b.c&amp;0.0.0.3
54917 </literallayout>
54918 <para>
54919 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
54920 want to test whether one bit or another bit is present (as opposed to both
54921 being present), you must use multiple values. For example:
54922 </para>
54923 <literallayout class="monospaced">
54924 dnslists = a.b.c&amp;0.0.0.1,0.0.0.2
54925 </literallayout>
54926 <para>
54927 matches if the final component of the address is an odd number or two times
54928 an odd number.
54929 </para>
54930 </section>
54931 <section id="SECID205">
54932 <title>Negated DNS matching conditions</title>
54933 <para>
54934 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
54935 condition. Whereas
54936 </para>
54937 <literallayout class="monospaced">
54938 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
54939 </literallayout>
54940 <para>
54941 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
54942 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
54943 </para>
54944 <literallayout class="monospaced">
54945 deny  dnslists = a.b.c!=127.0.0.2,127.0.0.3
54946 </literallayout>
54947 <para>
54948 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
54949 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
54950 words, the result of the test is inverted if an exclamation mark appears before
54951 the <literal>=</literal> (or the <literal>&amp;</literal>) sign.
54952 </para>
54953 <para>
54954 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
54955 host, or address list (which is why the syntax is different).
54956 </para>
54957 <para>
54958 If you are using just one list, the negation syntax does not gain you much. The
54959 previous example is precisely equivalent to
54960 </para>
54961 <literallayout class="monospaced">
54962 deny  dnslists = a.b.c
54963      !dnslists = a.b.c=127.0.0.2,127.0.0.3
54964 </literallayout>
54965 <para>
54966 However, if you are using multiple lists, the negation syntax is clearer.
54967 Consider this example:
54968 </para>
54969 <literallayout class="monospaced">
54970 deny  dnslists = sbl.spamhaus.org : \
54971                  list.dsbl.org : \
54972                  dnsbl.njabl.org!=127.0.0.3 : \
54973                  relays.ordb.org
54974 </literallayout>
54975 <para>
54976 Using only positive lists, this would have to be:
54977 </para>
54978 <literallayout class="monospaced">
54979 deny  dnslists = sbl.spamhaus.org : \
54980                  list.dsbl.org
54981 deny  dnslists = dnsbl.njabl.org
54982      !dnslists = dnsbl.njabl.org=127.0.0.3
54983 deny  dnslists = relays.ordb.org
54984 </literallayout>
54985 <para>
54986 which is less clear, and harder to maintain.
54987 </para>
54988 </section>
54989 <section id="SECThanmuldnsrec">
54990 <title>Handling multiple DNS records from a DNS list</title>
54991 <para>
54992 A DNS lookup for a <option>dnslists</option> condition may return more than one DNS record,
54993 thereby providing more than one IP address. When an item in a <option>dnslists</option> list
54994 is followed by <literal>=</literal> or <literal>&amp;</literal> and a list of IP addresses, in order to restrict
54995 the match to specific results from the DNS lookup, there are two ways in which
54996 the checking can be handled. For example, consider the condition:
54997 </para>
54998 <literallayout class="monospaced">
54999 dnslists = a.b.c=127.0.0.1
55000 </literallayout>
55001 <para>
55002 What happens if the DNS lookup for the incoming IP address yields both
55003 127.0.0.1 and 127.0.0.2 by means of two separate DNS records? Is the
55004 condition true because at least one given value was found, or is it false
55005 because at least one of the found values was not listed? And how does this
55006 affect negated conditions? Both possibilities are provided for with the help of
55007 additional separators <literal>==</literal> and <literal>=&amp;</literal>.
55008 </para>
55009 <itemizedlist>
55010 <listitem>
55011 <para>
55012 If <literal>=</literal> or <literal>&amp;</literal> is used, the condition is true if any one of the looked up
55013 IP addresses matches one of the listed addresses. For the example above, the
55014 condition is true because 127.0.0.1 matches.
55015 </para>
55016 </listitem>
55017 <listitem>
55018 <para>
55019 If <literal>==</literal> or <literal>=&amp;</literal> is used, the condition is true only if every one of the
55020 looked up IP addresses matches one of the listed addresses. If the condition is
55021 changed to:
55022 </para>
55023 <literallayout class="monospaced">
55024 dnslists = a.b.c==127.0.0.1
55025 </literallayout>
55026 <para>
55027 and the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
55028 false because 127.0.0.2 is not listed. You would need to have:
55029 </para>
55030 <literallayout class="monospaced">
55031 dnslists = a.b.c==127.0.0.1,127.0.0.2
55032 </literallayout>
55033 <para>
55034 for the condition to be true.
55035 </para>
55036 </listitem>
55037 </itemizedlist>
55038 <para>
55039 When <literal>!</literal> is used to negate IP address matching, it inverts the result, giving
55040 the precise opposite of the behaviour above. Thus:
55041 </para>
55042 <itemizedlist>
55043 <listitem>
55044 <para>
55045 If <literal>!=</literal> or <literal>!&amp;</literal> is used, the condition is true if none of the looked up IP
55046 addresses matches one of the listed addresses. Consider:
55047 </para>
55048 <literallayout class="monospaced">
55049 dnslists = a.b.c!&amp;0.0.0.1
55050 </literallayout>
55051 <para>
55052 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
55053 false because 127.0.0.1 matches.
55054 </para>
55055 </listitem>
55056 <listitem>
55057 <para>
55058 If <literal>!==</literal> or <literal>!=&amp;</literal> is used, the condition is true if there is at least one
55059 looked up IP address that does not match. Consider:
55060 </para>
55061 <literallayout class="monospaced">
55062 dnslists = a.b.c!=&amp;0.0.0.1
55063 </literallayout>
55064 <para>
55065 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
55066 true, because 127.0.0.2 does not match. You would need to have:
55067 </para>
55068 <literallayout class="monospaced">
55069 dnslists = a.b.c!=&amp;0.0.0.1,0.0.0.2
55070 </literallayout>
55071 <para>
55072 for the condition to be false.
55073 </para>
55074 </listitem>
55075 </itemizedlist>
55076 <para>
55077 When the DNS lookup yields only a single IP address, there is no difference
55078 between <literal>=</literal> and <literal>==</literal> and between <literal>&amp;</literal> and <literal>=&amp;</literal>.
55079 </para>
55080 </section>
55081 <section id="SECTmordetinf">
55082 <title>Detailed information from merged DNS lists</title>
55083 <para>
55084 <indexterm role="concept">
55085 <primary>DNS list</primary>
55086 <secondary>information from merged</secondary>
55087 </indexterm>
55088 When the facility for restricting the matching IP values in a DNS list is used,
55089 the text from the TXT record that is set in <varname>$dnslist_text</varname> may not reflect
55090 the true reason for rejection. This happens when lists are merged and the IP
55091 address in the A record is used to distinguish them; unfortunately there is
55092 only one TXT record. One way round this is not to use merged lists, but that
55093 can be inefficient because it requires multiple DNS lookups where one would do
55094 in the vast majority of cases when the host of interest is not on any of the
55095 lists.
55096 </para>
55097 <para>
55098 A less inefficient way of solving this problem is available. If
55099 two domain names, comma-separated, are given, the second is used first to
55100 do an initial check, making use of any IP value restrictions that are set.
55101 If there is a match, the first domain is used, without any IP value
55102 restrictions, to get the TXT record. As a byproduct of this, there is also
55103 a check that the IP being tested is indeed on the first list. The first
55104 domain is the one that is put in <varname>$dnslist_domain</varname>. For example:
55105 </para>
55106 <literallayout class="monospaced">
55107 reject message  = \
55108          rejected because $sender_host_address is blacklisted \
55109          at $dnslist_domain\n$dnslist_text
55110        dnslists = \
55111          sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \
55112          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
55113 </literallayout>
55114 <para>
55115 For the first blacklist item, this starts by doing a lookup in
55116 <emphasis>sbl-xbl.spamhaus.org</emphasis> and testing for a 127.0.0.2 return. If there is a
55117 match, it then looks in <emphasis>sbl.spamhaus.org</emphasis>, without checking the return
55118 value, and as long as something is found, it looks for the corresponding TXT
55119 record. If there is no match in <emphasis>sbl-xbl.spamhaus.org</emphasis>, nothing more is done.
55120 The second blacklist item is processed similarly.
55121 </para>
55122 <para>
55123 If you are interested in more than one merged list, the same list must be
55124 given several times, but because the results of the DNS lookups are cached,
55125 the DNS calls themselves are not repeated. For example:
55126 </para>
55127 <literallayout class="monospaced">
55128 reject dnslists = \
55129          http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \
55130          socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \
55131          misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \
55132          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
55133 </literallayout>
55134 <para>
55135 In this case there is one lookup in <emphasis>dnsbl.sorbs.net</emphasis>, and if none of the IP
55136 values matches (or if no record is found), this is the only lookup that is
55137 done. Only if there is a match is one of the more specific lists consulted.
55138 </para>
55139 </section>
55140 <section id="SECTmorednslistslast">
55141 <title>DNS lists and IPv6</title>
55142 <para>
55143 <indexterm role="concept">
55144 <primary>IPv6</primary>
55145 <secondary>DNS black lists</secondary>
55146 </indexterm>
55147 <indexterm role="concept">
55148 <primary>DNS list</primary>
55149 <secondary>IPv6 usage</secondary>
55150 </indexterm>
55151 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
55152 nibble by nibble. For example, if the calling host&#x2019;s IP address is
55153 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
55154 </para>
55155 <literallayout class="monospaced">
55156 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
55157   f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
55158 </literallayout>
55159 <para>
55160 (split over two lines here to fit on the page). Unfortunately, some of the DNS
55161 lists contain wildcard records, intended for IPv4, that interact badly with
55162 IPv6. For example, the DNS entry
55163 </para>
55164 <literallayout class="monospaced">
55165 *.3.some.list.example.    A    127.0.0.1
55166 </literallayout>
55167 <para>
55168 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
55169 Unfortunately, it also matches the entire 3::/4 IPv6 network.
55170 </para>
55171 <para>
55172 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
55173 <option>condition</option> condition, as in this example:
55174 </para>
55175 <literallayout class="monospaced">
55176 deny   condition = ${if isip4{$sender_host_address}}
55177        dnslists  = some.list.example
55178 </literallayout>
55179 <para>
55180 If an explicit key is being used for a DNS lookup and it may be an IPv6
55181 address you should specify alternate list separators for both the outer
55182 (DNS list name) list and inner (lookup keys) list:
55183 </para>
55184 <literallayout class="monospaced">
55185        dnslists = &lt;; dnsbl.example.com/&lt;|$acl_m_addrslist
55186 </literallayout>
55187 </section>
55188 <section id="SECTratelimiting">
55189 <title>Rate limiting incoming messages</title>
55190 <para>
55191 <indexterm role="concept">
55192 <primary>rate limiting</primary>
55193 <secondary>client sending</secondary>
55194 </indexterm>
55195 <indexterm role="concept">
55196 <primary>limiting client sending rates</primary>
55197 </indexterm>
55198 <indexterm role="option">
55199 <primary><option>smtp_ratelimit_*</option></primary>
55200 </indexterm>
55201 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
55202 which clients can send email. This is more powerful than the
55203 <option>smtp_ratelimit_*</option> options, because those options control the rate of
55204 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
55205 works across all connections (concurrent and sequential) from the same client
55206 host. The syntax of the <option>ratelimit</option> condition is:
55207 </para>
55208 <literallayout>
55209 <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;
55210 </literallayout>
55211 <para>
55212 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
55213 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
55214 </para>
55215 <para>
55216 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
55217 <varname>$sender_rate</varname> to the client&#x2019;s computed rate, <varname>$sender_rate_limit</varname> to the
55218 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
55219 of <emphasis>p</emphasis>.
55220 </para>
55221 <para>
55222 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
55223 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
55224 means that it takes Exim longer to forget a client&#x2019;s past behaviour. The
55225 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
55226 send in each time interval. It also specifies the number of messages permitted
55227 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
55228 constant, you can allow a client to send more messages in a burst without
55229 changing its long-term sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
55230 both small, messages must be sent at an even rate.
55231 </para>
55232 <para>
55233 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
55234 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
55235 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
55236 instructions when it is run with no arguments.
55237 </para>
55238 <para>
55239 The key is used to look up the data for calculating the client&#x2019;s average
55240 sending rate. This data is stored in Exim&#x2019;s spool directory, alongside the
55241 retry and other hints databases. The default key is <varname>$sender_host_address</varname>,
55242 which means Exim computes the sending rate of each client host IP address.
55243 By changing the key you can change how Exim identifies clients for the purpose
55244 of ratelimiting. For example, to limit the sending rate of each authenticated
55245 user, independent of the computer they are sending from, set the key to
55246 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
55247 example, <varname>$authenticated_id</varname> is only meaningful if the client has
55248 authenticated (which you can check with the <option>authenticated</option> ACL condition).
55249 </para>
55250 <para>
55251 The lookup key does not have to identify clients: If you want to limit the
55252 rate at which a recipient receives messages, you can use the key
55253 <literal>$local_part@$domain</literal> with the <option>per_rcpt</option> option (see below) in a RCPT
55254 ACL.
55255 </para>
55256 <para>
55257 Each <option>ratelimit</option> condition can have up to four options. A <option>per_*</option> option
55258 specifies what Exim measures the rate of, for example messages or recipients
55259 or bytes. You can adjust the measurement using the <option>unique=</option> and/or
55260 <option>count=</option> options. You can also control when Exim updates the recorded rate
55261 using a <option>strict</option>, <option>leaky</option>, or <option>readonly</option> option. The options are
55262 separated by a slash, like the other parameters. They may appear in any order.
55263 </para>
55264 <para>
55265 Internally, Exim appends the smoothing constant <emphasis>p</emphasis> onto the lookup key with
55266 any options that alter the meaning of the stored data. The limit <emphasis>m</emphasis> is not
55267 stored, so you can alter the configured maximum rate and Exim will still
55268 remember clients&#x2019; past behaviour. If you change the <option>per_*</option> mode or add or
55269 remove the <option>unique=</option> option, the lookup key changes so Exim will forget past
55270 behaviour. The lookup key is not affected by changes to the update mode and
55271 the <option>count=</option> option.
55272 </para>
55273 </section>
55274 <section id="ratoptmea">
55275 <title>Ratelimit options for what is being measured</title>
55276 <para>
55277 <indexterm role="concept">
55278 <primary>rate limiting</primary>
55279 <secondary>per_* options</secondary>
55280 </indexterm>
55281 The <option>per_conn</option> option limits the client&#x2019;s connection rate. It is not
55282 normally used in the <option>acl_not_smtp</option>, <option>acl_not_smtp_mime</option>, or
55283 <option>acl_not_smtp_start</option> ACLs.
55284 </para>
55285 <para>
55286 The <option>per_mail</option> option limits the client&#x2019;s rate of sending messages. This is
55287 the default if none of the <option>per_*</option> options is specified. It can be used in
55288 <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>, <option>acl_smtp_mime</option>,
55289 <option>acl_smtp_data</option>, or <option>acl_not_smtp</option>.
55290 </para>
55291 <para>
55292 The <option>per_byte</option> option limits the sender&#x2019;s email bandwidth. It can be used in
55293 the same ACLs as the <option>per_mail</option> option, though it is best to use this option
55294 in the <option>acl_smtp_mime</option>, <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs; if it is
55295 used in an earlier ACL, Exim relies on the SIZE parameter given by the client
55296 in its MAIL command, which may be inaccurate or completely missing. You can
55297 follow the limit <emphasis>m</emphasis> in the configuration with K, M, or G to specify limits
55298 in kilobytes, megabytes, or gigabytes, respectively.
55299 </para>
55300 <para>
55301 The <option>per_rcpt</option> option causes Exim to limit the rate at which recipients are
55302 accepted. It can be used in the <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
55303 <option>acl_smtp_mime</option>, <option>acl_smtp_data</option>, or <option>acl_smtp_rcpt</option> ACLs. In
55304 <option>acl_smtp_rcpt</option> the rate is updated one recipient at a time; in the other
55305 ACLs the rate is updated with the total recipient count in one go. Note that
55306 in either case the rate limiting engine will see a message with many
55307 recipients as a large high-speed burst.
55308 </para>
55309 <para>
55310 The <option>per_addr</option> option is like the <option>per_rcpt</option> option, except it counts the
55311 number of different recipients that the client has sent messages to in the
55312 last time period. That is, if the client repeatedly sends messages to the same
55313 recipient, its measured rate is not increased. This option can only be used in
55314 <option>acl_smtp_rcpt</option>.
55315 </para>
55316 <para>
55317 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
55318 condition is processed. This can be used to limit the rate of any SMTP
55319 command. If it is used in multiple ACLs it can limit the aggregate rate of
55320 multiple different commands.
55321 </para>
55322 <para>
55323 The <option>count=</option> option can be used to alter how much Exim adds to the client&#x2019;s
55324 measured rate. For example, the <option>per_byte</option> option is equivalent to
55325 <literal>per_mail/count=$message_size</literal>. If there is no <option>count=</option> option, Exim
55326 increases the measured rate by one (except for the <option>per_rcpt</option> option in ACLs
55327 other than <option>acl_smtp_rcpt</option>). The count does not have to be an integer.
55328 </para>
55329 <para>
55330 The <option>unique=</option> option is described in section <xref linkend="ratoptuniq"/> below.
55331 </para>
55332 </section>
55333 <section id="ratoptupd">
55334 <title>Ratelimit update modes</title>
55335 <para>
55336 <indexterm role="concept">
55337 <primary>rate limiting</primary>
55338 <secondary>reading data without updating</secondary>
55339 </indexterm>
55340 You can specify one of three options with the <option>ratelimit</option> condition to
55341 control when its database is updated. This section describes the <option>readonly</option>
55342 mode, and the next section describes the <option>strict</option> and <option>leaky</option> modes.
55343 </para>
55344 <para>
55345 If the <option>ratelimit</option> condition is used in <option>readonly</option> mode, Exim looks up a
55346 previously-computed rate to check against the limit.
55347 </para>
55348 <para>
55349 For example, you can test the client&#x2019;s sending rate and deny it access (when
55350 it is too fast) in the connect ACL. If the client passes this check then it
55351 can go on to send a message, in which case its recorded rate will be updated
55352 in the MAIL ACL. Subsequent connections from the same client will check this
55353 new rate.
55354 </para>
55355 <literallayout class="monospaced">
55356 acl_check_connect:
55357  deny ratelimit = 100 / 5m / readonly
55358     log_message = RATE CHECK: $sender_rate/$sender_rate_period \
55359                   (max $sender_rate_limit)
55360 # ...
55361 acl_check_mail:
55362  warn ratelimit = 100 / 5m / strict
55363     log_message = RATE UPDATE: $sender_rate/$sender_rate_period \
55364                   (max $sender_rate_limit)
55365 </literallayout>
55366 <para>
55367 If Exim encounters multiple <option>ratelimit</option> conditions with the same key when
55368 processing a message then it may increase the client&#x2019;s measured rate more than
55369 it should. For example, this will happen if you check the <option>per_rcpt</option> option
55370 in both <option>acl_smtp_rcpt</option> and <option>acl_smtp_data</option>. However it&#x2019;s OK to check the
55371 same <option>ratelimit</option> condition multiple times in the same ACL. You can avoid any
55372 multiple update problems by using the <option>readonly</option> option on later ratelimit
55373 checks.
55374 </para>
55375 <para>
55376 The <option>per_*</option> options described above do not make sense in some ACLs. If you
55377 use a <option>per_*</option> option in an ACL where it is not normally permitted then the
55378 update mode defaults to <option>readonly</option> and you cannot specify the <option>strict</option> or
55379 <option>leaky</option> modes. In other ACLs the default update mode is <option>leaky</option> (see the
55380 next section) so you must specify the <option>readonly</option> option explicitly.
55381 </para>
55382 </section>
55383 <section id="ratoptfast">
55384 <title>Ratelimit options for handling fast clients</title>
55385 <para>
55386 <indexterm role="concept">
55387 <primary>rate limiting</primary>
55388 <secondary>strict and leaky modes</secondary>
55389 </indexterm>
55390 If a client&#x2019;s average rate is greater than the maximum, the rate limiting
55391 engine can react in two possible ways, depending on the presence of the
55392 <option>strict</option> or <option>leaky</option> update modes. This is independent of the other
55393 counter-measures (such as rejecting the message) that may be specified by the
55394 rest of the ACL.
55395 </para>
55396 <para>
55397 The <option>leaky</option> (default) option means that the client&#x2019;s recorded rate is not
55398 updated if it is above the limit. The effect of this is that Exim measures the
55399 client&#x2019;s average rate of successfully sent email, which cannot be greater than
55400 the maximum allowed. If the client is over the limit it may suffer some
55401 counter-measures (as specified in the ACL), but it will still be able to send
55402 email at the configured maximum rate, whatever the rate of its attempts. This
55403 is generally the better choice if you have clients that retry automatically.
55404 For example, it does not prevent a sender with an over-aggressive retry rate
55405 from getting any email through.
55406 </para>
55407 <para>
55408 The <option>strict</option> option means that the client&#x2019;s recorded rate is always
55409 updated. The effect of this is that Exim measures the client&#x2019;s average rate
55410 of attempts to send email, which can be much higher than the maximum it is
55411 actually allowed. If the client is over the limit it may be subjected to
55412 counter-measures by the ACL. It must slow down and allow sufficient time to
55413 pass that its computed rate falls below the maximum before it can send email
55414 again. The time (the number of smoothing periods) it must wait and not
55415 attempt to send mail can be calculated with this formula:
55416 </para>
55417 <literallayout class="monospaced">
55418         ln(peakrate/maxrate)
55419 </literallayout>
55420 </section>
55421 <section id="ratoptuniq">
55422 <title>Limiting the rate of different events</title>
55423 <para>
55424 <indexterm role="concept">
55425 <primary>rate limiting</primary>
55426 <secondary>counting unique events</secondary>
55427 </indexterm>
55428 The <option>ratelimit</option> <option>unique=</option> option controls a mechanism for counting the
55429 rate of different events. For example, the <option>per_addr</option> option uses this
55430 mechanism to count the number of different recipients that the client has
55431 sent messages to in the last time period; it is equivalent to
55432 <literal>per_rcpt/unique=$local_part@$domain</literal>. You could use this feature to
55433 measure the rate that a client uses different sender addresses with the
55434 options <literal>per_mail/unique=$sender_address</literal>.
55435 </para>
55436 <para>
55437 For each <option>ratelimit</option> key Exim stores the set of <option>unique=</option> values that it
55438 has seen for that key. The whole set is thrown away when it is older than the
55439 rate smoothing period <emphasis>p</emphasis>, so each different event is counted at most once
55440 per period. In the <option>leaky</option> update mode, an event that causes the client to
55441 go over the limit is not added to the set, in the same way that the client&#x2019;s
55442 recorded rate is not updated in the same situation.
55443 </para>
55444 <para>
55445 When you combine the <option>unique=</option> and <option>readonly</option> options, the specific
55446 <option>unique=</option> value is ignored, and Exim just retrieves the client&#x2019;s stored
55447 rate.
55448 </para>
55449 <para>
55450 The <option>unique=</option> mechanism needs more space in the ratelimit database than the
55451 other <option>ratelimit</option> options in order to store the event set. The number of
55452 unique values is potentially as large as the rate limit, so the extra space
55453 required increases with larger limits.
55454 </para>
55455 <para>
55456 The uniqueification is not perfect: there is a small probability that Exim
55457 will think a new event has happened before. If the sender&#x2019;s rate is less than
55458 the limit, Exim should be more than 99.9% correct. However in <option>strict</option> mode
55459 the measured rate can go above the limit, in which case Exim may under-count
55460 events by a significant margin. Fortunately, if the rate is high enough (2.7
55461 times the limit) that the false positive rate goes above 9%, then Exim will
55462 throw away the over-full event set before the measured rate falls below the
55463 limit. Therefore the only harm should be that exceptionally high sending rates
55464 are logged incorrectly; any countermeasures you configure will be as effective
55465 as intended.
55466 </para>
55467 </section>
55468 <section id="useratlim">
55469 <title>Using rate limiting</title>
55470 <para>
55471 Exim&#x2019;s other ACL facilities are used to define what counter-measures are taken
55472 when the rate limit is exceeded. This might be anything from logging a warning
55473 (for example, while measuring existing sending rates in order to define
55474 policy), through time delays to slow down fast senders, up to rejecting the
55475 message. For example:
55476 </para>
55477 <literallayout class="monospaced">
55478 # Log all senders' rates
55479 warn ratelimit = 0 / 1h / strict
55480      log_message = Sender rate $sender_rate / $sender_rate_period
55481
55482 # Slow down fast senders; note the need to truncate $sender_rate
55483 # at the decimal point.
55484 warn ratelimit = 100 / 1h / per_rcpt / strict
55485      delay     = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
55486                    $sender_rate_limit }s
55487
55488 # Keep authenticated users under control
55489 deny authenticated = *
55490      ratelimit = 100 / 1d / strict / $authenticated_id
55491
55492 # System-wide rate limit
55493 defer message = Sorry, too busy. Try again later.
55494      ratelimit = 10 / 1s / $primary_hostname
55495
55496 # Restrict incoming rate from each host, with a default
55497 # set using a macro and special cases looked up in a table.
55498 defer message = Sender rate exceeds $sender_rate_limit \
55499                messages per $sender_rate_period
55500      ratelimit = ${lookup {$sender_host_address} \
55501                    cdb {DB/ratelimits.cdb} \
55502                    {$value} {RATELIMIT} }
55503 </literallayout>
55504 <para>
55505 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
55506 especially with the <option>per_rcpt</option> option, you may suffer from a performance
55507 bottleneck caused by locking on the ratelimit hints database. Apart from
55508 making your ACLs less complicated, you can reduce the problem by using a
55509 RAM disk for Exim&#x2019;s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
55510 this means that Exim will lose its hints data after a reboot (including retry
55511 hints, the callout cache, and ratelimit data).
55512 </para>
55513 </section>
55514 <section id="SECTaddressverification">
55515 <title>Address verification</title>
55516 <para>
55517 <indexterm role="concept">
55518 <primary>verifying address</primary>
55519 <secondary>options for</secondary>
55520 </indexterm>
55521 <indexterm role="concept">
55522 <primary>policy control</primary>
55523 <secondary>address verification</secondary>
55524 </indexterm>
55525 Several of the <option>verify</option> conditions described in section
55526 <xref linkend="SECTaclconditions"/> cause addresses to be verified. Section
55527 <xref linkend="SECTsenaddver"/> discusses the reporting of sender verification failures.
55528 The verification conditions can be followed by options that modify the
55529 verification process. The options are separated from the keyword and from each
55530 other by slashes, and some of them contain parameters. For example:
55531 </para>
55532 <literallayout class="monospaced">
55533 verify = sender/callout
55534 verify = recipient/defer_ok/callout=10s,defer_ok
55535 </literallayout>
55536 <para>
55537 The first stage of address verification, which always happens, is to run the
55538 address through the routers, in <quote>verify mode</quote>. Routers can detect the
55539 difference between verification and routing for delivery, and their actions can
55540 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
55541 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
55542 The available options are as follows:
55543 </para>
55544 <itemizedlist>
55545 <listitem>
55546 <para>
55547 If the <option>callout</option> option is specified, successful routing to one or more
55548 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
55549 check. Callouts and their sub-options are discussed in the next section.
55550 </para>
55551 </listitem>
55552 <listitem>
55553 <para>
55554 If there is a defer error while doing verification routing, the ACL
55555 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
55556 options, the condition is forced to be true instead. Note that this is a main
55557 verification option as well as a suboption for callouts.
55558 </para>
55559 </listitem>
55560 <listitem>
55561 <para>
55562 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
55563 discusses the reporting of sender address verification failures.
55564 </para>
55565 </listitem>
55566 <listitem>
55567 <para>
55568 The <option>success_on_redirect</option> option causes verification always to succeed
55569 immediately after a successful redirection. By default, if a redirection
55570 generates just one address, that address is also verified. See further
55571 discussion in section <xref linkend="SECTredirwhilveri"/>.
55572 </para>
55573 </listitem>
55574 </itemizedlist>
55575 <para>
55576 <indexterm role="concept">
55577 <primary>verifying address</primary>
55578 <secondary>differentiating failures</secondary>
55579 </indexterm>
55580 <indexterm role="variable">
55581 <primary><varname>$recipient_verify_failure</varname></primary>
55582 </indexterm>
55583 <indexterm role="variable">
55584 <primary><varname>$sender_verify_failure</varname></primary>
55585 </indexterm>
55586 <indexterm role="variable">
55587 <primary><varname>$acl_verify_message</varname></primary>
55588 </indexterm>
55589 After an address verification failure, <varname>$acl_verify_message</varname> contains the
55590 error message that is associated with the failure. It can be preserved by
55591 coding like this:
55592 </para>
55593 <literallayout class="monospaced">
55594 warn  !verify = sender
55595        set acl_m0 = $acl_verify_message
55596 </literallayout>
55597 <para>
55598 If you are writing your own custom rejection message or log message when
55599 denying access, you can use this variable to include information about the
55600 verification failure.
55601 </para>
55602 <para>
55603 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
55604 appropriate) contains one of the following words:
55605 </para>
55606 <itemizedlist>
55607 <listitem>
55608 <para>
55609 <option>qualify</option>: The address was unqualified (no domain), and the message
55610 was neither local nor came from an exempted host.
55611 </para>
55612 </listitem>
55613 <listitem>
55614 <para>
55615 <option>route</option>: Routing failed.
55616 </para>
55617 </listitem>
55618 <listitem>
55619 <para>
55620 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
55621 occurred at or before the MAIL command (that is, on initial
55622 connection, HELO, or MAIL).
55623 </para>
55624 </listitem>
55625 <listitem>
55626 <para>
55627 <option>recipient</option>: The RCPT command in a callout was rejected.
55628 </para>
55629 </listitem>
55630 <listitem>
55631 <para>
55632 <option>postmaster</option>: The postmaster check in a callout was rejected.
55633 </para>
55634 </listitem>
55635 </itemizedlist>
55636 <para>
55637 The main use of these variables is expected to be to distinguish between
55638 rejections of MAIL and rejections of RCPT in callouts.
55639 </para>
55640 </section>
55641 <section id="SECTcallver">
55642 <title>Callout verification</title>
55643 <para>
55644 <indexterm role="concept">
55645 <primary>verifying address</primary>
55646 <secondary>by callout</secondary>
55647 </indexterm>
55648 <indexterm role="concept">
55649 <primary>callout</primary>
55650 <secondary>verification</secondary>
55651 </indexterm>
55652 <indexterm role="concept">
55653 <primary>SMTP</primary>
55654 <secondary>callout verification</secondary>
55655 </indexterm>
55656 For non-local addresses, routing verifies the domain, but is unable to do any
55657 checking of the local part. There are situations where some means of verifying
55658 the local part is desirable. One way this can be done is to make an SMTP
55659 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
55660 a subsequent host for a recipient address, to see if the host accepts the
55661 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
55662 sender address, the callback is not to the client host that is trying to
55663 deliver the message, but to one of the hosts that accepts incoming mail for the
55664 sender&#x2019;s domain.
55665 </para>
55666 <para>
55667 Exim does not do callouts by default. If you want them to happen, you must
55668 request them by setting appropriate options on the <option>verify</option> condition, as
55669 described below. This facility should be used with care, because it can add a
55670 lot of resource usage to the cost of verifying an address. However, Exim does
55671 cache the results of callouts, which helps to reduce the cost. Details of
55672 caching are in section <xref linkend="SECTcallvercache"/>.
55673 </para>
55674 <para>
55675 Recipient callouts are usually used only between hosts that are controlled by
55676 the same administration. For example, a corporate gateway host could use
55677 callouts to check for valid recipients on an internal mailserver. A successful
55678 callout does not guarantee that a real delivery to the address would succeed;
55679 on the other hand, a failing callout does guarantee that a delivery would fail.
55680 </para>
55681 <para>
55682 If the <option>callout</option> option is present on a condition that verifies an address, a
55683 second stage of verification occurs if the address is successfully routed to
55684 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
55685 <command>manualroute</command> router, where the router specifies the hosts. However, if a
55686 router that does not set up hosts routes to an <command>smtp</command> transport with a
55687 <option>hosts</option> setting, the transport&#x2019;s hosts are used. If an <command>smtp</command> transport has
55688 <option>hosts_override</option> set, its hosts are always used, whether or not the router
55689 supplies a host list.
55690 Callouts are only supported on <command>smtp</command> transports.
55691 </para>
55692 <para>
55693 The port that is used is taken from the transport, if it is specified and is a
55694 remote transport. (For routers that do verification only, no transport need be
55695 specified.) Otherwise, the default SMTP port is used. If a remote transport
55696 specifies an outgoing interface, this is used; otherwise the interface is not
55697 specified. Likewise, the text that is used for the HELO command is taken from
55698 the transport&#x2019;s <option>helo_data</option> option; if there is no transport, the value of
55699 <varname>$smtp_active_hostname</varname> is used.
55700 </para>
55701 <para>
55702 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
55703 test whether a bounce message could be delivered to the sender address. The
55704 following SMTP commands are sent:
55705 </para>
55706 <literallayout>
55707 <literal>HELO </literal>&lt;<emphasis>local host name</emphasis>&gt;
55708 <literal>MAIL FROM:&lt;&gt;</literal>
55709 <literal>RCPT TO:</literal>&lt;<emphasis>the address to be tested</emphasis>&gt;
55710 <literal>QUIT</literal>
55711 </literallayout>
55712 <para>
55713 LHLO is used instead of HELO if the transport&#x2019;s <option>protocol</option> option is
55714 set to <quote>lmtp</quote>.
55715 </para>
55716 <para>
55717 The callout may use EHLO, AUTH and/or STARTTLS given appropriate option
55718 settings.
55719 </para>
55720 <para>
55721 A recipient callout check is similar. By default, it also uses an empty address
55722 for the sender. This default is chosen because most hosts do not make use of
55723 the sender address when verifying a recipient. Using the same address means
55724 that a single cache entry can be used for each recipient. Some sites, however,
55725 do make use of the sender address when verifying. These are catered for by the
55726 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
55727 </para>
55728 <para>
55729 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
55730 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
55731 Exim tries the next host, if any. If there is a problem with all the remote
55732 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
55733 <option>callout</option> option is given, in which case the condition is forced to succeed.
55734 </para>
55735 <para>
55736 <indexterm role="concept">
55737 <primary>SMTP</primary>
55738 <secondary>output flushing, disabling for callout</secondary>
55739 </indexterm>
55740 A callout may take a little time. For this reason, Exim normally flushes SMTP
55741 output before performing a callout in an ACL, to avoid unexpected timeouts in
55742 clients when the SMTP PIPELINING extension is in use. The flushing can be
55743 disabled by using a <option>control</option> modifier to set <option>no_callout_flush</option>.
55744 </para>
55745 </section>
55746 <section id="CALLaddparcall">
55747 <title>Additional parameters for callouts</title>
55748 <para>
55749 <indexterm role="concept">
55750 <primary>callout</primary>
55751 <secondary>additional parameters for</secondary>
55752 </indexterm>
55753 The <option>callout</option> option can be followed by an equals sign and a number of
55754 optional parameters, separated by commas. For example:
55755 </para>
55756 <literallayout class="monospaced">
55757 verify = recipient/callout=10s,defer_ok
55758 </literallayout>
55759 <para>
55760 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
55761 separate verify options, is retained for backwards compatibility, but is now
55762 deprecated. The additional parameters for <option>callout</option> are as follows:
55763 </para>
55764 <variablelist>
55765 <varlistentry>
55766 <term>&lt;<emphasis>a&nbsp;time&nbsp;interval</emphasis>&gt;</term>
55767 <listitem>
55768 <para>
55769 <indexterm role="concept">
55770 <primary>callout</primary>
55771 <secondary>timeout, specifying</secondary>
55772 </indexterm>
55773 This specifies the timeout that applies for the callout attempt to each host.
55774 For example:
55775 </para>
55776 <literallayout class="monospaced">
55777 verify = sender/callout=5s
55778 </literallayout>
55779 <para>
55780 The default is 30 seconds. The timeout is used for each response from the
55781 remote host. It is also used for the initial connection, unless overridden by
55782 the <option>connect</option> parameter.
55783 </para>
55784 </listitem></varlistentry>
55785 <varlistentry>
55786 <term><emphasis role="bold">connect&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
55787 <listitem>
55788 <para>
55789 <indexterm role="concept">
55790 <primary>callout</primary>
55791 <secondary>connection timeout, specifying</secondary>
55792 </indexterm>
55793 This parameter makes it possible to set a different (usually smaller) timeout
55794 for making the SMTP connection. For example:
55795 </para>
55796 <literallayout class="monospaced">
55797 verify = sender/callout=5s,connect=1s
55798 </literallayout>
55799 <para>
55800 If not specified, this timeout defaults to the general timeout value.
55801 </para>
55802 </listitem></varlistentry>
55803 <varlistentry>
55804 <term><emphasis role="bold">defer_ok</emphasis></term>
55805 <listitem>
55806 <para>
55807 <indexterm role="concept">
55808 <primary>callout</primary>
55809 <secondary>defer, action on</secondary>
55810 </indexterm>
55811 When this parameter is present, failure to contact any host, or any other kind
55812 of temporary error, is treated as success by the ACL. However, the cache is not
55813 updated in this circumstance.
55814 </para>
55815 </listitem></varlistentry>
55816 <varlistentry>
55817 <term><emphasis role="bold">fullpostmaster</emphasis></term>
55818 <listitem>
55819 <para>
55820 <indexterm role="concept">
55821 <primary>callout</primary>
55822 <secondary>full postmaster check</secondary>
55823 </indexterm>
55824 This operates like the <option>postmaster</option> option (see below), but if the check for
55825 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
55826 accordance with the specification in RFC 2821. The RFC states that the
55827 unqualified address <emphasis>postmaster</emphasis> should be accepted.
55828 </para>
55829 </listitem></varlistentry>
55830 <varlistentry>
55831 <term><emphasis role="bold">mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
55832 <listitem>
55833 <para>
55834 <indexterm role="concept">
55835 <primary>callout</primary>
55836 <secondary>sender when verifying header</secondary>
55837 </indexterm>
55838 When verifying addresses in header lines using the <option>header_sender</option>
55839 verification option, Exim behaves by default as if the addresses are envelope
55840 sender addresses from a message. Callout verification therefore tests to see
55841 whether a bounce message could be delivered, by using an empty address in the
55842 MAIL command. However, it is arguable that these addresses might never be used
55843 as envelope senders, and could therefore justifiably reject bounce messages
55844 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
55845 address to use in the MAIL command. For example:
55846 </para>
55847 <literallayout class="monospaced">
55848 require  verify = header_sender/callout=mailfrom=abcd@x.y.z
55849 </literallayout>
55850 <para>
55851 This parameter is available only for the <option>header_sender</option> verification option.
55852 </para>
55853 </listitem></varlistentry>
55854 <varlistentry>
55855 <term><emphasis role="bold">maxwait&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
55856 <listitem>
55857 <para>
55858 <indexterm role="concept">
55859 <primary>callout</primary>
55860 <secondary>overall timeout, specifying</secondary>
55861 </indexterm>
55862 This parameter sets an overall timeout for performing a callout verification.
55863 For example:
55864 </para>
55865 <literallayout class="monospaced">
55866 verify = sender/callout=5s,maxwait=30s
55867 </literallayout>
55868 <para>
55869 This timeout defaults to four times the callout timeout for individual SMTP
55870 commands. The overall timeout applies when there is more than one host that can
55871 be tried. The timeout is checked before trying the next host. This prevents
55872 very long delays if there are a large number of hosts and all are timing out
55873 (for example, when network connections are timing out).
55874 </para>
55875 </listitem></varlistentry>
55876 <varlistentry>
55877 <term><emphasis role="bold">no_cache</emphasis></term>
55878 <listitem>
55879 <para>
55880 <indexterm role="concept">
55881 <primary>callout</primary>
55882 <secondary>cache, suppressing</secondary>
55883 </indexterm>
55884 <indexterm role="concept">
55885 <primary>caching callout, suppressing</primary>
55886 </indexterm>
55887 When this parameter is given, the callout cache is neither read nor updated.
55888 </para>
55889 </listitem></varlistentry>
55890 <varlistentry>
55891 <term><emphasis role="bold">postmaster</emphasis></term>
55892 <listitem>
55893 <para>
55894 <indexterm role="concept">
55895 <primary>callout</primary>
55896 <secondary>postmaster; checking</secondary>
55897 </indexterm>
55898 When this parameter is set, a successful callout check is followed by a similar
55899 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
55900 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
55901 the postmaster check is recorded in a cache record; if it is a failure, this is
55902 used to fail subsequent callouts for the domain without a connection being
55903 made, until the cache record expires.
55904 </para>
55905 </listitem></varlistentry>
55906 <varlistentry>
55907 <term><emphasis role="bold">postmaster_mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
55908 <listitem>
55909 <para>
55910 The postmaster check uses an empty sender in the MAIL command by default.
55911 You can use this parameter to do a postmaster check using a different address.
55912 For example:
55913 </para>
55914 <literallayout class="monospaced">
55915 require  verify = sender/callout=postmaster_mailfrom=abc@x.y.z
55916 </literallayout>
55917 <para>
55918 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
55919 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
55920 </para>
55921 <literallayout class="monospaced">
55922 require  verify = sender/callout=postmaster_mailfrom=
55923 </literallayout>
55924 <para>
55925 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
55926 account of the sender address. It is assumed that either the empty address or
55927 a fixed non-empty address will be used. All that Exim remembers is that the
55928 postmaster check for the domain succeeded or failed.
55929 </para>
55930 </listitem></varlistentry>
55931 <varlistentry>
55932 <term><emphasis role="bold">random</emphasis></term>
55933 <listitem>
55934 <para>
55935 <indexterm role="concept">
55936 <primary>callout</primary>
55937 <secondary><quote>random</quote> check</secondary>
55938 </indexterm>
55939 When this parameter is set, before doing the normal callout check, Exim does a
55940 check for a <quote>random</quote> local part at the same domain. The local part is not
55941 really random &ndash; it is defined by the expansion of the option
55942 <option>callout_random_local_part</option>, which defaults to
55943 </para>
55944 <literallayout class="monospaced">
55945 $primary_hostname-$tod_epoch-testing
55946 </literallayout>
55947 <para>
55948 The idea here is to try to determine whether the remote host accepts all local
55949 parts without checking. If it does, there is no point in doing callouts for
55950 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
55951 a cache record, and used to force the current and subsequent callout checks to
55952 succeed without a connection being made, until the cache record expires.
55953 </para>
55954 </listitem></varlistentry>
55955 <varlistentry>
55956 <term><emphasis role="bold">use_postmaster</emphasis></term>
55957 <listitem>
55958 <para>
55959 <indexterm role="concept">
55960 <primary>callout</primary>
55961 <secondary>sender for recipient check</secondary>
55962 </indexterm>
55963 This parameter applies to recipient callouts only. For example:
55964 </para>
55965 <literallayout class="monospaced">
55966 deny  !verify = recipient/callout=use_postmaster
55967 </literallayout>
55968 <para>
55969 <indexterm role="variable">
55970 <primary><varname>$qualify_domain</varname></primary>
55971 </indexterm>
55972 It causes a non-empty postmaster address to be used in the MAIL command when
55973 performing the callout for the recipient, and also for a <quote>random</quote> check if
55974 that is configured. The local part of the address is <literal>postmaster</literal> and the
55975 domain is the contents of <varname>$qualify_domain</varname>.
55976 </para>
55977 </listitem></varlistentry>
55978 <varlistentry>
55979 <term><emphasis role="bold">use_sender</emphasis></term>
55980 <listitem>
55981 <para>
55982 This option applies to recipient callouts only. For example:
55983 </para>
55984 <literallayout class="monospaced">
55985 require  verify = recipient/callout=use_sender
55986 </literallayout>
55987 <para>
55988 It causes the message&#x2019;s actual sender address to be used in the MAIL
55989 command when performing the callout, instead of an empty address. There is no
55990 need to use this option unless you know that the called hosts make use of the
55991 sender when checking recipients. If used indiscriminately, it reduces the
55992 usefulness of callout caching.
55993 </para>
55994 </listitem></varlistentry>
55995 </variablelist>
55996 <para>
55997 If you use any of the parameters that set a non-empty sender for the MAIL
55998 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
55999 <option>use_sender</option>), you should think about possible loops. Recipient checking is
56000 usually done between two hosts that are under the same management, and the host
56001 that receives the callouts is not normally configured to do callouts itself.
56002 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
56003 these circumstances.
56004 </para>
56005 <para>
56006 However, if you use a non-empty sender address for a callout to an arbitrary
56007 host, there is the likelihood that the remote host will itself initiate a
56008 callout check back to your host. As it is checking what appears to be a message
56009 sender, it is likely to use an empty address in MAIL, thus avoiding a
56010 callout loop. However, to be on the safe side it would be best to set up your
56011 own ACLs so that they do not do sender verification checks when the recipient
56012 is the address you use for header sender or postmaster callout checking.
56013 </para>
56014 <para>
56015 Another issue to think about when using non-empty senders for callouts is
56016 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
56017 by the sender/recipient combination; thus, for any given recipient, many more
56018 actual callouts are performed than when an empty sender or postmaster is used.
56019 </para>
56020 </section>
56021 <section id="SECTcallvercache">
56022 <title>Callout caching</title>
56023 <para>
56024 <indexterm role="concept">
56025 <primary>hints database</primary>
56026 <secondary>callout cache</secondary>
56027 </indexterm>
56028 <indexterm role="concept">
56029 <primary>callout</primary>
56030 <secondary>cache, description of</secondary>
56031 </indexterm>
56032 <indexterm role="concept">
56033 <primary>caching</primary>
56034 <secondary>callout</secondary>
56035 </indexterm>
56036 Exim caches the results of callouts in order to reduce the amount of resources
56037 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
56038 option. A hints database called <quote>callout</quote> is used for the cache. Two
56039 different record types are used: one records the result of a callout check for
56040 a specific address, and the other records information that applies to the
56041 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
56042 </para>
56043 <para>
56044 When an original callout fails, a detailed SMTP error message is given about
56045 the failure. However, for subsequent failures use the cache data, this message
56046 is not available.
56047 </para>
56048 <para>
56049 The expiry times for negative and positive address cache records are
56050 independent, and can be set by the global options <option>callout_negative_expire</option>
56051 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
56052 </para>
56053 <para>
56054 If a host gives a negative response to an SMTP connection, or rejects any
56055 commands up to and including
56056 </para>
56057 <literallayout class="monospaced">
56058 MAIL FROM:&lt;&gt;
56059 </literallayout>
56060 <para>
56061 (but not including the MAIL command with a non-empty address),
56062 any callout attempt is bound to fail. Exim remembers such failures in a
56063 domain cache record, which it uses to fail callouts for the domain without
56064 making new connections, until the domain record times out. There are two
56065 separate expiry times for domain cache records:
56066 <option>callout_domain_negative_expire</option> (default 3h) and
56067 <option>callout_domain_positive_expire</option> (default 7d).
56068 </para>
56069 <para>
56070 Domain records expire when the negative expiry time is reached if callouts
56071 cannot be made for the domain, or if the postmaster check failed.
56072 Otherwise, they expire when the positive expiry time is reached. This
56073 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
56074 will eventually be noticed.
56075 </para>
56076 <para>
56077 The callout caching mechanism is based on the domain of the address that is
56078 being tested. If the domain routes to several hosts, it is assumed that their
56079 behaviour will be the same.
56080 </para>
56081 </section>
56082 <section id="SECTsenaddver">
56083 <title>Sender address verification reporting</title>
56084 <para>
56085 <indexterm role="concept">
56086 <primary>verifying</primary>
56087 <secondary>suppressing error details</secondary>
56088 </indexterm>
56089 See section <xref linkend="SECTaddressverification"/> for a general discussion of
56090 verification. When sender verification fails in an ACL, the details of the
56091 failure are given as additional output lines before the 550 response to the
56092 relevant SMTP command (RCPT or DATA). For example, if sender callout is in use,
56093 you might see:
56094 </para>
56095 <literallayout class="monospaced">
56096 MAIL FROM:&lt;xyz@abc.example&gt;
56097 250 OK
56098 RCPT TO:&lt;pqr@def.example&gt;
56099 550-Verification failed for &lt;xyz@abc.example&gt;
56100 550-Called:   192.168.34.43
56101 550-Sent:     RCPT TO:&lt;xyz@abc.example&gt;
56102 550-Response: 550 Unknown local part xyz in &lt;xyz@abc.example&gt;
56103 550 Sender verification failed
56104 </literallayout>
56105 <para>
56106 If more than one RCPT command fails in the same way, the details are given
56107 only for the first of them. However, some administrators do not want to send
56108 out this much information. You can suppress the details by adding
56109 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
56110 example:
56111 </para>
56112 <literallayout class="monospaced">
56113 verify = sender/no_details
56114 </literallayout>
56115 </section>
56116 <section id="SECTredirwhilveri">
56117 <title>Redirection while verifying</title>
56118 <para>
56119 <indexterm role="concept">
56120 <primary>verifying</primary>
56121 <secondary>redirection while</secondary>
56122 </indexterm>
56123 <indexterm role="concept">
56124 <primary>address redirection</primary>
56125 <secondary>while verifying</secondary>
56126 </indexterm>
56127 A dilemma arises when a local address is redirected by aliasing or forwarding
56128 during verification: should the generated addresses themselves be verified,
56129 or should the successful expansion of the original address be enough to verify
56130 it? By default, Exim takes the following pragmatic approach:
56131 </para>
56132 <itemizedlist>
56133 <listitem>
56134 <para>
56135 When an incoming address is redirected to just one child address, verification
56136 continues with the child address, and if that fails to verify, the original
56137 verification also fails.
56138 </para>
56139 </listitem>
56140 <listitem>
56141 <para>
56142 When an incoming address is redirected to more than one child address,
56143 verification does not continue. A success result is returned.
56144 </para>
56145 </listitem>
56146 </itemizedlist>
56147 <para>
56148 This seems the most reasonable behaviour for the common use of aliasing as a
56149 way of redirecting different local parts to the same mailbox. It means, for
56150 example, that a pair of alias entries of the form
56151 </para>
56152 <literallayout class="monospaced">
56153 A.Wol:   aw123
56154 aw123:   :fail: Gone away, no forwarding address
56155 </literallayout>
56156 <para>
56157 work as expected, with both local parts causing verification failure. When a
56158 redirection generates more than one address, the behaviour is more like a
56159 mailing list, where the existence of the alias itself is sufficient for
56160 verification to succeed.
56161 </para>
56162 <para>
56163 It is possible, however, to change the default behaviour so that all successful
56164 redirections count as successful verifications, however many new addresses are
56165 generated. This is specified by the <option>success_on_redirect</option> verification
56166 option. For example:
56167 </para>
56168 <literallayout class="monospaced">
56169 require verify = recipient/success_on_redirect/callout=10s
56170 </literallayout>
56171 <para>
56172 In this example, verification succeeds if a router generates a new address, and
56173 the callout does not occur, because no address was routed to a remote host.
56174 </para>
56175 <para>
56176 When verification is being tested via the <option>-bv</option> option, the treatment of
56177 redirections is as just described, unless the <option>-v</option> or any debugging option is
56178 also specified. In that case, full verification is done for every generated
56179 address and a report is output for each of them.
56180 </para>
56181 </section>
56182 <section id="SECTverifyCSA">
56183 <title>Client SMTP authorization (CSA)</title>
56184 <para>
56185 <indexterm role="concept">
56186 <primary>CSA</primary>
56187 <secondary>verifying</secondary>
56188 </indexterm>
56189 Client SMTP Authorization is a system that allows a site to advertise
56190 which machines are and are not permitted to send email. This is done by placing
56191 special SRV records in the DNS; these are looked up using the client&#x2019;s HELO
56192 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
56193 Authorization checks in Exim are performed by the ACL condition:
56194 </para>
56195 <literallayout class="monospaced">
56196 verify = csa
56197 </literallayout>
56198 <para>
56199 This fails if the client is not authorized. If there is a DNS problem, or if no
56200 valid CSA SRV record is found, or if the client is authorized, the condition
56201 succeeds. These three cases can be distinguished using the expansion variable
56202 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
56203 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
56204 be likely to cause problems for legitimate email.
56205 </para>
56206 <para>
56207 The error messages produced by the CSA code include slightly more
56208 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
56209 looking up the CSA SRV record, or problems looking up the CSA target
56210 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
56211 </para>
56212 <itemizedlist>
56213 <listitem>
56214 <para>
56215 The client&#x2019;s host name is explicitly not authorized.
56216 </para>
56217 </listitem>
56218 <listitem>
56219 <para>
56220 The client&#x2019;s IP address does not match any of the CSA target IP addresses.
56221 </para>
56222 </listitem>
56223 <listitem>
56224 <para>
56225 The client&#x2019;s host name is authorized but it has no valid target IP addresses
56226 (for example, the target&#x2019;s addresses are IPv6 and the client is using IPv4).
56227 </para>
56228 </listitem>
56229 <listitem>
56230 <para>
56231 The client&#x2019;s host name has no CSA SRV record but a parent domain has asserted
56232 that all subdomains must be explicitly authorized.
56233 </para>
56234 </listitem>
56235 </itemizedlist>
56236 <para>
56237 The <option>csa</option> verification condition can take an argument which is the domain to
56238 use for the DNS query. The default is:
56239 </para>
56240 <literallayout class="monospaced">
56241 verify = csa/$sender_helo_name
56242 </literallayout>
56243 <para>
56244 This implementation includes an extension to CSA. If the query domain
56245 is an address literal such as [192.0.2.95], or if it is a bare IP
56246 address, Exim searches for CSA SRV records in the reverse DNS as if
56247 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
56248 meaningful to say:
56249 </para>
56250 <literallayout class="monospaced">
56251 verify = csa/$sender_host_address
56252 </literallayout>
56253 <para>
56254 In fact, this is the check that Exim performs if the client does not say HELO.
56255 This extension can be turned off by setting the main configuration option
56256 <option>dns_csa_use_reverse</option> to be false.
56257 </para>
56258 <para>
56259 If a CSA SRV record is not found for the domain itself, a search
56260 is performed through its parent domains for a record which might be
56261 making assertions about subdomains. The maximum depth of this search is limited
56262 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
56263 default. Exim does not look for CSA SRV records in a top level domain, so the
56264 default settings handle HELO domains as long as seven
56265 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
56266 of legitimate HELO domains.
56267 </para>
56268 <para>
56269 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
56270 direct SRV lookups, this is not sufficient because of the extra parent domain
56271 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
56272 addresses into lookups in the reverse DNS space. The result of a successful
56273 lookup such as:
56274 </para>
56275 <literallayout class="monospaced">
56276 ${lookup dnsdb {csa=$sender_helo_name}}
56277 </literallayout>
56278 <para>
56279 has two space-separated fields: an authorization code and a target host name.
56280 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
56281 authorization required but absent, or <quote>?</quote> for unknown.
56282 </para>
56283 </section>
56284 <section id="SECTverifyPRVS">
56285 <title>Bounce address tag validation</title>
56286 <para>
56287 <indexterm role="concept">
56288 <primary>BATV, verifying</primary>
56289 </indexterm>
56290 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
56291 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
56292 Genuine incoming bounce messages should therefore always be addressed to
56293 recipients that have a valid tag. This scheme is a way of detecting unwanted
56294 bounce messages caused by sender address forgeries (often called <quote>collateral
56295 spam</quote>), because the recipients of such messages do not include valid tags.
56296 </para>
56297 <para>
56298 There are two expansion items to help with the implementation of the BATV
56299 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
56300 the original envelope sender address by using a simple key to add a hash of the
56301 address and some time-based randomizing information. The <option>prvs</option> expansion
56302 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
56303 The syntax of these expansion items is described in section
56304 <xref linkend="SECTexpansionitems"/>.
56305 </para>
56306 <para>
56307 As an example, suppose the secret per-address keys are stored in an MySQL
56308 database. A query to look up the key for an address could be defined as a macro
56309 like this:
56310 </para>
56311 <literallayout class="monospaced">
56312 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
56313                 WHERE sender='${quote_mysql:$prvscheck_address}'\
56314                 }{$value}}
56315 </literallayout>
56316 <para>
56317 Suppose also that the senders who make use of BATV are defined by an address
56318 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
56319 use this:
56320 </para>
56321 <literallayout class="monospaced">
56322 # Bounces: drop unsigned addresses for BATV senders
56323 deny message = This address does not send an unsigned reverse path
56324      senders = :
56325      recipients = +batv_senders
56326
56327 # Bounces: In case of prvs-signed address, check signature.
56328 deny message = Invalid reverse path signature.
56329      senders = :
56330      condition  = ${prvscheck {$local_part@$domain}\
56331                   {PRVSCHECK_SQL}{1}}
56332      !condition = $prvscheck_result
56333 </literallayout>
56334 <para>
56335 The first statement rejects recipients for bounce messages that are addressed
56336 to plain BATV sender addresses, because it is known that BATV senders do not
56337 send out messages with plain sender addresses. The second statement rejects
56338 recipients that are prvs-signed, but with invalid signatures (either because
56339 the key is wrong, or the signature has timed out).
56340 </para>
56341 <para>
56342 A non-prvs-signed address is not rejected by the second statement, because the
56343 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
56344 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
56345 the first argument is a syntactically valid prvs-signed address, the yield is
56346 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
56347 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
56348 of the checks (empty for failure, <quote>1</quote> for success).
56349 </para>
56350 <para>
56351 There is one more issue you must consider when implementing prvs-signing:
56352 you have to ensure that the routers accept prvs-signed addresses and
56353 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
56354 router to remove the signature with a configuration along these lines:
56355 </para>
56356 <literallayout class="monospaced">
56357 batv_redirect:
56358   driver = redirect
56359   data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
56360 </literallayout>
56361 <para>
56362 This works because, if the third argument of <option>prvscheck</option> is empty, the result
56363 of the expansion of a prvs-signed address is the decoded value of the original
56364 address. This router should probably be the first of your routers that handles
56365 local addresses.
56366 </para>
56367 <para>
56368 To create BATV-signed addresses in the first place, a transport of this form
56369 can be used:
56370 </para>
56371 <literallayout class="monospaced">
56372 external_smtp_batv:
56373   driver = smtp
56374   return_path = ${prvs {$return_path} \
56375                        {${lookup mysql{SELECT \
56376                        secret FROM batv_prvs WHERE \
56377                        sender='${quote_mysql:$sender_address}'} \
56378                        {$value}fail}}}
56379 </literallayout>
56380 <para>
56381 If no key can be found for the existing return path, no signing takes place.
56382 </para>
56383 </section>
56384 <section id="SECTrelaycontrol">
56385 <title>Using an ACL to control relaying</title>
56386 <para>
56387 <indexterm role="concept">
56388 <primary>access control lists (ACLs)</primary>
56389 <secondary>relay control</secondary>
56390 </indexterm>
56391 <indexterm role="concept">
56392 <primary>relaying</primary>
56393 <secondary>control by ACL</secondary>
56394 </indexterm>
56395 <indexterm role="concept">
56396 <primary>policy control</primary>
56397 <secondary>relay control</secondary>
56398 </indexterm>
56399 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
56400 delivers it directly to another host as a result of a remote address contained
56401 within it. Redirecting a local address via an alias or forward file and then
56402 passing the message on to another host is not relaying,
56403 <indexterm role="concept">
56404 <primary><quote>percent hack</quote></primary>
56405 </indexterm>
56406 but a redirection as a result of the <quote>percent hack</quote> is.
56407 </para>
56408 <para>
56409 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
56410 A host which is acting as a gateway or an MX backup is concerned with incoming
56411 relaying from arbitrary hosts to a specific set of domains. On the other hand,
56412 a host which is acting as a smart host for a number of clients is concerned
56413 with outgoing relaying from those clients to the Internet at large. Often the
56414 same host is fulfilling both functions,
56415 but in principle these two kinds of relaying are entirely independent. What is
56416 not wanted is the transmission of mail from arbitrary remote hosts through your
56417 system to arbitrary domains.
56418 </para>
56419 <para>
56420 You can implement relay control by means of suitable statements in the ACL that
56421 runs for each RCPT command. For convenience, it is often easiest to use
56422 Exim&#x2019;s named list facility to define the domains and hosts involved. For
56423 example, suppose you want to do the following:
56424 </para>
56425 <itemizedlist>
56426 <listitem>
56427 <para>
56428 Deliver a number of domains to mailboxes on the local host (or process them
56429 locally in some other way). Let&#x2019;s say these are <emphasis>my.dom1.example</emphasis> and
56430 <emphasis>my.dom2.example</emphasis>.
56431 </para>
56432 </listitem>
56433 <listitem>
56434 <para>
56435 Relay mail for a number of other domains for which you are the secondary MX.
56436 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
56437 </para>
56438 </listitem>
56439 <listitem>
56440 <para>
56441 Relay mail from the hosts on your local LAN, to whatever domains are involved.
56442 Suppose your LAN is 192.168.45.0/24.
56443 </para>
56444 </listitem>
56445 </itemizedlist>
56446 <para>
56447 In the main part of the configuration, you put the following definitions:
56448 </para>
56449 <literallayout class="monospaced">
56450 domainlist local_domains    = my.dom1.example : my.dom2.example
56451 domainlist relay_to_domains = friend1.example : friend2.example
56452 hostlist   relay_from_hosts = 192.168.45.0/24
56453 </literallayout>
56454 <para>
56455 Now you can use these definitions in the ACL that is run for every RCPT
56456 command:
56457 </para>
56458 <literallayout class="monospaced">
56459 acl_check_rcpt:
56460   accept domains = +local_domains : +relay_to_domains
56461   accept hosts   = +relay_from_hosts
56462 </literallayout>
56463 <para>
56464 The first statement accepts any RCPT command that contains an address in
56465 the local or relay domains. For any other domain, control passes to the second
56466 statement, which accepts the command only if it comes from one of the relay
56467 hosts. In practice, you will probably want to make your ACL more sophisticated
56468 than this, for example, by including sender and recipient verification. The
56469 default configuration includes a more comprehensive example, which is described
56470 in chapter <xref linkend="CHAPdefconfil"/>.
56471 </para>
56472 </section>
56473 <section id="SECTcheralcon">
56474 <title>Checking a relay configuration</title>
56475 <para>
56476 <indexterm role="concept">
56477 <primary>relaying</primary>
56478 <secondary>checking control of</secondary>
56479 </indexterm>
56480 You can check the relay characteristics of your configuration in the same way
56481 that you can test any ACL behaviour for an incoming SMTP connection, by using
56482 the <option>-bh</option> option to run a fake SMTP session with which you interact.
56483 </para>
56484 <para>
56485 For specifically testing for unwanted relaying, the host
56486 <emphasis>relay-test.mail-abuse.org</emphasis> provides a useful service. If you telnet to this
56487 host from the host on which Exim is running, using the normal telnet port, you
56488 will see a normal telnet connection message and then quite a long delay. Be
56489 patient. The remote host is making an SMTP connection back to your host, and
56490 trying a number of common probes to test for open relay vulnerability. The
56491 results of the tests will eventually appear on your terminal.
56492 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
56493 </para>
56494 </section>
56495 </chapter>
56496
56497 <chapter id="CHAPexiscan">
56498 <title>Content scanning at ACL time</title>
56499 <para>
56500 <indexterm role="concept" id="IIDcosca" class="startofrange">
56501 <primary>content scanning</primary>
56502 <secondary>at ACL time</secondary>
56503 </indexterm>
56504 The extension of Exim to include content scanning at ACL time, formerly known
56505 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
56506 was integrated into the main source for Exim release 4.50, and Tom continues to
56507 maintain it. Most of the wording of this chapter is taken from Tom&#x2019;s
56508 specification.
56509 </para>
56510 <para>
56511 It is also possible to scan the content of messages at other times. The
56512 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
56513 scanning after all the ACLs have run. A transport filter can be used to scan
56514 messages at delivery time (see the <option>transport_filter</option> option, described in
56515 chapter <xref linkend="CHAPtransportgeneric"/>).
56516 </para>
56517 <para>
56518 If you want to include the ACL-time content-scanning features when you compile
56519 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
56520 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
56521 </para>
56522 <itemizedlist>
56523 <listitem>
56524 <para>
56525 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
56526 for all MIME parts for SMTP and non-SMTP messages, respectively.
56527 </para>
56528 </listitem>
56529 <listitem>
56530 <para>
56531 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
56532 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
56533 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
56534 </para>
56535 </listitem>
56536 <listitem>
56537 <para>
56538 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
56539 of messages, or parts of messages, for debugging purposes.
56540 </para>
56541 </listitem>
56542 <listitem>
56543 <para>
56544 Additional expansion variables that are set in the new ACL and by the new
56545 conditions.
56546 </para>
56547 </listitem>
56548 <listitem>
56549 <para>
56550 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
56551 </para>
56552 </listitem>
56553 </itemizedlist>
56554 <para>
56555 There is another content-scanning configuration option for <filename>Local/Makefile</filename>,
56556 called WITH_OLD_DEMIME. If this is set, the old, deprecated <option>demime</option> ACL
56557 condition is compiled, in addition to all the other content-scanning features.
56558 </para>
56559 <para>
56560 Content-scanning is continually evolving, and new features are still being
56561 added. While such features are still unstable and liable to incompatible
56562 changes, they are made available in Exim by setting options whose names begin
56563 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
56564 this manual. You can find out about them by reading the file called
56565 <filename>doc/experimental.txt</filename>.
56566 </para>
56567 <para>
56568 All the content-scanning facilities work on a MBOX copy of the message that is
56569 temporarily created in a file called:
56570 </para>
56571 <literallayout>
56572 &lt;<emphasis>spool_directory</emphasis>&gt;<literal>/scan/</literal>&lt;<emphasis>message_id</emphasis>&gt;/&lt;<emphasis>message_id</emphasis>&gt;<literal>.eml</literal>
56573 </literallayout>
56574 <para>
56575 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
56576 expect an MBOX-like structure inside that file. The file is created when the
56577 first content scanning facility is called. Subsequent calls to content
56578 scanning conditions open the same file again. The directory is recursively
56579 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
56580 </para>
56581 <literallayout class="monospaced">
56582 control = no_mbox_unspool
56583 </literallayout>
56584 <para>
56585 has been encountered. When the MIME ACL decodes files, they are put into the
56586 same directory by default.
56587 </para>
56588 <section id="SECTscanvirus">
56589 <title>Scanning for viruses</title>
56590 <para>
56591 <indexterm role="concept">
56592 <primary>virus scanning</primary>
56593 </indexterm>
56594 <indexterm role="concept">
56595 <primary>content scanning</primary>
56596 <secondary>for viruses</secondary>
56597 </indexterm>
56598 <indexterm role="concept">
56599 <primary>content scanning</primary>
56600 <secondary>the <option>malware</option> condition</secondary>
56601 </indexterm>
56602 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
56603 It supports a <quote>generic</quote> interface to scanners called via the shell, and
56604 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
56605 in memory and thus are much faster.
56606 </para>
56607 <para>
56608 <indexterm role="option">
56609 <primary><option>av_scanner</option></primary>
56610 </indexterm>
56611 You can set the <option>av_scanner</option> option in first part of the Exim configuration
56612 file to specify which scanner to use, together with any additional options that
56613 are needed. The basic syntax is as follows:
56614 </para>
56615 <literallayout>
56616 <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>
56617 </literallayout>
56618 <para>
56619 If you do not set <option>av_scanner</option>, it defaults to
56620 </para>
56621 <literallayout class="monospaced">
56622 av_scanner = sophie:/var/run/sophie
56623 </literallayout>
56624 <para>
56625 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
56626 before use.
56627 The usual list-parsing of the content (see <xref linkend="SECTlistconstruct"/>) applies.
56628 The following scanner types are supported in this release:
56629 </para>
56630 <variablelist>
56631 <varlistentry>
56632 <term><option>aveserver</option></term>
56633 <listitem>
56634 <para>
56635 <indexterm role="concept">
56636 <primary>virus scanners</primary>
56637 <secondary>Kaspersky</secondary>
56638 </indexterm>
56639 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
56640 at <emphasis role="bold"><ulink url="http://www.kaspersky.com">http://www.kaspersky.com</ulink></emphasis>. This scanner type takes one option,
56641 which is the path to the daemon&#x2019;s UNIX socket. The default is shown in this
56642 example:
56643 </para>
56644 <literallayout class="monospaced">
56645 av_scanner = aveserver:/var/run/aveserver
56646 </literallayout>
56647 </listitem></varlistentry>
56648 <varlistentry>
56649 <term><option>clamd</option></term>
56650 <listitem>
56651 <para>
56652 <indexterm role="concept">
56653 <primary>virus scanners</primary>
56654 <secondary>clamd</secondary>
56655 </indexterm>
56656 This daemon-type scanner is GPL and free. You can get it at
56657 <emphasis role="bold"><ulink url="http://www.clamav.net/">http://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
56658 unpack MIME containers, so it used to be recommended to unpack MIME attachments
56659 in the MIME ACL. This no longer believed to be necessary. One option is
56660 required: either the path and name of a UNIX socket file, or a hostname or IP
56661 number, and a port, separated by space, as in the second of these examples:
56662 </para>
56663 <literallayout class="monospaced">
56664 av_scanner = clamd:/opt/clamd/socket
56665 av_scanner = clamd:192.0.2.3 1234
56666 av_scanner = clamd:192.0.2.3 1234:local
56667 av_scanner = clamd:192.0.2.3 1234 : 192.0.2.4 1234
56668 </literallayout>
56669 <para>
56670 If the value of av_scanner points to a UNIX socket file or contains the local
56671 keyword, then the ClamAV interface will pass a filename containing the data
56672 to be scanned, which will should normally result in less I/O happening and be
56673 more efficient.  Normally in the TCP case, the data is streamed to ClamAV as
56674 Exim does not assume that there is a common filesystem with the remote host.
56675 There is an option WITH_OLD_CLAMAV_STREAM in <filename>src/EDITME</filename> available, should
56676 you be running a version of ClamAV prior to 0.95.
56677 </para>
56678 <para>
56679 The final example shows that multiple TCP targets can be specified.  Exim will
56680 randomly use one for each incoming email (i.e. it load balances them).  Note
56681 that only TCP targets may be used if specifying a list of scanners; a UNIX
56682 socket cannot be mixed in with TCP targets.  If one of the servers becomes
56683 unavailable, Exim will try the remaining one(s) until it finds one that works.
56684 When a clamd server becomes unreachable, Exim will log a message.  Exim does
56685 not keep track of scanner state between multiple messages, and the scanner
56686 selection is random, so the message will get logged in the mainlog for each
56687 email that the down scanner gets chosen first (message wrapped to be readable):
56688 </para>
56689 <literallayout class="monospaced">
56690 2013-10-09 14:30:39 1VTumd-0000Y8-BQ malware acl condition:
56691    clamd: connection to localhost, port 3310 failed
56692    (Connection refused)
56693 </literallayout>
56694 <para>
56695 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
56696 contributing the code for this scanner.
56697 </para>
56698 </listitem></varlistentry>
56699 <varlistentry>
56700 <term><option>cmdline</option></term>
56701 <listitem>
56702 <para>
56703 <indexterm role="concept">
56704 <primary>virus scanners</primary>
56705 <secondary>command line interface</secondary>
56706 </indexterm>
56707 This is the keyword for the generic command line scanner interface. It can be
56708 used to attach virus scanners that are invoked from the shell. This scanner
56709 type takes 3 mandatory options:
56710 </para>
56711 <orderedlist numeration="arabic">
56712 <listitem>
56713 <para>
56714 The full path and name of the scanner binary, with all command line options,
56715 and a placeholder (<literal>%s</literal>) for the directory to scan.
56716 </para>
56717 </listitem>
56718 <listitem>
56719 <para>
56720 A regular expression to match against the STDOUT and STDERR output of the
56721 virus scanner. If the expression matches, a virus was found. You must make
56722 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
56723 the <quote>trigger</quote> expression.
56724 </para>
56725 </listitem>
56726 <listitem>
56727 <para>
56728 Another regular expression, containing exactly one pair of parentheses, to
56729 match the name of the virus found in the scanners output. This is called the
56730 <quote>name</quote> expression.
56731 </para>
56732 </listitem>
56733 </orderedlist>
56734 <para>
56735 For example, Sophos Sweep reports a virus on a line like this:
56736 </para>
56737 <literallayout class="monospaced">
56738 Virus 'W32/Magistr-B' found in file ./those.bat
56739 </literallayout>
56740 <para>
56741 For the trigger expression, we can match the phrase <quote>found in file</quote>. For the
56742 name expression, we want to extract the W32/Magistr-B string, so we can match
56743 for the single quotes left and right of it. Altogether, this makes the
56744 configuration setting:
56745 </para>
56746 <literallayout class="monospaced">
56747 av_scanner = cmdline:\
56748              /path/to/sweep -ss -all -rec -archive %s:\
56749              found in file:'(.+)'
56750 </literallayout>
56751 </listitem></varlistentry>
56752 <varlistentry>
56753 <term><option>drweb</option></term>
56754 <listitem>
56755 <para>
56756 <indexterm role="concept">
56757 <primary>virus scanners</primary>
56758 <secondary>DrWeb</secondary>
56759 </indexterm>
56760 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="http://www.sald.com/">http://www.sald.com/</ulink></emphasis>) interface
56761 takes one option,
56762 either a full path to a UNIX socket,
56763 or host and port specifiers separated by white space.
56764 The host may be a name or an IP address; the port is either a
56765 single number or a pair of numbers with a dash between.
56766 For example:
56767 </para>
56768 <literallayout class="monospaced">
56769 av_scanner = drweb:/var/run/drwebd.sock
56770 av_scanner = drweb:192.168.2.20 31337
56771 </literallayout>
56772 <para>
56773 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
56774 is used. Thanks to Alex Miller for contributing the code for this scanner.
56775 </para>
56776 </listitem></varlistentry>
56777 <varlistentry>
56778 <term><option>f-protd</option></term>
56779 <listitem>
56780 <para>
56781 <indexterm role="concept">
56782 <primary>virus scanners</primary>
56783 <secondary>f-protd</secondary>
56784 </indexterm>
56785 The f-protd scanner is accessed via HTTP over TCP.
56786 One argument is taken, being a space-separated hostname and port number
56787 (or port-range).
56788 For example:
56789 </para>
56790 <literallayout class="monospaced">
56791 av_scanner = f-protd:localhost 10200-10204
56792 </literallayout>
56793 <para>
56794 If you omit the argument, the default values show above are used.
56795 </para>
56796 </listitem></varlistentry>
56797 <varlistentry>
56798 <term><option>fsecure</option></term>
56799 <listitem>
56800 <para>
56801 <indexterm role="concept">
56802 <primary>virus scanners</primary>
56803 <secondary>F-Secure</secondary>
56804 </indexterm>
56805 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="http://www.f-secure.com">http://www.f-secure.com</ulink></emphasis>) takes one
56806 argument which is the path to a UNIX socket. For example:
56807 </para>
56808 <literallayout class="monospaced">
56809 av_scanner = fsecure:/path/to/.fsav
56810 </literallayout>
56811 <para>
56812 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
56813 Thelmen for contributing the code for this scanner.
56814 </para>
56815 </listitem></varlistentry>
56816 <varlistentry>
56817 <term><option>kavdaemon</option></term>
56818 <listitem>
56819 <para>
56820 <indexterm role="concept">
56821 <primary>virus scanners</primary>
56822 <secondary>Kaspersky</secondary>
56823 </indexterm>
56824 This is the scanner daemon of Kaspersky Version 4. This version of the
56825 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
56826 scanner type takes one option, which is the path to the daemon&#x2019;s UNIX socket.
56827 For example:
56828 </para>
56829 <literallayout class="monospaced">
56830 av_scanner = kavdaemon:/opt/AVP/AvpCtl
56831 </literallayout>
56832 <para>
56833 The default path is <filename>/var/run/AvpCtl</filename>.
56834 </para>
56835 </listitem></varlistentry>
56836 <varlistentry>
56837 <term><option>mksd</option></term>
56838 <listitem>
56839 <para>
56840 <indexterm role="concept">
56841 <primary>virus scanners</primary>
56842 <secondary>mksd</secondary>
56843 </indexterm>
56844 This is a daemon type scanner that is aimed mainly at Polish users, though some
56845 parts of documentation are now available in English. You can get it at
56846 <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
56847 the maximum number of processes used simultaneously to scan the attachments,
56848 provided that the demime facility is employed and also provided that mksd has
56849 been run with at least the same number of child processes. For example:
56850 </para>
56851 <literallayout class="monospaced">
56852 av_scanner = mksd:2
56853 </literallayout>
56854 <para>
56855 You can safely omit this option (the default value is 1).
56856 </para>
56857 </listitem></varlistentry>
56858 <varlistentry>
56859 <term><option>sock</option></term>
56860 <listitem>
56861 <para>
56862 <indexterm role="concept">
56863 <primary>virus scanners</primary>
56864 <secondary>simple socket-connected</secondary>
56865 </indexterm>
56866 This is a general-purpose way of talking to simple scanner daemons
56867 running on the local machine.
56868 There are four options:
56869 an address (which may be an IP addres and port, or the path of a Unix socket),
56870 a commandline to send (may include a single %s which will be replaced with
56871 the path to the mail file to be scanned),
56872 an RE to trigger on from the returned data,
56873 an RE to extract malware_name from the returned data.
56874 For example:
56875 </para>
56876 <literallayout class="monospaced">
56877 av_scanner = sock:127.0.0.1 6001:%s:(SPAM|VIRUS):(.*)\$
56878 </literallayout>
56879 <para>
56880 Default for the socket specifier is <filename>/tmp/malware.sock</filename>.
56881 Default for the commandline is <filename>%s\n</filename>.
56882 Both regular-expressions are required.
56883 </para>
56884 </listitem></varlistentry>
56885 <varlistentry>
56886 <term><option>sophie</option></term>
56887 <listitem>
56888 <para>
56889 <indexterm role="concept">
56890 <primary>virus scanners</primary>
56891 <secondary>Sophos and Sophie</secondary>
56892 </indexterm>
56893 Sophie is a daemon that uses Sophos&#x2019; <option>libsavi</option> library to scan for viruses.
56894 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
56895 for this scanner type is the path to the UNIX socket that Sophie uses for
56896 client communication. For example:
56897 </para>
56898 <literallayout class="monospaced">
56899 av_scanner = sophie:/tmp/sophie
56900 </literallayout>
56901 <para>
56902 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
56903 the option.
56904 </para>
56905 </listitem></varlistentry>
56906 </variablelist>
56907 <para>
56908 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
56909 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
56910 ACL.
56911 </para>
56912 <para>
56913 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
56914 makes it possible to use different scanners. See further below for an example.
56915 The <option>malware</option> condition caches its results, so when you use it multiple times
56916 for the same message, the actual scanning process is only carried out once.
56917 However, using expandable items in <option>av_scanner</option> disables this caching, in
56918 which case each use of the <option>malware</option> condition causes a new scan of the
56919 message.
56920 </para>
56921 <para>
56922 The <option>malware</option> condition takes a right-hand argument that is expanded before
56923 use. It can then be one of
56924 </para>
56925 <itemizedlist>
56926 <listitem>
56927 <para>
56928 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
56929 The condition succeeds if a virus was found, and fail otherwise. This is the
56930 recommended usage.
56931 </para>
56932 </listitem>
56933 <listitem>
56934 <para>
56935 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
56936 the condition fails immediately.
56937 </para>
56938 </listitem>
56939 <listitem>
56940 <para>
56941 A regular expression, in which case the message is scanned for viruses. The
56942 condition succeeds if a virus is found and its name matches the regular
56943 expression. This allows you to take special actions on certain types of virus.
56944 </para>
56945 </listitem>
56946 </itemizedlist>
56947 <para>
56948 You can append <literal>/defer_ok</literal> to the <option>malware</option> condition to accept messages
56949 even if there is a problem with the virus scanner. Otherwise, such a problem
56950 causes the ACL to defer.
56951 </para>
56952 <para>
56953 <indexterm role="variable">
56954 <primary><varname>$malware_name</varname></primary>
56955 </indexterm>
56956 When a virus is found, the condition sets up an expansion variable called
56957 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
56958 <option>message</option> modifier that specifies the error returned to the sender, and/or in
56959 logging data.
56960 </para>
56961 <para>
56962 If your virus scanner cannot unpack MIME and TNEF containers itself, you should
56963 use the <option>demime</option> condition (see section <xref linkend="SECTdemimecond"/>) before the
56964 <option>malware</option> condition.
56965 </para>
56966 <para>
56967 Beware the interaction of Exim&#x2019;s <option>message_size_limit</option> with any size limits
56968 imposed by your anti-virus scanner.
56969 </para>
56970 <para>
56971 Here is a very simple scanning example:
56972 </para>
56973 <literallayout class="monospaced">
56974 deny message = This message contains malware ($malware_name)
56975      demime = *
56976      malware = *
56977 </literallayout>
56978 <para>
56979 The next example accepts messages when there is a problem with the scanner:
56980 </para>
56981 <literallayout class="monospaced">
56982 deny message = This message contains malware ($malware_name)
56983      demime = *
56984      malware = */defer_ok
56985 </literallayout>
56986 <para>
56987 The next example shows how to use an ACL variable to scan with both sophie and
56988 aveserver. It assumes you have set:
56989 </para>
56990 <literallayout class="monospaced">
56991 av_scanner = $acl_m0
56992 </literallayout>
56993 <para>
56994 in the main Exim configuration.
56995 </para>
56996 <literallayout class="monospaced">
56997 deny message = This message contains malware ($malware_name)
56998      set acl_m0 = sophie
56999      malware = *
57000
57001 deny message = This message contains malware ($malware_name)
57002      set acl_m0 = aveserver
57003      malware = *
57004 </literallayout>
57005 </section>
57006 <section id="SECTscanspamass">
57007 <title>Scanning with SpamAssassin</title>
57008 <para>
57009 <indexterm role="concept">
57010 <primary>content scanning</primary>
57011 <secondary>for spam</secondary>
57012 </indexterm>
57013 <indexterm role="concept">
57014 <primary>spam scanning</primary>
57015 </indexterm>
57016 <indexterm role="concept">
57017 <primary>SpamAssassin</primary>
57018 </indexterm>
57019 The <option>spam</option> ACL condition calls SpamAssassin&#x2019;s <option>spamd</option> daemon to get a spam
57020 score and a report for the message. You can get SpamAssassin at
57021 <emphasis role="bold"><ulink url="http://www.spamassassin.org">http://www.spamassassin.org</ulink></emphasis>, or, if you have a working Perl
57022 installation, you can use CPAN by running:
57023 </para>
57024 <literallayout class="monospaced">
57025 perl -MCPAN -e 'install Mail::SpamAssassin'
57026 </literallayout>
57027 <para>
57028 SpamAssassin has its own set of configuration files. Please review its
57029 documentation to see how you can tweak it. The default installation should work
57030 nicely, however.
57031 </para>
57032 <para>
57033 <indexterm role="option">
57034 <primary><option>spamd_address</option></primary>
57035 </indexterm>
57036 After having installed and configured SpamAssassin, start the <option>spamd</option> daemon.
57037 By default, it listens on 127.0.0.1, TCP port 783. If you use another host or
57038 port for <option>spamd</option>, you must set the <option>spamd_address</option> option in the global
57039 part of the Exim configuration as follows (example):
57040 </para>
57041 <literallayout class="monospaced">
57042 spamd_address = 192.168.99.45 387
57043 </literallayout>
57044 <para>
57045 You do not need to set this option if you use the default. As of version 2.60,
57046 <option>spamd</option> also supports communication over UNIX sockets. If you want to use
57047 these, supply <option>spamd_address</option> with an absolute file name instead of a
57048 address/port pair:
57049 </para>
57050 <literallayout class="monospaced">
57051 spamd_address = /var/run/spamd_socket
57052 </literallayout>
57053 <para>
57054 You can have multiple <option>spamd</option> servers to improve scalability. These can
57055 reside on other hardware reachable over the network. To specify multiple
57056 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
57057 option, separated with colons:
57058 </para>
57059 <literallayout class="monospaced">
57060 spamd_address = 192.168.2.10 783 : \
57061                 192.168.2.11 783 : \
57062                 192.168.2.12 783
57063 </literallayout>
57064 <para>
57065 Up to 32 <option>spamd</option> servers are supported. The servers are queried in a random
57066 fashion. When a server fails to respond to the connection attempt, all other
57067 servers are tried until one succeeds. If no server responds, the <option>spam</option>
57068 condition defers.
57069 </para>
57070 <para>
57071 <emphasis role="bold">Warning</emphasis>: It is not possible to use the UNIX socket connection method with
57072 multiple <option>spamd</option> servers.
57073 </para>
57074 <para>
57075 The <option>spamd_address</option> variable is expanded before use if it starts with
57076 a dollar sign. In this case, the expansion may return a string that is
57077 used as the list so that multiple spamd servers can be the result of an
57078 expansion.
57079 </para>
57080 </section>
57081 <section id="SECID206">
57082 <title>Calling SpamAssassin from an Exim ACL</title>
57083 <para>
57084 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
57085 </para>
57086 <literallayout class="monospaced">
57087 deny message = This message was classified as SPAM
57088      spam = joe
57089 </literallayout>
57090 <para>
57091 The right-hand side of the <option>spam</option> condition specifies a name. This is
57092 relevant if you have set up multiple SpamAssassin profiles. If you do not want
57093 to scan using a specific profile, but rather use the SpamAssassin system-wide
57094 default profile, you can scan for an unknown name, or simply use <quote>nobody</quote>.
57095 However, you must put something on the right-hand side.
57096 </para>
57097 <para>
57098 The name allows you to use per-domain or per-user antispam profiles in
57099 principle, but this is not straightforward in practice, because a message may
57100 have multiple recipients, not necessarily all in the same domain. Because the
57101 <option>spam</option> condition has to be called from a DATA ACL in order to be able to
57102 read the contents of the message, the variables <varname>$local_part</varname> and <varname>$domain</varname>
57103 are not set.
57104 </para>
57105 <para>
57106 The right-hand side of the <option>spam</option> condition is expanded before being used, so
57107 you can put lookups or conditions there. When the right-hand side evaluates to
57108 <quote>0</quote> or <quote>false</quote>, no scanning is done and the condition fails immediately.
57109 </para>
57110 <para>
57111 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
57112 large ones may cause significant performance degradation. As most spam messages
57113 are quite small, it is recommended that you do not scan the big ones. For
57114 example:
57115 </para>
57116 <literallayout class="monospaced">
57117 deny message = This message was classified as SPAM
57118      condition = ${if &lt; {$message_size}{10K}}
57119      spam = nobody
57120 </literallayout>
57121 <para>
57122 The <option>spam</option> condition returns true if the threshold specified in the user&#x2019;s
57123 SpamAssassin profile has been matched or exceeded. If you want to use the
57124 <option>spam</option> condition for its side effects (see the variables below), you can make
57125 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
57126 </para>
57127 <para>
57128 <indexterm role="concept">
57129 <primary>spam scanning</primary>
57130 <secondary>returned variables</secondary>
57131 </indexterm>
57132 When the <option>spam</option> condition is run, it sets up a number of expansion
57133 variables. These variables are saved with the received message, thus they are
57134 available for use at delivery time.
57135 </para>
57136 <variablelist>
57137 <varlistentry>
57138 <term><varname>$spam_score</varname></term>
57139 <listitem>
57140 <para>
57141 The spam score of the message, for example <quote>3.4</quote> or <quote>30.5</quote>. This is useful
57142 for inclusion in log or reject messages.
57143 </para>
57144 </listitem></varlistentry>
57145 <varlistentry>
57146 <term><varname>$spam_score_int</varname></term>
57147 <listitem>
57148 <para>
57149 The spam score of the message, multiplied by ten, as an integer value. For
57150 example <quote>34</quote> or <quote>305</quote>. It may appear to disagree with <varname>$spam_score</varname>
57151 because <varname>$spam_score</varname> is rounded and <varname>$spam_score_int</varname> is truncated.
57152 The integer value is useful for numeric comparisons in conditions.
57153 </para>
57154 </listitem></varlistentry>
57155 <varlistentry>
57156 <term><varname>$spam_bar</varname></term>
57157 <listitem>
57158 <para>
57159 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
57160 integer part of the spam score value. A spam score of 4.4 would have a
57161 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
57162 headers, since MUAs can match on such strings.
57163 </para>
57164 </listitem></varlistentry>
57165 <varlistentry>
57166 <term><varname>$spam_report</varname></term>
57167 <listitem>
57168 <para>
57169 A multiline text table, containing the full SpamAssassin report for the
57170 message. Useful for inclusion in headers or reject messages.
57171 </para>
57172 </listitem></varlistentry>
57173 </variablelist>
57174 <para>
57175 The <option>spam</option> condition caches its results unless expansion in
57176 spamd_address was used. If you call it again with the same user name, it
57177 does not scan again, but rather returns the same values as before.
57178 </para>
57179 <para>
57180 The <option>spam</option> condition returns DEFER if there is any error while running
57181 the message through SpamAssassin or if the expansion of spamd_address
57182 failed. If you want to treat DEFER as FAIL (to pass on to the next ACL
57183 statement block), append <literal>/defer_ok</literal> to the right-hand side of the
57184 spam condition, like this:
57185 </para>
57186 <literallayout class="monospaced">
57187 deny message = This message was classified as SPAM
57188      spam    = joe/defer_ok
57189 </literallayout>
57190 <para>
57191 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
57192 </para>
57193 <para>
57194 Here is a longer, commented example of the use of the <option>spam</option>
57195 condition:
57196 </para>
57197 <literallayout class="monospaced">
57198 # put headers in all messages (no matter if spam or not)
57199 warn  spam = nobody:true
57200       add_header = X-Spam-Score: $spam_score ($spam_bar)
57201       add_header = X-Spam-Report: $spam_report
57202
57203 # add second subject line with *SPAM* marker when message
57204 # is over threshold
57205 warn  spam = nobody
57206       add_header = Subject: *SPAM* $h_Subject:
57207
57208 # reject spam at high scores (&gt; 12)
57209 deny  message = This message scored $spam_score spam points.
57210       spam = nobody:true
57211       condition = ${if &gt;{$spam_score_int}{120}{1}{0}}
57212 </literallayout>
57213 </section>
57214 <section id="SECTscanmimepart">
57215 <title>Scanning MIME parts</title>
57216 <para>
57217 <indexterm role="concept">
57218 <primary>content scanning</primary>
57219 <secondary>MIME parts</secondary>
57220 </indexterm>
57221 <indexterm role="concept">
57222 <primary>MIME content scanning</primary>
57223 </indexterm>
57224 <indexterm role="option">
57225 <primary><option>acl_smtp_mime</option></primary>
57226 </indexterm>
57227 <indexterm role="option">
57228 <primary><option>acl_not_smtp_mime</option></primary>
57229 </indexterm>
57230 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
57231 each MIME part of an SMTP message, including multipart types, in the sequence
57232 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
57233 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
57234 options may both refer to the same ACL if you want the same processing in both
57235 cases.
57236 </para>
57237 <para>
57238 These ACLs are called (possibly many times) just before the <option>acl_smtp_data</option>
57239 ACL in the case of an SMTP message, or just before the <option>acl_not_smtp</option> ACL in
57240 the case of a non-SMTP message. However, a MIME ACL is called only if the
57241 message contains a <emphasis>Content-Type:</emphasis> header line. When a call to a MIME
57242 ACL does not yield <quote>accept</quote>, ACL processing is aborted and the appropriate
57243 result code is sent to the client. In the case of an SMTP message, the
57244 <option>acl_smtp_data</option> ACL is not called when this happens.
57245 </para>
57246 <para>
57247 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
57248 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
57249 condition to match against the raw MIME part. You can also use the
57250 <option>mime_regex</option> condition to match against the decoded MIME part (see section
57251 <xref linkend="SECTscanregex"/>).
57252 </para>
57253 <para>
57254 At the start of a MIME ACL, a number of variables are set from the header
57255 information for the relevant MIME part. These are described below. The contents
57256 of the MIME part are not by default decoded into a disk file except for MIME
57257 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
57258 part into a disk file, you can use the <option>decode</option> condition. The general
57259 syntax is:
57260 </para>
57261 <literallayout>
57262 <literal>decode = [/</literal>&lt;<emphasis>path</emphasis>&gt;<literal>/]</literal>&lt;<emphasis>filename</emphasis>&gt;
57263 </literallayout>
57264 <para>
57265 The right hand side is expanded before use. After expansion,
57266 the value can be:
57267 </para>
57268 <orderedlist numeration="arabic">
57269 <listitem>
57270 <para>
57271 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
57272 </para>
57273 </listitem>
57274 <listitem>
57275 <para>
57276 The string <quote>default</quote>. In that case, the file is put in the temporary
57277 <quote>default</quote> directory &lt;<emphasis>spool_directory</emphasis>&gt;<filename>/scan/</filename>&lt;<emphasis>message_id</emphasis>&gt;<filename>/</filename> with
57278 a sequential file name consisting of the message id and a sequence number. The
57279 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
57280 </para>
57281 </listitem>
57282 <listitem>
57283 <para>
57284 A full path name starting with a slash. If the full name is an existing
57285 directory, it is used as a replacement for the default directory. The filename
57286 is then sequentially assigned. If the path does not exist, it is used as
57287 the full path and file name.
57288 </para>
57289 </listitem>
57290 <listitem>
57291 <para>
57292 If the string does not start with a slash, it is used as the
57293 filename, and the default path is then used.
57294 </para>
57295 </listitem>
57296 </orderedlist>
57297 <para>
57298 The <option>decode</option> condition normally succeeds. It is only false for syntax
57299 errors or unusual circumstances such as memory shortages. You can easily decode
57300 a file with its original, proposed filename using
57301 </para>
57302 <literallayout class="monospaced">
57303 decode = $mime_filename
57304 </literallayout>
57305 <para>
57306 However, you should keep in mind that <varname>$mime_filename</varname> might contain
57307 anything. If you place files outside of the default path, they are not
57308 automatically unlinked.
57309 </para>
57310 <para>
57311 For RFC822 attachments (these are messages attached to messages, with a
57312 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
57313 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
57314 variable is set (see below). Attached messages are always decoded to disk
57315 before being checked, and the files are unlinked once the check is done.
57316 </para>
57317 <para>
57318 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
57319 used to match regular expressions against raw and decoded MIME parts,
57320 respectively. They are described in section <xref linkend="SECTscanregex"/>.
57321 </para>
57322 <para>
57323 <indexterm role="concept">
57324 <primary>MIME content scanning</primary>
57325 <secondary>returned variables</secondary>
57326 </indexterm>
57327 The following list describes all expansion variables that are
57328 available in the MIME ACL:
57329 </para>
57330 <variablelist>
57331 <varlistentry>
57332 <term><varname>$mime_boundary</varname></term>
57333 <listitem>
57334 <para>
57335 If the current part is a multipart (see <varname>$mime_is_multipart</varname>) below, it should
57336 have a boundary string, which is stored in this variable. If the current part
57337 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
57338 contains the empty string.
57339 </para>
57340 </listitem></varlistentry>
57341 <varlistentry>
57342 <term><varname>$mime_charset</varname></term>
57343 <listitem>
57344 <para>
57345 This variable contains the character set identifier, if one was found in the
57346 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
57347 </para>
57348 <literallayout class="monospaced">
57349 us-ascii
57350 gb2312 (Chinese)
57351 iso-8859-1
57352 </literallayout>
57353 <para>
57354 Please note that this value is not normalized, so you should do matches
57355 case-insensitively.
57356 </para>
57357 </listitem></varlistentry>
57358 <varlistentry>
57359 <term><varname>$mime_content_description</varname></term>
57360 <listitem>
57361 <para>
57362 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
57363 header. It can contain a human-readable description of the parts content. Some
57364 implementations repeat the filename for attachments here, but they are usually
57365 only used for display purposes.
57366 </para>
57367 </listitem></varlistentry>
57368 <varlistentry>
57369 <term><varname>$mime_content_disposition</varname></term>
57370 <listitem>
57371 <para>
57372 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
57373 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
57374 </para>
57375 </listitem></varlistentry>
57376 <varlistentry>
57377 <term><varname>$mime_content_id</varname></term>
57378 <listitem>
57379 <para>
57380 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
57381 This is a unique ID that can be used to reference a part from another part.
57382 </para>
57383 </listitem></varlistentry>
57384 <varlistentry>
57385 <term><varname>$mime_content_size</varname></term>
57386 <listitem>
57387 <para>
57388 This variable is set only after the <option>decode</option> modifier (see above) has been
57389 successfully run. It contains the size of the decoded part in kilobytes. The
57390 size is always rounded up to full kilobytes, so only a completely empty part
57391 has a <varname>$mime_content_size</varname> of zero.
57392 </para>
57393 </listitem></varlistentry>
57394 <varlistentry>
57395 <term><varname>$mime_content_transfer_encoding</varname></term>
57396 <listitem>
57397 <para>
57398 This variable contains the normalized content of the
57399 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
57400 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
57401 </para>
57402 </listitem></varlistentry>
57403 <varlistentry>
57404 <term><varname>$mime_content_type</varname></term>
57405 <listitem>
57406 <para>
57407 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
57408 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
57409 are some examples of popular MIME types, as they may appear in this variable:
57410 </para>
57411 <literallayout class="monospaced">
57412 text/plain
57413 text/html
57414 application/octet-stream
57415 image/jpeg
57416 audio/midi
57417 </literallayout>
57418 <para>
57419 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
57420 empty string.
57421 </para>
57422 </listitem></varlistentry>
57423 <varlistentry>
57424 <term><varname>$mime_decoded_filename</varname></term>
57425 <listitem>
57426 <para>
57427 This variable is set only after the <option>decode</option> modifier (see above) has been
57428 successfully run. It contains the full path and file name of the file
57429 containing the decoded data.
57430 </para>
57431 </listitem></varlistentry>
57432 </variablelist>
57433 <para>
57434 <indexterm role="concept">
57435 <primary>RFC 2047</primary>
57436 </indexterm>
57437 </para>
57438 <variablelist>
57439 <varlistentry>
57440 <term><varname>$mime_filename</varname></term>
57441 <listitem>
57442 <para>
57443 This is perhaps the most important of the MIME variables. It contains a
57444 proposed filename for an attachment, if one was found in either the
57445 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
57446 RFC2047 decoded, but no additional sanity checks are done. If no filename was
57447 found, this variable contains the empty string.
57448 </para>
57449 </listitem></varlistentry>
57450 <varlistentry>
57451 <term><varname>$mime_is_coverletter</varname></term>
57452 <listitem>
57453 <para>
57454 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
57455 attached data. It can be used to clamp down on flashy or unnecessarily encoded
57456 content in the cover letter, while not restricting attachments at all.
57457 </para>
57458 <para>
57459 The variable contains 1 (true) for a MIME part believed to be part of the
57460 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
57461 follows:
57462 </para>
57463 <orderedlist numeration="arabic">
57464 <listitem>
57465 <para>
57466 The outermost MIME part of a message is always a cover letter.
57467 </para>
57468 </listitem>
57469 <listitem>
57470 <para>
57471 If a multipart/alternative or multipart/related MIME part is a cover letter,
57472 so are all MIME subparts within that multipart.
57473 </para>
57474 </listitem>
57475 <listitem>
57476 <para>
57477 If any other multipart is a cover letter, the first subpart is a cover letter,
57478 and the rest are attachments.
57479 </para>
57480 </listitem>
57481 <listitem>
57482 <para>
57483 All parts contained within an attachment multipart are attachments.
57484 </para>
57485 </listitem>
57486 </orderedlist>
57487 <para>
57488 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
57489 alternative plain text), while allowing HTML files to be attached. HTML
57490 coverletter mail attached to non-HMTL coverletter mail will also be allowed:
57491 </para>
57492 <literallayout class="monospaced">
57493 deny message = HTML mail is not accepted here
57494 !condition = $mime_is_rfc822
57495 condition = $mime_is_coverletter
57496 condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
57497 </literallayout>
57498 </listitem></varlistentry>
57499 <varlistentry>
57500 <term><varname>$mime_is_multipart</varname></term>
57501 <listitem>
57502 <para>
57503 This variable has the value 1 (true) when the current part has the main type
57504 <quote>multipart</quote>, for example <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
57505 Since multipart entities only serve as containers for other parts, you may not
57506 want to carry out specific actions on them.
57507 </para>
57508 </listitem></varlistentry>
57509 <varlistentry>
57510 <term><varname>$mime_is_rfc822</varname></term>
57511 <listitem>
57512 <para>
57513 This variable has the value 1 (true) if the current part is not a part of the
57514 checked message itself, but part of an attached message. Attached message
57515 decoding is fully recursive.
57516 </para>
57517 </listitem></varlistentry>
57518 <varlistentry>
57519 <term><varname>$mime_part_count</varname></term>
57520 <listitem>
57521 <para>
57522 This variable is a counter that is raised for each processed MIME part. It
57523 starts at zero for the very first part (which is usually a multipart). The
57524 counter is per-message, so it is reset when processing RFC822 attachments (see
57525 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
57526 complete, so you can use it in the DATA ACL to determine the number of MIME
57527 parts of a message. For non-MIME messages, this variable contains the value -1.
57528 </para>
57529 </listitem></varlistentry>
57530 </variablelist>
57531 </section>
57532 <section id="SECTscanregex">
57533 <title>Scanning with regular expressions</title>
57534 <para>
57535 <indexterm role="concept">
57536 <primary>content scanning</primary>
57537 <secondary>with regular expressions</secondary>
57538 </indexterm>
57539 <indexterm role="concept">
57540 <primary>regular expressions</primary>
57541 <secondary>content scanning with</secondary>
57542 </indexterm>
57543 You can specify your own custom regular expression matches on the full body of
57544 the message, or on individual MIME parts.
57545 </para>
57546 <para>
57547 The <option>regex</option> condition takes one or more regular expressions as arguments and
57548 matches them against the full message (when called in the DATA ACL) or a raw
57549 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
57550 linewise, with a maximum line length of 32K characters. That means you cannot
57551 have multiline matches with the <option>regex</option> condition.
57552 </para>
57553 <para>
57554 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
57555 to 32K of decoded content (the whole content at once, not linewise). If the
57556 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
57557 is decoded automatically when <option>mime_regex</option> is executed (using default path
57558 and filename values). If the decoded data is larger than  32K, only the first
57559 32K characters are checked.
57560 </para>
57561 <para>
57562 The regular expressions are passed as a colon-separated list. To include a
57563 literal colon, you must double it. Since the whole right-hand side string is
57564 expanded before being used, you must also escape dollar signs and backslashes
57565 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
57566 Here is a simple example that contains two regular expressions:
57567 </para>
57568 <literallayout class="monospaced">
57569 deny message = contains blacklisted regex ($regex_match_string)
57570      regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
57571 </literallayout>
57572 <para>
57573 The conditions returns true if any one of the regular expressions matches. The
57574 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
57575 matching regular expression.
57576 </para>
57577 <para>
57578 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
57579 CPU-intensive.
57580 </para>
57581 </section>
57582 <section id="SECTdemimecond">
57583 <title>The demime condition</title>
57584 <para>
57585 <indexterm role="concept">
57586 <primary>content scanning</primary>
57587 <secondary>MIME checking</secondary>
57588 </indexterm>
57589 <indexterm role="concept">
57590 <primary>MIME content scanning</primary>
57591 </indexterm>
57592 The <option>demime</option> ACL condition provides MIME unpacking, sanity checking and file
57593 extension blocking. It is usable only in the DATA and non-SMTP ACLs. The
57594 <option>demime</option> condition uses a simpler interface to MIME decoding than the MIME
57595 ACL functionality, but provides no additional facilities. Please note that this
57596 condition is deprecated and kept only for backward compatibility. You must set
57597 the WITH_OLD_DEMIME option in <filename>Local/Makefile</filename> at build time to be able to
57598 use the <option>demime</option> condition.
57599 </para>
57600 <para>
57601 The <option>demime</option> condition unpacks MIME containers in the message. It detects
57602 errors in MIME containers and can match file extensions found in the message
57603 against a list. Using this facility produces files containing the unpacked MIME
57604 parts of the message in the temporary scan directory. If you do antivirus
57605 scanning, it is recommended that you use the <option>demime</option> condition before the
57606 antivirus (<option>malware</option>) condition.
57607 </para>
57608 <para>
57609 On the right-hand side of the <option>demime</option> condition you can pass a
57610 colon-separated list of file extensions that it should match against. For
57611 example:
57612 </para>
57613 <literallayout class="monospaced">
57614 deny message = Found blacklisted file attachment
57615      demime  = vbs:com:bat:pif:prf:lnk
57616 </literallayout>
57617 <para>
57618 If one of the file extensions is found, the condition is true, otherwise it is
57619 false. If there is a temporary error while demimeing (for example, <quote>disk
57620 full</quote>), the condition defers, and the message is temporarily rejected (unless
57621 the condition is on a <option>warn</option> verb).
57622 </para>
57623 <para>
57624 The right-hand side is expanded before being treated as a list, so you can have
57625 conditions and lookups there. If it expands to an empty string, <quote>false</quote>, or
57626 zero (<quote>0</quote>), no demimeing is done and the condition is false.
57627 </para>
57628 <para>
57629 The <option>demime</option> condition set the following variables:
57630 </para>
57631 <variablelist>
57632 <varlistentry>
57633 <term><varname>$demime_errorlevel</varname></term>
57634 <listitem>
57635 <para>
57636 <indexterm role="variable">
57637 <primary><varname>$demime_errorlevel</varname></primary>
57638 </indexterm>
57639 When an error is detected in a MIME container, this variable contains the
57640 severity of the error, as an integer number. The higher the value, the more
57641 severe the error (the current maximum value is 3). If this variable is unset or
57642 zero, no error occurred.
57643 </para>
57644 </listitem></varlistentry>
57645 <varlistentry>
57646 <term><varname>$demime_reason</varname></term>
57647 <listitem>
57648 <para>
57649 <indexterm role="variable">
57650 <primary><varname>$demime_reason</varname></primary>
57651 </indexterm>
57652 When <varname>$demime_errorlevel</varname> is greater than zero, this variable contains a
57653 human-readable text string describing the MIME error that occurred.
57654 </para>
57655 </listitem></varlistentry>
57656 </variablelist>
57657 <variablelist>
57658 <varlistentry>
57659 <term><varname>$found_extension</varname></term>
57660 <listitem>
57661 <para>
57662 <indexterm role="variable">
57663 <primary><varname>$found_extension</varname></primary>
57664 </indexterm>
57665 When the <option>demime</option> condition is true, this variable contains the file
57666 extension it found.
57667 </para>
57668 </listitem></varlistentry>
57669 </variablelist>
57670 <para>
57671 Both <varname>$demime_errorlevel</varname> and <varname>$demime_reason</varname> are set by the first call of
57672 the <option>demime</option> condition, and are not changed on subsequent calls.
57673 </para>
57674 <para>
57675 If you do not want to check for file extensions, but rather use the <option>demime</option>
57676 condition for unpacking or error checking purposes, pass <quote>*</quote> as the
57677 right-hand side value. Here is a more elaborate example of how to use this
57678 facility:
57679 </para>
57680 <literallayout class="monospaced">
57681 # Reject messages with serious MIME container errors
57682 deny  message = Found MIME error ($demime_reason).
57683       demime = *
57684       condition = ${if &gt;{$demime_errorlevel}{2}{1}{0}}
57685
57686 # Reject known virus spreading file extensions.
57687 # Accepting these is pretty much braindead.
57688 deny  message = contains $found_extension file (blacklisted).
57689       demime  = com:vbs:bat:pif:scr
57690
57691 # Freeze .exe and .doc files. Postmaster can
57692 # examine them and eventually thaw them.
57693 deny  log_message = Another $found_extension file.
57694       demime = exe:doc
57695       control = freeze
57696 </literallayout>
57697 <para>
57698 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
57699 </para>
57700 </section>
57701 </chapter>
57702
57703 <chapter id="CHAPlocalscan">
57704 <title>Adding a local scan function to Exim</title>
57705 <titleabbrev>Local scan function</titleabbrev>
57706 <para>
57707 <indexterm role="concept" id="IIDlosca" class="startofrange">
57708 <primary><function>local_scan()</function> function</primary>
57709 <secondary>description of</secondary>
57710 </indexterm>
57711 <indexterm role="concept">
57712 <primary>customizing</primary>
57713 <secondary>input scan using C function</secondary>
57714 </indexterm>
57715 <indexterm role="concept">
57716 <primary>policy control</primary>
57717 <secondary>by local scan function</secondary>
57718 </indexterm>
57719 In these days of email worms, viruses, and ever-increasing spam, some sites
57720 want to apply a lot of checking to messages before accepting them.
57721 </para>
57722 <para>
57723 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
57724 passing messages to external virus and spam scanning software. You can also do
57725 a certain amount in Exim itself through string expansions and the <option>condition</option>
57726 condition in the ACL that runs after the SMTP DATA command or the ACL for
57727 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
57728 </para>
57729 <para>
57730 To allow for further customization to a site&#x2019;s own requirements, there is the
57731 possibility of linking Exim with a private message scanning function, written
57732 in C. If you want to run code that is written in something other than C, you
57733 can of course use a little C stub to call it.
57734 </para>
57735 <para>
57736 The local scan function is run once for every incoming message, at the point
57737 when Exim is just about to accept the message.
57738 It can therefore be used to control non-SMTP messages from local processes as
57739 well as messages arriving via SMTP.
57740 </para>
57741 <para>
57742 Exim applies a timeout to calls of the local scan function, and there is an
57743 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
57744 Zero means <quote>no timeout</quote>.
57745 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
57746 before calling the local scan function, so that the most common types of crash
57747 are caught. If the timeout is exceeded or one of those signals is caught, the
57748 incoming message is rejected with a temporary error if it is an SMTP message.
57749 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
57750 code. The incident is logged on the main and reject logs.
57751 </para>
57752 <section id="SECID207">
57753 <title>Building Exim to use a local scan function</title>
57754 <para>
57755 <indexterm role="concept">
57756 <primary><function>local_scan()</function> function</primary>
57757 <secondary>building Exim to use</secondary>
57758 </indexterm>
57759 To make use of the local scan function feature, you must tell Exim where your
57760 function is before building Exim, by setting LOCAL_SCAN_SOURCE in your
57761 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
57762 directory, so you might set
57763 </para>
57764 <literallayout class="monospaced">
57765 LOCAL_SCAN_SOURCE=Local/local_scan.c
57766 </literallayout>
57767 <para>
57768 for example. The function must be called <function>local_scan()</function>. It is called by
57769 Exim after it has received a message, when the success return code is about to
57770 be sent. This is after all the ACLs have been run. The return code from your
57771 function controls whether the message is actually accepted or not. There is a
57772 commented template function (that just accepts the message) in the file
57773 _src/local_scan.c_.
57774 </para>
57775 <para>
57776 If you want to make use of Exim&#x2019;s run time configuration file to set options
57777 for your <function>local_scan()</function> function, you must also set
57778 </para>
57779 <literallayout class="monospaced">
57780 LOCAL_SCAN_HAS_OPTIONS=yes
57781 </literallayout>
57782 <para>
57783 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
57784 </para>
57785 </section>
57786 <section id="SECTapiforloc">
57787 <title>API for local_scan()</title>
57788 <para>
57789 <indexterm role="concept">
57790 <primary><function>local_scan()</function> function</primary>
57791 <secondary>API description</secondary>
57792 </indexterm>
57793 You must include this line near the start of your code:
57794 </para>
57795 <literallayout class="monospaced">
57796 #include "local_scan.h"
57797 </literallayout>
57798 <para>
57799 This header file defines a number of variables and other values, and the
57800 prototype for the function itself. Exim is coded to use unsigned char values
57801 almost exclusively, and one of the things this header defines is a shorthand
57802 for <literal>unsigned char</literal> called <literal>uschar</literal>.
57803 It also contains the following macro definitions, to simplify casting character
57804 strings and pointers to character strings:
57805 </para>
57806 <literallayout class="monospaced">
57807 #define CS   (char *)
57808 #define CCS  (const char *)
57809 #define CSS  (char **)
57810 #define US   (unsigned char *)
57811 #define CUS  (const unsigned char *)
57812 #define USS  (unsigned char **)
57813 </literallayout>
57814 <para>
57815 The function prototype for <function>local_scan()</function> is:
57816 </para>
57817 <literallayout class="monospaced">
57818 extern int local_scan(int fd, uschar **return_text);
57819 </literallayout>
57820 <para>
57821 The arguments are as follows:
57822 </para>
57823 <itemizedlist>
57824 <listitem>
57825 <para>
57826 <option>fd</option> is a file descriptor for the file that contains the body of the message
57827 (the -D file). The file is open for reading and writing, but updating it is not
57828 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
57829 </para>
57830 <para>
57831 The descriptor is positioned at character 19 of the file, which is the first
57832 character of the body itself, because the first 19 characters are the message
57833 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
57834 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
57835 case this changes in some future version.
57836 </para>
57837 </listitem>
57838 <listitem>
57839 <para>
57840 <option>return_text</option> is an address which you can use to return a pointer to a text
57841 string at the end of the function. The value it points to on entry is NULL.
57842 </para>
57843 </listitem>
57844 </itemizedlist>
57845 <para>
57846 The function must return an <option>int</option> value which is one of the following macros:
57847 </para>
57848 <variablelist>
57849 <varlistentry>
57850 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
57851 <listitem>
57852 <para>
57853 <indexterm role="variable">
57854 <primary><varname>$local_scan_data</varname></primary>
57855 </indexterm>
57856 The message is accepted. If you pass back a string of text, it is saved with
57857 the message, and made available in the variable <varname>$local_scan_data</varname>. No
57858 newlines are permitted (if there are any, they are turned into spaces) and the
57859 maximum length of text is 1000 characters.
57860 </para>
57861 </listitem></varlistentry>
57862 <varlistentry>
57863 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
57864 <listitem>
57865 <para>
57866 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
57867 queued without immediate delivery, and is frozen.
57868 </para>
57869 </listitem></varlistentry>
57870 <varlistentry>
57871 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
57872 <listitem>
57873 <para>
57874 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
57875 queued without immediate delivery.
57876 </para>
57877 </listitem></varlistentry>
57878 <varlistentry>
57879 <term><literal>LOCAL_SCAN_REJECT</literal></term>
57880 <listitem>
57881 <para>
57882 The message is rejected; the returned text is used as an error message which is
57883 passed back to the sender and which is also logged. Newlines are permitted &ndash;
57884 they cause a multiline response for SMTP rejections, but are converted to
57885 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
57886 used.
57887 </para>
57888 </listitem></varlistentry>
57889 <varlistentry>
57890 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
57891 <listitem>
57892 <para>
57893 The message is temporarily rejected; the returned text is used as an error
57894 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
57895 problem</quote> is used.
57896 </para>
57897 </listitem></varlistentry>
57898 <varlistentry>
57899 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
57900 <listitem>
57901 <para>
57902 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
57903 message is not written to the reject log. It has the effect of unsetting the
57904 <option>rejected_header</option> log selector for just this rejection. If
57905 <option>rejected_header</option> is already unset (see the discussion of the
57906 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
57907 same as LOCAL_SCAN_REJECT.
57908 </para>
57909 </listitem></varlistentry>
57910 <varlistentry>
57911 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
57912 <listitem>
57913 <para>
57914 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
57915 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
57916 </para>
57917 </listitem></varlistentry>
57918 </variablelist>
57919 <para>
57920 If the message is not being received by interactive SMTP, rejections are
57921 reported by writing to <option>stderr</option> or by sending an email, as configured by the
57922 <option>-oe</option> command line options.
57923 </para>
57924 </section>
57925 <section id="SECTconoptloc">
57926 <title>Configuration options for local_scan()</title>
57927 <para>
57928 <indexterm role="concept">
57929 <primary><function>local_scan()</function> function</primary>
57930 <secondary>configuration options</secondary>
57931 </indexterm>
57932 It is possible to have option settings in the main configuration file
57933 that set values in static variables in the <function>local_scan()</function> module. If you
57934 want to do this, you must have the line
57935 </para>
57936 <literallayout class="monospaced">
57937 LOCAL_SCAN_HAS_OPTIONS=yes
57938 </literallayout>
57939 <para>
57940 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
57941 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
57942 file, you must define static variables to hold the option values, and a table
57943 to define them.
57944 </para>
57945 <para>
57946 The table must be a vector called <option>local_scan_options</option>, of type
57947 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
57948 and a pointer to the variable that holds the value. The entries must appear in
57949 alphabetical order. Following <option>local_scan_options</option> you must also define a
57950 variable called <option>local_scan_options_count</option> that contains the number of
57951 entries in the table. Here is a short example, showing two kinds of option:
57952 </para>
57953 <literallayout class="monospaced">
57954 static int my_integer_option = 42;
57955 static uschar *my_string_option = US"a default string";
57956
57957 optionlist local_scan_options[] = {
57958   { "my_integer", opt_int,       &amp;my_integer_option },
57959   { "my_string",  opt_stringptr, &amp;my_string_option }
57960 };
57961
57962 int local_scan_options_count =
57963   sizeof(local_scan_options)/sizeof(optionlist);
57964 </literallayout>
57965 <para>
57966 The values of the variables can now be changed from Exim&#x2019;s runtime
57967 configuration file by including a local scan section as in this example:
57968 </para>
57969 <literallayout class="monospaced">
57970 begin local_scan
57971 my_integer = 99
57972 my_string = some string of text...
57973 </literallayout>
57974 <para>
57975 The available types of option data are as follows:
57976 </para>
57977 <variablelist>
57978 <varlistentry>
57979 <term><emphasis role="bold">opt_bool</emphasis></term>
57980 <listitem>
57981 <para>
57982 This specifies a boolean (true/false) option. The address should point to a
57983 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
57984 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
57985 whether such a variable has been set at all, you can initialize it to
57986 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
57987 values.)
57988 </para>
57989 </listitem></varlistentry>
57990 <varlistentry>
57991 <term><emphasis role="bold">opt_fixed</emphasis></term>
57992 <listitem>
57993 <para>
57994 This specifies a fixed point number, such as is used for load averages.
57995 The address should point to a variable of type <literal>int</literal>. The value is stored
57996 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
57997 </para>
57998 </listitem></varlistentry>
57999 <varlistentry>
58000 <term><emphasis role="bold">opt_int</emphasis></term>
58001 <listitem>
58002 <para>
58003 This specifies an integer; the address should point to a variable of type
58004 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
58005 Exim.
58006 </para>
58007 </listitem></varlistentry>
58008 <varlistentry>
58009 <term><emphasis role="bold">opt_mkint</emphasis></term>
58010 <listitem>
58011 <para>
58012 This is the same as <option>opt_int</option>, except that when such a value is output in a
58013 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
58014 printed with the suffix K or M.
58015 </para>
58016 </listitem></varlistentry>
58017 <varlistentry>
58018 <term><emphasis role="bold">opt_octint</emphasis></term>
58019 <listitem>
58020 <para>
58021 This also specifies an integer, but the value is always interpreted as an
58022 octal integer, whether or not it starts with the digit zero, and it is
58023 always output in octal.
58024 </para>
58025 </listitem></varlistentry>
58026 <varlistentry>
58027 <term><emphasis role="bold">opt_stringptr</emphasis></term>
58028 <listitem>
58029 <para>
58030 This specifies a string value; the address must be a pointer to a
58031 variable that points to a string (for example, of type <literal>uschar *</literal>).
58032 </para>
58033 </listitem></varlistentry>
58034 <varlistentry>
58035 <term><emphasis role="bold">opt_time</emphasis></term>
58036 <listitem>
58037 <para>
58038 This specifies a time interval value. The address must point to a variable of
58039 type <literal>int</literal>. The value that is placed there is a number of seconds.
58040 </para>
58041 </listitem></varlistentry>
58042 </variablelist>
58043 <para>
58044 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
58045 out the values of all the <function>local_scan()</function> options.
58046 </para>
58047 </section>
58048 <section id="SECID208">
58049 <title>Available Exim variables</title>
58050 <para>
58051 <indexterm role="concept">
58052 <primary><function>local_scan()</function> function</primary>
58053 <secondary>available Exim variables</secondary>
58054 </indexterm>
58055 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
58056 are the only ones that are guaranteed to be maintained from release to release.
58057 Note, however, that you can obtain the value of any Exim expansion variable,
58058 including <varname>$recipients</varname>, by calling <emphasis>expand_string()</emphasis>. The exported
58059 C variables are as follows:
58060 </para>
58061 <variablelist>
58062 <varlistentry>
58063 <term><emphasis role="bold">int&nbsp;body_linecount</emphasis></term>
58064 <listitem>
58065 <para>
58066 This variable contains the number of lines in the message&#x2019;s body.
58067 </para>
58068 </listitem></varlistentry>
58069 <varlistentry>
58070 <term><emphasis role="bold">int&nbsp;body_zerocount</emphasis></term>
58071 <listitem>
58072 <para>
58073 This variable contains the number of binary zero bytes in the message&#x2019;s body.
58074 </para>
58075 </listitem></varlistentry>
58076 <varlistentry>
58077 <term><emphasis role="bold">unsigned&nbsp;int&nbsp;debug_selector</emphasis></term>
58078 <listitem>
58079 <para>
58080 This variable is set to zero when no debugging is taking place. Otherwise, it
58081 is a bitmap of debugging selectors. Two bits are identified for use in
58082 <function>local_scan()</function>; they are defined as macros:
58083 </para>
58084 <itemizedlist>
58085 <listitem>
58086 <para>
58087 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
58088 testing option that is not privileged &ndash; any caller may set it. All the
58089 other selector bits can be set only by admin users.
58090 </para>
58091 </listitem>
58092 <listitem>
58093 <para>
58094 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
58095 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
58096 of debugging bits.
58097 </para>
58098 </listitem>
58099 </itemizedlist>
58100 <para>
58101 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
58102 selected, you should use code like this:
58103 </para>
58104 <literallayout class="monospaced">
58105 if ((debug_selector &amp; D_local_scan) != 0)
58106   debug_printf("xxx", ...);
58107 </literallayout>
58108 </listitem></varlistentry>
58109 <varlistentry>
58110 <term><emphasis role="bold">uschar&nbsp;*expand_string_message</emphasis></term>
58111 <listitem>
58112 <para>
58113 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
58114 variable <option>expand_string_message</option> contains the error message, zero-terminated.
58115 </para>
58116 </listitem></varlistentry>
58117 <varlistentry>
58118 <term><emphasis role="bold">header_line&nbsp;*header_list</emphasis></term>
58119 <listitem>
58120 <para>
58121 A pointer to a chain of header lines. The <option>header_line</option> structure is
58122 discussed below.
58123 </para>
58124 </listitem></varlistentry>
58125 <varlistentry>
58126 <term><emphasis role="bold">header_line&nbsp;*header_last</emphasis></term>
58127 <listitem>
58128 <para>
58129 A pointer to the last of the header lines.
58130 </para>
58131 </listitem></varlistentry>
58132 <varlistentry>
58133 <term><emphasis role="bold">uschar&nbsp;*headers_charset</emphasis></term>
58134 <listitem>
58135 <para>
58136 The value of the <option>headers_charset</option> configuration option.
58137 </para>
58138 </listitem></varlistentry>
58139 <varlistentry>
58140 <term><emphasis role="bold">BOOL&nbsp;host_checking</emphasis></term>
58141 <listitem>
58142 <para>
58143 This variable is TRUE during a host checking session that is initiated by the
58144 <option>-bh</option> command line option.
58145 </para>
58146 </listitem></varlistentry>
58147 <varlistentry>
58148 <term><emphasis role="bold">uschar&nbsp;*interface_address</emphasis></term>
58149 <listitem>
58150 <para>
58151 The IP address of the interface that received the message, as a string. This
58152 is NULL for locally submitted messages.
58153 </para>
58154 </listitem></varlistentry>
58155 <varlistentry>
58156 <term><emphasis role="bold">int&nbsp;interface_port</emphasis></term>
58157 <listitem>
58158 <para>
58159 The port on which this message was received. When testing with the <option>-bh</option>
58160 command line option, the value of this variable is -1 unless a port has been
58161 specified via the <option>-oMi</option> option.
58162 </para>
58163 </listitem></varlistentry>
58164 <varlistentry>
58165 <term><emphasis role="bold">uschar&nbsp;*message_id</emphasis></term>
58166 <listitem>
58167 <para>
58168 This variable contains Exim&#x2019;s message id for the incoming message (the value of
58169 <varname>$message_exim_id</varname>) as a zero-terminated string.
58170 </para>
58171 </listitem></varlistentry>
58172 <varlistentry>
58173 <term><emphasis role="bold">uschar&nbsp;*received_protocol</emphasis></term>
58174 <listitem>
58175 <para>
58176 The name of the protocol by which the message was received.
58177 </para>
58178 </listitem></varlistentry>
58179 <varlistentry>
58180 <term><emphasis role="bold">int&nbsp;recipients_count</emphasis></term>
58181 <listitem>
58182 <para>
58183 The number of accepted recipients.
58184 </para>
58185 </listitem></varlistentry>
58186 <varlistentry>
58187 <term><emphasis role="bold">recipient_item&nbsp;*recipients_list</emphasis></term>
58188 <listitem>
58189 <para>
58190 <indexterm role="concept">
58191 <primary>recipient</primary>
58192 <secondary>adding in local scan</secondary>
58193 </indexterm>
58194 <indexterm role="concept">
58195 <primary>recipient</primary>
58196 <secondary>removing in local scan</secondary>
58197 </indexterm>
58198 The list of accepted recipients, held in a vector of length
58199 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
58200 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
58201 below). You can delete recipients by removing them from the vector and
58202 adjusting the value in <option>recipients_count</option>. In particular, by setting
58203 <option>recipients_count</option> to zero you remove all recipients. If you then return the
58204 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
58205 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
58206 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
58207 </para>
58208 </listitem></varlistentry>
58209 <varlistentry>
58210 <term><emphasis role="bold">uschar&nbsp;*sender_address</emphasis></term>
58211 <listitem>
58212 <para>
58213 The envelope sender address. For bounce messages this is the empty string.
58214 </para>
58215 </listitem></varlistentry>
58216 <varlistentry>
58217 <term><emphasis role="bold">uschar&nbsp;*sender_host_address</emphasis></term>
58218 <listitem>
58219 <para>
58220 The IP address of the sending host, as a string. This is NULL for
58221 locally-submitted messages.
58222 </para>
58223 </listitem></varlistentry>
58224 <varlistentry>
58225 <term><emphasis role="bold">uschar&nbsp;*sender_host_authenticated</emphasis></term>
58226 <listitem>
58227 <para>
58228 The name of the authentication mechanism that was used, or NULL if the message
58229 was not received over an authenticated SMTP connection.
58230 </para>
58231 </listitem></varlistentry>
58232 <varlistentry>
58233 <term><emphasis role="bold">uschar&nbsp;*sender_host_name</emphasis></term>
58234 <listitem>
58235 <para>
58236 The name of the sending host, if known.
58237 </para>
58238 </listitem></varlistentry>
58239 <varlistentry>
58240 <term><emphasis role="bold">int&nbsp;sender_host_port</emphasis></term>
58241 <listitem>
58242 <para>
58243 The port on the sending host.
58244 </para>
58245 </listitem></varlistentry>
58246 <varlistentry>
58247 <term><emphasis role="bold">BOOL&nbsp;smtp_input</emphasis></term>
58248 <listitem>
58249 <para>
58250 This variable is TRUE for all SMTP input, including BSMTP.
58251 </para>
58252 </listitem></varlistentry>
58253 <varlistentry>
58254 <term><emphasis role="bold">BOOL&nbsp;smtp_batched_input</emphasis></term>
58255 <listitem>
58256 <para>
58257 This variable is TRUE for BSMTP input.
58258 </para>
58259 </listitem></varlistentry>
58260 <varlistentry>
58261 <term><emphasis role="bold">int&nbsp;store_pool</emphasis></term>
58262 <listitem>
58263 <para>
58264 The contents of this variable control which pool of memory is used for new
58265 requests. See section <xref linkend="SECTmemhanloc"/> for details.
58266 </para>
58267 </listitem></varlistentry>
58268 </variablelist>
58269 </section>
58270 <section id="SECID209">
58271 <title>Structure of header lines</title>
58272 <para>
58273 The <option>header_line</option> structure contains the members listed below.
58274 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
58275 (see below). You can cause header lines to be ignored (deleted) by setting
58276 their type to *.
58277 </para>
58278 <variablelist>
58279 <varlistentry>
58280 <term><emphasis role="bold">struct&nbsp;header_line&nbsp;*next</emphasis></term>
58281 <listitem>
58282 <para>
58283 A pointer to the next header line, or NULL for the last line.
58284 </para>
58285 </listitem></varlistentry>
58286 <varlistentry>
58287 <term><emphasis role="bold">int&nbsp;type</emphasis></term>
58288 <listitem>
58289 <para>
58290 A code identifying certain headers that Exim recognizes. The codes are printing
58291 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
58292 Notice in particular that any header line whose type is * is not transmitted
58293 with the message. This flagging is used for header lines that have been
58294 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
58295 lines.) Effectively, * means <quote>deleted</quote>.
58296 </para>
58297 </listitem></varlistentry>
58298 <varlistentry>
58299 <term><emphasis role="bold">int&nbsp;slen</emphasis></term>
58300 <listitem>
58301 <para>
58302 The number of characters in the header line, including the terminating and any
58303 internal newlines.
58304 </para>
58305 </listitem></varlistentry>
58306 <varlistentry>
58307 <term><emphasis role="bold">uschar&nbsp;*text</emphasis></term>
58308 <listitem>
58309 <para>
58310 A pointer to the text of the header. It always ends with a newline, followed by
58311 a zero byte. Internal newlines are preserved.
58312 </para>
58313 </listitem></varlistentry>
58314 </variablelist>
58315 </section>
58316 <section id="SECID210">
58317 <title>Structure of recipient items</title>
58318 <para>
58319 The <option>recipient_item</option> structure contains these members:
58320 </para>
58321 <variablelist>
58322 <varlistentry>
58323 <term><emphasis role="bold">uschar&nbsp;*address</emphasis></term>
58324 <listitem>
58325 <para>
58326 This is a pointer to the recipient address as it was received.
58327 </para>
58328 </listitem></varlistentry>
58329 <varlistentry>
58330 <term><emphasis role="bold">int&nbsp;pno</emphasis></term>
58331 <listitem>
58332 <para>
58333 This is used in later Exim processing when top level addresses are created by
58334 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
58335 and must always contain -1 at this stage.
58336 </para>
58337 </listitem></varlistentry>
58338 <varlistentry>
58339 <term><emphasis role="bold">uschar&nbsp;*errors_to</emphasis></term>
58340 <listitem>
58341 <para>
58342 If this value is not NULL, bounce messages caused by failing to deliver to the
58343 recipient are sent to the address it contains. In other words, it overrides the
58344 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
58345 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
58346 an unqualified address, Exim qualifies it using the domain from
58347 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
58348 is NULL for all recipients.
58349 </para>
58350 </listitem></varlistentry>
58351 </variablelist>
58352 </section>
58353 <section id="SECID211">
58354 <title>Available Exim functions</title>
58355 <para>
58356 <indexterm role="concept">
58357 <primary><function>local_scan()</function> function</primary>
58358 <secondary>available Exim functions</secondary>
58359 </indexterm>
58360 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
58361 These are the only ones that are guaranteed to be maintained from release to
58362 release:
58363 </para>
58364 <variablelist>
58365 <varlistentry>
58366 <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>
58367 <listitem>
58368 <para>
58369 This function creates a child process that runs the command specified by
58370 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
58371 be NULL if no environment variables are to be passed. A new umask is supplied
58372 for the process in <option>newumask</option>.
58373 </para>
58374 <para>
58375 Pipes to the standard input and output of the new process are set up
58376 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
58377 standard error is cloned to the standard output. If there are any file
58378 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
58379 argument is TRUE, the new process is made into a process group leader.
58380 </para>
58381 <para>
58382 The function returns the pid of the new process, or -1 if things go wrong.
58383 </para>
58384 </listitem></varlistentry>
58385 <varlistentry>
58386 <term><emphasis role="bold">int&nbsp;child_close(pid_t&nbsp;pid,&nbsp;int&nbsp;timeout)</emphasis></term>
58387 <listitem>
58388 <para>
58389 This function waits for a child process to terminate, or for a timeout (in
58390 seconds) to expire. A timeout value of zero means wait as long as it takes. The
58391 return value is as follows:
58392 </para>
58393 <itemizedlist>
58394 <listitem>
58395 <para>
58396 &gt;= 0
58397 </para>
58398 <para>
58399 The process terminated by a normal exit and the value is the process
58400 ending status.
58401 </para>
58402 </listitem>
58403 <listitem>
58404 <para>
58405 &lt; 0 and &gt; &ndash;256
58406 </para>
58407 <para>
58408 The process was terminated by a signal and the value is the negation of the
58409 signal number.
58410 </para>
58411 </listitem>
58412 <listitem>
58413 <para>
58414 &ndash;256
58415 </para>
58416 <para>
58417 The process timed out.
58418 </para>
58419 </listitem>
58420 <listitem>
58421 <para>
58422 &ndash;257
58423 </para>
58424 <para>
58425 The was some other error in wait(); <option>errno</option> is still set.
58426 </para>
58427 </listitem>
58428 </itemizedlist>
58429 </listitem></varlistentry>
58430 <varlistentry>
58431 <term><emphasis role="bold">pid_t&nbsp;child_open_exim(int&nbsp;*fd)</emphasis></term>
58432 <listitem>
58433 <para>
58434 This function provide you with a means of submitting a new message to
58435 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
58436 want, but this packages it all up for you.) The function creates a pipe,
58437 forks a subprocess that is running
58438 </para>
58439 <literallayout class="monospaced">
58440 exim -t -oem -oi -f &lt;&gt;
58441 </literallayout>
58442 <para>
58443 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
58444 that is connected to the standard input. The yield of the function is the PID
58445 of the subprocess. You can then write a message to the file descriptor, with
58446 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
58447 </para>
58448 <para>
58449 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
58450 finish and to collect its ending status. A timeout value of zero is usually
58451 fine in this circumstance. Unless you have made a mistake with the recipient
58452 addresses, you should get a return code of zero.
58453 </para>
58454 </listitem></varlistentry>
58455 <varlistentry>
58456 <term><emphasis role="bold">pid_t&nbsp;child_open_exim2(int&nbsp;*fd,&nbsp;uschar&nbsp;*sender,&nbsp;uschar&nbsp;*sender_authentication)</emphasis></term>
58457 <listitem>
58458 <para>
58459 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
58460 that it runs is:
58461 </para>
58462 <literallayout>
58463 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
58464 </literallayout>
58465 <para>
58466 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
58467 </para>
58468 </listitem></varlistentry>
58469 <varlistentry>
58470 <term><emphasis role="bold">void&nbsp;debug_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
58471 <listitem>
58472 <para>
58473 This is Exim&#x2019;s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
58474 output is written to the standard error stream. If no debugging is selected,
58475 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
58476 conditional on the <literal>local_scan</literal> debug selector by coding like this:
58477 </para>
58478 <literallayout class="monospaced">
58479 if ((debug_selector &amp; D_local_scan) != 0)
58480   debug_printf("xxx", ...);
58481 </literallayout>
58482 </listitem></varlistentry>
58483 <varlistentry>
58484 <term><emphasis role="bold">uschar&nbsp;*expand_string(uschar&nbsp;*string)</emphasis></term>
58485 <listitem>
58486 <para>
58487 This is an interface to Exim&#x2019;s string expansion code. The return value is the
58488 expanded string, or NULL if there was an expansion failure.
58489 The C variable <option>expand_string_message</option> contains an error message after an
58490 expansion failure. If expansion does not change the string, the return value is
58491 the pointer to the input string. Otherwise, the return value points to a new
58492 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
58493 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
58494 </para>
58495 </listitem></varlistentry>
58496 <varlistentry>
58497 <term><emphasis role="bold">void&nbsp;header_add(int&nbsp;type,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
58498 <listitem>
58499 <para>
58500 This function allows you to an add additional header line at the end of the
58501 existing ones. The first argument is the type, and should normally be a space
58502 character. The second argument is a format string and any number of
58503 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
58504 if you want, and you must ensure that the string ends with a newline.
58505 </para>
58506 </listitem></varlistentry>
58507 <varlistentry>
58508 <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>
58509 <listitem>
58510 <para>
58511 This function adds a new header line at a specified point in the header
58512 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
58513 </para>
58514 <para>
58515 If <option>name</option> is NULL, the new header is added at the end of the chain if
58516 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
58517 NULL, the header lines are searched for the first non-deleted header that
58518 matches the name. If one is found, the new header is added before it if
58519 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
58520 found header and any adjacent subsequent ones with the same name (even if
58521 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
58522 option controls where the header is added. If it is true, addition is at the
58523 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
58524 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
58525 </para>
58526 <literallayout class="monospaced">
58527 header_add_at_position(TRUE, US"Received", TRUE,
58528   ' ', "X-xxx: ...");
58529 </literallayout>
58530 <para>
58531 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
58532 there may not be if <option>received_header_text</option> expands to an empty string.
58533 </para>
58534 </listitem></varlistentry>
58535 <varlistentry>
58536 <term><emphasis role="bold">void&nbsp;header_remove(int&nbsp;occurrence,&nbsp;uschar&nbsp;*name)</emphasis></term>
58537 <listitem>
58538 <para>
58539 This function removes header lines. If <option>occurrence</option> is zero or negative, all
58540 occurrences of the header are removed. If occurrence is greater than zero, that
58541 particular instance of the header is removed. If no header(s) can be found that
58542 match the specification, the function does nothing.
58543 </para>
58544 </listitem></varlistentry>
58545 <varlistentry>
58546 <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>
58547 <listitem>
58548 <para>
58549 This function tests whether the given header has the given name. It is not just
58550 a string comparison, because white space is permitted between the name and the
58551 colon. If the <option>notdel</option> argument is true, a false return is forced for all
58552 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
58553 </para>
58554 <literallayout class="monospaced">
58555 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
58556 </literallayout>
58557 </listitem></varlistentry>
58558 <varlistentry>
58559 <term><emphasis role="bold">uschar&nbsp;*lss_b64encode(uschar&nbsp;*cleartext,&nbsp;int&nbsp;length)</emphasis></term>
58560 <listitem>
58561 <para>
58562 <indexterm role="concept">
58563 <primary>base64 encoding</primary>
58564 <secondary>functions for <function>local_scan()</function> use</secondary>
58565 </indexterm>
58566 This function base64-encodes a string, which is passed by address and length.
58567 The text may contain bytes of any value, including zero. The result is passed
58568 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
58569 zero-terminated.
58570 </para>
58571 </listitem></varlistentry>
58572 <varlistentry>
58573 <term><emphasis role="bold">int&nbsp;lss_b64decode(uschar&nbsp;*codetext,&nbsp;uschar&nbsp;**cleartext)</emphasis></term>
58574 <listitem>
58575 <para>
58576 This function decodes a base64-encoded string. Its arguments are a
58577 zero-terminated base64-encoded string and the address of a variable that is set
58578 to point to the result, which is in dynamic memory. The length of the decoded
58579 string is the yield of the function. If the input is invalid base64 data, the
58580 yield is -1. A zero byte is added to the end of the output string to make it
58581 easy to interpret as a C string (assuming it contains no zeros of its own). The
58582 added zero byte is not included in the returned count.
58583 </para>
58584 </listitem></varlistentry>
58585 <varlistentry>
58586 <term><emphasis role="bold">int&nbsp;lss_match_domain(uschar&nbsp;*domain,&nbsp;uschar&nbsp;*list)</emphasis></term>
58587 <listitem>
58588 <para>
58589 This function checks for a match in a domain list. Domains are always
58590 matched caselessly. The return value is one of the following:
58591 </para>
58592 <literallayout>
58593 <literal>OK     </literal> match succeeded
58594 <literal>FAIL   </literal> match failed
58595 <literal>DEFER  </literal> match deferred
58596 </literallayout>
58597 <para>
58598 DEFER is usually caused by some kind of lookup defer, such as the
58599 inability to contact a database.
58600 </para>
58601 </listitem></varlistentry>
58602 <varlistentry>
58603 <term><emphasis role="bold">int&nbsp;lss_match_local_part(uschar&nbsp;*localpart,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
58604 <listitem>
58605 <para>
58606 This function checks for a match in a local part list. The third argument
58607 controls case-sensitivity. The return values are as for
58608 <emphasis>lss_match_domain()</emphasis>.
58609 </para>
58610 </listitem></varlistentry>
58611 <varlistentry>
58612 <term><emphasis role="bold">int&nbsp;lss_match_address(uschar&nbsp;*address,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
58613 <listitem>
58614 <para>
58615 This function checks for a match in an address list. The third argument
58616 controls the case-sensitivity of the local part match. The domain is always
58617 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
58618 </para>
58619 </listitem></varlistentry>
58620 <varlistentry>
58621 <term><emphasis role="bold">int&nbsp;lss_match_host(uschar&nbsp;*host_name,&nbsp;uschar&nbsp;*host_address,&nbsp;uschar&nbsp;*list)</emphasis></term>
58622 <listitem>
58623 <para>
58624 This function checks for a match in a host list. The most common usage is
58625 expected to be
58626 </para>
58627 <literallayout class="monospaced">
58628 lss_match_host(sender_host_name, sender_host_address, ...)
58629 </literallayout>
58630 <para>
58631 <indexterm role="variable">
58632 <primary><varname>$sender_host_address</varname></primary>
58633 </indexterm>
58634 An empty address field matches an empty item in the host list. If the host name
58635 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
58636 looked up if a host name is required to match an item in the list. The return
58637 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
58638 returns ERROR in the case when it had to look up a host name, but the lookup
58639 failed.
58640 </para>
58641 </listitem></varlistentry>
58642 <varlistentry>
58643 <term><emphasis role="bold">void&nbsp;log_write(unsigned&nbsp;int&nbsp;selector,&nbsp;int&nbsp;which,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
58644 <listitem>
58645 <para>
58646 This function writes to Exim&#x2019;s log files. The first argument should be zero (it
58647 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
58648 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
58649 them. It specifies to which log or logs the message is written. The remaining
58650 arguments are a format and relevant insertion arguments. The string should not
58651 contain any newlines, not even at the end.
58652 </para>
58653 </listitem></varlistentry>
58654 <varlistentry>
58655 <term><emphasis role="bold">void&nbsp;receive_add_recipient(uschar&nbsp;*address,&nbsp;int&nbsp;pno)</emphasis></term>
58656 <listitem>
58657 <para>
58658 This function adds an additional recipient to the message. The first argument
58659 is the recipient address. If it is unqualified (has no domain), it is qualified
58660 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
58661 </para>
58662 <para>
58663 This function does not allow you to specify a private <option>errors_to</option> address (as
58664 described with the structure of <option>recipient_item</option> above), because it pre-dates
58665 the addition of that field to the structure. However, it is easy to add such a
58666 value afterwards. For example:
58667 </para>
58668 <literallayout class="monospaced">
58669  receive_add_recipient(US"monitor@mydom.example", -1);
58670  recipients_list[recipients_count-1].errors_to =
58671    US"postmaster@mydom.example";
58672 </literallayout>
58673 </listitem></varlistentry>
58674 <varlistentry>
58675 <term><emphasis role="bold">BOOL&nbsp;receive_remove_recipient(uschar&nbsp;*recipient)</emphasis></term>
58676 <listitem>
58677 <para>
58678 This is a convenience function to remove a named recipient from the list of
58679 recipients. It returns true if a recipient was removed, and false if no
58680 matching recipient could be found. The argument must be a complete email
58681 address.
58682 </para>
58683 </listitem></varlistentry>
58684 </variablelist>
58685 <para>
58686 <indexterm role="concept">
58687 <primary>RFC 2047</primary>
58688 </indexterm>
58689 </para>
58690 <variablelist>
58691 <varlistentry>
58692 <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>
58693 <listitem>
58694 <para>
58695 This function decodes strings that are encoded according to RFC 2047. Typically
58696 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
58697 from the Q or B encoding into a byte-string. Then, if provided with the name of
58698 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
58699 made  to translate the result to the named character set. If this fails, the
58700 binary string is returned with an error message.
58701 </para>
58702 <para>
58703 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
58704 maximum MIME word length is enforced. The third argument is the target
58705 encoding, or NULL if no translation is wanted.
58706 </para>
58707 <para>
58708 <indexterm role="concept">
58709 <primary>binary zero</primary>
58710 <secondary>in RFC 2047 decoding</secondary>
58711 </indexterm>
58712 <indexterm role="concept">
58713 <primary>RFC 2047</primary>
58714 <secondary>binary zero in</secondary>
58715 </indexterm>
58716 If a binary zero is encountered in the decoded string, it is replaced by the
58717 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
58718 not be 0 because header lines are handled as zero-terminated strings.
58719 </para>
58720 <para>
58721 The function returns the result of processing the string, zero-terminated; if
58722 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
58723 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
58724 </para>
58725 <para>
58726 If an error is encountered, the function returns NULL and uses the <option>error</option>
58727 argument to return an error message. The variable pointed to by <option>error</option> is
58728 set to NULL if there is no error; it may be set non-NULL even when the function
58729 returns a non-NULL value if decoding was successful, but there was a problem
58730 with translation.
58731 </para>
58732 </listitem></varlistentry>
58733 <varlistentry>
58734 <term><emphasis role="bold">int&nbsp;smtp_fflush(void)</emphasis></term>
58735 <listitem>
58736 <para>
58737 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
58738 below.
58739 </para>
58740 </listitem></varlistentry>
58741 <varlistentry>
58742 <term><emphasis role="bold">void&nbsp;smtp_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
58743 <listitem>
58744 <para>
58745 The arguments of this function are like <function>printf()</function>; it writes to the SMTP
58746 output stream. You should use this function only when there is an SMTP output
58747 stream, that is, when the incoming message is being received via interactive
58748 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
58749 is FALSE. If you want to test for an incoming message from another host (as
58750 opposed to a local process that used the <option>-bs</option> command line option), you can
58751 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
58752 is involved.
58753 </para>
58754 <para>
58755 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
58756 output function, so it can be used for all forms of SMTP connection.
58757 </para>
58758 <para>
58759 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
58760 must start with an appropriate response code: 550 if you are going to return
58761 LOCAL_SCAN_REJECT, 451 if you are going to return
58762 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
58763 initial lines of a multi-line response, the code must be followed by a hyphen
58764 to indicate that the line is not the final response line. You must also ensure
58765 that the lines you write terminate with CRLF. For example:
58766 </para>
58767 <literallayout class="monospaced">
58768 smtp_printf("550-this is some extra info\r\n");
58769 return LOCAL_SCAN_REJECT;
58770 </literallayout>
58771 <para>
58772 Note that you can also create multi-line responses by including newlines in
58773 the data returned via the <option>return_text</option> argument. The added value of using
58774 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
58775 multiple output lines.
58776 </para>
58777 <para>
58778 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
58779 does not automatically flush pending output, and therefore does not test
58780 the state of the stream. (In the main code of Exim, flushing and error
58781 detection is done when Exim is ready for the next SMTP input command.) If
58782 you want to flush the output and check for an error (for example, the
58783 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
58784 arguments. It flushes the output stream, and returns a non-zero value if there
58785 is an error.
58786 </para>
58787 </listitem></varlistentry>
58788 <varlistentry>
58789 <term><emphasis role="bold">void&nbsp;*store_get(int)</emphasis></term>
58790 <listitem>
58791 <para>
58792 This function accesses Exim&#x2019;s internal store (memory) manager. It gets a new
58793 chunk of memory whose size is given by the argument. Exim bombs out if it ever
58794 runs out of memory. See the next section for a discussion of memory handling.
58795 </para>
58796 </listitem></varlistentry>
58797 <varlistentry>
58798 <term><emphasis role="bold">void&nbsp;*store_get_perm(int)</emphasis></term>
58799 <listitem>
58800 <para>
58801 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
58802 permanent pool. See the next section for a discussion of memory handling.
58803 </para>
58804 </listitem></varlistentry>
58805 <varlistentry>
58806 <term><emphasis role="bold">uschar&nbsp;*string_copy(uschar&nbsp;*string)</emphasis></term>
58807 <listitem>
58808 <para>
58809 See below.
58810 </para>
58811 </listitem></varlistentry>
58812 <varlistentry>
58813 <term><emphasis role="bold">uschar&nbsp;*string_copyn(uschar&nbsp;*string,&nbsp;int&nbsp;length)</emphasis></term>
58814 <listitem>
58815 <para>
58816 See below.
58817 </para>
58818 </listitem></varlistentry>
58819 <varlistentry>
58820 <term><emphasis role="bold">uschar&nbsp;*string_sprintf(char&nbsp;*format,&nbsp;...)</emphasis></term>
58821 <listitem>
58822 <para>
58823 These three functions create strings using Exim&#x2019;s dynamic memory facilities.
58824 The first makes a copy of an entire string. The second copies up to a maximum
58825 number of characters, indicated by the second argument. The third uses a format
58826 and insertion arguments to create a new string. In each case, the result is a
58827 pointer to a new string in the current memory pool. See the next section for
58828 more discussion.
58829 </para>
58830 </listitem></varlistentry>
58831 </variablelist>
58832 </section>
58833 <section id="SECTmemhanloc">
58834 <title>More about Exim&#x2019;s memory handling</title>
58835 <para>
58836 <indexterm role="concept">
58837 <primary><function>local_scan()</function> function</primary>
58838 <secondary>memory handling</secondary>
58839 </indexterm>
58840 No function is provided for freeing memory, because that is never needed.
58841 The dynamic memory that Exim uses when receiving a message is automatically
58842 recycled if another message is received by the same process (this applies only
58843 to incoming SMTP connections &ndash; other input methods can supply only one
58844 message at a time). After receiving the last message, a reception process
58845 terminates.
58846 </para>
58847 <para>
58848 Because it is recycled, the normal dynamic memory cannot be used for holding
58849 data that must be preserved over a number of incoming messages on the same SMTP
58850 connection. However, Exim in fact uses two pools of dynamic memory; the second
58851 one is not recycled, and can be used for this purpose.
58852 </para>
58853 <para>
58854 If you want to allocate memory that remains available for subsequent messages
58855 in the same SMTP connection, you should set
58856 </para>
58857 <literallayout class="monospaced">
58858 store_pool = POOL_PERM
58859 </literallayout>
58860 <para>
58861 before calling the function that does the allocation. There is no need to
58862 restore the value if you do not need to; however, if you do want to revert to
58863 the normal pool, you can either restore the previous value of <option>store_pool</option> or
58864 set it explicitly to POOL_MAIN.
58865 </para>
58866 <para>
58867 The pool setting applies to all functions that get dynamic memory, including
58868 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
58869 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
58870 block of memory from the permanent pool while preserving the value of
58871 <option>store_pool</option>.
58872 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
58873 </para>
58874 </section>
58875 </chapter>
58876
58877 <chapter id="CHAPsystemfilter">
58878 <title>System-wide message filtering</title>
58879 <para>
58880 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
58881 <primary>filter</primary>
58882 <secondary>system filter</secondary>
58883 </indexterm>
58884 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
58885 <primary>filtering all mail</primary>
58886 </indexterm>
58887 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
58888 <primary>system filter</primary>
58889 </indexterm>
58890 The previous chapters (on ACLs and the local scan function) describe checks
58891 that can be applied to messages before they are accepted by a host. There is
58892 also a mechanism for checking messages once they have been received, but before
58893 they are delivered. This is called the <emphasis>system filter</emphasis>.
58894 </para>
58895 <para>
58896 The system filter operates in a similar manner to users&#x2019; filter files, but it
58897 is run just once per message (however many recipients the message has).
58898 It should not normally be used as a substitute for routing, because <option>deliver</option>
58899 commands in a system router provide new envelope recipient addresses.
58900 The system filter must be an Exim filter. It cannot be a Sieve filter.
58901 </para>
58902 <para>
58903 The system filter is run at the start of a delivery attempt, before any routing
58904 is done. If a message fails to be completely delivered at the first attempt,
58905 the system filter is run again at the start of every retry.
58906 If you want your filter to do something only once per message, you can make use
58907 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
58908 prevent it happening on retries.
58909 </para>
58910 <para>
58911 <indexterm role="variable">
58912 <primary><varname>$domain</varname></primary>
58913 </indexterm>
58914 <indexterm role="variable">
58915 <primary><varname>$local_part</varname></primary>
58916 </indexterm>
58917 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
58918 specific to individual recipient addresses, such as <varname>$local_part</varname> and
58919 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
58920 you want to run a centrally-specified filter for each recipient address
58921 independently, you can do so by setting up a suitable <command>redirect</command> router, as
58922 described in section <xref linkend="SECTperaddfil"/> below.
58923 </para>
58924 <section id="SECID212">
58925 <title>Specifying a system filter</title>
58926 <para>
58927 <indexterm role="concept">
58928 <primary>uid (user id)</primary>
58929 <secondary>system filter</secondary>
58930 </indexterm>
58931 <indexterm role="concept">
58932 <primary>gid (group id)</primary>
58933 <secondary>system filter</secondary>
58934 </indexterm>
58935 The name of the file that contains the system filter must be specified by
58936 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
58937 other than root, you must also set <option>system_filter_user</option> and
58938 <option>system_filter_group</option> as appropriate. For example:
58939 </para>
58940 <literallayout class="monospaced">
58941 system_filter = /etc/mail/exim.filter
58942 system_filter_user = exim
58943 </literallayout>
58944 <para>
58945 If a system filter generates any deliveries directly to files or pipes (via the
58946 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
58947 specified by setting <option>system_filter_file_transport</option> and
58948 <option>system_filter_pipe_transport</option>, respectively. Similarly,
58949 <option>system_filter_reply_transport</option> must be set to handle any messages generated
58950 by the <option>reply</option> command.
58951 </para>
58952 </section>
58953 <section id="SECID213">
58954 <title>Testing a system filter</title>
58955 <para>
58956 You can run simple tests of a system filter in the same way as for a user
58957 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
58958 are permitted only in system filters are recognized.
58959 </para>
58960 <para>
58961 If you want to test the combined effect of a system filter and a user filter,
58962 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
58963 </para>
58964 </section>
58965 <section id="SECID214">
58966 <title>Contents of a system filter</title>
58967 <para>
58968 The language used to specify system filters is the same as for users&#x2019; filter
58969 files. It is described in the separate end-user document <emphasis>Exim&#x2019;s interface to
58970 mail filtering</emphasis>. However, there are some additional features that are
58971 available only in system filters; these are described in subsequent sections.
58972 If they are encountered in a user&#x2019;s filter file or when testing with <option>-bf</option>,
58973 they cause errors.
58974 </para>
58975 <para>
58976 <indexterm role="concept">
58977 <primary>frozen messages</primary>
58978 <secondary>manual thaw; testing in filter</secondary>
58979 </indexterm>
58980 There are two special conditions which, though available in users&#x2019; filter
58981 files, are designed for use in system filters. The condition <option>first_delivery</option>
58982 is true only for the first attempt at delivering a message, and
58983 <option>manually_thawed</option> is true only if the message has been frozen, and
58984 subsequently thawed by an admin user. An explicit forced delivery counts as a
58985 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
58986 </para>
58987 <para>
58988 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
58989 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
58990 succeed, it will not be tried again.
58991 If you want Exim to retry an unseen delivery until it succeeds, you should
58992 arrange to set it up every time the filter runs.
58993 </para>
58994 <para>
58995 When a system filter finishes running, the values of the variables <varname>$n0</varname> &ndash;
58996 <varname>$n9</varname> are copied into <varname>$sn0</varname> &ndash; <varname>$sn9</varname> and are thereby made available to
58997 users&#x2019; filter files. Thus a system filter can, for example, set up <quote>scores</quote>
58998 to which users&#x2019; filter files can refer.
58999 </para>
59000 </section>
59001 <section id="SECID215">
59002 <title>Additional variable for system filters</title>
59003 <para>
59004 <indexterm role="variable">
59005 <primary><varname>$recipients</varname></primary>
59006 </indexterm>
59007 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
59008 of the message (separated by commas and white space), is available in system
59009 filters. It is not available in users&#x2019; filters for privacy reasons.
59010 </para>
59011 </section>
59012 <section id="SECID216">
59013 <title>Defer, freeze, and fail commands for system filters</title>
59014 <para>
59015 <indexterm role="concept">
59016 <primary>freezing messages</primary>
59017 </indexterm>
59018 <indexterm role="concept">
59019 <primary>message</primary>
59020 <secondary>freezing</secondary>
59021 </indexterm>
59022 <indexterm role="concept">
59023 <primary>message</primary>
59024 <secondary>forced failure</secondary>
59025 </indexterm>
59026 <indexterm role="concept">
59027 <primary><option>fail</option></primary>
59028 <secondary>in system filter</secondary>
59029 </indexterm>
59030 <indexterm role="concept">
59031 <primary><option>freeze</option> in system filter</primary>
59032 </indexterm>
59033 <indexterm role="concept">
59034 <primary><option>defer</option> in system filter</primary>
59035 </indexterm>
59036 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
59037 always available in system filters, but are not normally enabled in users&#x2019;
59038 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
59039 for the <command>redirect</command> router.) These commands can optionally be followed by the
59040 word <option>text</option> and a string containing an error message, for example:
59041 </para>
59042 <literallayout class="monospaced">
59043 fail text "this message looks like spam to me"
59044 </literallayout>
59045 <para>
59046 The keyword <option>text</option> is optional if the next character is a double quote.
59047 </para>
59048 <para>
59049 The <option>defer</option> command defers delivery of the original recipients of the
59050 message. The <option>fail</option> command causes all the original recipients to be failed,
59051 and a bounce message to be created. The <option>freeze</option> command suspends all
59052 delivery attempts for the original recipients. In all cases, any new deliveries
59053 that are specified by the filter are attempted as normal after the filter has
59054 run.
59055 </para>
59056 <para>
59057 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
59058 not manually frozen since. This means that automatic freezing by a system
59059 filter can be used as a way of checking out suspicious messages. If a message
59060 is found to be all right, manually unfreezing it allows it to be delivered.
59061 </para>
59062 <para>
59063 <indexterm role="concept">
59064 <primary>log</primary>
59065 <secondary><option>fail</option> command log line</secondary>
59066 </indexterm>
59067 <indexterm role="concept">
59068 <primary><option>fail</option></primary>
59069 <secondary>log line; reducing</secondary>
59070 </indexterm>
59071 The text given with a fail command is used as part of the bounce message as
59072 well as being written to the log. If the message is quite long, this can fill
59073 up a lot of log space when such failures are common. To reduce the size of the
59074 log message, Exim interprets the text in a special way if it starts with the
59075 two characters <literal>&lt;&lt;</literal> and contains <literal>&gt;&gt;</literal> later. The text between these two
59076 strings is written to the log, and the rest of the text is used in the bounce
59077 message. For example:
59078 </para>
59079 <literallayout class="monospaced">
59080 fail "&lt;&lt;filter test 1&gt;&gt;Your message is rejected \
59081      because it contains attachments that we are \
59082      not prepared to receive."
59083 </literallayout>
59084 <para>
59085 <indexterm role="concept">
59086 <primary>loop</primary>
59087 <secondary>caused by <option>fail</option></secondary>
59088 </indexterm>
59089 Take great care with the <option>fail</option> command when basing the decision to fail on
59090 the contents of the message, because the bounce message will of course include
59091 the contents of the original message and will therefore trigger the <option>fail</option>
59092 command again (causing a mail loop) unless steps are taken to prevent this.
59093 Testing the <option>error_message</option> condition is one way to prevent this. You could
59094 use, for example
59095 </para>
59096 <literallayout class="monospaced">
59097 if $message_body contains "this is spam" and not error_message
59098 then fail text "spam is not wanted here" endif
59099 </literallayout>
59100 <para>
59101 though of course that might let through unwanted bounce messages. The
59102 alternative is clever checking of the body and/or headers to detect bounces
59103 generated by the filter.
59104 </para>
59105 <para>
59106 The interpretation of a system filter file ceases after a
59107 <option>defer</option>,
59108 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
59109 set up earlier in the filter file are honoured, so you can use a sequence such
59110 as
59111 </para>
59112 <literallayout class="monospaced">
59113 mail ...
59114 freeze
59115 </literallayout>
59116 <para>
59117 to send a specified message when the system filter is freezing (or deferring or
59118 failing) a message. The normal deliveries for the message do not, of course,
59119 take place.
59120 </para>
59121 </section>
59122 <section id="SECTaddremheasys">
59123 <title>Adding and removing headers in a system filter</title>
59124 <para>
59125 <indexterm role="concept">
59126 <primary>header lines</primary>
59127 <secondary>adding; in system filter</secondary>
59128 </indexterm>
59129 <indexterm role="concept">
59130 <primary>header lines</primary>
59131 <secondary>removing; in system filter</secondary>
59132 </indexterm>
59133 <indexterm role="concept">
59134 <primary>filter</primary>
59135 <secondary>header lines; adding/removing</secondary>
59136 </indexterm>
59137 Two filter commands that are available only in system filters are:
59138 </para>
59139 <literallayout class="monospaced">
59140 headers add &lt;string&gt;
59141 headers remove &lt;string&gt;
59142 </literallayout>
59143 <para>
59144 The argument for the <option>headers add</option> is a string that is expanded and then
59145 added to the end of the message&#x2019;s headers. It is the responsibility of the
59146 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
59147 space is ignored, and if the string is otherwise empty, or if the expansion is
59148 forced to fail, the command has no effect.
59149 </para>
59150 <para>
59151 You can use <quote>\n</quote> within the string, followed by white space, to specify
59152 continued header lines. More than one header may be added in one command by
59153 including <quote>\n</quote> within the string without any following white space. For
59154 example:
59155 </para>
59156 <literallayout class="monospaced">
59157 headers add "X-header-1: ....\n  \
59158              continuation of X-header-1 ...\n\
59159              X-header-2: ...."
59160 </literallayout>
59161 <para>
59162 Note that the header line continuation white space after the first newline must
59163 be placed before the backslash that continues the input string, because white
59164 space after input continuations is ignored.
59165 </para>
59166 <para>
59167 The argument for <option>headers remove</option> is a colon-separated list of header names.
59168 This command applies only to those headers that are stored with the message;
59169 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
59170 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
59171 header with the same name, they are all removed.
59172 </para>
59173 <para>
59174 The <option>headers</option> command in a system filter makes an immediate change to the set
59175 of header lines that was received with the message (with possible additions
59176 from ACL processing). Subsequent commands in the system filter operate on the
59177 modified set, which also forms the basis for subsequent message delivery.
59178 Unless further modified during routing or transporting, this set of headers is
59179 used for all recipients of the message.
59180 </para>
59181 <para>
59182 During routing and transporting, the variables that refer to the contents of
59183 header lines refer only to those lines that are in this set. Thus, header lines
59184 that are added by a system filter are visible to users&#x2019; filter files and to all
59185 routers and transports. This contrasts with the manipulation of header lines by
59186 routers and transports, which is not immediate, but which instead is saved up
59187 until the message is actually being written (see section
59188 <xref linkend="SECTheadersaddrem"/>).
59189 </para>
59190 <para>
59191 If the message is not delivered at the first attempt, header lines that were
59192 added by the system filter are stored with the message, and so are still
59193 present at the next delivery attempt. Header lines that were removed are still
59194 present, but marked <quote>deleted</quote> so that they are not transported with the
59195 message. For this reason, it is usual to make the <option>headers</option> command
59196 conditional on <option>first_delivery</option> so that the set of header lines is not
59197 modified more than once.
59198 </para>
59199 <para>
59200 Because header modification in a system filter acts immediately, you have to
59201 use an indirect approach if you want to modify the contents of a header line.
59202 For example:
59203 </para>
59204 <literallayout class="monospaced">
59205 headers add "Old-Subject: $h_subject:"
59206 headers remove "Subject"
59207 headers add "Subject: new subject (was: $h_old-subject:)"
59208 headers remove "Old-Subject"
59209 </literallayout>
59210 </section>
59211 <section id="SECID217">
59212 <title>Setting an errors address in a system filter</title>
59213 <para>
59214 <indexterm role="concept">
59215 <primary>envelope sender</primary>
59216 </indexterm>
59217 In a system filter, if a <option>deliver</option> command is followed by
59218 </para>
59219 <literallayout class="monospaced">
59220 errors_to &lt;some address&gt;
59221 </literallayout>
59222 <para>
59223 in order to change the envelope sender (and hence the error reporting) for that
59224 delivery, any address may be specified. (In a user filter, only the current
59225 user&#x2019;s address can be set.) For example, if some mail is being monitored, you
59226 might use
59227 </para>
59228 <literallayout class="monospaced">
59229 unseen deliver monitor@spying.example errors_to root@local.example
59230 </literallayout>
59231 <para>
59232 to take a copy which would not be sent back to the normal error reporting
59233 address if its delivery failed.
59234 </para>
59235 </section>
59236 <section id="SECTperaddfil">
59237 <title>Per-address filtering</title>
59238 <para>
59239 <indexterm role="variable">
59240 <primary><varname>$domain</varname></primary>
59241 </indexterm>
59242 <indexterm role="variable">
59243 <primary><varname>$local_part</varname></primary>
59244 </indexterm>
59245 In contrast to the system filter, which is run just once per message for each
59246 delivery attempt, it is also possible to set up a system-wide filtering
59247 operation that runs once for each recipient address. In this case, variables
59248 such as <varname>$local_part</varname> and <varname>$domain</varname> can be used, and indeed, the choice of
59249 filter file could be made dependent on them. This is an example of a router
59250 which implements such a filter:
59251 </para>
59252 <literallayout class="monospaced">
59253 central_filter:
59254   check_local_user
59255   driver = redirect
59256   domains = +local_domains
59257   file = /central/filters/$local_part
59258   no_verify
59259   allow_filter
59260   allow_freeze
59261 </literallayout>
59262 <para>
59263 The filter is run in a separate process under its own uid. Therefore, either
59264 <option>check_local_user</option> must be set (as above), in which case the filter is run as
59265 the local user, or the <option>user</option> option must be used to specify which user to
59266 use. If both are set, <option>user</option> overrides.
59267 </para>
59268 <para>
59269 Care should be taken to ensure that none of the commands in the filter file
59270 specify a significant delivery if the message is to go on to be delivered to
59271 its intended recipient. The router will not then claim to have dealt with the
59272 address, so it will be passed on to subsequent routers to be delivered in the
59273 normal way.
59274 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
59275 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
59276 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
59277 </para>
59278 </section>
59279 </chapter>
59280
59281 <chapter id="CHAPmsgproc">
59282 <title>Message processing</title>
59283 <para>
59284 <indexterm role="concept" id="IIDmesproc" class="startofrange">
59285 <primary>message</primary>
59286 <secondary>general processing</secondary>
59287 </indexterm>
59288 Exim performs various transformations on the sender and recipient addresses of
59289 all messages that it handles, and also on the messages&#x2019; header lines. Some of
59290 these are optional and configurable, while others always take place. All of
59291 this processing, except rewriting as a result of routing, and the addition or
59292 removal of header lines while delivering, happens when a message is received,
59293 before it is placed on Exim&#x2019;s queue.
59294 </para>
59295 <para>
59296 Some of the automatic processing takes place by default only for
59297 <quote>locally-originated</quote> messages. This adjective is used to describe messages
59298 that are not received over TCP/IP, but instead are passed to an Exim process on
59299 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
59300 set up by the <option>-bs</option> command line option.
59301 </para>
59302 <para>
59303 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
59304 or ::1) are not considered to be locally-originated. Exim does not treat the
59305 loopback interface specially in any way.
59306 </para>
59307 <para>
59308 If you want the loopback interface to be treated specially, you must ensure
59309 that there are appropriate entries in your ACLs.
59310 </para>
59311 <section id="SECTsubmodnon">
59312 <title>Submission mode for non-local messages</title>
59313 <para>
59314 <indexterm role="concept">
59315 <primary>message</primary>
59316 <secondary>submission</secondary>
59317 </indexterm>
59318 <indexterm role="concept">
59319 <primary>submission mode</primary>
59320 </indexterm>
59321 Processing that happens automatically for locally-originated messages (unless
59322 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
59323 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
59324 state. Submission mode is set by the modifier
59325 </para>
59326 <literallayout class="monospaced">
59327 control = submission
59328 </literallayout>
59329 <para>
59330 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
59331 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
59332 a local submission, and is normally used when the source of the message is
59333 known to be an MUA running on a client host (as opposed to an MTA). For
59334 example, to set submission mode for messages originating on the IPv4 loopback
59335 interface, you could include the following in the MAIL ACL:
59336 </para>
59337 <literallayout class="monospaced">
59338 warn  hosts = 127.0.0.1
59339       control = submission
59340 </literallayout>
59341 <para>
59342 <indexterm role="concept">
59343 <primary><option>sender_retain</option> submission option</primary>
59344 </indexterm>
59345 There are some options that can be used when setting submission mode. A slash
59346 is used to separate options. For example:
59347 </para>
59348 <literallayout class="monospaced">
59349 control = submission/sender_retain
59350 </literallayout>
59351 <para>
59352 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
59353 true and <option>local_from_check</option> false for the current incoming message. The first
59354 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
59355 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
59356 authenticated sender. With this setting, Exim still fixes up messages by adding
59357 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
59358 attempt to check sender authenticity in header lines.
59359 </para>
59360 <para>
59361 When <option>sender_retain</option> is not set, a submission mode setting may specify a
59362 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
59363 example:
59364 </para>
59365 <literallayout class="monospaced">
59366 control = submission/domain=some.domain
59367 </literallayout>
59368 <para>
59369 The domain may be empty. How this value is used is described in sections
59370 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
59371 that allows you to specify the user&#x2019;s full name for inclusion in a created
59372 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
59373 </para>
59374 <literallayout class="monospaced">
59375 accept authenticated = *
59376        control = submission/domain=wonderland.example/\
59377                             name=${lookup {$authenticated_id} \
59378                                    lsearch {/etc/exim/namelist}}
59379 </literallayout>
59380 <para>
59381 Because the name may contain any characters, including slashes, the <option>name</option>
59382 option must be given last. The remainder of the string is used as the name. For
59383 the example above, if <filename>/etc/exim/namelist</filename> contains:
59384 </para>
59385 <literallayout class="monospaced">
59386 bigegg:  Humpty Dumpty
59387 </literallayout>
59388 <para>
59389 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
59390 line would be:
59391 </para>
59392 <literallayout class="monospaced">
59393 Sender: Humpty Dumpty &lt;bigegg@wonderland.example&gt;
59394 </literallayout>
59395 <para>
59396 <indexterm role="concept">
59397 <primary>return path</primary>
59398 <secondary>in submission mode</secondary>
59399 </indexterm>
59400 By default, submission mode forces the return path to the same address as is
59401 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
59402 specified, the return path is also left unchanged.
59403 </para>
59404 <para>
59405 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
59406 ACL. This means that any sender checks performed before the fix-ups use the
59407 untrusted sender address specified by the user, not the trusted sender address
59408 specified by submission mode. Although this might be slightly unexpected, it
59409 does mean that you can configure ACL checks to spot that a user is trying to
59410 spoof another&#x2019;s address.
59411 </para>
59412 </section>
59413 <section id="SECTlineendings">
59414 <title>Line endings</title>
59415 <para>
59416 <indexterm role="concept">
59417 <primary>line endings</primary>
59418 </indexterm>
59419 <indexterm role="concept">
59420 <primary>carriage return</primary>
59421 </indexterm>
59422 <indexterm role="concept">
59423 <primary>linefeed</primary>
59424 </indexterm>
59425 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
59426 linefeed) is the line ending for messages transmitted over the Internet using
59427 SMTP over TCP/IP. However, within individual operating systems, different
59428 conventions are used. For example, Unix-like systems use just LF, but others
59429 use CRLF or just CR.
59430 </para>
59431 <para>
59432 Exim was designed for Unix-like systems, and internally, it stores messages
59433 using the system&#x2019;s convention of a single LF as a line terminator. When
59434 receiving a message, all line endings are translated to this standard format.
59435 Originally, it was thought that programs that passed messages directly to an
59436 MTA within an operating system would use that system&#x2019;s convention. Experience
59437 has shown that this is not the case; for example, there are Unix applications
59438 that use CRLF in this circumstance. For this reason, and for compatibility with
59439 other MTAs, the way Exim handles line endings for all messages is now as
59440 follows:
59441 </para>
59442 <itemizedlist>
59443 <listitem>
59444 <para>
59445 LF not preceded by CR is treated as a line ending.
59446 </para>
59447 </listitem>
59448 <listitem>
59449 <para>
59450 CR is treated as a line ending; if it is immediately followed by LF, the LF
59451 is ignored.
59452 </para>
59453 </listitem>
59454 <listitem>
59455 <para>
59456 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
59457 nor a local message in the state where a line containing only a dot is a
59458 terminator.
59459 </para>
59460 </listitem>
59461 <listitem>
59462 <para>
59463 If a bare CR is encountered within a header line, an extra space is added after
59464 the line terminator so as not to end the header line. The reasoning behind this
59465 is that bare CRs in header lines are most likely either to be mistakes, or
59466 people trying to play silly games.
59467 </para>
59468 </listitem>
59469 <listitem>
59470 <para>
59471 If the first header line received in a message ends with CRLF, a subsequent
59472 bare LF in a header line is treated in the same way as a bare CR in a header
59473 line.
59474 </para>
59475 </listitem>
59476 </itemizedlist>
59477 </section>
59478 <section id="SECID218">
59479 <title>Unqualified addresses</title>
59480 <para>
59481 <indexterm role="concept">
59482 <primary>unqualified addresses</primary>
59483 </indexterm>
59484 <indexterm role="concept">
59485 <primary>address</primary>
59486 <secondary>qualification</secondary>
59487 </indexterm>
59488 By default, Exim expects every envelope address it receives from an external
59489 host to be fully qualified. Unqualified addresses cause negative responses to
59490 SMTP commands. However, because SMTP is used as a means of transporting
59491 messages from MUAs running on personal workstations, there is sometimes a
59492 requirement to accept unqualified addresses from specific hosts or IP networks.
59493 </para>
59494 <para>
59495 Exim has two options that separately control which hosts may send unqualified
59496 sender or recipient addresses in SMTP commands, namely
59497 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
59498 cases, if an unqualified address is accepted, it is qualified by adding the
59499 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
59500 </para>
59501 <para>
59502 <indexterm role="option">
59503 <primary><option>qualify_domain</option></primary>
59504 </indexterm>
59505 <indexterm role="option">
59506 <primary><option>qualify_recipient</option></primary>
59507 </indexterm>
59508 Unqualified addresses in header lines are automatically qualified for messages
59509 that are locally originated, unless the <option>-bnq</option> option is given on the command
59510 line. For messages received over SMTP, unqualified addresses in header lines
59511 are qualified only if unqualified addresses are permitted in SMTP commands. In
59512 other words, such qualification is also controlled by
59513 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
59514 </para>
59515 </section>
59516 <section id="SECID219">
59517 <title>The UUCP From line</title>
59518 <para>
59519 <indexterm role="concept">
59520 <primary><quote>From</quote> line</primary>
59521 </indexterm>
59522 <indexterm role="concept">
59523 <primary>UUCP</primary>
59524 <secondary><quote>From</quote> line</secondary>
59525 </indexterm>
59526 <indexterm role="concept">
59527 <primary>sender</primary>
59528 <secondary>address</secondary>
59529 </indexterm>
59530 <indexterm role="option">
59531 <primary><option>uucp_from_pattern</option></primary>
59532 </indexterm>
59533 <indexterm role="option">
59534 <primary><option>uucp_from_sender</option></primary>
59535 </indexterm>
59536 <indexterm role="concept">
59537 <primary>envelope sender</primary>
59538 </indexterm>
59539 <indexterm role="concept">
59540 <primary>Sendmail compatibility</primary>
59541 <secondary><quote>From</quote> line</secondary>
59542 </indexterm>
59543 Messages that have come from UUCP (and some other applications) often begin
59544 with a line containing the envelope sender and a timestamp, following the word
59545 <quote>From</quote>. Examples of two common formats are:
59546 </para>
59547 <literallayout class="monospaced">
59548 From a.oakley@berlin.mus Fri Jan  5 12:35 GMT 1996
59549 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
59550 </literallayout>
59551 <para>
59552 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
59553 Exim recognizes such lines at the start of messages that are submitted to it
59554 via the command line (that is, on the standard input). It does not recognize
59555 such lines in incoming SMTP messages, unless the sending host matches
59556 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
59557 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
59558 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
59559 default value matches the two common cases shown above and puts the address
59560 that follows <quote>From</quote> into <varname>$1</varname>.
59561 </para>
59562 <para>
59563 <indexterm role="concept">
59564 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
59565 <secondary>in <quote>From </quote> line handling</secondary>
59566 </indexterm>
59567 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
59568 a trusted user, the message&#x2019;s sender address is constructed by expanding the
59569 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
59570 then parsed as an RFC 2822 address. If there is no domain, the local part is
59571 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
59572 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
59573 </para>
59574 <para>
59575 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
59576 sender address is not changed. This is also the case for incoming SMTP messages
59577 that are permitted to contain <quote>From</quote> lines.
59578 </para>
59579 <para>
59580 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
59581 treated as a data line that starts the body of the message, as it is not valid
59582 as a header line. This also happens if a <quote>From</quote> line is present in an
59583 incoming SMTP message from a source that is not permitted to send them.
59584 </para>
59585 </section>
59586 <section id="SECID220">
59587 <title>Resent- header lines</title>
59588 <para>
59589 <indexterm role="concept">
59590 <primary><option>Resent-</option> header lines</primary>
59591 </indexterm>
59592 RFC 2822 makes provision for sets of header lines starting with the string
59593 <literal>Resent-</literal> to be added to a message when it is resent by the original
59594 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
59595 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
59596 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
59597 </para>
59598 <blockquote>
59599 <para>
59600 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
59601 processing of replies or other such automatic actions on messages.</emphasis>
59602 </para>
59603 </blockquote>
59604 <para>
59605 This leaves things a bit vague as far as other processing actions such as
59606 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
59607 follows:
59608 </para>
59609 <itemizedlist>
59610 <listitem>
59611 <para>
59612 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
59613 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
59614 </para>
59615 </listitem>
59616 <listitem>
59617 <para>
59618 If there&#x2019;s a rewriting rule for a particular header line, it is also applied to
59619 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
59620 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
59621 </para>
59622 </listitem>
59623 <listitem>
59624 <para>
59625 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
59626 also removed.
59627 </para>
59628 </listitem>
59629 <listitem>
59630 <para>
59631 For a locally-submitted message,
59632 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
59633 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
59634 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
59635 included in log lines in this case.
59636 </para>
59637 </listitem>
59638 <listitem>
59639 <para>
59640 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
59641 <option>Resent-</option> header lines are present.
59642 </para>
59643 </listitem>
59644 </itemizedlist>
59645 </section>
59646 <section id="SECID221">
59647 <title>The Auto-Submitted: header line</title>
59648 <para>
59649 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
59650 includes the header line:
59651 </para>
59652 <literallayout class="monospaced">
59653 Auto-Submitted: auto-replied
59654 </literallayout>
59655 </section>
59656 <section id="SECID222">
59657 <title>The Bcc: header line</title>
59658 <para>
59659 <indexterm role="concept">
59660 <primary><emphasis>Bcc:</emphasis> header line</primary>
59661 </indexterm>
59662 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
59663 message&#x2019;s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
59664 extracting its addresses). If <option>-t</option> is not present on the command line, any
59665 existing <emphasis>Bcc:</emphasis> is not removed.
59666 </para>
59667 </section>
59668 <section id="SECID223">
59669 <title>The Date: header line</title>
59670 <para>
59671 <indexterm role="concept">
59672 <primary><emphasis>Date:</emphasis> header line</primary>
59673 </indexterm>
59674 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
59675 Exim adds one, using the current date and time, unless the
59676 <option>suppress_local_fixups</option> control has been specified.
59677 </para>
59678 </section>
59679 <section id="SECID224">
59680 <title>The Delivery-date: header line</title>
59681 <para>
59682 <indexterm role="concept">
59683 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
59684 </indexterm>
59685 <indexterm role="option">
59686 <primary><option>delivery_date_remove</option></primary>
59687 </indexterm>
59688 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
59689 set. Exim can be configured to add them to the final delivery of messages. (See
59690 the generic <option>delivery_date_add</option> transport option.) They should not be present
59691 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
59692 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
59693 messages.
59694 </para>
59695 </section>
59696 <section id="SECID225">
59697 <title>The Envelope-to: header line</title>
59698 <para>
59699 <indexterm role="concept">
59700 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
59701 </indexterm>
59702 <indexterm role="option">
59703 <primary><option>envelope_to_remove</option></primary>
59704 </indexterm>
59705 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
59706 Exim can be configured to add them to the final delivery of messages. (See the
59707 generic <option>envelope_to_add</option> transport option.) They should not be present in
59708 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
59709 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
59710 messages.
59711 </para>
59712 </section>
59713 <section id="SECTthefrohea">
59714 <title>The From: header line</title>
59715 <para>
59716 <indexterm role="concept">
59717 <primary><emphasis>From:</emphasis> header line</primary>
59718 </indexterm>
59719 <indexterm role="concept">
59720 <primary>Sendmail compatibility</primary>
59721 <secondary><quote>From</quote> line</secondary>
59722 </indexterm>
59723 <indexterm role="concept">
59724 <primary>message</primary>
59725 <secondary>submission</secondary>
59726 </indexterm>
59727 <indexterm role="concept">
59728 <primary>submission mode</primary>
59729 </indexterm>
59730 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
59731 adds one if either of the following conditions is true:
59732 </para>
59733 <itemizedlist>
59734 <listitem>
59735 <para>
59736 The envelope sender address is not empty (that is, this is not a bounce
59737 message). The added header line copies the envelope sender address.
59738 </para>
59739 </listitem>
59740 <listitem>
59741 <para>
59742 <indexterm role="variable">
59743 <primary><varname>$authenticated_id</varname></primary>
59744 </indexterm>
59745 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
59746 </para>
59747 <orderedlist numeration="arabic">
59748 <listitem>
59749 <para>
59750 <indexterm role="variable">
59751 <primary><varname>$qualify_domain</varname></primary>
59752 </indexterm>
59753 If no domain is specified by the submission control, the local part is
59754 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
59755 </para>
59756 </listitem>
59757 <listitem>
59758 <para>
59759 If a non-empty domain is specified by the submission control, the local
59760 part is <varname>$authenticated_id</varname>, and the domain is the specified domain.
59761 </para>
59762 </listitem>
59763 <listitem>
59764 <para>
59765 If an empty domain is specified by the submission control,
59766 <varname>$authenticated_id</varname> is assumed to be the complete address.
59767 </para>
59768 </listitem>
59769 </orderedlist>
59770 </listitem>
59771 </itemizedlist>
59772 <para>
59773 A non-empty envelope sender takes precedence.
59774 </para>
59775 <para>
59776 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
59777 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
59778 containing the sender&#x2019;s address. The calling user&#x2019;s login name and full name
59779 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
59780 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
59781 <option>unknown_login</option> configuration option). The address is qualified with
59782 <option>qualify_domain</option>.
59783 </para>
59784 <para>
59785 For compatibility with Sendmail, if an incoming, non-SMTP message has a
59786 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
59787 user, this is replaced by an address containing the user&#x2019;s login name and full
59788 name as described in section <xref linkend="SECTconstr"/>.
59789 </para>
59790 </section>
59791 <section id="SECID226">
59792 <title>The Message-ID: header line</title>
59793 <para>
59794 <indexterm role="concept">
59795 <primary><emphasis>Message-ID:</emphasis> header line</primary>
59796 </indexterm>
59797 <indexterm role="concept">
59798 <primary>message</primary>
59799 <secondary>submission</secondary>
59800 </indexterm>
59801 <indexterm role="option">
59802 <primary><option>message_id_header_text</option></primary>
59803 </indexterm>
59804 If a locally-generated or submission-mode incoming message does not contain a
59805 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
59806 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
59807 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
59808 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim&#x2019;s internal
59809 message id, preceded by the letter E to ensure it starts with a letter, and
59810 followed by @ and the primary host name. Additional information can be included
59811 in this header line by setting the <option>message_id_header_text</option> and/or
59812 <option>message_id_header_domain</option> options.
59813 </para>
59814 </section>
59815 <section id="SECID227">
59816 <title>The Received: header line</title>
59817 <para>
59818 <indexterm role="concept">
59819 <primary><emphasis>Received:</emphasis> header line</primary>
59820 </indexterm>
59821 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
59822 contents are defined by the <option>received_header_text</option> configuration option, and
59823 Exim automatically adds a semicolon and a timestamp to the configured string.
59824 </para>
59825 <para>
59826 The <emphasis>Received:</emphasis> header is generated as soon as the message&#x2019;s header lines
59827 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
59828 line is the time that the message started to be received. This is the value
59829 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
59830 </para>
59831 <para>
59832 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
59833 changed to the time of acceptance, which is (apart from a small delay while the
59834 -H spool file is written) the earliest time at which delivery could start.
59835 </para>
59836 </section>
59837 <section id="SECID228">
59838 <title>The References: header line</title>
59839 <para>
59840 <indexterm role="concept">
59841 <primary><emphasis>References:</emphasis> header line</primary>
59842 </indexterm>
59843 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
59844 header line. This is constructed according to the rules that are described in
59845 section 3.64 of RFC 2822 (which states that replies should contain such a
59846 header line), and section 3.14 of RFC 3834 (which states that automatic
59847 responses are not different in this respect). However, because some mail
59848 processing software does not cope well with very long header lines, no more
59849 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
59850 incoming message. If there are more than 12, the first one and then the final
59851 11 are copied, before adding the message ID of the incoming message.
59852 </para>
59853 </section>
59854 <section id="SECID229">
59855 <title>The Return-path: header line</title>
59856 <para>
59857 <indexterm role="concept">
59858 <primary><emphasis>Return-path:</emphasis> header line</primary>
59859 </indexterm>
59860 <indexterm role="option">
59861 <primary><option>return_path_remove</option></primary>
59862 </indexterm>
59863 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
59864 it does the final delivery of messages. (See the generic <option>return_path_add</option>
59865 transport option.) Therefore, they should not be present in messages in
59866 transit. If the <option>return_path_remove</option> configuration option is set (the
59867 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
59868 </para>
59869 </section>
59870 <section id="SECTthesenhea">
59871 <title>The Sender: header line</title>
59872 <para>
59873 <indexterm role="concept">
59874 <primary><emphasis>Sender:</emphasis> header line</primary>
59875 </indexterm>
59876 <indexterm role="concept">
59877 <primary>message</primary>
59878 <secondary>submission</secondary>
59879 </indexterm>
59880 For a locally-originated message from an untrusted user, Exim may remove an
59881 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
59882 these actions by setting the <option>local_sender_retain</option> option true, the
59883 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
59884 control setting.
59885 </para>
59886 <para>
59887 When a local message is received from an untrusted user and
59888 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
59889 control has not been set, a check is made to see if the address given in the
59890 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
59891 that is expected has the login name as the local part and the value of
59892 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
59893 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
59894 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
59895 line is added to the message.
59896 </para>
59897 <para>
59898 If you set <option>local_from_check</option> false, this checking does not occur. However,
59899 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
59900 <option>local_sender_retain</option> to be true. It is not possible to set both of these
59901 options true at the same time.
59902 </para>
59903 <para>
59904 <indexterm role="concept">
59905 <primary>submission mode</primary>
59906 </indexterm>
59907 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
59908 received over TCP/IP or for messages submitted by trusted users. However, when
59909 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
59910 not specified on the submission control, the following processing takes place:
59911 </para>
59912 <para>
59913 <indexterm role="variable">
59914 <primary><varname>$authenticated_id</varname></primary>
59915 </indexterm>
59916 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
59917 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
59918 created as follows:
59919 </para>
59920 <itemizedlist>
59921 <listitem>
59922 <para>
59923 <indexterm role="variable">
59924 <primary><varname>$qualify_domain</varname></primary>
59925 </indexterm>
59926 If no domain is specified by the submission control, the local part is
59927 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
59928 </para>
59929 </listitem>
59930 <listitem>
59931 <para>
59932 If a non-empty domain is specified by the submission control, the local part
59933 is <varname>$authenticated_id</varname>, and the domain is the specified domain.
59934 </para>
59935 </listitem>
59936 <listitem>
59937 <para>
59938 If an empty domain is specified by the submission control,
59939 <varname>$authenticated_id</varname> is assumed to be the complete address.
59940 </para>
59941 </listitem>
59942 </itemizedlist>
59943 <para>
59944 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
59945 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
59946 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
59947 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
59948 </para>
59949 <para>
59950 <indexterm role="concept">
59951 <primary>return path</primary>
59952 <secondary>created from <emphasis>Sender:</emphasis></secondary>
59953 </indexterm>
59954 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
59955 the message (the envelope sender address) is changed to be the same address,
59956 except in the case of submission mode when <option>sender_retain</option> is specified.
59957 </para>
59958 </section>
59959 <section id="SECTheadersaddrem">
59960 <title>Adding and removing header lines in routers and transports</title>
59961 <para>
59962 <indexterm role="concept">
59963 <primary>header lines</primary>
59964 <secondary>adding; in router or transport</secondary>
59965 </indexterm>
59966 <indexterm role="concept">
59967 <primary>header lines</primary>
59968 <secondary>removing; in router or transport</secondary>
59969 </indexterm>
59970 When a message is delivered, the addition and removal of header lines can be
59971 specified in a system filter, or on any of the routers and transports that
59972 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
59973 modifying headers in a system filter. Header lines can also be added in an ACL
59974 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
59975 </para>
59976 <para>
59977 In contrast to what happens in a system filter, header modifications that are
59978 specified on routers and transports apply only to the particular recipient
59979 addresses that are being processed by those routers and transports. These
59980 changes do not actually take place until a copy of the message is being
59981 transported. Therefore, they do not affect the basic set of header lines, and
59982 they do not affect the values of the variables that refer to header lines.
59983 </para>
59984 <para>
59985 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
59986 the transport cannot refer to the modified header lines, because such
59987 expansions all occur before the message is actually transported.
59988 </para>
59989 <para>
59990 For both routers and transports, the argument of a <option>headers_add</option>
59991 option must be in the form of one or more RFC 2822 header lines, separated by
59992 newlines (coded as <quote>\n</quote>). For example:
59993 </para>
59994 <literallayout class="monospaced">
59995 headers_add = X-added-header: added by $primary_hostname\n\
59996               X-added-second: another added header line
59997 </literallayout>
59998 <para>
59999 Exim does not check the syntax of these added header lines.
60000 </para>
60001 <para>
60002 Multiple <option>headers_add</option> options for a single router or transport can be
60003 specified; the values will append to a single list of header lines.
60004 Each header-line is separately expanded.
60005 </para>
60006 <para>
60007 The argument of a <option>headers_remove</option> option must consist of a colon-separated
60008 list of header names. This is confusing, because header names themselves are
60009 often terminated by colons. In this case, the colons are the list separators,
60010 not part of the names. For example:
60011 </para>
60012 <literallayout class="monospaced">
60013 headers_remove = return-receipt-to:acknowledge-to
60014 </literallayout>
60015 <para>
60016 Multiple <option>headers_remove</option> options for a single router or transport can be
60017 specified; the arguments will append to a single header-names list.
60018 Each item is separately expanded.
60019 Note that colons in complex expansions which are used to
60020 form all or part of a <option>headers_remove</option> list
60021 will act as list separators.
60022 </para>
60023 <para>
60024 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router,
60025 items are expanded at routing time,
60026 and then associated with all addresses that are
60027 accepted by that router, and also with any new addresses that it generates. If
60028 an address passes through several routers as a result of aliasing or
60029 forwarding, the changes are cumulative.
60030 </para>
60031 <para>
60032 <indexterm role="option">
60033 <primary><option>unseen</option></primary>
60034 </indexterm>
60035 However, this does not apply to multiple routers that result from the use of
60036 the <option>unseen</option> option. Any header modifications that were specified by the
60037 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
60038 </para>
60039 <para>
60040 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
60041 settings cannot be delivered together in a batch, so a transport is always
60042 dealing with a set of addresses that have the same header-processing
60043 requirements.
60044 </para>
60045 <para>
60046 The transport starts by writing the original set of header lines that arrived
60047 with the message, possibly modified by the system filter. As it writes out
60048 these lines, it consults the list of header names that were attached to the
60049 recipient address(es) by <option>headers_remove</option> options in routers, and it also
60050 consults the transport&#x2019;s own <option>headers_remove</option> option. Header lines whose
60051 names are on either of these lists are not written out. If there are multiple
60052 instances of any listed header, they are all skipped.
60053 </para>
60054 <para>
60055 After the remaining original header lines have been written, new header
60056 lines that were specified by routers&#x2019; <option>headers_add</option> options are written, in
60057 the order in which they were attached to the address. These are followed by any
60058 header lines specified by the transport&#x2019;s <option>headers_add</option> option.
60059 </para>
60060 <para>
60061 This way of handling header line modifications in routers and transports has
60062 the following consequences:
60063 </para>
60064 <itemizedlist>
60065 <listitem>
60066 <para>
60067 The original set of header lines, possibly modified by the system filter,
60068 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
60069 to it, at all times.
60070 </para>
60071 </listitem>
60072 <listitem>
60073 <para>
60074 Header lines that are added by a router&#x2019;s
60075 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
60076 expansion syntax in subsequent routers or the transport.
60077 </para>
60078 </listitem>
60079 <listitem>
60080 <para>
60081 Conversely, header lines that are specified for removal by <option>headers_remove</option>
60082 in a router remain visible to subsequent routers and the transport.
60083 </para>
60084 </listitem>
60085 <listitem>
60086 <para>
60087 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
60088 a later router or by a transport.
60089 </para>
60090 </listitem>
60091 <listitem>
60092 <para>
60093 An added header can refer to the contents of an original header that is to be
60094 removed, even it has the same name as the added header. For example:
60095 </para>
60096 <literallayout class="monospaced">
60097 headers_remove = subject
60098 headers_add = Subject: new subject (was: $h_subject:)
60099 </literallayout>
60100 </listitem>
60101 </itemizedlist>
60102 <para>
60103 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
60104 for a <command>redirect</command> router that has the <option>one_time</option> option set.
60105 </para>
60106 </section>
60107 <section id="SECTconstr">
60108 <title>Constructed addresses</title>
60109 <para>
60110 <indexterm role="concept">
60111 <primary>address</primary>
60112 <secondary>constructed</secondary>
60113 </indexterm>
60114 <indexterm role="concept">
60115 <primary>constructed address</primary>
60116 </indexterm>
60117 When Exim constructs a sender address for a locally-generated message, it uses
60118 the form
60119 </para>
60120 <literallayout>
60121 &lt;<emphasis>user name</emphasis>&gt;&nbsp;&nbsp;&lt;<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>&gt;
60122 </literallayout>
60123 <para>
60124 For example:
60125 </para>
60126 <literallayout class="monospaced">
60127 Zaphod Beeblebrox &lt;zaphod@end.univ.example&gt;
60128 </literallayout>
60129 <para>
60130 The user name is obtained from the <option>-F</option> command line option if set, or
60131 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
60132 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
60133 ampersand character, this is replaced by the login name with the first letter
60134 upper cased, as is conventional in a number of operating systems. See the
60135 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
60136 The <option>unknown_username</option> option can be used to specify user names in cases when
60137 there is no password file entry.
60138 </para>
60139 <para>
60140 <indexterm role="concept">
60141 <primary>RFC 2047</primary>
60142 </indexterm>
60143 In all cases, the user name is made to conform to RFC 2822 by quoting all or
60144 parts of it if necessary. In addition, if it contains any non-printing
60145 characters, it is encoded as described in RFC 2047, which defines a way of
60146 including non-ASCII characters in header lines. The value of the
60147 <option>headers_charset</option> option specifies the name of the encoding that is used (the
60148 characters are assumed to be in this encoding). The setting of
60149 <option>print_topbitchars</option> controls whether characters with the top bit set (that
60150 is, with codes greater than 127) count as printing characters or not.
60151 </para>
60152 </section>
60153 <section id="SECID230">
60154 <title>Case of local parts</title>
60155 <para>
60156 <indexterm role="concept">
60157 <primary>case of local parts</primary>
60158 </indexterm>
60159 <indexterm role="concept">
60160 <primary>local part</primary>
60161 <secondary>case of</secondary>
60162 </indexterm>
60163 RFC 2822 states that the case of letters in the local parts of addresses cannot
60164 be assumed to be non-significant. Exim preserves the case of local parts of
60165 addresses, but by default it uses a lower-cased form when it is routing,
60166 because on most Unix systems, usernames are in lower case and case-insensitive
60167 routing is required. However, any particular router can be made to use the
60168 original case for local parts by setting the <option>caseful_local_part</option> generic
60169 router option.
60170 </para>
60171 <para>
60172 <indexterm role="concept">
60173 <primary>mixed-case login names</primary>
60174 </indexterm>
60175 If you must have mixed-case user names on your system, the best way to proceed,
60176 assuming you want case-independent handling of incoming email, is to set up
60177 your first router to convert incoming local parts in your domains to the
60178 correct case by means of a file lookup. For example:
60179 </para>
60180 <literallayout class="monospaced">
60181 correct_case:
60182   driver = redirect
60183   domains = +local_domains
60184   data = ${lookup{$local_part}cdb\
60185               {/etc/usercased.cdb}{$value}fail}\
60186               @$domain
60187 </literallayout>
60188 <para>
60189 For this router, the local part is forced to lower case by the default action
60190 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
60191 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
60192 on any subsequent routers which process your domains, they will operate on
60193 local parts with the correct case in a case-sensitive manner.
60194 </para>
60195 </section>
60196 <section id="SECID231">
60197 <title>Dots in local parts</title>
60198 <para>
60199 <indexterm role="concept">
60200 <primary>dot</primary>
60201 <secondary>in local part</secondary>
60202 </indexterm>
60203 <indexterm role="concept">
60204 <primary>local part</primary>
60205 <secondary>dots in</secondary>
60206 </indexterm>
60207 RFC 2822 forbids empty components in local parts. That is, an unquoted local
60208 part may not begin or end with a dot, nor have two consecutive dots in the
60209 middle. However, it seems that many MTAs do not enforce this, so Exim permits
60210 empty components for compatibility.
60211 </para>
60212 </section>
60213 <section id="SECID232">
60214 <title>Rewriting addresses</title>
60215 <para>
60216 <indexterm role="concept">
60217 <primary>rewriting</primary>
60218 <secondary>addresses</secondary>
60219 </indexterm>
60220 Rewriting of sender and recipient addresses, and addresses in headers, can
60221 happen automatically, or as the result of configuration options, as described
60222 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
60223 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
60224 </para>
60225 <para>
60226 Automatic rewriting includes qualification, as mentioned above. The other case
60227 in which it can happen is when an incomplete non-local domain is given. The
60228 routing process may cause this to be expanded into the full domain name. For
60229 example, a header such as
60230 </para>
60231 <literallayout class="monospaced">
60232 To: hare@teaparty
60233 </literallayout>
60234 <para>
60235 might get rewritten as
60236 </para>
60237 <literallayout class="monospaced">
60238 To: hare@teaparty.wonderland.fict.example
60239 </literallayout>
60240 <para>
60241 Rewriting as a result of routing is the one kind of message processing that
60242 does not happen at input time, as it cannot be done until the address has
60243 been routed.
60244 </para>
60245 <para>
60246 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
60247 addresses have been routed, in case any of the headers get changed as a
60248 result of routing. However, doing this in practice would hold up many
60249 deliveries for unreasonable amounts of time, just because one address could not
60250 immediately be routed. Exim therefore does not delay other deliveries when
60251 routing of one or more addresses is deferred.
60252 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
60253 </para>
60254 </section>
60255 </chapter>
60256
60257 <chapter id="CHAPSMTP">
60258 <title>SMTP processing</title>
60259 <para>
60260 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
60261 <primary>SMTP</primary>
60262 <secondary>processing details</secondary>
60263 </indexterm>
60264 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
60265 <primary>LMTP</primary>
60266 <secondary>processing details</secondary>
60267 </indexterm>
60268 Exim supports a number of different ways of using the SMTP protocol, and its
60269 LMTP variant, which is an interactive protocol for transferring messages into a
60270 closed mail store application. This chapter contains details of how SMTP is
60271 processed. For incoming mail, the following are available:
60272 </para>
60273 <itemizedlist>
60274 <listitem>
60275 <para>
60276 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
60277 </para>
60278 </listitem>
60279 <listitem>
60280 <para>
60281 SMTP over the standard input and output (the <option>-bs</option> option);
60282 </para>
60283 </listitem>
60284 <listitem>
60285 <para>
60286 Batched SMTP on the standard input (the <option>-bS</option> option).
60287 </para>
60288 </listitem>
60289 </itemizedlist>
60290 <para>
60291 For mail delivery, the following are available:
60292 </para>
60293 <itemizedlist>
60294 <listitem>
60295 <para>
60296 SMTP over TCP/IP (the <command>smtp</command> transport);
60297 </para>
60298 </listitem>
60299 <listitem>
60300 <para>
60301 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
60302 <quote>lmtp</quote>);
60303 </para>
60304 </listitem>
60305 <listitem>
60306 <para>
60307 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
60308 transport);
60309 </para>
60310 </listitem>
60311 <listitem>
60312 <para>
60313 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
60314 the <option>use_bsmtp</option> option set).
60315 </para>
60316 </listitem>
60317 </itemizedlist>
60318 <para>
60319 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
60320 stored in or read from files (or pipes), in a format in which SMTP commands are
60321 used to contain the envelope information.
60322 </para>
60323 <section id="SECToutSMTPTCP">
60324 <title>Outgoing SMTP and LMTP over TCP/IP</title>
60325 <para>
60326 <indexterm role="concept">
60327 <primary>SMTP</primary>
60328 <secondary>outgoing over TCP/IP</secondary>
60329 </indexterm>
60330 <indexterm role="concept">
60331 <primary>outgoing SMTP over TCP/IP</primary>
60332 </indexterm>
60333 <indexterm role="concept">
60334 <primary>LMTP</primary>
60335 <secondary>over TCP/IP</secondary>
60336 </indexterm>
60337 <indexterm role="concept">
60338 <primary>outgoing LMTP over TCP/IP</primary>
60339 </indexterm>
60340 <indexterm role="concept">
60341 <primary>EHLO</primary>
60342 </indexterm>
60343 <indexterm role="concept">
60344 <primary>HELO</primary>
60345 </indexterm>
60346 <indexterm role="concept">
60347 <primary>SIZE option on MAIL command</primary>
60348 </indexterm>
60349 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
60350 The <option>protocol</option> option selects which protocol is to be used, but the actual
60351 processing is the same in both cases.
60352 </para>
60353 <para>
60354 If, in response to its EHLO command, Exim is told that the SIZE
60355 parameter is supported, it adds SIZE=&lt;<emphasis>n</emphasis>&gt; to each subsequent MAIL
60356 command. The value of &lt;<emphasis>n</emphasis>&gt; is the message size plus the value of the
60357 <option>size_addition</option> option (default 1024) to allow for additions to the message
60358 such as per-transport header lines, or changes made in a
60359 <indexterm role="concept">
60360 <primary>transport</primary>
60361 <secondary>filter</secondary>
60362 </indexterm>
60363 <indexterm role="concept">
60364 <primary>filter</primary>
60365 <secondary>transport filter</secondary>
60366 </indexterm>
60367 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
60368 suppressed.
60369 </para>
60370 <para>
60371 If the remote server advertises support for PIPELINING, Exim uses the
60372 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
60373 required for the transaction.
60374 </para>
60375 <para>
60376 If the remote server advertises support for the STARTTLS command, and Exim
60377 was built to support TLS encryption, it tries to start a TLS session unless the
60378 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
60379 Either a match in that or <option>hosts_verify_avoid_tls</option> apply when the transport
60380 is called for verification.
60381 </para>
60382 <para>
60383 If the remote server advertises support for the AUTH command, Exim scans
60384 the authenticators configuration for any suitable client settings, as described
60385 in chapter <xref linkend="CHAPSMTPAUTH"/>.
60386 </para>
60387 <para>
60388 <indexterm role="concept">
60389 <primary>carriage return</primary>
60390 </indexterm>
60391 <indexterm role="concept">
60392 <primary>linefeed</primary>
60393 </indexterm>
60394 Responses from the remote host are supposed to be terminated by CR followed by
60395 LF. However, there are known to be hosts that do not send CR characters, so in
60396 order to be able to interwork with such hosts, Exim treats LF on its own as a
60397 line terminator.
60398 </para>
60399 <para>
60400 If a message contains a number of different addresses, all those with the same
60401 characteristics (for example, the same envelope sender) that resolve to the
60402 same set of hosts, in the same order, are sent in a single SMTP transaction,
60403 even if they are for different domains, unless there are more than the setting
60404 of the <option>max_rcpt</option>s option in the <command>smtp</command> transport allows, in which case
60405 they are split into groups containing no more than <option>max_rcpt</option>s addresses
60406 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
60407 in parallel sessions. The order of hosts with identical MX values is not
60408 significant when checking whether addresses can be batched in this way.
60409 </para>
60410 <para>
60411 When the <command>smtp</command> transport suffers a temporary failure that is not
60412 message-related, Exim updates its transport-specific database, which contains
60413 records indexed by host name that remember which messages are waiting for each
60414 particular host. It also updates the retry database with new retry times.
60415 </para>
60416 <para>
60417 <indexterm role="concept">
60418 <primary>hints database</primary>
60419 <secondary>retry keys</secondary>
60420 </indexterm>
60421 Exim&#x2019;s retry hints are based on host name plus IP address, so if one address of
60422 a multi-homed host is broken, it will soon be skipped most of the time.
60423 See the next section for more detail about error handling.
60424 </para>
60425 <para>
60426 <indexterm role="concept">
60427 <primary>SMTP</primary>
60428 <secondary>passed connection</secondary>
60429 </indexterm>
60430 <indexterm role="concept">
60431 <primary>SMTP</primary>
60432 <secondary>batching over TCP/IP</secondary>
60433 </indexterm>
60434 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
60435 looks in the hints database for the transport to see if there are any queued
60436 messages waiting for the host to which it is connected. If it finds one, it
60437 creates a new Exim process using the <option>-MC</option> option (which can only be used by
60438 a process running as root or the Exim user) and passes the TCP/IP socket to it
60439 so that it can deliver another message using the same socket. The new process
60440 does only those deliveries that are routed to the connected host, and may in
60441 turn pass the socket on to a third process, and so on.
60442 </para>
60443 <para>
60444 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
60445 limit the number of messages sent down a single TCP/IP connection.
60446 </para>
60447 <para>
60448 <indexterm role="concept">
60449 <primary>asterisk</primary>
60450 <secondary>after IP address</secondary>
60451 </indexterm>
60452 The second and subsequent messages delivered down an existing connection are
60453 identified in the main log by the addition of an asterisk after the closing
60454 square bracket of the IP address.
60455 </para>
60456 </section>
60457 <section id="SECToutSMTPerr">
60458 <title>Errors in outgoing SMTP</title>
60459 <para>
60460 <indexterm role="concept">
60461 <primary>error</primary>
60462 <secondary>in outgoing SMTP</secondary>
60463 </indexterm>
60464 <indexterm role="concept">
60465 <primary>SMTP</primary>
60466 <secondary>errors in outgoing</secondary>
60467 </indexterm>
60468 <indexterm role="concept">
60469 <primary>host</primary>
60470 <secondary>error</secondary>
60471 </indexterm>
60472 Three different kinds of error are recognized for outgoing SMTP: host errors,
60473 message errors, and recipient errors.
60474 </para>
60475 <variablelist>
60476 <varlistentry>
60477 <term><emphasis role="bold">Host errors</emphasis></term>
60478 <listitem>
60479 <para>
60480 A host error is not associated with a particular message or with a
60481 particular recipient of a message. The host errors are:
60482 </para>
60483 <itemizedlist>
60484 <listitem>
60485 <para>
60486 Connection refused or timed out,
60487 </para>
60488 </listitem>
60489 <listitem>
60490 <para>
60491 Any error response code on connection,
60492 </para>
60493 </listitem>
60494 <listitem>
60495 <para>
60496 Any error response code to EHLO or HELO,
60497 </para>
60498 </listitem>
60499 <listitem>
60500 <para>
60501 Loss of connection at any time, except after <quote>.</quote>,
60502 </para>
60503 </listitem>
60504 <listitem>
60505 <para>
60506 I/O errors at any time,
60507 </para>
60508 </listitem>
60509 <listitem>
60510 <para>
60511 Timeouts during the session, other than in response to MAIL, RCPT or
60512 the <quote>.</quote> at the end of the data.
60513 </para>
60514 </listitem>
60515 </itemizedlist>
60516 <para>
60517 For a host error, a permanent error response on connection, or in response to
60518 EHLO, causes all addresses routed to the host to be failed. Any other host
60519 error causes all addresses to be deferred, and retry data to be created for the
60520 host. It is not tried again, for any message, until its retry time arrives. If
60521 the current set of addresses are not all delivered in this run (to some
60522 alternative host), the message is added to the list of those waiting for this
60523 host, so if it is still undelivered when a subsequent successful delivery is
60524 made to the host, it will be sent down the same SMTP connection.
60525 </para>
60526 </listitem></varlistentry>
60527 <varlistentry>
60528 <term><emphasis role="bold">Message errors</emphasis></term>
60529 <listitem>
60530 <para>
60531 <indexterm role="concept">
60532 <primary>message</primary>
60533 <secondary>error</secondary>
60534 </indexterm>
60535 A message error is associated with a particular message when sent to a
60536 particular host, but not with a particular recipient of the message. The
60537 message errors are:
60538 </para>
60539 <itemizedlist>
60540 <listitem>
60541 <para>
60542 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
60543 the data,
60544 </para>
60545 </listitem>
60546 <listitem>
60547 <para>
60548 Timeout after MAIL,
60549 </para>
60550 </listitem>
60551 <listitem>
60552 <para>
60553 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
60554 timeout after the DATA command itself is treated as a host error, as is loss of
60555 connection at any other time.
60556 </para>
60557 </listitem>
60558 </itemizedlist>
60559 <para>
60560 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
60561 to be failed, and a delivery error report to be returned to the sender. A
60562 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
60563 addresses to be deferred. Retry data is not created for the host, but instead,
60564 a retry record for the combination of host plus message id is created. The
60565 message is not added to the list of those waiting for this host. This ensures
60566 that the failing message will not be sent to this host again until the retry
60567 time arrives. However, other messages that are routed to the host are not
60568 affected, so if it is some property of the message that is causing the error,
60569 it will not stop the delivery of other mail.
60570 </para>
60571 <para>
60572 If the remote host specified support for the SIZE parameter in its response
60573 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
60574 over-large message will cause a message error because the error arrives as a
60575 response to MAIL.
60576 </para>
60577 </listitem></varlistentry>
60578 <varlistentry>
60579 <term><emphasis role="bold">Recipient errors</emphasis></term>
60580 <listitem>
60581 <para>
60582 <indexterm role="concept">
60583 <primary>recipient</primary>
60584 <secondary>error</secondary>
60585 </indexterm>
60586 A recipient error is associated with a particular recipient of a message. The
60587 recipient errors are:
60588 </para>
60589 <itemizedlist>
60590 <listitem>
60591 <para>
60592 Any error response to RCPT,
60593 </para>
60594 </listitem>
60595 <listitem>
60596 <para>
60597 Timeout after RCPT.
60598 </para>
60599 </listitem>
60600 </itemizedlist>
60601 <para>
60602 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
60603 recipient address to be failed, and a bounce message to be returned to the
60604 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
60605 address to be deferred, and routing retry data to be created for it. This is
60606 used to delay processing of the address in subsequent queue runs, until its
60607 routing retry time arrives. This applies to all messages, but because it
60608 operates only in queue runs, one attempt will be made to deliver a new message
60609 to the failing address before the delay starts to operate. This ensures that,
60610 if the failure is really related to the message rather than the recipient
60611 (<quote>message too big for this recipient</quote> is a possible example), other messages
60612 have a chance of getting delivered. If a delivery to the address does succeed,
60613 the retry information gets cleared, so all stuck messages get tried again, and
60614 the retry clock is reset.
60615 </para>
60616 <para>
60617 The message is not added to the list of those waiting for this host. Use of the
60618 host for other messages is unaffected, and except in the case of a timeout,
60619 other recipients are processed independently, and may be successfully delivered
60620 in the current SMTP session. After a timeout it is of course impossible to
60621 proceed with the session, so all addresses get deferred. However, those other
60622 than the one that failed do not suffer any subsequent retry delays. Therefore,
60623 if one recipient is causing trouble, the others have a chance of getting
60624 through when a subsequent delivery attempt occurs before the failing
60625 recipient&#x2019;s retry time.
60626 </para>
60627 </listitem></varlistentry>
60628 </variablelist>
60629 <para>
60630 In all cases, if there are other hosts (or IP addresses) available for the
60631 current set of addresses (for example, from multiple MX records), they are
60632 tried in this run for any undelivered addresses, subject of course to their
60633 own retry data. In other words, recipient error retry data does not take effect
60634 until the next delivery attempt.
60635 </para>
60636 <para>
60637 Some hosts have been observed to give temporary error responses to every
60638 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
60639 would be nice if such circumstances could be recognized, and defer data for the
60640 host itself created, but this is not possible within the current Exim design.
60641 What actually happens is that retry data for every (host, message) combination
60642 is created.
60643 </para>
60644 <para>
60645 The reason that timeouts after MAIL and RCPT are treated specially is that
60646 these can sometimes arise as a result of the remote host&#x2019;s verification
60647 procedures. Exim makes this assumption, and treats them as if a temporary error
60648 response had been received. A timeout after <quote>.</quote> is treated specially because
60649 it is known that some broken implementations fail to recognize the end of the
60650 message if the last character of the last line is a binary zero. Thus, it is
60651 helpful to treat this case as a message error.
60652 </para>
60653 <para>
60654 Timeouts at other times are treated as host errors, assuming a problem with the
60655 host, or the connection to it. If a timeout after MAIL, RCPT,
60656 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
60657 the timeout is likely to occur at some other point in the dialogue, causing it
60658 then to be treated as a host error.
60659 </para>
60660 <para>
60661 There is experimental evidence that some MTAs drop the connection after the
60662 terminating <quote>.</quote> if they do not like the contents of the message for some
60663 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
60664 should be given. That is why Exim treats this case as a message rather than a
60665 host error, in order not to delay other messages to the same host.
60666 </para>
60667 </section>
60668 <section id="SECID233">
60669 <title>Incoming SMTP messages over TCP/IP</title>
60670 <para>
60671 <indexterm role="concept">
60672 <primary>SMTP</primary>
60673 <secondary>incoming over TCP/IP</secondary>
60674 </indexterm>
60675 <indexterm role="concept">
60676 <primary>incoming SMTP over TCP/IP</primary>
60677 </indexterm>
60678 <indexterm role="concept">
60679 <primary>inetd</primary>
60680 </indexterm>
60681 <indexterm role="concept">
60682 <primary>daemon</primary>
60683 </indexterm>
60684 Incoming SMTP messages can be accepted in one of two ways: by running a
60685 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
60686 <filename>/etc/inetd.conf</filename> should be like this:
60687 </para>
60688 <literallayout class="monospaced">
60689 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
60690 </literallayout>
60691 <para>
60692 Exim distinguishes between this case and the case of a locally running user
60693 agent using the <option>-bs</option> option by checking whether or not the standard input is
60694 a socket. When it is, either the port must be privileged (less than 1024), or
60695 the caller must be root or the Exim user. If any other user passes a socket
60696 with an unprivileged port number, Exim prints a message on the standard error
60697 stream and exits with an error code.
60698 </para>
60699 <para>
60700 By default, Exim does not make a log entry when a remote host connects or
60701 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
60702 unexpected. It can be made to write such log entries by setting the
60703 <option>smtp_connection</option> log selector.
60704 </para>
60705 <para>
60706 <indexterm role="concept">
60707 <primary>carriage return</primary>
60708 </indexterm>
60709 <indexterm role="concept">
60710 <primary>linefeed</primary>
60711 </indexterm>
60712 Commands from the remote host are supposed to be terminated by CR followed by
60713 LF. However, there are known to be hosts that do not send CR characters. In
60714 order to be able to interwork with such hosts, Exim treats LF on its own as a
60715 line terminator.
60716 Furthermore, because common code is used for receiving messages from all
60717 sources, a CR on its own is also interpreted as a line terminator. However, the
60718 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
60719 </para>
60720 <para>
60721 <indexterm role="concept">
60722 <primary>EHLO</primary>
60723 <secondary>invalid data</secondary>
60724 </indexterm>
60725 <indexterm role="concept">
60726 <primary>HELO</primary>
60727 <secondary>invalid data</secondary>
60728 </indexterm>
60729 One area that sometimes gives rise to problems concerns the EHLO or
60730 HELO commands. Some clients send syntactically invalid versions of these
60731 commands, which Exim rejects by default. (This is nothing to do with verifying
60732 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
60733 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
60734 match the broken hosts that send invalid commands.
60735 </para>
60736 <para>
60737 <indexterm role="concept">
60738 <primary>SIZE option on MAIL command</primary>
60739 </indexterm>
60740 <indexterm role="concept">
60741 <primary>MAIL</primary>
60742 <secondary>SIZE option</secondary>
60743 </indexterm>
60744 The amount of disk space available is checked whenever SIZE is received on
60745 a MAIL command, independently of whether <option>message_size_limit</option> or
60746 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
60747 false. A temporary error is given if there is not enough space. If
60748 <option>check_spool_space</option> is set, the check is for that amount of space plus the
60749 value given with SIZE, that is, it checks that the addition of the incoming
60750 message will not reduce the space below the threshold.
60751 </para>
60752 <para>
60753 When a message is successfully received, Exim includes the local message id in
60754 its response to the final <quote>.</quote> that terminates the data. If the remote host
60755 logs this text it can help with tracing what has happened to a message.
60756 </para>
60757 <para>
60758 The Exim daemon can limit the number of simultaneous incoming connections it is
60759 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
60760 number of simultaneous incoming connections from a single remote host (see the
60761 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
60762 rejected using the SMTP temporary error code 421.
60763 </para>
60764 <para>
60765 The Exim daemon does not rely on the SIGCHLD signal to detect when a
60766 subprocess has finished, as this can get lost at busy times. Instead, it looks
60767 for completed subprocesses every time it wakes up. Provided there are other
60768 things happening (new incoming calls, starts of queue runs), completed
60769 processes will be noticed and tidied away. On very quiet systems you may
60770 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
60771 it will be noticed when the daemon next wakes up.
60772 </para>
60773 <para>
60774 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
60775 and can also be set up to reject SMTP calls from non-reserved hosts at times of
60776 high system load &ndash; for details see the <option>smtp_accept_reserve</option>,
60777 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
60778 applies in both the daemon and <emphasis>inetd</emphasis> cases.
60779 </para>
60780 <para>
60781 Exim normally starts a delivery process for each message received, though this
60782 can be varied by means of the <option>-odq</option> command line option and the
60783 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
60784 number of simultaneously running delivery processes started in this way from
60785 SMTP input can be limited by the <option>smtp_accept_queue</option> and
60786 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
60787 subsequently received messages are just put on the input queue without starting
60788 a delivery process.
60789 </para>
60790 <para>
60791 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
60792 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
60793 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
60794 handled by an entirely independent Exim process. Control by load average is,
60795 however, available with <emphasis>inetd</emphasis>.
60796 </para>
60797 <para>
60798 Exim can be configured to verify addresses in incoming SMTP commands as they
60799 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
60800 to rewrite addresses at this time &ndash; before any syntax checking is done. See
60801 section <xref linkend="SECTrewriteS"/>.
60802 </para>
60803 <para>
60804 Exim can also be configured to limit the rate at which a client host submits
60805 MAIL and RCPT commands in a single SMTP session. See the
60806 <option>smtp_ratelimit_hosts</option> option.
60807 </para>
60808 </section>
60809 <section id="SECID234">
60810 <title>Unrecognized SMTP commands</title>
60811 <para>
60812 <indexterm role="concept">
60813 <primary>SMTP</primary>
60814 <secondary>unrecognized commands</secondary>
60815 </indexterm>
60816 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
60817 commands during a single SMTP connection, it drops the connection after sending
60818 the error response to the last command. The default value for
60819 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
60820 abuse that subvert web servers into making connections to SMTP ports; in these
60821 circumstances, a number of non-SMTP lines are sent first.
60822 </para>
60823 </section>
60824 <section id="SECID235">
60825 <title>Syntax and protocol errors in SMTP commands</title>
60826 <para>
60827 <indexterm role="concept">
60828 <primary>SMTP</primary>
60829 <secondary>syntax errors</secondary>
60830 </indexterm>
60831 <indexterm role="concept">
60832 <primary>SMTP</primary>
60833 <secondary>protocol errors</secondary>
60834 </indexterm>
60835 A syntax error is detected if an SMTP command is recognized, but there is
60836 something syntactically wrong with its data, for example, a malformed email
60837 address in a RCPT command. Protocol errors include invalid command
60838 sequencing such as RCPT before MAIL. If Exim receives more than
60839 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
60840 drops the connection after sending the error response to the last command. The
60841 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
60842 broken clients that loop sending bad commands (yes, it has been seen).
60843 </para>
60844 </section>
60845 <section id="SECID236">
60846 <title>Use of non-mail SMTP commands</title>
60847 <para>
60848 <indexterm role="concept">
60849 <primary>SMTP</primary>
60850 <secondary>non-mail commands</secondary>
60851 </indexterm>
60852 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
60853 DATA. Exim counts such commands, and drops the connection if there are too
60854 many of them in a single SMTP session. This action catches some
60855 denial-of-service attempts and things like repeated failing AUTHs, or a mad
60856 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
60857 defines what <quote>too many</quote> means. Its default value is 10.
60858 </para>
60859 <para>
60860 When a new message is expected, one occurrence of RSET is not counted. This
60861 allows a client to send one RSET between messages (this is not necessary,
60862 but some clients do it). Exim also allows one uncounted occurrence of HELO
60863 or EHLO, and one occurrence of STARTTLS between messages. After
60864 starting up a TLS session, another EHLO is expected, and so it too is not
60865 counted.
60866 </para>
60867 <para>
60868 The first occurrence of AUTH in a connection, or immediately following
60869 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
60870 RCPT, DATA, and QUIT are counted.
60871 </para>
60872 <para>
60873 You can control which hosts are subject to the limit set by
60874 <option>smtp_accept_max_nonmail</option> by setting
60875 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
60876 the limit apply to all hosts. This option means that you can exclude any
60877 specific badly-behaved hosts that you have to live with.
60878 </para>
60879 </section>
60880 <section id="SECID237">
60881 <title>The VRFY and EXPN commands</title>
60882 <para>
60883 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
60884 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
60885 appropriate) in order to decide whether the command should be accepted or not.
60886 If no ACL is defined, the command is rejected.
60887 </para>
60888 <para>
60889 <indexterm role="concept">
60890 <primary>VRFY</primary>
60891 <secondary>processing</secondary>
60892 </indexterm>
60893 When VRFY is accepted, it runs exactly the same code as when Exim is
60894 called with the <option>-bv</option> option.
60895 </para>
60896 <para>
60897 <indexterm role="concept">
60898 <primary>EXPN</primary>
60899 <secondary>processing</secondary>
60900 </indexterm>
60901 When EXPN is accepted, a single-level expansion of the address is done.
60902 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
60903 than a verification (the <option>-bv</option> option). If an unqualified local part is given
60904 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
60905 of VRFY and EXPN commands are logged on the main and reject logs, and
60906 VRFY verification failures are logged on the main log for consistency with
60907 RCPT failures.
60908 </para>
60909 </section>
60910 <section id="SECTETRN">
60911 <title>The ETRN command</title>
60912 <para>
60913 <indexterm role="concept">
60914 <primary>ETRN</primary>
60915 <secondary>processing</secondary>
60916 </indexterm>
60917 RFC 1985 describes an SMTP command called ETRN that is designed to
60918 overcome the security problems of the TURN command (which has fallen into
60919 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
60920 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
60921 should be accepted or not. If no ACL is defined, the command is rejected.
60922 </para>
60923 <para>
60924 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
60925 delivery to certain hosts. As Exim does not organize its message queue by host,
60926 the only form of ETRN that is supported by default is the one where the
60927 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
60928 specific to the SMTP server. A valid ETRN command causes a run of Exim with
60929 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
60930 argument. For example,
60931 </para>
60932 <literallayout class="monospaced">
60933 ETRN #brigadoon
60934 </literallayout>
60935 <para>
60936 runs the command
60937 </para>
60938 <literallayout class="monospaced">
60939 exim -R brigadoon
60940 </literallayout>
60941 <para>
60942 which causes a delivery attempt on all messages with undelivered addresses
60943 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
60944 default), Exim prevents the simultaneous execution of more than one queue run
60945 for the same argument string as a result of an ETRN command. This stops
60946 a misbehaving client from starting more than one queue runner at once.
60947 </para>
60948 <para>
60949 <indexterm role="concept">
60950 <primary>hints database</primary>
60951 <secondary>ETRN serialization</secondary>
60952 </indexterm>
60953 Exim implements the serialization by means of a hints database in which a
60954 record is written whenever a process is started by ETRN, and deleted when
60955 the process completes. However, Exim does not keep the SMTP session waiting for
60956 the ETRN process to complete. Once ETRN is accepted, the client is sent
60957 a <quote>success</quote> return code. Obviously there is scope for hints records to get
60958 left lying around if there is a system or program crash. To guard against this,
60959 Exim ignores any records that are more than six hours old.
60960 </para>
60961 <para>
60962 <indexterm role="option">
60963 <primary><option>smtp_etrn_command</option></primary>
60964 </indexterm>
60965 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
60966 used. This specifies a command that is run whenever ETRN is received,
60967 whatever the form of its argument. For
60968 example:
60969 </para>
60970 <literallayout class="monospaced">
60971 smtp_etrn_command = /etc/etrn_command $domain \
60972                     $sender_host_address
60973 </literallayout>
60974 <para>
60975 <indexterm role="variable">
60976 <primary><varname>$domain</varname></primary>
60977 </indexterm>
60978 The string is split up into arguments which are independently expanded. The
60979 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
60980 and no syntax checking is done on the contents of this argument. Exim does not
60981 wait for the command to complete, so its status code is not checked. Exim runs
60982 under its own uid and gid when receiving incoming SMTP, so it is not possible
60983 for it to change them before running the command.
60984 </para>
60985 </section>
60986 <section id="SECID238">
60987 <title>Incoming local SMTP</title>
60988 <para>
60989 <indexterm role="concept">
60990 <primary>SMTP</primary>
60991 <secondary>local incoming</secondary>
60992 </indexterm>
60993 Some user agents use SMTP to pass messages to their local MTA using the
60994 standard input and output, as opposed to passing the envelope on the command
60995 line and writing the message to the standard input. This is supported by the
60996 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
60997 messages over TCP/IP (including the use of ACLs), except that the envelope
60998 sender given in a MAIL command is ignored unless the caller is trusted. In
60999 an ACL you can detect this form of SMTP input by testing for an empty host
61000 identification. It is common to have this as the first line in the ACL that
61001 runs for RCPT commands:
61002 </para>
61003 <literallayout class="monospaced">
61004 accept hosts = :
61005 </literallayout>
61006 <para>
61007 This accepts SMTP messages from local processes without doing any other tests.
61008 </para>
61009 </section>
61010 <section id="SECTbatchSMTP">
61011 <title>Outgoing batched SMTP</title>
61012 <para>
61013 <indexterm role="concept">
61014 <primary>SMTP</primary>
61015 <secondary>batched outgoing</secondary>
61016 </indexterm>
61017 <indexterm role="concept">
61018 <primary>batched SMTP output</primary>
61019 </indexterm>
61020 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
61021 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
61022 be output in BSMTP format. No SMTP responses are possible for this form of
61023 delivery. All it is doing is using SMTP commands as a way of transmitting the
61024 envelope along with the message.
61025 </para>
61026 <para>
61027 The message is written to the file or pipe preceded by the SMTP commands
61028 MAIL and RCPT, and followed by a line containing a single dot. Lines in
61029 the message that start with a dot have an extra dot added. The SMTP command
61030 HELO is not normally used. If it is required, the <option>message_prefix</option> option
61031 can be used to specify it.
61032 </para>
61033 <para>
61034 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
61035 one recipient address at a time by default. However, you can arrange for them
61036 to handle several addresses at once by setting the <option>batch_max</option> option. When
61037 this is done for BSMTP, messages may contain multiple RCPT commands. See
61038 chapter <xref linkend="CHAPbatching"/> for more details.
61039 </para>
61040 <para>
61041 <indexterm role="variable">
61042 <primary><varname>$host</varname></primary>
61043 </indexterm>
61044 When one or more addresses are routed to a BSMTP transport by a router that
61045 sets up a host list, the name of the first host on the list is available to the
61046 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
61047 router:
61048 </para>
61049 <literallayout class="monospaced">
61050 begin routers
61051 route_append:
61052   driver = manualroute
61053   transport = smtp_appendfile
61054   route_list = domain.example  batch.host.example
61055
61056 begin transports
61057 smtp_appendfile:
61058   driver = appendfile
61059   directory = /var/bsmtp/$host
61060   batch_max = 1000
61061   use_bsmtp
61062   user = exim
61063 </literallayout>
61064 <para>
61065 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
61066 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
61067 message (unless there are more than 1000 recipients).
61068 </para>
61069 </section>
61070 <section id="SECTincomingbatchedSMTP">
61071 <title>Incoming batched SMTP</title>
61072 <para>
61073 <indexterm role="concept">
61074 <primary>SMTP</primary>
61075 <secondary>batched incoming</secondary>
61076 </indexterm>
61077 <indexterm role="concept">
61078 <primary>batched SMTP input</primary>
61079 </indexterm>
61080 The <option>-bS</option> command line option causes Exim to accept one or more messages by
61081 reading SMTP on the standard input, but to generate no responses. If the caller
61082 is trusted, the senders in the MAIL commands are believed; otherwise the
61083 sender is always the caller of Exim. Unqualified senders and receivers are not
61084 rejected (there seems little point) but instead just get qualified. HELO
61085 and EHLO act as RSET; VRFY, EXPN, ETRN and  HELP, act
61086 as NOOP; QUIT quits.
61087 </para>
61088 <para>
61089 Minimal policy checking is done for BSMTP input. Only the non-SMTP
61090 ACL is run in the same way as for non-SMTP local input.
61091 </para>
61092 <para>
61093 If an error is detected while reading a message, including a missing <quote>.</quote> at
61094 the end, Exim gives up immediately. It writes details of the error to the
61095 standard output in a stylized way that the calling program should be able to
61096 make some use of automatically, for example:
61097 </para>
61098 <literallayout class="monospaced">
61099 554 Unexpected end of file
61100 Transaction started in line 10
61101 Error detected in line 14
61102 </literallayout>
61103 <para>
61104 It writes a more verbose version, for human consumption, to the standard error
61105 file, for example:
61106 </para>
61107 <literallayout class="monospaced">
61108 An error was detected while processing a file of BSMTP input.
61109 The error message was:
61110
61111 501 '&gt;' missing at end of address
61112
61113 The SMTP transaction started in line 10.
61114 The error was detected in line 12.
61115 The SMTP command at fault was:
61116
61117 rcpt to:&lt;malformed@in.com.plete
61118
61119 1 previous message was successfully processed.
61120 The rest of the batch was abandoned.
61121 </literallayout>
61122 <para>
61123 The return code from Exim is zero only if there were no errors. It is 1 if some
61124 messages were accepted before an error was detected, and 2 if no messages were
61125 accepted.
61126 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
61127 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
61128 </para>
61129 </section>
61130 </chapter>
61131
61132 <chapter id="CHAPemsgcust">
61133 <title>Customizing bounce and warning messages</title>
61134 <titleabbrev>Customizing messages</titleabbrev>
61135 <para>
61136 When a message fails to be delivered, or remains on the queue for more than a
61137 configured amount of time, Exim sends a message to the original sender, or
61138 to an alternative configured address. The text of these messages is built into
61139 the code of Exim, but it is possible to change it, either by adding a single
61140 string, or by replacing each of the paragraphs by text supplied in a file.
61141 </para>
61142 <para>
61143 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
61144 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
61145 option. Exim also adds the line
61146 </para>
61147 <literallayout class="monospaced">
61148 Auto-Submitted: auto-generated
61149 </literallayout>
61150 <para>
61151 to all warning and bounce messages,
61152 </para>
61153 <section id="SECID239">
61154 <title>Customizing bounce messages</title>
61155 <para>
61156 <indexterm role="concept">
61157 <primary>customizing</primary>
61158 <secondary>bounce message</secondary>
61159 </indexterm>
61160 <indexterm role="concept">
61161 <primary>bounce message</primary>
61162 <secondary>customizing</secondary>
61163 </indexterm>
61164 If <option>bounce_message_text</option> is set, its contents are included in the default
61165 message immediately after <quote>This message was created automatically by mail
61166 delivery software.</quote> The string is not expanded. It is not used if
61167 <option>bounce_message_file</option> is set.
61168 </para>
61169 <para>
61170 When <option>bounce_message_file</option> is set, it must point to a template file for
61171 constructing error messages. The file consists of a series of text items,
61172 separated by lines consisting of exactly four asterisks. If the file cannot be
61173 opened, default text is used and a message is written to the main and panic
61174 logs. If any text item in the file is empty, default text is used for that
61175 item.
61176 </para>
61177 <para>
61178 <indexterm role="variable">
61179 <primary><varname>$bounce_recipient</varname></primary>
61180 </indexterm>
61181 <indexterm role="variable">
61182 <primary><varname>$bounce_return_size_limit</varname></primary>
61183 </indexterm>
61184 Each item of text that is read from the file is expanded, and there are two
61185 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
61186 the recipient of an error message while it is being created, and
61187 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
61188 option, rounded to a whole number.
61189 </para>
61190 <para>
61191 The items must appear in the file in the following order:
61192 </para>
61193 <itemizedlist>
61194 <listitem>
61195 <para>
61196 The first item is included in the headers, and should include at least a
61197 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
61198 </para>
61199 </listitem>
61200 <listitem>
61201 <para>
61202 The second item forms the start of the error message. After it, Exim lists the
61203 failing addresses with their error messages.
61204 </para>
61205 </listitem>
61206 <listitem>
61207 <para>
61208 The third item is used to introduce any text from pipe transports that is to be
61209 returned to the sender. It is omitted if there is no such text.
61210 </para>
61211 </listitem>
61212 <listitem>
61213 <para>
61214 The fourth item is used to introduce the copy of the message that is returned
61215 as part of the error report.
61216 </para>
61217 </listitem>
61218 <listitem>
61219 <para>
61220 The fifth item is added after the fourth one if the returned message is
61221 truncated because it is bigger than <option>return_size_limit</option>.
61222 </para>
61223 </listitem>
61224 <listitem>
61225 <para>
61226 The sixth item is added after the copy of the original message.
61227 </para>
61228 </listitem>
61229 </itemizedlist>
61230 <para>
61231 The default state (<option>bounce_message_file</option> unset) is equivalent to the
61232 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
61233 other lines have been split in order to fit them on the page:
61234 </para>
61235 <literallayout class="monospaced">
61236 Subject: Mail delivery failed
61237   ${if eq{$sender_address}{$bounce_recipient}
61238   {: returning message to sender}}
61239 ****
61240 This message was created automatically by mail delivery software.
61241
61242 A message ${if eq{$sender_address}{$bounce_recipient}
61243   {that you sent }{sent by
61244
61245 &lt;$sender_address&gt;
61246
61247 }}could not be delivered to all of its recipients.
61248 This is a permanent error. The following address(es) failed:
61249 ****
61250 The following text was generated during the delivery attempt(s):
61251 ****
61252 ------ This is a copy of the message, including all the headers.
61253   ------
61254 ****
61255 ------ The body of the message is $message_size characters long;
61256   only the first
61257 ------ $bounce_return_size_limit or so are included here.
61258 ****
61259 </literallayout>
61260 </section>
61261 <section id="SECTcustwarn">
61262 <title>Customizing warning messages</title>
61263 <para>
61264 <indexterm role="concept">
61265 <primary>customizing</primary>
61266 <secondary>warning message</secondary>
61267 </indexterm>
61268 <indexterm role="concept">
61269 <primary>warning of delay</primary>
61270 <secondary>customizing the message</secondary>
61271 </indexterm>
61272 The option <option>warn_message_file</option> can be pointed at a template file for use when
61273 warnings about message delays are created. In this case there are only three
61274 text sections:
61275 </para>
61276 <itemizedlist>
61277 <listitem>
61278 <para>
61279 The first item is included in the headers, and should include at least a
61280 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
61281 </para>
61282 </listitem>
61283 <listitem>
61284 <para>
61285 The second item forms the start of the warning message. After it, Exim lists
61286 the delayed addresses.
61287 </para>
61288 </listitem>
61289 <listitem>
61290 <para>
61291 The third item then ends the message.
61292 </para>
61293 </listitem>
61294 </itemizedlist>
61295 <para>
61296 The default state is equivalent to the following file, except that some lines
61297 have been split here, in order to fit them on the page:
61298 </para>
61299 <literallayout class="monospaced">
61300 Subject: Warning: message $message_exim_id delayed
61301   $warn_message_delay
61302 ****
61303 This message was created automatically by mail delivery software.
61304
61305 A message ${if eq{$sender_address}{$warn_message_recipients}
61306 {that you sent }{sent by
61307
61308 &lt;$sender_address&gt;
61309
61310 }}has not been delivered to all of its recipients after
61311 more than $warn_message_delay on the queue on $primary_hostname.
61312
61313 The message identifier is:     $message_exim_id
61314 The subject of the message is: $h_subject
61315 The date of the message is:    $h_date
61316
61317 The following address(es) have not yet been delivered:
61318 ****
61319 No action is required on your part. Delivery attempts will
61320 continue for some time, and this warning may be repeated at
61321 intervals if the message remains undelivered. Eventually the
61322 mail delivery software will give up, and when that happens,
61323 the message will be returned to you.
61324 </literallayout>
61325 <para>
61326 <indexterm role="variable">
61327 <primary><varname>$warn_message_delay</varname></primary>
61328 </indexterm>
61329 <indexterm role="variable">
61330 <primary><varname>$warn_message_recipients</varname></primary>
61331 </indexterm>
61332 However, in the default state the subject and date lines are omitted if no
61333 appropriate headers exist. During the expansion of this file,
61334 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote>&lt;<emphasis>n</emphasis>&gt;
61335 minutes</quote> or <quote>&lt;<emphasis>n</emphasis>&gt; hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
61336 of recipients for the warning message. There may be more than one if there are
61337 multiple addresses with different <option>errors_to</option> settings on the routers that
61338 handled them.
61339 </para>
61340 </section>
61341 </chapter>
61342
61343 <chapter id="CHAPcomconreq">
61344 <title>Some common configuration settings</title>
61345 <para>
61346 This chapter discusses some configuration settings that seem to be fairly
61347 common. More examples and discussion can be found in the Exim book.
61348 </para>
61349 <section id="SECID240">
61350 <title>Sending mail to a smart host</title>
61351 <para>
61352 <indexterm role="concept">
61353 <primary>smart host</primary>
61354 <secondary>example router</secondary>
61355 </indexterm>
61356 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
61357 should replace the default <command>dnslookup</command> router with a router which does the
61358 routing explicitly:
61359 </para>
61360 <literallayout class="monospaced">
61361 send_to_smart_host:
61362   driver = manualroute
61363   route_list = !+local_domains smart.host.name
61364   transport = remote_smtp
61365 </literallayout>
61366 <para>
61367 You can use the smart host&#x2019;s IP address instead of the name if you wish.
61368 If you are using Exim only to submit messages to a smart host, and not for
61369 receiving incoming messages, you can arrange for it to do the submission
61370 synchronously by setting the <option>mua_wrapper</option> option (see chapter
61371 <xref linkend="CHAPnonqueueing"/>).
61372 </para>
61373 </section>
61374 <section id="SECTmailinglists">
61375 <title>Using Exim to handle mailing lists</title>
61376 <para>
61377 <indexterm role="concept">
61378 <primary>mailing lists</primary>
61379 </indexterm>
61380 Exim can be used to run simple mailing lists, but for large and/or complicated
61381 requirements, the use of additional specialized mailing list software such as
61382 Majordomo or Mailman is recommended.
61383 </para>
61384 <para>
61385 The <command>redirect</command> router can be used to handle mailing lists where each list
61386 is maintained in a separate file, which can therefore be managed by an
61387 independent manager. The <option>domains</option> router option can be used to run these
61388 lists in a separate domain from normal mail. For example:
61389 </para>
61390 <literallayout class="monospaced">
61391 lists:
61392   driver = redirect
61393   domains = lists.example
61394   file = /usr/lists/$local_part
61395   forbid_pipe
61396   forbid_file
61397   errors_to = $local_part-request@lists.example
61398   no_more
61399 </literallayout>
61400 <para>
61401 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
61402 in that domain, it looks for a file that matches the local part. If there is no
61403 such file, the router declines, but because <option>no_more</option> is set, no subsequent
61404 routers are tried, and so the whole delivery fails.
61405 </para>
61406 <para>
61407 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
61408 expanded into a file name or a pipe delivery, which is usually inappropriate in
61409 a mailing list.
61410 </para>
61411 <para>
61412 <indexterm role="option">
61413 <primary><option>errors_to</option></primary>
61414 </indexterm>
61415 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
61416 taken from a mailing list are to be sent to the given address rather than the
61417 original sender of the message. However, before acting on this, Exim verifies
61418 the error address, and ignores it if verification fails.
61419 </para>
61420 <para>
61421 For example, using the configuration above, mail sent to
61422 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
61423 <filename>/usr/lists/dicts</filename>, with error reports directed to
61424 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
61425 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
61426 the address(es) of this particular list&#x2019;s manager(s), but other approaches,
61427 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
61428 or <option>local_part_suffix</option> options) to handle addresses of the form
61429 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
61430 </para>
61431 </section>
61432 <section id="SECID241">
61433 <title>Syntax errors in mailing lists</title>
61434 <para>
61435 <indexterm role="concept">
61436 <primary>mailing lists</primary>
61437 <secondary>syntax errors in</secondary>
61438 </indexterm>
61439 If an entry in redirection data contains a syntax error, Exim normally defers
61440 delivery of the original address. That means that a syntax error in a mailing
61441 list holds up all deliveries to the list. This may not be appropriate when a
61442 list is being maintained automatically from data supplied by users, and the
61443 addresses are not rigorously checked.
61444 </para>
61445 <para>
61446 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
61447 entries that fail to parse, noting the incident in the log. If in addition
61448 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
61449 whenever a broken address is skipped. It is usually appropriate to set
61450 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
61451 </para>
61452 </section>
61453 <section id="SECID242">
61454 <title>Re-expansion of mailing lists</title>
61455 <para>
61456 <indexterm role="concept">
61457 <primary>mailing lists</primary>
61458 <secondary>re-expansion of</secondary>
61459 </indexterm>
61460 Exim remembers every individual address to which a message has been delivered,
61461 in order to avoid duplication, but it normally stores only the original
61462 recipient addresses with a message. If all the deliveries to a mailing list
61463 cannot be done at the first attempt, the mailing list is re-expanded when the
61464 delivery is next tried. This means that alterations to the list are taken into
61465 account at each delivery attempt, so addresses that have been added to
61466 the list since the message arrived will therefore receive a copy of the
61467 message, even though it pre-dates their subscription.
61468 </para>
61469 <para>
61470 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
61471 on the <command>redirect</command> router. If this is done, any addresses generated by the
61472 router that fail to deliver at the first attempt are added to the message as
61473 <quote>top level</quote> addresses, and the parent address that generated them is marked
61474 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
61475 subsequent delivery attempts. The disadvantage of this is that if any of the
61476 failing addresses are incorrect, correcting them in the file has no effect on
61477 pre-existing messages.
61478 </para>
61479 <para>
61480 The original top-level address is remembered with each of the generated
61481 addresses, and is output in any log messages. However, any intermediate parent
61482 addresses are not recorded. This makes a difference to the log only if the
61483 <option>all_parents</option> selector is set, but for mailing lists there is normally only
61484 one level of expansion anyway.
61485 </para>
61486 </section>
61487 <section id="SECID243">
61488 <title>Closed mailing lists</title>
61489 <para>
61490 <indexterm role="concept">
61491 <primary>mailing lists</primary>
61492 <secondary>closed</secondary>
61493 </indexterm>
61494 The examples so far have assumed open mailing lists, to which anybody may
61495 send mail. It is also possible to set up closed lists, where mail is accepted
61496 from specified senders only. This is done by making use of the generic
61497 <option>senders</option> option to restrict the router that handles the list.
61498 </para>
61499 <para>
61500 The following example uses the same file as a list of recipients and as a list
61501 of permitted senders. It requires three routers:
61502 </para>
61503 <literallayout class="monospaced">
61504 lists_request:
61505   driver = redirect
61506   domains = lists.example
61507   local_part_suffix = -request
61508   file = /usr/lists/$local_part$local_part_suffix
61509   no_more
61510
61511 lists_post:
61512   driver = redirect
61513   domains = lists.example
61514   senders = ${if exists {/usr/lists/$local_part}\
61515              {lsearch;/usr/lists/$local_part}{*}}
61516   file = /usr/lists/$local_part
61517   forbid_pipe
61518   forbid_file
61519   errors_to = $local_part-request@lists.example
61520   no_more
61521
61522 lists_closed:
61523   driver = redirect
61524   domains = lists.example
61525   allow_fail
61526   data = :fail: $local_part@lists.example is a closed mailing list
61527 </literallayout>
61528 <para>
61529 All three routers have the same <option>domains</option> setting, so for any other domains,
61530 they are all skipped. The first router runs only if the local part ends in
61531 <option>-request</option>. It handles messages to the list manager(s) by means of an open
61532 mailing list.
61533 </para>
61534 <para>
61535 The second router runs only if the <option>senders</option> precondition is satisfied. It
61536 checks for the existence of a list that corresponds to the local part, and then
61537 checks that the sender is on the list by means of a linear search. It is
61538 necessary to check for the existence of the file before trying to search it,
61539 because otherwise Exim thinks there is a configuration error. If the file does
61540 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
61541 means that the router runs, but because there is no list, declines, and
61542 <option>no_more</option> ensures that no further routers are run. The address fails with an
61543 <quote>unrouteable address</quote> error.
61544 </para>
61545 <para>
61546 The third router runs only if the second router is skipped, which happens when
61547 a mailing list exists, but the sender is not on it. This router forcibly fails
61548 the address, giving a suitable error message.
61549 </para>
61550 </section>
61551 <section id="SECTverp">
61552 <title>Variable Envelope Return Paths (VERP)</title>
61553 <para>
61554 <indexterm role="concept">
61555 <primary>VERP</primary>
61556 </indexterm>
61557 <indexterm role="concept">
61558 <primary>Variable Envelope Return Paths</primary>
61559 </indexterm>
61560 <indexterm role="concept">
61561 <primary>envelope sender</primary>
61562 </indexterm>
61563 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;
61564 are a way of helping mailing list administrators discover which subscription
61565 address is the cause of a particular delivery failure. The idea is to encode
61566 the original recipient address in the outgoing envelope sender address, so that
61567 if the message is forwarded by another host and then subsequently bounces, the
61568 original recipient can be extracted from the recipient address of the bounce.
61569 </para>
61570 <para>
61571 <indexterm role="option">
61572 <primary><option>errors_to</option></primary>
61573 </indexterm>
61574 <indexterm role="option">
61575 <primary><option>return_path</option></primary>
61576 </indexterm>
61577 Envelope sender addresses can be modified by Exim using two different
61578 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
61579 list examples), or the <option>return_path</option> option on a transport. The second of
61580 these is effective only if the message is successfully delivered to another
61581 host; it is not used for errors detected on the local host (see the description
61582 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
61583 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
61584 </para>
61585 <literallayout class="monospaced">
61586 verp_smtp:
61587   driver = smtp
61588   max_rcpt = 1
61589   return_path = \
61590     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
61591       {$1-request+$local_part=$domain@your.dom.example}fail}
61592 </literallayout>
61593 <para>
61594 This has the effect of rewriting the return path (envelope sender) on outgoing
61595 SMTP messages, if the local part of the original return path ends in
61596 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
61597 local part and domain of the recipient into the return path. Suppose, for
61598 example, that a message whose return path has been set to
61599 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
61600 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
61601 rewritten as
61602 </para>
61603 <literallayout class="monospaced">
61604 somelist-request+subscriber=other.dom.example@your.dom.example
61605 </literallayout>
61606 <para>
61607 <indexterm role="variable">
61608 <primary><varname>$local_part</varname></primary>
61609 </indexterm>
61610 For this to work, you must tell Exim to send multiple copies of messages that
61611 have more than one recipient, so that each copy has just one recipient. This is
61612 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
61613 might be sent to several different recipients in the same domain, in which case
61614 <varname>$local_part</varname> is not available in the transport, because it is not unique.
61615 </para>
61616 <para>
61617 Unless your host is doing nothing but mailing list deliveries, you should
61618 probably use a separate transport for the VERP deliveries, so as not to use
61619 extra resources in making one-per-recipient copies for other deliveries. This
61620 can easily be done by expanding the <option>transport</option> option in the router:
61621 </para>
61622 <literallayout class="monospaced">
61623 dnslookup:
61624   driver = dnslookup
61625   domains = ! +local_domains
61626   transport = \
61627     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
61628       {verp_smtp}{remote_smtp}}
61629   no_more
61630 </literallayout>
61631 <para>
61632 If you want to change the return path using <option>errors_to</option> in a router instead
61633 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
61634 routers that handle mailing list addresses. This will ensure that all delivery
61635 errors, including those detected on the local host, are sent to the VERP
61636 address.
61637 </para>
61638 <para>
61639 On a host that does no local deliveries and has no manual routing, only the
61640 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
61641 SMTP deliveries. Every mailing list recipient has its own return path value,
61642 and so Exim must hand them to the transport one at a time. Here is an example
61643 of a <command>dnslookup</command> router that implements VERP:
61644 </para>
61645 <literallayout class="monospaced">
61646 verp_dnslookup:
61647   driver = dnslookup
61648   domains = ! +local_domains
61649   transport = remote_smtp
61650   errors_to = \
61651     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
61652      {$1-request+$local_part=$domain@your.dom.example}fail}
61653   no_more
61654 </literallayout>
61655 <para>
61656 Before you start sending out messages with VERPed return paths, you must also
61657 configure Exim to accept the bounce messages that come back to those paths.
61658 Typically this is done by setting a <option>local_part_suffix</option> option for a
61659 router, and using this to route the messages to wherever you want to handle
61660 them.
61661 </para>
61662 <para>
61663 The overhead incurred in using VERP depends very much on the size of the
61664 message, the number of recipient addresses that resolve to the same remote
61665 host, and the speed of the connection over which the message is being sent. If
61666 a lot of addresses resolve to the same host and the connection is slow, sending
61667 a separate copy of the message for each address may take substantially longer
61668 than sending a single copy with many recipients (for which VERP cannot be
61669 used).
61670 </para>
61671 </section>
61672 <section id="SECTvirtualdomains">
61673 <title>Virtual domains</title>
61674 <para>
61675 <indexterm role="concept">
61676 <primary>virtual domains</primary>
61677 </indexterm>
61678 <indexterm role="concept">
61679 <primary>domain</primary>
61680 <secondary>virtual</secondary>
61681 </indexterm>
61682 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
61683 meanings:
61684 </para>
61685 <itemizedlist>
61686 <listitem>
61687 <para>
61688 A domain for which there are no real mailboxes; all valid local parts are
61689 aliases for other email addresses. Common examples are organizational
61690 top-level domains and <quote>vanity</quote> domains.
61691 </para>
61692 </listitem>
61693 <listitem>
61694 <para>
61695 One of a number of independent domains that are all handled by the same host,
61696 with mailboxes on that host, but where the mailbox owners do not necessarily
61697 have login accounts on that host.
61698 </para>
61699 </listitem>
61700 </itemizedlist>
61701 <para>
61702 The first usage is probably more common, and does seem more <quote>virtual</quote> than
61703 the second. This kind of domain can be handled in Exim with a straightforward
61704 aliasing router. One approach is to create a separate alias file for each
61705 virtual domain. Exim can test for the existence of the alias file to determine
61706 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
61707 to a router of this form:
61708 </para>
61709 <literallayout class="monospaced">
61710 virtual:
61711   driver = redirect
61712   domains = dsearch;/etc/mail/virtual
61713   data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain}}
61714   no_more
61715 </literallayout>
61716 <para>
61717 The <option>domains</option> option specifies that the router is to be skipped, unless there
61718 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
61719 domain that is being processed. When the router runs, it looks up the local
61720 part in the file to find a new address (or list of addresses). The <option>no_more</option>
61721 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
61722 string), Exim gives up on the address without trying any subsequent routers.
61723 </para>
61724 <para>
61725 This one router can handle all the virtual domains because the alias file names
61726 follow a fixed pattern. Permissions can be arranged so that appropriate people
61727 can edit the different alias files. A successful aliasing operation results in
61728 a new envelope recipient address, which is then routed from scratch.
61729 </para>
61730 <para>
61731 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
61732 way. One approach is to create a file for each domain containing a list of
61733 valid local parts, and use it in a router like this:
61734 </para>
61735 <literallayout class="monospaced">
61736 my_domains:
61737   driver = accept
61738   domains = dsearch;/etc/mail/domains
61739   local_parts = lsearch;/etc/mail/domains/$domain
61740   transport = my_mailboxes
61741 </literallayout>
61742 <para>
61743 The address is accepted if there is a file for the domain, and the local part
61744 can be found in the file. The <option>domains</option> option is used to check for the
61745 file&#x2019;s existence because <option>domains</option> is tested before the <option>local_parts</option>
61746 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
61747 because that option is tested after <option>local_parts</option>. The transport is as
61748 follows:
61749 </para>
61750 <literallayout class="monospaced">
61751 my_mailboxes:
61752   driver = appendfile
61753   file = /var/mail/$domain/$local_part
61754   user = mail
61755 </literallayout>
61756 <para>
61757 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
61758 required, to specify which uid is to be used for writing to the mailboxes.
61759 </para>
61760 <para>
61761 The configuration shown here is just one example of how you might support this
61762 requirement. There are many other ways this kind of configuration can be set
61763 up, for example, by using a database instead of separate files to hold all the
61764 information about the domains.
61765 </para>
61766 </section>
61767 <section id="SECTmulbox">
61768 <title>Multiple user mailboxes</title>
61769 <para>
61770 <indexterm role="concept">
61771 <primary>multiple mailboxes</primary>
61772 </indexterm>
61773 <indexterm role="concept">
61774 <primary>mailbox</primary>
61775 <secondary>multiple</secondary>
61776 </indexterm>
61777 <indexterm role="concept">
61778 <primary>local part</primary>
61779 <secondary>prefix</secondary>
61780 </indexterm>
61781 <indexterm role="concept">
61782 <primary>local part</primary>
61783 <secondary>suffix</secondary>
61784 </indexterm>
61785 Heavy email users often want to operate with multiple mailboxes, into which
61786 incoming mail is automatically sorted. A popular way of handling this is to
61787 allow users to use multiple sender addresses, so that replies can easily be
61788 identified. Users are permitted to add prefixes or suffixes to their local
61789 parts for this purpose. The wildcard facility of the generic router options
61790 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
61791 example, consider this router:
61792 </para>
61793 <literallayout class="monospaced">
61794 userforward:
61795   driver = redirect
61796   check_local_user
61797   file = $home/.forward
61798   local_part_suffix = -*
61799   local_part_suffix_optional
61800   allow_filter
61801 </literallayout>
61802 <para>
61803 <indexterm role="variable">
61804 <primary><varname>$local_part_suffix</varname></primary>
61805 </indexterm>
61806 It runs a user&#x2019;s <filename>.forward</filename> file for all local parts of the form
61807 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
61808 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
61809 </para>
61810 <literallayout class="monospaced">
61811 if $local_part_suffix contains -special then
61812 save /home/$local_part/Mail/special
61813 endif
61814 </literallayout>
61815 <para>
61816 If the filter file does not exist, or does not deal with such addresses, they
61817 fall through to subsequent routers, and, assuming no subsequent use of the
61818 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
61819 control over which suffixes are valid.
61820 </para>
61821 <para>
61822 Alternatively, a suffix can be used to trigger the use of a different
61823 <filename>.forward</filename> file &ndash; which is the way a similar facility is implemented in
61824 another MTA:
61825 </para>
61826 <literallayout class="monospaced">
61827 userforward:
61828   driver = redirect
61829   check_local_user
61830   file = $home/.forward$local_part_suffix
61831   local_part_suffix = -*
61832   local_part_suffix_optional
61833   allow_filter
61834 </literallayout>
61835 <para>
61836 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
61837 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
61838 does not exist, or does not deal with the address, it is passed on to
61839 subsequent routers, which could, if required, look for an unqualified
61840 <filename>.forward</filename> file to use as a default.
61841 </para>
61842 </section>
61843 <section id="SECID244">
61844 <title>Simplified vacation processing</title>
61845 <para>
61846 <indexterm role="concept">
61847 <primary>vacation processing</primary>
61848 </indexterm>
61849 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
61850 a pipe command in a <filename>.forward</filename> file
61851 (see section <xref linkend="SECTspecitredli"/> for syntax details).
61852 This is prone to error by inexperienced users. There are two features of Exim
61853 that can be used to make this process simpler for users:
61854 </para>
61855 <itemizedlist>
61856 <listitem>
61857 <para>
61858 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
61859 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
61860 alternatively can use Exim&#x2019;s <command>autoreply</command> transport. The contents of a user&#x2019;s
61861 <filename>.forward</filename> file are then much simpler. For example:
61862 </para>
61863 <literallayout class="monospaced">
61864 spqr, vacation-spqr
61865 </literallayout>
61866 </listitem>
61867 <listitem>
61868 <para>
61869 The <option>require_files</option> generic router option can be used to trigger a
61870 vacation delivery by checking for the existence of a certain file in the
61871 user&#x2019;s home directory. The <option>unseen</option> generic option should also be used, to
61872 ensure that the original delivery also proceeds. In this case, all the user has
61873 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
61874 message.
61875 </para>
61876 </listitem>
61877 </itemizedlist>
61878 <para>
61879 Another advantage of both these methods is that they both work even when the
61880 use of arbitrary pipes by users is locked out.
61881 </para>
61882 </section>
61883 <section id="SECID245">
61884 <title>Taking copies of mail</title>
61885 <para>
61886 <indexterm role="concept">
61887 <primary>message</primary>
61888 <secondary>copying every</secondary>
61889 </indexterm>
61890 Some installations have policies that require archive copies of all messages to
61891 be made. A single copy of each message can easily be taken by an appropriate
61892 command in a system filter, which could, for example, use a different file for
61893 each day&#x2019;s messages.
61894 </para>
61895 <para>
61896 There is also a shadow transport mechanism that can be used to take copies of
61897 messages that are successfully delivered by local transports, one copy per
61898 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
61899 notification of delivery by sites that insist on doing such things.
61900 </para>
61901 </section>
61902 <section id="SECID246">
61903 <title>Intermittently connected hosts</title>
61904 <para>
61905 <indexterm role="concept">
61906 <primary>intermittently connected hosts</primary>
61907 </indexterm>
61908 It has become quite common (because it is cheaper) for hosts to connect to the
61909 Internet periodically rather than remain connected all the time. The normal
61910 arrangement is that mail for such hosts accumulates on a system that is
61911 permanently connected.
61912 </para>
61913 <para>
61914 Exim was designed for use on permanently connected hosts, and so it is not
61915 particularly well-suited to use in an intermittently connected environment.
61916 Nevertheless there are some features that can be used.
61917 </para>
61918 </section>
61919 <section id="SECID247">
61920 <title>Exim on the upstream server host</title>
61921 <para>
61922 It is tempting to arrange for incoming mail for the intermittently connected
61923 host to remain on Exim&#x2019;s queue until the client connects. However, this
61924 approach does not scale very well. Two different kinds of waiting message are
61925 being mixed up in the same queue &ndash; those that cannot be delivered because of
61926 some temporary problem, and those that are waiting for their destination host
61927 to connect. This makes it hard to manage the queue, as well as wasting
61928 resources, because each queue runner scans the entire queue.
61929 </para>
61930 <para>
61931 A better approach is to separate off those messages that are waiting for an
61932 intermittently connected host. This can be done by delivering these messages
61933 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
61934 format, from where they are transmitted by other software when their
61935 destination connects. This makes it easy to collect all the mail for one host
61936 in a single directory, and to apply local timeout rules on a per-message basis
61937 if required.
61938 </para>
61939 <para>
61940 On a very small scale, leaving the mail on Exim&#x2019;s queue can be made to work. If
61941 you are doing this, you should configure Exim with a long retry period for the
61942 intermittent host. For example:
61943 </para>
61944 <literallayout class="monospaced">
61945 cheshire.wonderland.fict.example    *   F,5d,24h
61946 </literallayout>
61947 <para>
61948 This stops a lot of failed delivery attempts from occurring, but Exim remembers
61949 which messages it has queued up for that host. Once the intermittent host comes
61950 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
61951 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
61952 causes all the queued up messages to be delivered, often down a single SMTP
61953 connection. While the host remains connected, any new messages get delivered
61954 immediately.
61955 </para>
61956 <para>
61957 If the connecting hosts do not have fixed IP addresses, that is, if a host is
61958 issued with a different IP address each time it connects, Exim&#x2019;s retry
61959 mechanisms on the holding host get confused, because the IP address is normally
61960 used as part of the key string for holding retry information. This can be
61961 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
61962 Since this has disadvantages for permanently connected hosts, it is best to
61963 arrange a separate transport for the intermittently connected ones.
61964 </para>
61965 </section>
61966 <section id="SECID248">
61967 <title>Exim on the intermittently connected client host</title>
61968 <para>
61969 The value of <option>smtp_accept_queue_per_connection</option> should probably be
61970 increased, or even set to zero (that is, disabled) on the intermittently
61971 connected host, so that all incoming messages down a single connection get
61972 delivered immediately.
61973 </para>
61974 <para>
61975 <indexterm role="concept">
61976 <primary>SMTP</primary>
61977 <secondary>passed connection</secondary>
61978 </indexterm>
61979 <indexterm role="concept">
61980 <primary>SMTP</primary>
61981 <secondary>multiple deliveries</secondary>
61982 </indexterm>
61983 <indexterm role="concept">
61984 <primary>multiple SMTP deliveries</primary>
61985 </indexterm>
61986 Mail waiting to be sent from an intermittently connected host will probably
61987 not have been routed, because without a connection DNS lookups are not
61988 possible. This means that if a normal queue run is done at connection time,
61989 each message is likely to be sent in a separate SMTP session. This can be
61990 avoided by starting the queue run with a command line option beginning with
61991 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
61992 first pass, routing is done but no deliveries take place. The second pass is a
61993 normal queue run; since all the messages have been previously routed, those
61994 destined for the same host are likely to get sent as multiple deliveries in a
61995 single SMTP connection.
61996 </para>
61997 </section>
61998 </chapter>
61999
62000 <chapter id="CHAPnonqueueing">
62001 <title>Using Exim as a non-queueing client</title>
62002 <titleabbrev>Exim as a non-queueing client</titleabbrev>
62003 <para>
62004 <indexterm role="concept">
62005 <primary>client, non-queueing</primary>
62006 </indexterm>
62007 <indexterm role="concept">
62008 <primary>smart host</primary>
62009 <secondary>suppressing queueing</secondary>
62010 </indexterm>
62011 On a personal computer, it is a common requirement for all
62012 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
62013 configured to operate that way, for all the popular operating systems.
62014 However, there are some MUAs for Unix-like systems that cannot be so
62015 configured: they submit messages using the command line interface of
62016 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
62017 messages this way.
62018 </para>
62019 <para>
62020 If the personal computer runs continuously, there is no problem, because it can
62021 run a conventional MTA that handles delivery to the smart host, and deal with
62022 any delays via its queueing mechanism. However, if the computer does not run
62023 continuously or runs different operating systems at different times, queueing
62024 email is not desirable.
62025 </para>
62026 <para>
62027 There is therefore a requirement for something that can provide the
62028 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
62029 any queueing or retrying facilities. Furthermore, the delivery to the smart
62030 host should be synchronous, so that if it fails, the sending MUA is immediately
62031 informed. In other words, we want something that extends an MUA that submits
62032 to a local MTA via the command line so that it behaves like one that submits
62033 to a remote smart host using TCP/SMTP.
62034 </para>
62035 <para>
62036 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
62037 that do this job. However, people have found them to be lacking in various
62038 ways. For instance, you might want to allow aliasing and forwarding to be done
62039 before sending a message to the smart host.
62040 </para>
62041 <para>
62042 Exim already had the necessary infrastructure for doing this job. Just a few
62043 tweaks were needed to make it behave as required, though it is somewhat of an
62044 overkill to use a fully-featured MTA for this purpose.
62045 </para>
62046 <para>
62047 <indexterm role="option">
62048 <primary><option>mua_wrapper</option></primary>
62049 </indexterm>
62050 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
62051 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
62052 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
62053 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
62054 compatible router and transport configuration. Typically there will be just one
62055 router and one transport, sending everything to a smart host.
62056 </para>
62057 <para>
62058 When run in MUA wrapping mode, the behaviour of Exim changes in the
62059 following ways:
62060 </para>
62061 <itemizedlist>
62062 <listitem>
62063 <para>
62064 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
62065 In other words, the only way to submit messages is via the command line.
62066 </para>
62067 </listitem>
62068 <listitem>
62069 <para>
62070 Each message is synchronously delivered as soon as it is received (<option>-odi</option> is
62071 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
62072 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
62073 does not finish until the delivery attempt is complete. If the delivery is
62074 successful, a zero return code is given.
62075 </para>
62076 </listitem>
62077 <listitem>
62078 <para>
62079 Address redirection is permitted, but the final routing for all addresses must
62080 be to the same remote transport, and to the same list of hosts. Furthermore,
62081 the return address (envelope sender) must be the same for all recipients, as
62082 must any added or deleted header lines. In other words, it must be possible to
62083 deliver the message in a single SMTP transaction, however many recipients there
62084 are.
62085 </para>
62086 </listitem>
62087 <listitem>
62088 <para>
62089 If these conditions are not met, or if routing any address results in a
62090 failure or defer status, or if Exim is unable to deliver all the recipients
62091 successfully to one of the smart hosts, delivery of the entire message fails.
62092 </para>
62093 </listitem>
62094 <listitem>
62095 <para>
62096 Because no queueing is allowed, all failures are treated as permanent; there
62097 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
62098 smart host. Furthermore, because only a single yes/no response can be given to
62099 the caller, it is not possible to deliver to some recipients and not others. If
62100 there is an error (temporary or permanent) for any recipient, all are failed.
62101 </para>
62102 </listitem>
62103 <listitem>
62104 <para>
62105 If more than one smart host is listed, Exim will try another host after a
62106 connection failure or a timeout, in the normal way. However, if this kind of
62107 failure happens for all the hosts, the delivery fails.
62108 </para>
62109 </listitem>
62110 <listitem>
62111 <para>
62112 When delivery fails, an error message is written to the standard error stream
62113 (as well as to Exim&#x2019;s log), and Exim exits to the caller with a return code
62114 value 1. The message is expunged from Exim&#x2019;s spool files. No bounce messages
62115 are ever generated.
62116 </para>
62117 </listitem>
62118 <listitem>
62119 <para>
62120 No retry data is maintained, and any retry rules are ignored.
62121 </para>
62122 </listitem>
62123 <listitem>
62124 <para>
62125 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
62126 true, <option>max_rcpt</option> in the <command>smtp</command> transport is forced to <quote>unlimited</quote>,
62127 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
62128 </para>
62129 </listitem>
62130 </itemizedlist>
62131 <para>
62132 The overall effect is that Exim makes a single synchronous attempt to deliver
62133 the message, failing if there is any kind of problem. Because no local
62134 deliveries are done and no daemon can be run, Exim does not need root
62135 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
62136 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
62137 the advantages and disadvantages of running without root privilege.
62138 </para>
62139 </chapter>
62140
62141 <chapter id="CHAPlog">
62142 <title>Log files</title>
62143 <para>
62144 <indexterm role="concept" id="IIDloggen" class="startofrange">
62145 <primary>log</primary>
62146 <secondary>general description</secondary>
62147 </indexterm>
62148 <indexterm role="concept">
62149 <primary>log</primary>
62150 <secondary>types of</secondary>
62151 </indexterm>
62152 Exim writes three different logs, referred to as the main log, the reject log,
62153 and the panic log:
62154 </para>
62155 <itemizedlist>
62156 <listitem>
62157 <para>
62158 <indexterm role="concept">
62159 <primary>main log</primary>
62160 </indexterm>
62161 The main log records the arrival of each message and each delivery in a single
62162 line in each case. The format is as compact as possible, in an attempt to keep
62163 down the size of log files. Two-character flag sequences make it easy to pick
62164 out these lines. A number of other events are recorded in the main log. Some of
62165 them are optional, in which case the <option>log_selector</option> option controls whether
62166 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
62167 analysis of main log files, is provided in the Exim distribution (see section
62168 <xref linkend="SECTmailstat"/>).
62169 </para>
62170 </listitem>
62171 <listitem>
62172 <para>
62173 <indexterm role="concept">
62174 <primary>reject log</primary>
62175 </indexterm>
62176 The reject log records information from messages that are rejected as a result
62177 of a configuration option (that is, for policy reasons).
62178 The first line of each rejection is a copy of the line that is also written to
62179 the main log. Then, if the message&#x2019;s header has been read at the time the log
62180 is written, its contents are written to this log. Only the original header
62181 lines are available; header lines added by ACLs are not logged. You can use the
62182 reject log to check that your policy controls are working correctly; on a busy
62183 host this may be easier than scanning the main log for rejection messages. You
62184 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
62185 false.
62186 </para>
62187 </listitem>
62188 <listitem>
62189 <para>
62190 <indexterm role="concept">
62191 <primary>panic log</primary>
62192 </indexterm>
62193 <indexterm role="concept">
62194 <primary>system log</primary>
62195 </indexterm>
62196 When certain serious errors occur, Exim writes entries to its panic log. If the
62197 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
62198 are usually written to the main log as well, but can get lost amid the mass of
62199 other entries. The panic log should be empty under normal circumstances. It is
62200 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
62201 regularly, in order to become aware of any problems. When Exim cannot open its
62202 panic log, it tries as a last resort to write to the system log (syslog). This
62203 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
62204 message itself is written at priority LOG_CRIT.
62205 </para>
62206 </listitem>
62207 </itemizedlist>
62208 <para>
62209 Every log line starts with a timestamp, in the format shown in the following
62210 example. Note that many of the examples shown in this chapter are line-wrapped.
62211 In the log file, this would be all on one line:
62212 </para>
62213 <literallayout class="monospaced">
62214 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
62215   by QUIT
62216 </literallayout>
62217 <para>
62218 By default, the timestamps are in the local timezone. There are two
62219 ways of changing this:
62220 </para>
62221 <itemizedlist>
62222 <listitem>
62223 <para>
62224 You can set the <option>timezone</option> option to a different time zone; in particular, if
62225 you set
62226 </para>
62227 <literallayout class="monospaced">
62228 timezone = UTC
62229 </literallayout>
62230 <para>
62231 the timestamps will be in UTC (aka GMT).
62232 </para>
62233 </listitem>
62234 <listitem>
62235 <para>
62236 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
62237 example:
62238 </para>
62239 <literallayout class="monospaced">
62240 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
62241 </literallayout>
62242 </listitem>
62243 </itemizedlist>
62244 <para>
62245 <indexterm role="concept">
62246 <primary>log</primary>
62247 <secondary>process ids in</secondary>
62248 </indexterm>
62249 <indexterm role="concept">
62250 <primary>pid (process id)</primary>
62251 <secondary>in log lines</secondary>
62252 </indexterm>
62253 Exim does not include its process id in log lines by default, but you can
62254 request that it does so by specifying the <literal>pid</literal> log selector (see section
62255 <xref linkend="SECTlogselector"/>). When this is set, the process id is output, in square
62256 brackets, immediately after the time and date.
62257 </para>
62258 <section id="SECTwhelogwri">
62259 <title>Where the logs are written</title>
62260 <para>
62261 <indexterm role="concept">
62262 <primary>log</primary>
62263 <secondary>destination</secondary>
62264 </indexterm>
62265 <indexterm role="concept">
62266 <primary>log</primary>
62267 <secondary>to file</secondary>
62268 </indexterm>
62269 <indexterm role="concept">
62270 <primary>log</primary>
62271 <secondary>to syslog</secondary>
62272 </indexterm>
62273 <indexterm role="concept">
62274 <primary>syslog</primary>
62275 </indexterm>
62276 The logs may be written to local files, or to syslog, or both. However, it
62277 should be noted that many syslog implementations use UDP as a transport, and
62278 are therefore unreliable in the sense that messages are not guaranteed to
62279 arrive at the loghost, nor is the ordering of messages necessarily maintained.
62280 It has also been reported that on large log files (tens of megabytes) you may
62281 need to tweak syslog to prevent it syncing the file with each write &ndash; on
62282 Linux this has been seen to make syslog take 90% plus of CPU time.
62283 </para>
62284 <para>
62285 The destination for Exim&#x2019;s logs is configured by setting LOG_FILE_PATH in
62286 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the run time
62287 configuration. This latter string is expanded, so it can contain, for example,
62288 references to the host name:
62289 </para>
62290 <literallayout class="monospaced">
62291 log_file_path = /var/log/$primary_hostname/exim_%slog
62292 </literallayout>
62293 <para>
62294 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
62295 rather than at run time, because then the setting is available right from the
62296 start of Exim&#x2019;s execution. Otherwise, if there&#x2019;s something it wants to log
62297 before it has read the configuration file (for example, an error in the
62298 configuration file) it will not use the path you want, and may not be able to
62299 log at all.
62300 </para>
62301 <para>
62302 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
62303 list, currently limited to at most two items. This is one option where the
62304 facility for changing a list separator may not be used. The list must always be
62305 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
62306 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
62307 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
62308 implying the use of a default path.
62309 </para>
62310 <para>
62311 When Exim encounters an empty item in the list, it searches the list defined by
62312 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
62313 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
62314 mean <quote>use the path specified at build time</quote>. It no such item exists, log
62315 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
62316 equivalent to the setting:
62317 </para>
62318 <literallayout class="monospaced">
62319 log_file_path = $spool_directory/log/%slog
62320 </literallayout>
62321 <para>
62322 If you do not specify anything at build time or run time, that is where the
62323 logs are written.
62324 </para>
62325 <para>
62326 A log file path may also contain <literal>%D</literal> or <literal>%M</literal> if datestamped log file names
62327 are in use &ndash; see section <xref linkend="SECTdatlogfil"/> below.
62328 </para>
62329 <para>
62330 Here are some examples of possible settings:
62331 </para>
62332 <literallayout>
62333 <literal>LOG_FILE_PATH=syslog                    </literal> syslog only
62334 <literal>LOG_FILE_PATH=:syslog                   </literal> syslog and default path
62335 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
62336 <literal>LOG_FILE_PATH=/usr/log/exim_%s          </literal> specified path only
62337 </literallayout>
62338 <para>
62339 If there are more than two paths in the list, the first is used and a panic
62340 error is logged.
62341 </para>
62342 </section>
62343 <section id="SECID285">
62344 <title>Logging to local files that are periodically <quote>cycled</quote></title>
62345 <para>
62346 <indexterm role="concept">
62347 <primary>log</primary>
62348 <secondary>cycling local files</secondary>
62349 </indexterm>
62350 <indexterm role="concept">
62351 <primary>cycling logs</primary>
62352 </indexterm>
62353 <indexterm role="concept">
62354 <primary><emphasis>exicyclog</emphasis></primary>
62355 </indexterm>
62356 <indexterm role="concept">
62357 <primary>log</primary>
62358 <secondary>local files; writing to</secondary>
62359 </indexterm>
62360 Some operating systems provide centralized and standardized methods for cycling
62361 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
62362 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
62363 main and reject logs each time it is called. The maximum number of old logs to
62364 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
62365 </para>
62366 <para>
62367 An Exim delivery process opens the main log when it first needs to write to it,
62368 and it keeps the file open in case subsequent entries are required &ndash; for
62369 example, if a number of different deliveries are being done for the same
62370 message. However, remote SMTP deliveries can take a long time, and this means
62371 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
62372 something similar is being used to rename log files on a regular basis. To
62373 ensure that a switch of log files is noticed as soon as possible, Exim calls
62374 <function>stat()</function> on the main log&#x2019;s name before reusing an open file, and if the file
62375 does not exist, or its inode has changed, the old file is closed and Exim
62376 tries to open the main log from scratch. Thus, an old log file may remain open
62377 for quite some time, but no Exim processes should write to it once it has been
62378 renamed.
62379 </para>
62380 </section>
62381 <section id="SECTdatlogfil">
62382 <title>Datestamped log files</title>
62383 <para>
62384 <indexterm role="concept">
62385 <primary>log</primary>
62386 <secondary>datestamped files</secondary>
62387 </indexterm>
62388 Instead of cycling the main and reject log files by renaming them
62389 periodically, some sites like to use files whose names contain a datestamp,
62390 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename> or
62391 <filename>yyyymm</filename>. Exim has support for this way of working. It is enabled by setting
62392 the <option>log_file_path</option> option to a path that includes <literal>%D</literal> or <literal>%M</literal> at the
62393 point where the datestamp is required. For example:
62394 </para>
62395 <literallayout class="monospaced">
62396 log_file_path = /var/spool/exim/log/%slog-%D
62397 log_file_path = /var/log/exim-%s-%D.log
62398 log_file_path = /var/spool/exim/log/%D-%slog
62399 log_file_path = /var/log/exim/%s.%M
62400 </literallayout>
62401 <para>
62402 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
62403 examples of names generated by the above examples:
62404 </para>
62405 <literallayout class="monospaced">
62406 /var/spool/exim/log/mainlog-20021225
62407 /var/log/exim-reject-20021225.log
62408 /var/spool/exim/log/20021225-mainlog
62409 /var/log/exim/main.200212
62410 </literallayout>
62411 <para>
62412 When this form of log file is specified, Exim automatically switches to new
62413 files at midnight. It does not make any attempt to compress old logs; you
62414 will need to write your own script if you require this. You should not
62415 run <emphasis>exicyclog</emphasis> with this form of logging.
62416 </para>
62417 <para>
62418 The location of the panic log is also determined by <option>log_file_path</option>, but it
62419 is not datestamped, because rotation of the panic log does not make sense.
62420 When generating the name of the panic log, <literal>%D</literal> or <literal>%M</literal> are removed from
62421 the string. In addition, if it immediately follows a slash, a following
62422 non-alphanumeric character is removed; otherwise a preceding non-alphanumeric
62423 character is removed. Thus, the four examples above would give these panic
62424 log names:
62425 </para>
62426 <literallayout class="monospaced">
62427 /var/spool/exim/log/paniclog
62428 /var/log/exim-panic.log
62429 /var/spool/exim/log/paniclog
62430 /var/log/exim/panic
62431 </literallayout>
62432 </section>
62433 <section id="SECID249">
62434 <title>Logging to syslog</title>
62435 <para>
62436 <indexterm role="concept">
62437 <primary>log</primary>
62438 <secondary>syslog; writing to</secondary>
62439 </indexterm>
62440 The use of syslog does not change what Exim logs or the format of its messages,
62441 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
62442 Exim&#x2019;s log lines are omitted when these lines are sent to syslog. Apart from
62443 that, the same strings are written to syslog as to log files. The syslog
62444 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
62445 by default, but you can change these by setting the <option>syslog_facility</option> and
62446 <option>syslog_processname</option> options, respectively. If Exim was compiled with
62447 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
62448 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
62449 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
62450 the time and host name to each line.
62451 The three log streams are mapped onto syslog priorities as follows:
62452 </para>
62453 <itemizedlist>
62454 <listitem>
62455 <para>
62456 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
62457 </para>
62458 </listitem>
62459 <listitem>
62460 <para>
62461 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
62462 </para>
62463 </listitem>
62464 <listitem>
62465 <para>
62466 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
62467 </para>
62468 </listitem>
62469 </itemizedlist>
62470 <para>
62471 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
62472 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
62473 these are routed by syslog to the same place. You can suppress this duplication
62474 by setting <option>syslog_duplication</option> false.
62475 </para>
62476 <para>
62477 Exim&#x2019;s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
62478 entries contain multiple lines when headers are included. To cope with both
62479 these cases, entries written to syslog are split into separate <function>syslog()</function>
62480 calls at each internal newline, and also after a maximum of
62481 870 data characters. (This allows for a total syslog line length of 1024, when
62482 additions such as timestamps are added.) If you are running a syslog
62483 replacement that can handle lines longer than the 1024 characters allowed by
62484 RFC 3164, you should set
62485 </para>
62486 <literallayout class="monospaced">
62487 SYSLOG_LONG_LINES=yes
62488 </literallayout>
62489 <para>
62490 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
62491 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
62492 </para>
62493 <para>
62494 To make it easy to re-assemble split lines later, each component of a split
62495 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;]
62496 where &lt;<emphasis>n</emphasis>&gt; is the component number and &lt;<emphasis>m</emphasis>&gt; is the total number of
62497 components in the entry. The / delimiter is used when the line was split
62498 because it was too long; if it was split because of an internal newline, the \
62499 delimiter is used. For example, supposing the length limit to be 50 instead of
62500 870, the following would be the result of a typical rejection message to
62501 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
62502 name, and pid as added by syslog:
62503 </para>
62504 <literallayout class="monospaced">
62505 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
62506 [2/5]  [127.0.0.1] (ph10): syntax error in 'From' header
62507 [3/5]  when scanning for sender: missing or malformed lo
62508 [4/5] cal part in "&lt;&gt;" (envelope sender is &lt;ph10@cam.exa
62509 [5/5] mple&gt;)
62510 </literallayout>
62511 <para>
62512 The same error might cause the following lines to be written to <quote>rejectlog</quote>
62513 (LOG_NOTICE):
62514 </para>
62515 <literallayout class="monospaced">
62516 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
62517 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
62518 [3/18] er when scanning for sender: missing or malformed
62519 [4/18]  local part in "&lt;&gt;" (envelope sender is &lt;ph10@cam
62520 [5\18] .example&gt;)
62521 [6\18] Recipients: ph10@some.domain.cam.example
62522 [7\18] P Received: from [127.0.0.1] (ident=ph10)
62523 [8\18]        by xxxxx.cam.example with smtp (Exim 4.00)
62524 [9\18]        id 16RdAL-0006pc-00
62525 [10/18]        for ph10@cam.example; Mon, 16 Sep 2002 16:
62526 [11\18] 09:43 +0100
62527 [12\18] F From: &lt;&gt;
62528 [13\18]   Subject: this is a test header
62529 [18\18]   X-something: this is another header
62530 [15/18] I Message-Id: &lt;E16RdAL-0006pc-00@xxxxx.cam.examp
62531 [16\18] le&gt;
62532 [17\18] B Bcc:
62533 [18/18]   Date: Mon, 16 Sep 2002 16:09:43 +0100
62534 </literallayout>
62535 <para>
62536 Log lines that are neither too long nor contain newlines are written to syslog
62537 without modification.
62538 </para>
62539 <para>
62540 If only syslog is being used, the Exim monitor is unable to provide a log tail
62541 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
62542 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
62543 where it is.
62544 </para>
62545 </section>
62546 <section id="SECID250">
62547 <title>Log line flags</title>
62548 <para>
62549 One line is written to the main log for each message received, and for each
62550 successful, unsuccessful, and delayed delivery. These lines can readily be
62551 picked out by the distinctive two-character flags that immediately follow the
62552 timestamp. The flags are:
62553 </para>
62554 <literallayout>
62555 <literal>&lt;=</literal>     message arrival
62556 <literal>=&gt;</literal>     normal message delivery
62557 <literal>-&gt;</literal>     additional address in same delivery
62558 <literal>&gt;&gt;</literal>     cutthrough message delivery
62559 <literal>*&gt;</literal>     delivery suppressed by <option>-N</option>
62560 <literal>**</literal>     delivery failed; address bounced
62561 <literal>==</literal>     delivery deferred; temporary problem
62562 </literallayout>
62563 </section>
62564 <section id="SECID251">
62565 <title>Logging message reception</title>
62566 <para>
62567 <indexterm role="concept">
62568 <primary>log</primary>
62569 <secondary>reception line</secondary>
62570 </indexterm>
62571 The format of the single-line entry in the main log that is written for every
62572 message received is shown in the basic example below, which is split over
62573 several lines in order to fit it on the page:
62574 </para>
62575 <literallayout class="monospaced">
62576 2002-10-31 08:57:53 16ZCW1-0005MB-00 &lt;= kryten@dwarf.fict.example
62577   H=mailer.fict.example [192.168.123.123] U=exim
62578   P=smtp S=5678 id=&lt;incoming message id&gt;
62579 </literallayout>
62580 <para>
62581 The address immediately following <quote>&lt;=</quote> is the envelope sender address. A
62582 bounce message is shown with the sender address <quote>&lt;&gt;</quote>, and if it is locally
62583 generated, this is followed by an item of the form
62584 </para>
62585 <literallayout class="monospaced">
62586 R=&lt;message id&gt;
62587 </literallayout>
62588 <para>
62589 which is a reference to the message that caused the bounce to be sent.
62590 </para>
62591 <para>
62592 <indexterm role="concept">
62593 <primary>HELO</primary>
62594 </indexterm>
62595 <indexterm role="concept">
62596 <primary>EHLO</primary>
62597 </indexterm>
62598 For messages from other hosts, the H and U fields identify the remote host and
62599 record the RFC 1413 identity of the user that sent the message, if one was
62600 received. The number given in square brackets is the IP address of the sending
62601 host. If there is a single, unparenthesized  host name in the H field, as
62602 above, it has been verified to correspond to the IP address (see the
62603 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
62604 by the remote host in the SMTP HELO or EHLO command, and has not been
62605 verified. If verification yields a different name to that given for HELO or
62606 EHLO, the verified name appears first, followed by the HELO or EHLO
62607 name in parentheses.
62608 </para>
62609 <para>
62610 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
62611 without brackets, in the HELO or EHLO command, leading to entries in
62612 the log containing text like these examples:
62613 </para>
62614 <literallayout class="monospaced">
62615 H=(10.21.32.43) [192.168.8.34]
62616 H=([10.21.32.43]) [192.168.8.34]
62617 </literallayout>
62618 <para>
62619 This can be confusing. Only the final address in square brackets can be relied
62620 on.
62621 </para>
62622 <para>
62623 For locally generated messages (that is, messages not received over TCP/IP),
62624 the H field is omitted, and the U field contains the login name of the caller
62625 of Exim.
62626 </para>
62627 <para>
62628 <indexterm role="concept">
62629 <primary>authentication</primary>
62630 <secondary>logging</secondary>
62631 </indexterm>
62632 <indexterm role="concept">
62633 <primary>AUTH</primary>
62634 <secondary>logging</secondary>
62635 </indexterm>
62636 For all messages, the P field specifies the protocol used to receive the
62637 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
62638 of incoming SMTP messages, the value indicates whether or not any SMTP
62639 extensions (ESMTP), encryption, or authentication were used. If the SMTP
62640 session was encrypted, there is an additional X field that records the cipher
62641 suite that was used.
62642 </para>
62643 <para>
62644 The protocol is set to <quote>esmtpsa</quote> or <quote>esmtpa</quote> for messages received from
62645 hosts that have authenticated themselves using the SMTP AUTH command. The first
62646 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
62647 there is an additional item A= followed by the name of the authenticator that
62648 was used. If an authenticated identification was set up by the authenticator&#x2019;s
62649 <option>server_set_id</option> option, this is logged too, separated by a colon from the
62650 authenticator name.
62651 </para>
62652 <para>
62653 <indexterm role="concept">
62654 <primary>size</primary>
62655 <secondary>of message</secondary>
62656 </indexterm>
62657 The id field records the existing message id, if present. The size of the
62658 received message is given by the S field. When the message is delivered,
62659 headers may be removed or added, so that the size of delivered copies of the
62660 message may not correspond with this value (and indeed may be different to each
62661 other).
62662 </para>
62663 <para>
62664 The <option>log_selector</option> option can be used to request the logging of additional
62665 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
62666 </para>
62667 </section>
62668 <section id="SECID252">
62669 <title>Logging deliveries</title>
62670 <para>
62671 <indexterm role="concept">
62672 <primary>log</primary>
62673 <secondary>delivery line</secondary>
62674 </indexterm>
62675 The format of the single-line entry in the main log that is written for every
62676 delivery is shown in one of the examples below, for local and remote
62677 deliveries, respectively. Each example has been split into two lines in order
62678 to fit it on the page:
62679 </para>
62680 <literallayout class="monospaced">
62681 2002-10-31 08:59:13 16ZCW1-0005MB-00 =&gt; marv
62682   &lt;marv@hitch.fict.example&gt; R=localuser T=local_delivery
62683 2002-10-31 09:00:10 16ZCW1-0005MB-00 =&gt;
62684   monk@holistic.fict.example R=dnslookup T=remote_smtp
62685   H=holistic.fict.example [192.168.234.234]
62686 </literallayout>
62687 <para>
62688 For ordinary local deliveries, the original address is given in angle brackets
62689 after the final delivery address, which might be a pipe or a file. If
62690 intermediate address(es) exist between the original and the final address, the
62691 last of these is given in parentheses after the final address. The R and T
62692 fields record the router and transport that were used to process the address.
62693 </para>
62694 <para>
62695 If SMTP AUTH was used for the delivery there is an additional item A=
62696 followed by the name of the authenticator that was used.
62697 If an authenticated identification was set up by the authenticator&#x2019;s <option>client_set_id</option>
62698 option, this is logged too, separated by a colon from the authenticator name.
62699 </para>
62700 <para>
62701 If a shadow transport was run after a successful local delivery, the log line
62702 for the successful delivery has an item added on the end, of the form
62703 </para>
62704 <literallayout>
62705 <literal>ST=&lt;</literal><emphasis>shadow transport name</emphasis><literal>&gt;</literal>
62706 </literallayout>
62707 <para>
62708 If the shadow transport did not succeed, the error message is put in
62709 parentheses afterwards.
62710 </para>
62711 <para>
62712 <indexterm role="concept">
62713 <primary>asterisk</primary>
62714 <secondary>after IP address</secondary>
62715 </indexterm>
62716 When more than one address is included in a single delivery (for example, two
62717 SMTP RCPT commands in one transaction) the second and subsequent addresses are
62718 flagged with <literal>-&gt;</literal> instead of <literal>=&gt;</literal>. When two or more messages are delivered
62719 down a single SMTP connection, an asterisk follows the IP address in the log
62720 lines for the second and subsequent messages.
62721 </para>
62722 <para>
62723 <indexterm role="concept">
62724 <primary>delivery</primary>
62725 <secondary>cutthrough; logging</secondary>
62726 </indexterm>
62727 <indexterm role="concept">
62728 <primary>cutthrough</primary>
62729 <secondary>logging</secondary>
62730 </indexterm>
62731 When delivery is done in cutthrough mode it is flagged with <literal>&gt;&gt;</literal> and the log
62732 line precedes the reception line, since cutthrough waits for a possible
62733 rejection from the destination in case it can reject the sourced item.
62734 </para>
62735 <para>
62736 The generation of a reply message by a filter file gets logged as a
62737 <quote>delivery</quote> to the addressee, preceded by <quote>&gt;</quote>.
62738 </para>
62739 <para>
62740 The <option>log_selector</option> option can be used to request the logging of additional
62741 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
62742 </para>
62743 </section>
62744 <section id="SECID253">
62745 <title>Discarded deliveries</title>
62746 <para>
62747 <indexterm role="concept">
62748 <primary>discarded messages</primary>
62749 </indexterm>
62750 <indexterm role="concept">
62751 <primary>message</primary>
62752 <secondary>discarded</secondary>
62753 </indexterm>
62754 <indexterm role="concept">
62755 <primary>delivery</primary>
62756 <secondary>discarded; logging</secondary>
62757 </indexterm>
62758 When a message is discarded as a result of the command <quote>seen finish</quote> being
62759 obeyed in a filter file which generates no deliveries, a log entry of the form
62760 </para>
62761 <literallayout class="monospaced">
62762 2002-12-10 00:50:49 16auJc-0001UB-00 =&gt; discarded
62763   &lt;low.club@bridge.example&gt; R=userforward
62764 </literallayout>
62765 <para>
62766 is written, to record why no deliveries are logged. When a message is discarded
62767 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
62768 </para>
62769 <literallayout class="monospaced">
62770 1999-03-02 09:44:33 10HmaX-0005vi-00 =&gt; :blackhole:
62771   &lt;hole@nowhere.example&gt; R=blackhole_router
62772 </literallayout>
62773 </section>
62774 <section id="SECID254">
62775 <title>Deferred deliveries</title>
62776 <para>
62777 When a delivery is deferred, a line of the following form is logged:
62778 </para>
62779 <literallayout class="monospaced">
62780 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
62781   R=dnslookup T=smtp defer (146): Connection refused
62782 </literallayout>
62783 <para>
62784 In the case of remote deliveries, the error is the one that was given for the
62785 last IP address that was tried. Details of individual SMTP failures are also
62786 written to the log, so the above line would be preceded by something like
62787 </para>
62788 <literallayout class="monospaced">
62789 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
62790   mail1.endrest.example [192.168.239.239]: Connection refused
62791 </literallayout>
62792 <para>
62793 When a deferred address is skipped because its retry time has not been reached,
62794 a message is written to the log, but this can be suppressed by setting an
62795 appropriate value in <option>log_selector</option>.
62796 </para>
62797 </section>
62798 <section id="SECID255">
62799 <title>Delivery failures</title>
62800 <para>
62801 <indexterm role="concept">
62802 <primary>delivery</primary>
62803 <secondary>failure; logging</secondary>
62804 </indexterm>
62805 If a delivery fails because an address cannot be routed, a line of the
62806 following form is logged:
62807 </para>
62808 <literallayout class="monospaced">
62809 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
62810   &lt;jim@trek99.example&gt;: unknown mail domain
62811 </literallayout>
62812 <para>
62813 If a delivery fails at transport time, the router and transport are shown, and
62814 the response from the remote host is included, as in this example:
62815 </para>
62816 <literallayout class="monospaced">
62817 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
62818   R=dnslookup T=remote_smtp: SMTP error from remote mailer
62819   after pipelined RCPT TO:&lt;ace400@pb.example&gt;: host
62820   pbmail3.py.example [192.168.63.111]: 553 5.3.0
62821   &lt;ace400@pb.example&gt;...Addressee unknown
62822 </literallayout>
62823 <para>
62824 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
62825 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
62826 disabling PIPELINING. The log lines for all forms of delivery failure are
62827 flagged with <literal>**</literal>.
62828 </para>
62829 </section>
62830 <section id="SECID256">
62831 <title>Fake deliveries</title>
62832 <para>
62833 <indexterm role="concept">
62834 <primary>delivery</primary>
62835 <secondary>fake; logging</secondary>
62836 </indexterm>
62837 If a delivery does not actually take place because the <option>-N</option> option has been
62838 used to suppress it, a normal delivery line is written to the log, except that
62839 <quote>=&gt;</quote> is replaced by <quote>*&gt;</quote>.
62840 </para>
62841 </section>
62842 <section id="SECID257">
62843 <title>Completion</title>
62844 <para>
62845 A line of the form
62846 </para>
62847 <literallayout class="monospaced">
62848 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
62849 </literallayout>
62850 <para>
62851 is written to the main log when a message is about to be removed from the spool
62852 at the end of its processing.
62853 </para>
62854 </section>
62855 <section id="SECID258">
62856 <title>Summary of Fields in Log Lines</title>
62857 <para>
62858 <indexterm role="concept">
62859 <primary>log</primary>
62860 <secondary>summary of fields</secondary>
62861 </indexterm>
62862 A summary of the field identifiers that are used in log lines is shown in
62863 the following table:
62864 </para>
62865 <literallayout>
62866 <literal>A   </literal>        authenticator name (and optional id and sender)
62867 <literal>C   </literal>        SMTP confirmation on delivery
62868 <literal>    </literal>        command list for <quote>no mail in SMTP session</quote>
62869 <literal>CV  </literal>        certificate verification status
62870 <literal>D   </literal>        duration of <quote>no mail in SMTP session</quote>
62871 <literal>DN  </literal>        distinguished name from peer certificate
62872 <literal>DT  </literal>        on <literal>=&gt;</literal> lines: time taken for a delivery
62873 <literal>F   </literal>        sender address (on delivery lines)
62874 <literal>H   </literal>        host name and IP address
62875 <literal>I   </literal>        local interface used
62876 <literal>id  </literal>        message id for incoming message
62877 <literal>P   </literal>        on <literal>&lt;=</literal> lines: protocol used
62878 <literal>    </literal>        on <literal>=&gt;</literal> and <literal>**</literal> lines: return path
62879 <literal>QT  </literal>        on <literal>=&gt;</literal> lines: time spent on queue so far
62880 <literal>    </literal>        on <quote>Completed</quote> lines: time spent on queue
62881 <literal>R   </literal>        on <literal>&lt;=</literal> lines: reference for local bounce
62882 <literal>    </literal>        on <literal>=&gt;</literal>  <literal>**</literal> and <literal>==</literal> lines: router name
62883 <literal>S   </literal>        size of message
62884 <literal>SNI </literal>        server name indication from TLS client hello
62885 <literal>ST  </literal>        shadow transport name
62886 <literal>T   </literal>        on <literal>&lt;=</literal> lines: message subject (topic)
62887 <literal>    </literal>        on <literal>=&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: transport name
62888 <literal>U   </literal>        local user or RFC 1413 identity
62889 <literal>X   </literal>        TLS cipher suite
62890 </literallayout>
62891 </section>
62892 <section id="SECID259">
62893 <title>Other log entries</title>
62894 <para>
62895 Various other types of log entry are written from time to time. Most should be
62896 self-explanatory. Among the more common are:
62897 </para>
62898 <itemizedlist>
62899 <listitem>
62900 <para>
62901 <indexterm role="concept">
62902 <primary>retry</primary>
62903 <secondary>time not reached</secondary>
62904 </indexterm>
62905 <emphasis>retry time not reached</emphasis>&nbsp;&nbsp;An address previously suffered a temporary error
62906 during routing or local delivery, and the time to retry has not yet arrived.
62907 This message is not written to an individual message log file unless it happens
62908 during the first delivery attempt.
62909 </para>
62910 </listitem>
62911 <listitem>
62912 <para>
62913 <emphasis>retry time not reached for any host</emphasis>&nbsp;&nbsp;An address previously suffered
62914 temporary errors during remote delivery, and the retry time has not yet arrived
62915 for any of the hosts to which it is routed.
62916 </para>
62917 </listitem>
62918 <listitem>
62919 <para>
62920 <indexterm role="concept">
62921 <primary>spool directory</primary>
62922 <secondary>file locked</secondary>
62923 </indexterm>
62924 <emphasis>spool file locked</emphasis>&nbsp;&nbsp;An attempt to deliver a message cannot proceed because
62925 some other Exim process is already working on the message. This can be quite
62926 common if queue running processes are started at frequent intervals. The
62927 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
62928 doing.
62929 </para>
62930 </listitem>
62931 <listitem>
62932 <para>
62933 <indexterm role="concept">
62934 <primary>error</primary>
62935 <secondary>ignored</secondary>
62936 </indexterm>
62937 <emphasis>error ignored</emphasis>&nbsp;&nbsp;There are several circumstances that give rise to this
62938 message:
62939 </para>
62940 <orderedlist numeration="arabic">
62941 <listitem>
62942 <para>
62943 Exim failed to deliver a bounce message whose age was greater than
62944 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
62945 </para>
62946 </listitem>
62947 <listitem>
62948 <para>
62949 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
62950 failed. The delivery was discarded.
62951 </para>
62952 </listitem>
62953 <listitem>
62954 <para>
62955 A delivery set up by a router configured with
62956 </para>
62957 <literallayout class="monospaced">
62958     errors_to = &lt;&gt;
62959 </literallayout>
62960 <para>
62961 failed. The delivery was discarded.
62962 </para>
62963 </listitem>
62964 </orderedlist>
62965 </listitem>
62966 </itemizedlist>
62967 </section>
62968 <section id="SECTlogselector">
62969 <title>Reducing or increasing what is logged</title>
62970 <para>
62971 <indexterm role="concept">
62972 <primary>log</primary>
62973 <secondary>selectors</secondary>
62974 </indexterm>
62975 By setting the <option>log_selector</option> global option, you can disable some of Exim&#x2019;s
62976 default logging, or you can request additional logging. The value of
62977 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
62978 example:
62979 </para>
62980 <literallayout class="monospaced">
62981 log_selector = +arguments -retry_defer
62982 </literallayout>
62983 <para>
62984 The list of optional log items is in the following table, with the default
62985 selection marked by asterisks:
62986 </para>
62987 <literallayout>
62988 <literal> 8bitmime                   </literal>  received 8BITMIME status
62989 <literal>*acl_warn_skipped           </literal>  skipped <option>warn</option> statement in ACL
62990 <literal> address_rewrite            </literal>  address rewriting
62991 <literal> all_parents                </literal>  all parents in =&gt; lines
62992 <literal> arguments                  </literal>  command line arguments
62993 <literal>*connection_reject          </literal>  connection rejections
62994 <literal>*delay_delivery             </literal>  immediate delivery delayed
62995 <literal> deliver_time               </literal>  time taken to perform delivery
62996 <literal> delivery_size              </literal>  add <literal>S=</literal><emphasis>nnn</emphasis> to =&gt; lines
62997 <literal>*dnslist_defer              </literal>  defers of DNS list (aka RBL) lookups
62998 <literal>*etrn                       </literal>  ETRN commands
62999 <literal>*host_lookup_failed         </literal>  as it says
63000 <literal> ident_timeout              </literal>  timeout for ident connection
63001 <literal> incoming_interface         </literal>  incoming interface on &lt;= lines
63002 <literal> incoming_port              </literal>  incoming port on &lt;= lines
63003 <literal>*lost_incoming_connection   </literal>  as it says (includes timeouts)
63004 <literal> outgoing_port              </literal>  add remote port to =&gt; lines
63005 <literal>*queue_run                  </literal>  start and end queue runs
63006 <literal> queue_time                 </literal>  time on queue for one recipient
63007 <literal> queue_time_overall         </literal>  time on queue for whole message
63008 <literal> pid                        </literal>  Exim process id
63009 <literal> received_recipients        </literal>  recipients on &lt;= lines
63010 <literal> received_sender            </literal>  sender on &lt;= lines
63011 <literal>*rejected_header            </literal>  header contents on reject log
63012 <literal>*retry_defer                </literal>  <quote>retry time not reached</quote>
63013 <literal> return_path_on_delivery    </literal>  put return path on =&gt; and ** lines
63014 <literal> sender_on_delivery         </literal>  add sender to =&gt; lines
63015 <literal>*sender_verify_fail         </literal>  sender verification failures
63016 <literal>*size_reject                </literal>  rejection because too big
63017 <literal>*skip_delivery              </literal>  delivery skipped in a queue run
63018 <literal>*smtp_confirmation          </literal>  SMTP confirmation on =&gt; lines
63019 <literal> smtp_connection            </literal>  SMTP connections
63020 <literal> smtp_incomplete_transaction</literal>  incomplete SMTP transactions
63021 <literal> smtp_mailauth              </literal>  AUTH argument to MAIL commands
63022 <literal> smtp_no_mail               </literal>  session with no MAIL commands
63023 <literal> smtp_protocol_error        </literal>  SMTP protocol errors
63024 <literal> smtp_syntax_error          </literal>  SMTP syntax errors
63025 <literal> subject                    </literal>  contents of <emphasis>Subject:</emphasis> on &lt;= lines
63026 <literal> tls_certificate_verified   </literal>  certificate verification status
63027 <literal>*tls_cipher                 </literal>  TLS cipher suite on &lt;= and =&gt; lines
63028 <literal> tls_peerdn                 </literal>  TLS peer DN on &lt;= and =&gt; lines
63029 <literal> tls_sni                    </literal>  TLS SNI on &lt;= lines
63030 <literal> unknown_in_list            </literal>  DNS lookup failed in list match
63031
63032 <literal> all                        </literal>  all of the above
63033 </literallayout>
63034 <para>
63035 More details on each of these items follows:
63036 </para>
63037 <itemizedlist>
63038 <listitem>
63039 <para>
63040 <indexterm role="concept">
63041 <primary>8BITMIME</primary>
63042 </indexterm>
63043 <indexterm role="concept">
63044 <primary>log</primary>
63045 <secondary>8BITMIME</secondary>
63046 </indexterm>
63047 <option>8bitmime</option>: This causes Exim to log any 8BITMIME status of received messages,
63048 which may help in tracking down interoperability issues with ancient MTAs
63049 that are not 8bit clean.  This is added to the <quote>&lt;=</quote> line, tagged with
63050 <literal>M8S=</literal> and a value of <literal>0</literal>, <literal>7</literal> or <literal>8</literal>, corresponding to "not given",
63051 <literal>7BIT</literal> and <literal>8BITMIME</literal> respectively.
63052 </para>
63053 </listitem>
63054 <listitem>
63055 <para>
63056 <indexterm role="concept">
63057 <primary><option>warn</option> ACL verb</primary>
63058 <secondary>log when skipping</secondary>
63059 </indexterm>
63060 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
63061 its conditions cannot be evaluated, a log line to this effect is written if
63062 this log selector is set.
63063 </para>
63064 </listitem>
63065 <listitem>
63066 <para>
63067 <indexterm role="concept">
63068 <primary>log</primary>
63069 <secondary>rewriting</secondary>
63070 </indexterm>
63071 <indexterm role="concept">
63072 <primary>rewriting</primary>
63073 <secondary>logging</secondary>
63074 </indexterm>
63075 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
63076 rewrites, but not to rewrites in filters run as an unprivileged user (because
63077 such users cannot access the log).
63078 </para>
63079 </listitem>
63080 <listitem>
63081 <para>
63082 <indexterm role="concept">
63083 <primary>log</primary>
63084 <secondary>full parentage</secondary>
63085 </indexterm>
63086 <option>all_parents</option>: Normally only the original and final addresses are logged on
63087 delivery lines; with this selector, intermediate parents are given in
63088 parentheses between them.
63089 </para>
63090 </listitem>
63091 <listitem>
63092 <para>
63093 <indexterm role="concept">
63094 <primary>log</primary>
63095 <secondary>Exim arguments</secondary>
63096 </indexterm>
63097 <indexterm role="concept">
63098 <primary>Exim arguments, logging</primary>
63099 </indexterm>
63100 <option>arguments</option>: This causes Exim to write the arguments with which it was called
63101 to the main log, preceded by the current working directory. This is a debugging
63102 feature, added to make it easier to find out how certain MUAs call
63103 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
63104 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
63105 that are empty or that contain white space are quoted. Non-printing characters
63106 are shown as escape sequences. This facility cannot log unrecognized arguments,
63107 because the arguments are checked before the configuration file is read. The
63108 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
63109 between the caller and Exim.
63110 </para>
63111 </listitem>
63112 <listitem>
63113 <para>
63114 <indexterm role="concept">
63115 <primary>log</primary>
63116 <secondary>connection rejections</secondary>
63117 </indexterm>
63118 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
63119 connection is rejected, for whatever reason.
63120 </para>
63121 </listitem>
63122 <listitem>
63123 <para>
63124 <indexterm role="concept">
63125 <primary>log</primary>
63126 <secondary>delayed delivery</secondary>
63127 </indexterm>
63128 <indexterm role="concept">
63129 <primary>delayed delivery, logging</primary>
63130 </indexterm>
63131 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
63132 started for an incoming message because the load is too high or too many
63133 messages were received on one connection. Logging does not occur if no delivery
63134 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
63135 </para>
63136 </listitem>
63137 <listitem>
63138 <para>
63139 <indexterm role="concept">
63140 <primary>log</primary>
63141 <secondary>delivery duration</secondary>
63142 </indexterm>
63143 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
63144 perform the actual delivery is logged as DT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>DT=1s</literal>.
63145 </para>
63146 </listitem>
63147 <listitem>
63148 <para>
63149 <indexterm role="concept">
63150 <primary>log</primary>
63151 <secondary>message size on delivery</secondary>
63152 </indexterm>
63153 <indexterm role="concept">
63154 <primary>size</primary>
63155 <secondary>of message</secondary>
63156 </indexterm>
63157 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
63158 the <quote>=&gt;</quote> line, tagged with S=.
63159 </para>
63160 </listitem>
63161 <listitem>
63162 <para>
63163 <indexterm role="concept">
63164 <primary>log</primary>
63165 <secondary>dnslist defer</secondary>
63166 </indexterm>
63167 <indexterm role="concept">
63168 <primary>DNS list</primary>
63169 <secondary>logging defer</secondary>
63170 </indexterm>
63171 <indexterm role="concept">
63172 <primary>black list (DNS)</primary>
63173 </indexterm>
63174 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
63175 DNS black list suffers a temporary error.
63176 </para>
63177 </listitem>
63178 <listitem>
63179 <para>
63180 <indexterm role="concept">
63181 <primary>log</primary>
63182 <secondary>ETRN commands</secondary>
63183 </indexterm>
63184 <indexterm role="concept">
63185 <primary>ETRN</primary>
63186 <secondary>logging</secondary>
63187 </indexterm>
63188 <option>etrn</option>: Every valid ETRN command that is received is logged, before the ACL
63189 is run to determine whether or not it is actually accepted. An invalid ETRN
63190 command, or one received within a message transaction is not logged by this
63191 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
63192 </para>
63193 </listitem>
63194 <listitem>
63195 <para>
63196 <indexterm role="concept">
63197 <primary>log</primary>
63198 <secondary>host lookup failure</secondary>
63199 </indexterm>
63200 <option>host_lookup_failed</option>: When a lookup of a host&#x2019;s IP addresses fails to find
63201 any addresses, or when a lookup of an IP address fails to find a host name, a
63202 log line is written. This logging does not apply to direct DNS lookups when
63203 routing email addresses, but it does apply to <quote>byname</quote> lookups.
63204 </para>
63205 </listitem>
63206 <listitem>
63207 <para>
63208 <indexterm role="concept">
63209 <primary>log</primary>
63210 <secondary>ident timeout</secondary>
63211 </indexterm>
63212 <indexterm role="concept">
63213 <primary>RFC 1413</primary>
63214 <secondary>logging timeout</secondary>
63215 </indexterm>
63216 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
63217 client&#x2019;s ident port times out.
63218 </para>
63219 </listitem>
63220 <listitem>
63221 <para>
63222 <indexterm role="concept">
63223 <primary>log</primary>
63224 <secondary>incoming interface</secondary>
63225 </indexterm>
63226 <indexterm role="concept">
63227 <primary>interface</primary>
63228 <secondary>logging</secondary>
63229 </indexterm>
63230 <option>incoming_interface</option>: The interface on which a message was received is added
63231 to the <quote>&lt;=</quote> line as an IP address in square brackets, tagged by I= and
63232 followed by a colon and the port number. The local interface and port are also
63233 added to other SMTP log lines, for example <quote>SMTP connection from</quote>, and to
63234 rejection lines.
63235 </para>
63236 </listitem>
63237 <listitem>
63238 <para>
63239 <indexterm role="concept">
63240 <primary>log</primary>
63241 <secondary>incoming remote port</secondary>
63242 </indexterm>
63243 <indexterm role="concept">
63244 <primary>port</primary>
63245 <secondary>logging remote</secondary>
63246 </indexterm>
63247 <indexterm role="concept">
63248 <primary>TCP/IP</primary>
63249 <secondary>logging incoming remote port</secondary>
63250 </indexterm>
63251 <indexterm role="variable">
63252 <primary><varname>$sender_fullhost</varname></primary>
63253 </indexterm>
63254 <indexterm role="variable">
63255 <primary><varname>$sender_rcvhost</varname></primary>
63256 </indexterm>
63257 <option>incoming_port</option>: The remote port number from which a message was received is
63258 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
63259 in square brackets, and separated from it by a colon. This is implemented by
63260 changing the value that is put in the <varname>$sender_fullhost</varname> and
63261 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
63262 important with the widening use of NAT (see RFC 2505).
63263 </para>
63264 </listitem>
63265 <listitem>
63266 <para>
63267 <indexterm role="concept">
63268 <primary>log</primary>
63269 <secondary>dropped connection</secondary>
63270 </indexterm>
63271 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
63272 connection is unexpectedly dropped.
63273 </para>
63274 </listitem>
63275 <listitem>
63276 <para>
63277 <indexterm role="concept">
63278 <primary>log</primary>
63279 <secondary>outgoing remote port</secondary>
63280 </indexterm>
63281 <indexterm role="concept">
63282 <primary>port</primary>
63283 <secondary>logging outgoint remote</secondary>
63284 </indexterm>
63285 <indexterm role="concept">
63286 <primary>TCP/IP</primary>
63287 <secondary>logging ougtoing remote port</secondary>
63288 </indexterm>
63289 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
63290 containing =&gt; tags) following the IP address. This option is not included in
63291 the default setting, because for most ordinary configurations, the remote port
63292 number is always 25 (the SMTP port).
63293 </para>
63294 </listitem>
63295 <listitem>
63296 <para>
63297 <indexterm role="concept">
63298 <primary>log</primary>
63299 <secondary>process ids in</secondary>
63300 </indexterm>
63301 <indexterm role="concept">
63302 <primary>pid (process id)</primary>
63303 <secondary>in log lines</secondary>
63304 </indexterm>
63305 <option>pid</option>: The current process id is added to every log line, in square brackets,
63306 immediately after the time and date.
63307 </para>
63308 </listitem>
63309 <listitem>
63310 <para>
63311 <indexterm role="concept">
63312 <primary>log</primary>
63313 <secondary>queue run</secondary>
63314 </indexterm>
63315 <indexterm role="concept">
63316 <primary>queue runner</primary>
63317 <secondary>logging</secondary>
63318 </indexterm>
63319 <option>queue_run</option>: The start and end of every queue run are logged.
63320 </para>
63321 </listitem>
63322 <listitem>
63323 <para>
63324 <indexterm role="concept">
63325 <primary>log</primary>
63326 <secondary>queue time</secondary>
63327 </indexterm>
63328 <option>queue_time</option>: The amount of time the message has been in the queue on the
63329 local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on delivery (<literal>=&gt;</literal>) lines, for example,
63330 <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the message, so it
63331 includes reception time as well as the delivery time for the current address.
63332 This means that it may be longer than the difference between the arrival and
63333 delivery log line times, because the arrival log line is not written until the
63334 message has been successfully received.
63335 </para>
63336 </listitem>
63337 <listitem>
63338 <para>
63339 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
63340 the local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on <quote>Completed</quote> lines, for
63341 example, <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the
63342 message, so it includes reception time as well as the total delivery time.
63343 </para>
63344 </listitem>
63345 <listitem>
63346 <para>
63347 <indexterm role="concept">
63348 <primary>log</primary>
63349 <secondary>recipients</secondary>
63350 </indexterm>
63351 <option>received_recipients</option>: The recipients of a message are listed in the main log
63352 as soon as the message is received. The list appears at the end of the log line
63353 that is written when a message is received, preceded by the word <quote>for</quote>. The
63354 addresses are listed after they have been qualified, but before any rewriting
63355 has taken place.
63356 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
63357 in the list.
63358 </para>
63359 </listitem>
63360 <listitem>
63361 <para>
63362 <indexterm role="concept">
63363 <primary>log</primary>
63364 <secondary>sender reception</secondary>
63365 </indexterm>
63366 <option>received_sender</option>: The unrewritten original sender of a message is added to
63367 the end of the log line that records the message&#x2019;s arrival, after the word
63368 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
63369 </para>
63370 </listitem>
63371 <listitem>
63372 <para>
63373 <indexterm role="concept">
63374 <primary>log</primary>
63375 <secondary>header lines for rejection</secondary>
63376 </indexterm>
63377 <option>rejected_header</option>: If a message&#x2019;s header has been received at the time a
63378 rejection is written to the reject log, the complete header is added to the
63379 log. Header logging can be turned off individually for messages that are
63380 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
63381 </para>
63382 </listitem>
63383 <listitem>
63384 <para>
63385 <indexterm role="concept">
63386 <primary>log</primary>
63387 <secondary>retry defer</secondary>
63388 </indexterm>
63389 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
63390 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
63391 message is always omitted from individual message logs after the first delivery
63392 attempt.
63393 </para>
63394 </listitem>
63395 <listitem>
63396 <para>
63397 <indexterm role="concept">
63398 <primary>log</primary>
63399 <secondary>return path</secondary>
63400 </indexterm>
63401 <option>return_path_on_delivery</option>: The return path that is being transmitted with
63402 the message is included in delivery and bounce lines, using the tag P=.
63403 This is omitted if no delivery actually happens, for example, if routing fails,
63404 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
63405 </para>
63406 </listitem>
63407 <listitem>
63408 <para>
63409 <indexterm role="concept">
63410 <primary>log</primary>
63411 <secondary>sender on delivery</secondary>
63412 </indexterm>
63413 <option>sender_on_delivery</option>: The message&#x2019;s sender address is added to every delivery
63414 and bounce line, tagged by F= (for <quote>from</quote>).
63415 This is the original sender that was received with the message; it is not
63416 necessarily the same as the outgoing return path.
63417 </para>
63418 </listitem>
63419 <listitem>
63420 <para>
63421 <indexterm role="concept">
63422 <primary>log</primary>
63423 <secondary>sender verify failure</secondary>
63424 </indexterm>
63425 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
63426 gives details of a sender verification failure is not written. Log lines for
63427 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
63428 detail is lost.
63429 </para>
63430 </listitem>
63431 <listitem>
63432 <para>
63433 <indexterm role="concept">
63434 <primary>log</primary>
63435 <secondary>size rejection</secondary>
63436 </indexterm>
63437 <option>size_reject</option>: A log line is written whenever a message is rejected because
63438 it is too big.
63439 </para>
63440 </listitem>
63441 <listitem>
63442 <para>
63443 <indexterm role="concept">
63444 <primary>log</primary>
63445 <secondary>frozen messages; skipped</secondary>
63446 </indexterm>
63447 <indexterm role="concept">
63448 <primary>frozen messages</primary>
63449 <secondary>logging skipping</secondary>
63450 </indexterm>
63451 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
63452 queue run because it is frozen or because another process is already delivering
63453 it.
63454 <indexterm role="concept">
63455 <primary><quote>spool file is locked</quote></primary>
63456 </indexterm>
63457 The message that is written is <quote>spool file is locked</quote>.
63458 </para>
63459 </listitem>
63460 <listitem>
63461 <para>
63462 <indexterm role="concept">
63463 <primary>log</primary>
63464 <secondary>smtp confirmation</secondary>
63465 </indexterm>
63466 <indexterm role="concept">
63467 <primary>SMTP</primary>
63468 <secondary>logging confirmation</secondary>
63469 </indexterm>
63470 <indexterm role="concept">
63471 <primary>LMTP</primary>
63472 <secondary>logging confirmation</secondary>
63473 </indexterm>
63474 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP or LMTP dialogue for
63475 outgoing messages is added to delivery log lines in the form <literal>C=</literal>&lt;<emphasis>text</emphasis>&gt;.
63476 A number of MTAs (including Exim) return an identifying string in this
63477 response.
63478 </para>
63479 </listitem>
63480 <listitem>
63481 <para>
63482 <indexterm role="concept">
63483 <primary>log</primary>
63484 <secondary>SMTP connections</secondary>
63485 </indexterm>
63486 <indexterm role="concept">
63487 <primary>SMTP</primary>
63488 <secondary>logging connections</secondary>
63489 </indexterm>
63490 <option>smtp_connection</option>: A log line is written whenever an SMTP connection is
63491 established or closed, unless the connection is from a host that matches
63492 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
63493 only when the closure is unexpected.) This applies to connections from local
63494 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
63495 dropped in the middle of a message, a log line is always written, whether or
63496 not this selector is set, but otherwise nothing is written at the start and end
63497 of connections unless this selector is enabled.
63498 </para>
63499 <para>
63500 For TCP/IP connections to an Exim daemon, the current number of connections is
63501 included in the log message for each new connection, but note that the count is
63502 reset if the daemon is restarted.
63503 Also, because connections are closed (and the closure is logged) in
63504 subprocesses, the count may not include connections that have been closed but
63505 whose termination the daemon has not yet noticed. Thus, while it is possible to
63506 match up the opening and closing of connections in the log, the value of the
63507 logged counts may not be entirely accurate.
63508 </para>
63509 </listitem>
63510 <listitem>
63511 <para>
63512 <indexterm role="concept">
63513 <primary>log</primary>
63514 <secondary>SMTP transaction; incomplete</secondary>
63515 </indexterm>
63516 <indexterm role="concept">
63517 <primary>SMTP</primary>
63518 <secondary>logging incomplete transactions</secondary>
63519 </indexterm>
63520 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
63521 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
63522 and the message sender plus any accepted recipients are included in the log
63523 line. This can provide evidence of dictionary attacks.
63524 </para>
63525 </listitem>
63526 <listitem>
63527 <para>
63528 <indexterm role="concept">
63529 <primary>log</primary>
63530 <secondary>non-MAIL SMTP sessions</secondary>
63531 </indexterm>
63532 <indexterm role="concept">
63533 <primary>MAIL</primary>
63534 <secondary>logging session without</secondary>
63535 </indexterm>
63536 <option>smtp_no_mail</option>: A line is written to the main log whenever an accepted SMTP
63537 connection terminates without having issued a MAIL command. This includes both
63538 the case when the connection is dropped, and the case when QUIT is used. It
63539 does not include cases where the connection is rejected right at the start (by
63540 an ACL, or because there are too many connections, or whatever). These cases
63541 already have their own log lines.
63542 </para>
63543 <para>
63544 The log line that is written contains the identity of the client in the usual
63545 way, followed by D= and a time, which records the duration of the connection.
63546 If the connection was authenticated, this fact is logged exactly as it is for
63547 an incoming message, with an A= item. If the connection was encrypted, CV=,
63548 DN=, and X= items may appear as they do for an incoming message, controlled by
63549 the same logging options.
63550 </para>
63551 <para>
63552 Finally, if any SMTP commands were issued during the connection, a C= item
63553 is added to the line, listing the commands that were used. For example,
63554 </para>
63555 <literallayout class="monospaced">
63556 C=EHLO,QUIT
63557 </literallayout>
63558 <para>
63559 shows that the client issued QUIT straight after EHLO. If there were fewer
63560 than 20 commands, they are all listed. If there were more than 20 commands,
63561 the last 20 are listed, preceded by <quote>...</quote>. However, with the default
63562 setting of 10 for <option>smtp_accep_max_nonmail</option>, the connection will in any case
63563 have been aborted before 20 non-mail commands are processed.
63564 </para>
63565 </listitem>
63566 <listitem>
63567 <para>
63568 <option>smtp_mailauth</option>: A third subfield with the authenticated sender,
63569 colon-separated, is appended to the A= item for a message arrival or delivery
63570 log line, if an AUTH argument to the SMTP MAIL command (see <xref linkend="SECTauthparamail"/>)
63571 was accepted or used.
63572 </para>
63573 </listitem>
63574 <listitem>
63575 <para>
63576 <indexterm role="concept">
63577 <primary>log</primary>
63578 <secondary>SMTP protocol error</secondary>
63579 </indexterm>
63580 <indexterm role="concept">
63581 <primary>SMTP</primary>
63582 <secondary>logging protocol error</secondary>
63583 </indexterm>
63584 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
63585 encountered. Exim does not have perfect detection of all protocol errors
63586 because of transmission delays and the use of pipelining. If PIPELINING has
63587 been advertised to a client, an Exim server assumes that the client will use
63588 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
63589 received after rejecting MAIL) as protocol errors.
63590 </para>
63591 </listitem>
63592 <listitem>
63593 <para>
63594 <indexterm role="concept">
63595 <primary>SMTP</primary>
63596 <secondary>logging syntax errors</secondary>
63597 </indexterm>
63598 <indexterm role="concept">
63599 <primary>SMTP</primary>
63600 <secondary>syntax errors; logging</secondary>
63601 </indexterm>
63602 <indexterm role="concept">
63603 <primary>SMTP</primary>
63604 <secondary>unknown command; logging</secondary>
63605 </indexterm>
63606 <indexterm role="concept">
63607 <primary>log</primary>
63608 <secondary>unknown SMTP command</secondary>
63609 </indexterm>
63610 <indexterm role="concept">
63611 <primary>log</primary>
63612 <secondary>SMTP syntax error</secondary>
63613 </indexterm>
63614 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
63615 encountered. An unrecognized command is treated as a syntax error. For an
63616 external connection, the host identity is given; for an internal connection
63617 using <option>-bs</option> the sender identification (normally the calling user) is given.
63618 </para>
63619 </listitem>
63620 <listitem>
63621 <para>
63622 <indexterm role="concept">
63623 <primary>log</primary>
63624 <secondary>subject</secondary>
63625 </indexterm>
63626 <indexterm role="concept">
63627 <primary>subject, logging</primary>
63628 </indexterm>
63629 <option>subject</option>: The subject of the message is added to the arrival log line,
63630 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
63631 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
63632 specifies whether characters with values greater than 127 should be logged
63633 unchanged, or whether they should be rendered as escape sequences.
63634 </para>
63635 </listitem>
63636 <listitem>
63637 <para>
63638 <indexterm role="concept">
63639 <primary>log</primary>
63640 <secondary>certificate verification</secondary>
63641 </indexterm>
63642 <option>tls_certificate_verified</option>: An extra item is added to &lt;= and =&gt; log lines
63643 when TLS is in use. The item is <literal>CV=yes</literal> if the peer&#x2019;s certificate was
63644 verified, and <literal>CV=no</literal> if not.
63645 </para>
63646 </listitem>
63647 <listitem>
63648 <para>
63649 <indexterm role="concept">
63650 <primary>log</primary>
63651 <secondary>TLS cipher</secondary>
63652 </indexterm>
63653 <indexterm role="concept">
63654 <primary>TLS</primary>
63655 <secondary>logging cipher</secondary>
63656 </indexterm>
63657 <option>tls_cipher</option>: When a message is sent or received over an encrypted
63658 connection, the cipher suite used is added to the log line, preceded by X=.
63659 </para>
63660 </listitem>
63661 <listitem>
63662 <para>
63663 <indexterm role="concept">
63664 <primary>log</primary>
63665 <secondary>TLS peer DN</secondary>
63666 </indexterm>
63667 <indexterm role="concept">
63668 <primary>TLS</primary>
63669 <secondary>logging peer DN</secondary>
63670 </indexterm>
63671 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
63672 connection, and a certificate is supplied by the remote host, the peer DN is
63673 added to the log line, preceded by DN=.
63674 </para>
63675 </listitem>
63676 <listitem>
63677 <para>
63678 <indexterm role="concept">
63679 <primary>log</primary>
63680 <secondary>TLS SNI</secondary>
63681 </indexterm>
63682 <indexterm role="concept">
63683 <primary>TLS</primary>
63684 <secondary>logging SNI</secondary>
63685 </indexterm>
63686 <option>tls_sni</option>: When a message is received over an encrypted connection, and
63687 the remote host provided the Server Name Indication extension, the SNI is
63688 added to the log line, preceded by SNI=.
63689 </para>
63690 </listitem>
63691 <listitem>
63692 <para>
63693 <indexterm role="concept">
63694 <primary>log</primary>
63695 <secondary>DNS failure in list</secondary>
63696 </indexterm>
63697 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
63698 result of a list match is failure because a DNS lookup failed.
63699 </para>
63700 </listitem>
63701 </itemizedlist>
63702 </section>
63703 <section id="SECID260">
63704 <title>Message log</title>
63705 <para>
63706 <indexterm role="concept">
63707 <primary>message</primary>
63708 <secondary>log file for</secondary>
63709 </indexterm>
63710 <indexterm role="concept">
63711 <primary>log</primary>
63712 <secondary>message log; description of</secondary>
63713 </indexterm>
63714 <indexterm role="concept">
63715 <primary><filename>msglog</filename> directory</primary>
63716 </indexterm>
63717 <indexterm role="option">
63718 <primary><option>preserve_message_logs</option></primary>
63719 </indexterm>
63720 In addition to the general log files, Exim writes a log file for each message
63721 that it handles. The names of these per-message logs are the message ids, and
63722 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
63723 message log contains copies of the log lines that apply to the message. This
63724 makes it easier to inspect the status of an individual message without having
63725 to search the main log. A message log is deleted when processing of the message
63726 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
63727 only with great care because they can fill up your disk very quickly.
63728 </para>
63729 <para>
63730 On a heavily loaded system, it may be desirable to disable the use of
63731 per-message logs, in order to reduce disk I/O. This can be done by setting the
63732 <option>message_logs</option> option false.
63733 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
63734 </para>
63735 </section>
63736 </chapter>
63737
63738 <chapter id="CHAPutils">
63739 <title>Exim utilities</title>
63740 <para>
63741 <indexterm role="concept" id="IIDutils" class="startofrange">
63742 <primary>utilities</primary>
63743 </indexterm>
63744 A number of utility scripts and programs are supplied with Exim and are
63745 described in this chapter. There is also the Exim Monitor, which is covered in
63746 the next chapter. The utilities described here are:
63747 </para>
63748 <informaltable frame="none">
63749 <tgroup cols="3" colsep="0" rowsep="0">
63750 <colspec colwidth="7*" align="left"/>
63751 <colspec colwidth="15*" align="left"/>
63752 <colspec colwidth="40*" align="left"/>
63753 <tbody>
63754 <row>
63755 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinoutwha"/></entry>
63756 <entry><emphasis>exiwhat</emphasis></entry>
63757 <entry>list what Exim processes are doing</entry>
63758 </row>
63759 <row>
63760 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTgreptheque"/></entry>
63761 <entry><emphasis>exiqgrep</emphasis></entry>
63762 <entry>grep the queue</entry>
63763 </row>
63764 <row>
63765 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTsumtheque"/></entry>
63766 <entry><emphasis>exiqsumm</emphasis></entry>
63767 <entry>summarize the queue</entry>
63768 </row>
63769 <row>
63770 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTextspeinf"/></entry>
63771 <entry><emphasis>exigrep</emphasis></entry>
63772 <entry>search the main log</entry>
63773 </row>
63774 <row>
63775 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTexipick"/></entry>
63776 <entry><emphasis>exipick</emphasis></entry>
63777 <entry>select messages on various criteria</entry>
63778 </row>
63779 <row>
63780 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcyclogfil"/></entry>
63781 <entry><emphasis>exicyclog</emphasis></entry>
63782 <entry>cycle (rotate) log files</entry>
63783 </row>
63784 <row>
63785 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailstat"/></entry>
63786 <entry><emphasis>eximstats</emphasis></entry>
63787 <entry>extract statistics from the log</entry>
63788 </row>
63789 <row>
63790 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcheckaccess"/></entry>
63791 <entry><emphasis>exim_checkaccess</emphasis></entry>
63792 <entry>check address acceptance from given IP</entry>
63793 </row>
63794 <row>
63795 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTdbmbuild"/></entry>
63796 <entry><emphasis>exim_dbmbuild</emphasis></entry>
63797 <entry>build a DBM file</entry>
63798 </row>
63799 <row>
63800 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinindret"/></entry>
63801 <entry><emphasis>exinext</emphasis></entry>
63802 <entry>extract retry information</entry>
63803 </row>
63804 <row>
63805 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
63806 <entry><emphasis>exim_dumpdb</emphasis></entry>
63807 <entry>dump a hints database</entry>
63808 </row>
63809 <row>
63810 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
63811 <entry><emphasis>exim_tidydb</emphasis></entry>
63812 <entry>clean up a hints database</entry>
63813 </row>
63814 <row>
63815 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
63816 <entry><emphasis>exim_fixdb</emphasis></entry>
63817 <entry>patch a hints database</entry>
63818 </row>
63819 <row>
63820 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailboxmaint"/></entry>
63821 <entry><emphasis>exim_lock</emphasis></entry>
63822 <entry>lock a mailbox file</entry>
63823 </row>
63824 </tbody>
63825 </tgroup>
63826 </informaltable>
63827 <para>
63828 Another utility that might be of use to sites with many MTAs is Tom Kistner&#x2019;s
63829 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
63830 <emphasis role="bold"><ulink url="http://duncanthrax.net/exilog/">http://duncanthrax.net/exilog/</ulink></emphasis> for details.
63831 </para>
63832 <section id="SECTfinoutwha">
63833 <title>Finding out what Exim processes are doing (exiwhat)</title>
63834 <para>
63835 <indexterm role="concept">
63836 <primary><emphasis>exiwhat</emphasis></primary>
63837 </indexterm>
63838 <indexterm role="concept">
63839 <primary>process, querying</primary>
63840 </indexterm>
63841 <indexterm role="concept">
63842 <primary>SIGUSR1</primary>
63843 </indexterm>
63844 On operating systems that can restart a system call after receiving a signal
63845 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
63846 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
63847 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
63848 processes it can find, having first emptied the file. It then waits for one
63849 second to allow the Exim processes to react before displaying the results. In
63850 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
63851 send the signal to the Exim processes, so it is normally run as root.
63852 </para>
63853 <para>
63854 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
63855 use by system administrators. It is not sensible, for example, to set up a
63856 script that sends SIGUSR1 signals to Exim processes at short intervals.
63857 </para>
63858 <para>
63859 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
63860 varies in different operating systems. Not only are different options used,
63861 but the format of the output is different. For this reason, there are some
63862 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
63863 it doesn&#x2019;t seem to be working for you, check the following compile-time
63864 options:
63865 </para>
63866 <literallayout>
63867 <literal>EXIWHAT_PS_CMD    </literal> the command for running <emphasis>ps</emphasis>
63868 <literal>EXIWHAT_PS_ARG    </literal> the argument for <emphasis>ps</emphasis>
63869 <literal>EXIWHAT_EGREP_ARG </literal> the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output
63870 <literal>EXIWHAT_KILL_ARG  </literal> the argument for the <emphasis>kill</emphasis> command
63871 </literallayout>
63872 <para>
63873 An example of typical output from <emphasis>exiwhat</emphasis> is
63874 </para>
63875 <literallayout class="monospaced">
63876 164 daemon: -q1h, listening on port 25
63877 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
63878 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
63879   [10.19.42.42] (editor@ref.example)
63880 10592 handling incoming call from [192.168.243.242]
63881 10628 accepting a local non-SMTP message
63882 </literallayout>
63883 <para>
63884 The first number in the output line is the process number. The third line has
63885 been split here, in order to fit it on the page.
63886 </para>
63887 </section>
63888 <section id="SECTgreptheque">
63889 <title>Selective queue listing (exiqgrep)</title>
63890 <para>
63891 <indexterm role="concept">
63892 <primary><emphasis>exiqgrep</emphasis></primary>
63893 </indexterm>
63894 <indexterm role="concept">
63895 <primary>queue</primary>
63896 <secondary>grepping</secondary>
63897 </indexterm>
63898 This utility is a Perl script contributed by Matt Hubbard. It runs
63899 </para>
63900 <literallayout class="monospaced">
63901 exim -bpu
63902 </literallayout>
63903 <para>
63904 or (in case <emphasis role="bold">-a</emphasis> switch is specified)
63905 </para>
63906 <literallayout class="monospaced">
63907 exim -bp
63908 </literallayout>
63909 <para>
63910 The <emphasis role="bold">-C</emphasis> option is used to specify an alternate <filename>exim.conf</filename> which might
63911 contain alternate exim configuration the queue management might be using.
63912 </para>
63913 <para>
63914 to obtain a queue listing, and then greps the output to select messages 
63915 that match given criteria. The following selection options are available:
63916 </para>
63917 <variablelist>
63918 <varlistentry>
63919 <term><emphasis role="bold">-f</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
63920 <listitem>
63921 <para>
63922 Match the sender address using a case-insensitive search. The field that is
63923 tested is enclosed in angle brackets, so you can test for bounce messages with
63924 </para>
63925 <literallayout class="monospaced">
63926 exiqgrep -f '^&lt;&gt;$'
63927 </literallayout>
63928 </listitem></varlistentry>
63929 <varlistentry>
63930 <term><emphasis role="bold">-r</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
63931 <listitem>
63932 <para>
63933 Match a recipient address using a case-insensitve search. The field that is
63934 tested is not enclosed in angle brackets.
63935 </para>
63936 </listitem></varlistentry>
63937 <varlistentry>
63938 <term><emphasis role="bold">-s</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
63939 <listitem>
63940 <para>
63941 Match against the size field.
63942 </para>
63943 </listitem></varlistentry>
63944 <varlistentry>
63945 <term><emphasis role="bold">-y</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
63946 <listitem>
63947 <para>
63948 Match messages that are younger than the given time.
63949 </para>
63950 </listitem></varlistentry>
63951 <varlistentry>
63952 <term><emphasis role="bold">-o</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
63953 <listitem>
63954 <para>
63955 Match messages that are older than the given time.
63956 </para>
63957 </listitem></varlistentry>
63958 <varlistentry>
63959 <term><emphasis role="bold">-z</emphasis></term>
63960 <listitem>
63961 <para>
63962 Match only frozen messages.
63963 </para>
63964 </listitem></varlistentry>
63965 <varlistentry>
63966 <term><emphasis role="bold">-x</emphasis></term>
63967 <listitem>
63968 <para>
63969 Match only non-frozen messages.
63970 </para>
63971 </listitem></varlistentry>
63972 </variablelist>
63973 <para>
63974 The following options control the format of the output:
63975 </para>
63976 <variablelist>
63977 <varlistentry>
63978 <term><emphasis role="bold">-c</emphasis></term>
63979 <listitem>
63980 <para>
63981 Display only the count of matching messages.
63982 </para>
63983 </listitem></varlistentry>
63984 <varlistentry>
63985 <term><emphasis role="bold">-l</emphasis></term>
63986 <listitem>
63987 <para>
63988 Long format &ndash; display the full message information as output by Exim. This is
63989 the default.
63990 </para>
63991 </listitem></varlistentry>
63992 <varlistentry>
63993 <term><emphasis role="bold">-i</emphasis></term>
63994 <listitem>
63995 <para>
63996 Display message ids only.
63997 </para>
63998 </listitem></varlistentry>
63999 <varlistentry>
64000 <term><emphasis role="bold">-b</emphasis></term>
64001 <listitem>
64002 <para>
64003 Brief format &ndash; one line per message.
64004 </para>
64005 </listitem></varlistentry>
64006 <varlistentry>
64007 <term><emphasis role="bold">-R</emphasis></term>
64008 <listitem>
64009 <para>
64010 Display messages in reverse order.
64011 </para>
64012 </listitem></varlistentry>
64013 <varlistentry>
64014 <term><emphasis role="bold">-a</emphasis></term>
64015 <listitem>
64016 <para>
64017 Include delivered recipients in queue listing.
64018 </para>
64019 </listitem></varlistentry>
64020 </variablelist>
64021 <para>
64022 There is one more option, <option>-h</option>, which outputs a list of options.
64023 </para>
64024 </section>
64025 <section id="SECTsumtheque">
64026 <title>Summarizing the queue (exiqsumm)</title>
64027 <para>
64028 <indexterm role="concept">
64029 <primary><emphasis>exiqsumm</emphasis></primary>
64030 </indexterm>
64031 <indexterm role="concept">
64032 <primary>queue</primary>
64033 <secondary>summary</secondary>
64034 </indexterm>
64035 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
64036 -bp</literal> and produces a summary of the messages on the queue. Thus, you use it by
64037 running a command such as
64038 </para>
64039 <literallayout class="monospaced">
64040 exim -bp | exiqsumm
64041 </literallayout>
64042 <para>
64043 The output consists of one line for each domain that has messages waiting for
64044 it, as in the following example:
64045 </para>
64046 <literallayout class="monospaced">
64047 3   2322   74m   66m  msn.com.example
64048 </literallayout>
64049 <para>
64050 Each line lists the number of pending deliveries for a domain, their total
64051 volume, and the length of time that the oldest and the newest messages have
64052 been waiting. Note that the number of pending deliveries is greater than the
64053 number of messages when messages have more than one recipient.
64054 </para>
64055 <para>
64056 A summary line is output at the end. By default the output is sorted on the
64057 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
64058 the output to be sorted by oldest message and by count of messages,
64059 respectively. There are also three options that split the messages for each
64060 domain into two or more subcounts: <option>-b</option> separates bounce messages, <option>-f</option>
64061 separates frozen messages, and <option>-s</option> separates messages according to their
64062 sender.
64063 </para>
64064 <para>
64065 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
64066 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
64067 generated by aliasing or forwarding are included (unless the <option>one_time</option>
64068 option of the <command>redirect</command> router has been used to convert them into <quote>top
64069 level</quote> addresses).
64070 </para>
64071 </section>
64072 <section id="SECTextspeinf">
64073 <title>Extracting specific information from the log (exigrep)</title>
64074 <para>
64075 <indexterm role="concept">
64076 <primary><emphasis>exigrep</emphasis></primary>
64077 </indexterm>
64078 <indexterm role="concept">
64079 <primary>log</primary>
64080 <secondary>extracts; grepping for</secondary>
64081 </indexterm>
64082 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
64083 files for entries that match a given pattern. When it finds a match, it
64084 extracts all the log entries for the relevant message, not just those that
64085 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
64086 given message, or all mail for a given user, or for a given host, for example.
64087 The input files can be in Exim log format or syslog format.
64088 If a matching log line is not associated with a specific message, it is
64089 included in <emphasis>exigrep</emphasis>&#x2019;s output without any additional lines. The usage is:
64090 </para>
64091 <literallayout revisionflag="changed">
64092 <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>
64093 </literallayout>
64094 <para>
64095 If no log file names are given on the command line, the standard input is read.
64096 </para>
64097 <para>
64098 The <option>-t</option> argument specifies a number of seconds. It adds an additional
64099 condition for message selection. Messages that are complete are shown only if
64100 they spent more than &lt;<emphasis>n</emphasis>&gt; seconds on the queue.
64101 </para>
64102 <para>
64103 By default, <emphasis>exigrep</emphasis> does case-insensitive matching. The <option>-I</option> option
64104 makes it case-sensitive. This may give a performance improvement when searching
64105 large log files. Without <option>-I</option>, the Perl pattern matches use Perl&#x2019;s <literal>/i</literal>
64106 option; with <option>-I</option> they do not. In both cases it is possible to change the
64107 case sensitivity within the pattern by using <literal>(?i)</literal> or <literal>(?-i)</literal>.
64108 </para>
64109 <para>
64110 The <option>-l</option> option means <quote>literal</quote>, that is, treat all characters in the
64111 pattern as standing for themselves. Otherwise the pattern must be a Perl
64112 regular expression.
64113 </para>
64114 <para>
64115 The <option>-v</option> option inverts the matching condition. That is, a line is selected
64116 if it does <emphasis>not</emphasis> match the pattern.
64117 </para>
64118 <para revisionflag="changed">
64119 The <option>-M</option> options means <quote>related messages</quote>. <emphasis>exigrep</emphasis> will show messages
64120 that are generated as a result/response to a message that <emphasis>exigrep</emphasis> matched
64121 normally.
64122 </para>
64123 <para revisionflag="changed">
64124 Example of <option>-M</option>:
64125 user_a sends a message to user_b, which generates a bounce back to user_b. If
64126 <emphasis>exigrep</emphasis> is used to search for <quote>user_a</quote>, only the first message will be
64127 displayed.  But if <emphasis>exigrep</emphasis> is used to search for <quote>user_b</quote>, the first and
64128 the second (bounce) message will be displayed. Using <option>-M</option> with <emphasis>exigrep</emphasis>
64129 when searching for <quote>user_a</quote> will show both messages since the bounce is
64130 <quote>related</quote> to or a <quote>result</quote> of the first message that was found by the
64131 search term.
64132 </para>
64133 <para>
64134 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
64135 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
64136 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
64137 </para>
64138 </section>
64139 <section id="SECTexipick">
64140 <title>Selecting messages by various criteria (exipick)</title>
64141 <para>
64142 <indexterm role="concept">
64143 <primary><emphasis>exipick</emphasis></primary>
64144 </indexterm>
64145 John Jetmore&#x2019;s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
64146 lists messages from the queue according to a variety of criteria. For details
64147 of <emphasis>exipick</emphasis>&#x2019;s facilities, visit the web page at
64148 <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
64149 the <option>--help</option> option.
64150 </para>
64151 </section>
64152 <section id="SECTcyclogfil">
64153 <title>Cycling log files (exicyclog)</title>
64154 <para>
64155 <indexterm role="concept">
64156 <primary>log</primary>
64157 <secondary>cycling local files</secondary>
64158 </indexterm>
64159 <indexterm role="concept">
64160 <primary>cycling logs</primary>
64161 </indexterm>
64162 <indexterm role="concept">
64163 <primary><emphasis>exicyclog</emphasis></primary>
64164 </indexterm>
64165 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
64166 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
64167 you are using log files with datestamps in their names (see section
64168 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
64169 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
64170 There are two command line options for <emphasis>exicyclog</emphasis>:
64171 </para>
64172 <itemizedlist>
64173 <listitem>
64174 <para>
64175 <option>-k</option> &lt;<emphasis>count</emphasis>&gt; specifies the number of log files to keep, overriding the
64176 default that is set when Exim is built. The default default is 10.
64177 </para>
64178 </listitem>
64179 <listitem>
64180 <para>
64181 <option>-l</option> &lt;<emphasis>path</emphasis>&gt; specifies the log file path, in the same format as Exim&#x2019;s
64182 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
64183 overriding the script&#x2019;s default, which is to find the setting from Exim&#x2019;s
64184 configuration.
64185 </para>
64186 </listitem>
64187 </itemizedlist>
64188 <para>
64189 Each time <emphasis>exicyclog</emphasis> is run the file names get <quote>shuffled down</quote> by one. If
64190 the main log file name is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
64191 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
64192 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
64193 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
64194 logs are handled similarly.
64195 </para>
64196 <para>
64197 If the limit is greater than 99, the script uses 3-digit numbers such as
64198 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
64199 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
64200 any existing log files.
64201 </para>
64202 <para>
64203 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
64204 the end are deleted. All files with numbers greater than 01 are compressed,
64205 using a compression command which is configured by the COMPRESS_COMMAND
64206 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
64207 root <option>crontab</option> entry of the form
64208 </para>
64209 <literallayout class="monospaced">
64210 1 0 * * * su exim -c /usr/exim/bin/exicyclog
64211 </literallayout>
64212 <para>
64213 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
64214 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
64215 </para>
64216 </section>
64217 <section id="SECTmailstat">
64218 <title>Mail statistics (eximstats)</title>
64219 <para>
64220 <indexterm role="concept">
64221 <primary>statistics</primary>
64222 </indexterm>
64223 <indexterm role="concept">
64224 <primary><emphasis>eximstats</emphasis></primary>
64225 </indexterm>
64226 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
64227 information from log files. The output is either plain text, or HTML.
64228 Exim log files are also supported by the <emphasis>Lire</emphasis> system produced by the
64229 LogReport Foundation <emphasis role="bold"><ulink url="http://www.logreport.org">http://www.logreport.org</ulink></emphasis>.
64230 </para>
64231 <para>
64232 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
64233 latest version is the result of some extensive revision by Steve Campbell. A
64234 lot of information is given by default, but there are options for suppressing
64235 various parts of it. Following any options, the arguments to the script are a
64236 list of files, which should be main log files. For example:
64237 </para>
64238 <literallayout class="monospaced">
64239 eximstats -nr /var/spool/exim/log/mainlog.01
64240 </literallayout>
64241 <para>
64242 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
64243 messages received from or delivered to various hosts. The information is sorted
64244 both by message count and by volume, and the top fifty hosts in each category
64245 are listed on the standard output. Similar information, based on email
64246 addresses or domains instead of hosts can be requested by means of various
64247 options. For messages delivered and received locally, similar statistics are
64248 also produced per user.
64249 </para>
64250 <para>
64251 The output also includes total counts and statistics about delivery errors, and
64252 histograms showing the number of messages received and deliveries made in each
64253 hour of the day. A delivery with more than one address in its envelope (for
64254 example, an SMTP transaction with more than one RCPT command) is counted
64255 as a single delivery by <emphasis>eximstats</emphasis>.
64256 </para>
64257 <para>
64258 Though normally more deliveries than receipts are reported (as messages may
64259 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
64260 messages received than delivered, even though the queue is empty at the start
64261 and end of the period in question. If an incoming message contains no valid
64262 recipients, no deliveries are recorded for it. A bounce message is handled as
64263 an entirely separate message.
64264 </para>
64265 <para>
64266 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
64267 of messages received and deliveries made, and the number of hosts involved in
64268 each case. It also outputs the number of messages that were delayed (that is,
64269 not completely delivered at the first attempt), and the number that had at
64270 least one address that failed.
64271 </para>
64272 <para>
64273 The remainder of the output is in sections that can be independently disabled
64274 or modified by various options. It consists of a summary of deliveries by
64275 transport, histograms of messages received and delivered per time interval
64276 (default per hour), information about the time messages spent on the queue,
64277 a list of relayed messages, lists of the top fifty sending hosts, local
64278 senders, destination hosts, and destination local users by count and by volume,
64279 and a list of delivery errors that occurred.
64280 </para>
64281 <para>
64282 The relay information lists messages that were actually relayed, that is, they
64283 came from a remote host and were directly delivered to some other remote host,
64284 without being processed (for example, for aliasing or forwarding) locally.
64285 </para>
64286 <para>
64287 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
64288 outputs. These are documented in the Perl script itself, and can be extracted
64289 by running the command <command>perldoc</command> on the script. For example:
64290 </para>
64291 <literallayout class="monospaced">
64292 perldoc /usr/exim/bin/eximstats
64293 </literallayout>
64294 </section>
64295 <section id="SECTcheckaccess">
64296 <title>Checking access policy (exim_checkaccess)</title>
64297 <para>
64298 <indexterm role="concept">
64299 <primary><emphasis>exim_checkaccess</emphasis></primary>
64300 </indexterm>
64301 <indexterm role="concept">
64302 <primary>policy control</primary>
64303 <secondary>checking access</secondary>
64304 </indexterm>
64305 <indexterm role="concept">
64306 <primary>checking access</primary>
64307 </indexterm>
64308 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
64309 debugging output, in order to check what Exim is doing when it is applying
64310 policy controls to incoming SMTP mail. However, not everybody is sufficiently
64311 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
64312 sometimes you just want to answer the question <quote>Does this address have
64313 access?</quote> without bothering with any further details.
64314 </para>
64315 <para>
64316 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
64317 two arguments, an IP address and an email address:
64318 </para>
64319 <literallayout class="monospaced">
64320 exim_checkaccess 10.9.8.7 A.User@a.domain.example
64321 </literallayout>
64322 <para>
64323 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
64324 given email address would be accepted in a RCPT command in a TCP/IP
64325 connection from the host with the given IP address. The output of the utility
64326 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
64327 </para>
64328 <literallayout class="monospaced">
64329 Rejected:
64330 550 Relay not permitted
64331 </literallayout>
64332 <para>
64333 When running this test, the utility uses <literal>&lt;&gt;</literal> as the envelope sender address
64334 for the MAIL command, but you can change this by providing additional
64335 options. These are passed directly to the Exim command. For example, to specify
64336 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
64337 you can use:
64338 </para>
64339 <literallayout class="monospaced">
64340 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
64341                  -f himself@there.example
64342 </literallayout>
64343 <para>
64344 Note that these additional Exim command line items must be given after the two
64345 mandatory arguments.
64346 </para>
64347 <para>
64348 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
64349 while running its checks. You can run checks that include callouts by using
64350 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
64351 </para>
64352 </section>
64353 <section id="SECTdbmbuild">
64354 <title>Making DBM files (exim_dbmbuild)</title>
64355 <para>
64356 <indexterm role="concept">
64357 <primary>DBM</primary>
64358 <secondary>building dbm files</secondary>
64359 </indexterm>
64360 <indexterm role="concept">
64361 <primary>building DBM files</primary>
64362 </indexterm>
64363 <indexterm role="concept">
64364 <primary><emphasis>exim_dbmbuild</emphasis></primary>
64365 </indexterm>
64366 <indexterm role="concept">
64367 <primary>lower casing</primary>
64368 </indexterm>
64369 <indexterm role="concept">
64370 <primary>binary zero</primary>
64371 <secondary>in lookup key</secondary>
64372 </indexterm>
64373 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
64374 the format used by the <command>lsearch</command> lookup (see section
64375 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
64376 names as keys and the remainder of the information as data. The lower-casing
64377 can be prevented by calling the program with the <option>-nolc</option> option.
64378 </para>
64379 <para>
64380 A terminating zero is included as part of the key string. This is expected by
64381 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
64382 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
64383 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
64384 files.
64385 </para>
64386 <para>
64387 The program requires two arguments: the name of the input file (which can be a
64388 single hyphen to indicate the standard input), and the name of the output file.
64389 It creates the output under a temporary name, and then renames it if all went
64390 well.
64391 </para>
64392 <para>
64393 <indexterm role="concept">
64394 <primary>USE_DB</primary>
64395 </indexterm>
64396 If the native DB interface is in use (USE_DB is set in a compile-time
64397 configuration file &ndash; this is common in free versions of Unix) the two file
64398 names must be different, because in this mode the Berkeley DB functions create
64399 a single output file using exactly the name given. For example,
64400 </para>
64401 <literallayout class="monospaced">
64402 exim_dbmbuild /etc/aliases /etc/aliases.db
64403 </literallayout>
64404 <para>
64405 reads the system alias file and creates a DBM version of it in
64406 <filename>/etc/aliases.db</filename>.
64407 </para>
64408 <para>
64409 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
64410 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
64411 environment, the suffixes are added to the second argument of
64412 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
64413 when the Berkeley functions are used in compatibility mode (though this is not
64414 recommended), because in that case it adds a <filename>.db</filename> suffix to the file name.
64415 </para>
64416 <para>
64417 If a duplicate key is encountered, the program outputs a warning, and when it
64418 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
64419 option is used. By default, only the first of a set of duplicates is used &ndash;
64420 this makes it compatible with <command>lsearch</command> lookups. There is an option
64421 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
64422 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
64423 <option>stderr</option>. For other errors, where it doesn&#x2019;t actually make a new file, the
64424 return code is 2.
64425 </para>
64426 </section>
64427 <section id="SECTfinindret">
64428 <title>Finding individual retry times (exinext)</title>
64429 <para>
64430 <indexterm role="concept">
64431 <primary>retry</primary>
64432 <secondary>times</secondary>
64433 </indexterm>
64434 <indexterm role="concept">
64435 <primary><emphasis>exinext</emphasis></primary>
64436 </indexterm>
64437 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
64438 fish specific information out of the retry database. Given a mail domain (or a
64439 complete address), it looks up the hosts for that domain, and outputs any retry
64440 information for the hosts or for the domain. At present, the retry information
64441 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
64442 output. For example:
64443 </para>
64444 <literallayout class="monospaced">
64445 $ exinext piglet@milne.fict.example
64446 kanga.milne.example:192.168.8.1 error 146: Connection refused
64447   first failed: 21-Feb-1996 14:57:34
64448   last tried:   21-Feb-1996 14:57:34
64449   next try at:  21-Feb-1996 15:02:34
64450 roo.milne.example:192.168.8.3 error 146: Connection refused
64451   first failed: 20-Jan-1996 13:12:08
64452   last tried:   21-Feb-1996 11:42:03
64453   next try at:  21-Feb-1996 19:42:03
64454   past final cutoff time
64455 </literallayout>
64456 <para>
64457 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
64458 will give any retry information for that local part in your default domain.
64459 A message id can be used to obtain retry information pertaining to a specific
64460 message. This exists only when an attempt to deliver a message to a remote host
64461 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
64462 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
64463 run very often.
64464 </para>
64465 <para>
64466 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
64467 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
64468 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
64469 configuration file, and the second sets macros for use within the configuration
64470 file. These features are mainly to help in testing, but might also be useful in
64471 environments where more than one configuration file is in use.
64472 </para>
64473 </section>
64474 <section id="SECThindatmai">
64475 <title>Hints database maintenance</title>
64476 <para>
64477 <indexterm role="concept">
64478 <primary>hints database</primary>
64479 <secondary>maintenance</secondary>
64480 </indexterm>
64481 <indexterm role="concept">
64482 <primary>maintaining Exim&#x2019;s hints database</primary>
64483 </indexterm>
64484 Three utility programs are provided for maintaining the DBM files that Exim
64485 uses to contain its delivery hint information. Each program requires two
64486 arguments. The first specifies the name of Exim&#x2019;s spool directory, and the
64487 second is the name of the database it is to operate on. These are as follows:
64488 </para>
64489 <itemizedlist>
64490 <listitem>
64491 <para>
64492 <emphasis>retry</emphasis>: the database of retry information
64493 </para>
64494 </listitem>
64495 <listitem>
64496 <para>
64497 <emphasis>wait-</emphasis>&lt;<emphasis>transport name</emphasis>&gt;: databases of information about messages waiting
64498 for remote hosts
64499 </para>
64500 </listitem>
64501 <listitem>
64502 <para>
64503 <emphasis>callout</emphasis>: the callout cache
64504 </para>
64505 </listitem>
64506 <listitem>
64507 <para>
64508 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
64509 </para>
64510 </listitem>
64511 <listitem>
64512 <para>
64513 <emphasis>misc</emphasis>: other hints data
64514 </para>
64515 </listitem>
64516 </itemizedlist>
64517 <para>
64518 The <emphasis>misc</emphasis> database is used for
64519 </para>
64520 <itemizedlist>
64521 <listitem>
64522 <para>
64523 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
64524 </para>
64525 </listitem>
64526 <listitem>
64527 <para>
64528 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
64529 <command>smtp</command> transport)
64530 </para>
64531 </listitem>
64532 </itemizedlist>
64533 </section>
64534 <section id="SECID261">
64535 <title>exim_dumpdb</title>
64536 <para>
64537 <indexterm role="concept">
64538 <primary><emphasis>exim_dumpdb</emphasis></primary>
64539 </indexterm>
64540 The entire contents of a database are written to the standard output by the
64541 <emphasis>exim_dumpdb</emphasis> program, which has no options or arguments other than the
64542 spool and database names. For example, to dump the retry database:
64543 </para>
64544 <literallayout class="monospaced">
64545 exim_dumpdb /var/spool/exim retry
64546 </literallayout>
64547 <para>
64548 Two lines of output are produced for each entry:
64549 </para>
64550 <literallayout class="monospaced">
64551 T:mail.ref.example:192.168.242.242 146 77 Connection refused
64552 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
64553 </literallayout>
64554 <para>
64555 The first item on the first line is the key of the record. It starts with one
64556 of the letters R, or T, depending on whether it refers to a routing or
64557 transport retry. For a local delivery, the next part is the local address; for
64558 a remote delivery it is the name of the remote host, followed by its failing IP
64559 address (unless <option>retry_include_ip_address</option> is set false on the <command>smtp</command>
64560 transport). If the remote port is not the standard one (port 25), it is added
64561 to the IP address. Then there follows an error code, an additional error code,
64562 and a textual description of the error.
64563 </para>
64564 <para>
64565 The three times on the second line are the time of first failure, the time of
64566 the last delivery attempt, and the computed time for the next attempt. The line
64567 ends with an asterisk if the cutoff time for the last retry rule has been
64568 exceeded.
64569 </para>
64570 <para>
64571 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
64572 consists of a host name followed by a list of ids for messages that are or were
64573 waiting to be delivered to that host. If there are a very large number for any
64574 one host, continuation records, with a sequence number added to the host name,
64575 may be seen. The data in these records is often out of date, because a message
64576 may be routed to several alternative hosts, and Exim makes no effort to keep
64577 cross-references.
64578 </para>
64579 </section>
64580 <section id="SECID262">
64581 <title>exim_tidydb</title>
64582 <para>
64583 <indexterm role="concept">
64584 <primary><emphasis>exim_tidydb</emphasis></primary>
64585 </indexterm>
64586 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
64587 database. If run with no options, it removes all records that are more than 30
64588 days old. The age is calculated from the date and time that the record was last
64589 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
64590 since the first delivery failure. Information about a host that has been down
64591 for more than 30 days will remain in the database, provided that the record is
64592 updated sufficiently often.
64593 </para>
64594 <para>
64595 The cutoff date can be altered by means of the <option>-t</option> option, which must be
64596 followed by a time. For example, to remove all records older than a week from
64597 the retry database:
64598 </para>
64599 <literallayout class="monospaced">
64600 exim_tidydb -t 7d /var/spool/exim retry
64601 </literallayout>
64602 <para>
64603 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
64604 message ids. In the former these appear as data in records keyed by host &ndash;
64605 they were messages that were waiting for that host &ndash; and in the latter they
64606 are the keys for retry information for messages that have suffered certain
64607 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
64608 message ids in database records are those of messages that are still on the
64609 queue. Message ids for messages that no longer exist are removed from
64610 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
64611 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
64612 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
64613 whenever it removes information from the database.
64614 </para>
64615 <para>
64616 Certain records are automatically removed by Exim when they are no longer
64617 needed, but others are not. For example, if all the MX hosts for a domain are
64618 down, a retry record is created for each one. If the primary MX host comes back
64619 first, its record is removed when Exim successfully delivers to it, but the
64620 records for the others remain because Exim has not tried to use those hosts.
64621 </para>
64622 <para>
64623 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
64624 hints databases. You should do this at a quiet time of day, because it requires
64625 a database to be locked (and therefore inaccessible to Exim) while it does its
64626 work. Removing records from a DBM file does not normally make the file smaller,
64627 but all the common DBM libraries are able to re-use the space that is released.
64628 After an initial phase of increasing in size, the databases normally reach a
64629 point at which they no longer get any bigger, as long as they are regularly
64630 tidied.
64631 </para>
64632 <para>
64633 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
64634 databases is likely to keep on increasing.
64635 </para>
64636 </section>
64637 <section id="SECID263">
64638 <title>exim_fixdb</title>
64639 <para>
64640 <indexterm role="concept">
64641 <primary><emphasis>exim_fixdb</emphasis></primary>
64642 </indexterm>
64643 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
64644 Its main use is for testing Exim, but it might also be occasionally useful for
64645 getting round problems in a live system. It has no options, and its interface
64646 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
64647 key of a database record can then be entered, and the data for that record is
64648 displayed.
64649 </para>
64650 <para>
64651 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
64652 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
64653 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
64654 data for individual fields can be changed by typing the field number followed
64655 by new data, for example:
64656 </para>
64657 <literallayout class="monospaced">
64658 &gt; 4 951102:1000
64659 </literallayout>
64660 <para>
64661 resets the time of the next delivery attempt. Time values are given as a
64662 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
64663 used as optional separators.
64664 </para>
64665 </section>
64666 <section id="SECTmailboxmaint">
64667 <title>Mailbox maintenance (exim_lock)</title>
64668 <para>
64669 <indexterm role="concept">
64670 <primary>mailbox</primary>
64671 <secondary>maintenance</secondary>
64672 </indexterm>
64673 <indexterm role="concept">
64674 <primary><emphasis>exim_lock</emphasis></primary>
64675 </indexterm>
64676 <indexterm role="concept">
64677 <primary>locking mailboxes</primary>
64678 </indexterm>
64679 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
64680 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
64681 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
64682 a user agent while investigating a problem. The utility requires the name of
64683 the file as its first argument. If the locking is successful, the second
64684 argument is run as a command (using C&#x2019;s <function>system()</function> function); if there is no
64685 second argument, the value of the SHELL environment variable is used; if this
64686 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
64687 is unlocked and the utility ends. The following options are available:
64688 </para>
64689 <variablelist>
64690 <varlistentry>
64691 <term><option>-fcntl</option></term>
64692 <listitem>
64693 <para>
64694 Use <function>fcntl()</function> locking on the open mailbox.
64695 </para>
64696 </listitem></varlistentry>
64697 <varlistentry>
64698 <term><option>-flock</option></term>
64699 <listitem>
64700 <para>
64701 Use <function>flock()</function> locking on the open mailbox, provided the operating system
64702 supports it.
64703 </para>
64704 </listitem></varlistentry>
64705 <varlistentry>
64706 <term><option>-interval</option></term>
64707 <listitem>
64708 <para>
64709 This must be followed by a number, which is a number of seconds; it sets the
64710 interval to sleep between retries (default 3).
64711 </para>
64712 </listitem></varlistentry>
64713 <varlistentry>
64714 <term><option>-lockfile</option></term>
64715 <listitem>
64716 <para>
64717 Create a lock file before opening the mailbox.
64718 </para>
64719 </listitem></varlistentry>
64720 <varlistentry>
64721 <term><option>-mbx</option></term>
64722 <listitem>
64723 <para>
64724 Lock the mailbox using MBX rules.
64725 </para>
64726 </listitem></varlistentry>
64727 <varlistentry>
64728 <term><option>-q</option></term>
64729 <listitem>
64730 <para>
64731 Suppress verification output.
64732 </para>
64733 </listitem></varlistentry>
64734 <varlistentry>
64735 <term><option>-retries</option></term>
64736 <listitem>
64737 <para>
64738 This must be followed by a number; it sets the number of times to try to get
64739 the lock (default 10).
64740 </para>
64741 </listitem></varlistentry>
64742 <varlistentry>
64743 <term><option>-restore_time</option></term>
64744 <listitem>
64745 <para>
64746 This option causes <option>exim_lock</option> to restore the modified and read times to the
64747 locked file before exiting. This allows you to access a locked mailbox (for
64748 example, to take a backup copy) without disturbing the times that the user
64749 subsequently sees.
64750 </para>
64751 </listitem></varlistentry>
64752 <varlistentry>
64753 <term><option>-timeout</option></term>
64754 <listitem>
64755 <para>
64756 This must be followed by a number, which is a number of seconds; it sets a
64757 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
64758 default), a non-blocking call is used.
64759 </para>
64760 </listitem></varlistentry>
64761 <varlistentry>
64762 <term><option>-v</option></term>
64763 <listitem>
64764 <para>
64765 Generate verbose output.
64766 </para>
64767 </listitem></varlistentry>
64768 </variablelist>
64769 <para>
64770 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
64771 default is to create a lock file and also to use <function>fcntl()</function> locking on the
64772 mailbox, which is the same as Exim&#x2019;s default. The use of <option>-flock</option> or
64773 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
64774 requires that the directory containing the file be writeable. Locking by lock
64775 file does not last for ever; Exim assumes that a lock file is expired if it is
64776 more than 30 minutes old.
64777 </para>
64778 <para>
64779 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
64780 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
64781 to be taken out on the open mailbox, and an exclusive lock on the file
64782 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
64783 number of the mailbox file. When the locking is released, if an exclusive lock
64784 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
64785 </para>
64786 <para>
64787 The default output contains verification of the locking that takes place. The
64788 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
64789 suppresses all output except error messages.
64790 </para>
64791 <para>
64792 A command such as
64793 </para>
64794 <literallayout class="monospaced">
64795 exim_lock /var/spool/mail/spqr
64796 </literallayout>
64797 <para>
64798 runs an interactive shell while the file is locked, whereas
64799 </para>
64800 <literallayout>
64801 <literal>exim_lock -q /var/spool/mail/spqr &lt;&lt;End</literal>
64802 &lt;<emphasis>some commands</emphasis>&gt;
64803 <literal>End</literal>
64804 </literallayout>
64805 <para>
64806 runs a specific non-interactive sequence of commands while the file is locked,
64807 suppressing all verification output. A single command can be run by a command
64808 such as
64809 </para>
64810 <literallayout class="monospaced">
64811 exim_lock -q /var/spool/mail/spqr \
64812   "cp /var/spool/mail/spqr /some/where"
64813 </literallayout>
64814 <para>
64815 Note that if a command is supplied, it must be entirely contained within the
64816 second argument &ndash; hence the quotes.
64817 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
64818 </para>
64819 </section>
64820 </chapter>
64821
64822 <chapter id="CHAPeximon">
64823 <title>The Exim monitor</title>
64824 <para>
64825 <indexterm role="concept" id="IIDeximon" class="startofrange">
64826 <primary>Exim monitor</primary>
64827 <secondary>description</secondary>
64828 </indexterm>
64829 <indexterm role="concept">
64830 <primary>X-windows</primary>
64831 </indexterm>
64832 <indexterm role="concept">
64833 <primary><emphasis>eximon</emphasis></primary>
64834 </indexterm>
64835 <indexterm role="concept">
64836 <primary>Local/eximon.conf</primary>
64837 </indexterm>
64838 <indexterm role="concept">
64839 <primary><filename>exim_monitor/EDITME</filename></primary>
64840 </indexterm>
64841 The Exim monitor is an application which displays in an X window information
64842 about the state of Exim&#x2019;s queue and what Exim is doing. An admin user can
64843 perform certain operations on messages from this GUI interface; however all
64844 such facilities are also available from the command line, and indeed, the
64845 monitor itself makes use of the command line to perform any actions requested.
64846 </para>
64847 <section id="SECID264">
64848 <title>Running the monitor</title>
64849 <para>
64850 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
64851 script that sets up a number of environment variables, and then runs the
64852 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
64853 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
64854 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
64855 parameters are for.
64856 </para>
64857 <para>
64858 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
64859 a particular invocation by setting up environment variables of the same names,
64860 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
64861 </para>
64862 <literallayout class="monospaced">
64863 EXIMON_LOG_DEPTH=400 eximon
64864 </literallayout>
64865 <para>
64866 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
64867 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
64868 overrides the Exim log file configuration. This makes it possible to have
64869 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
64870 syslog messages are routed to a file on the local host.
64871 </para>
64872 <para>
64873 X resources can be used to change the appearance of the window in the normal
64874 way. For example, a resource setting of the form
64875 </para>
64876 <literallayout class="monospaced">
64877 Eximon*background: gray94
64878 </literallayout>
64879 <para>
64880 changes the colour of the background to light grey rather than white. The
64881 stripcharts are drawn with both the data lines and the reference lines in
64882 black. This means that the reference lines are not visible when on top of the
64883 data. However, their colour can be changed by setting a resource called
64884 <quote>highlight</quote> (an odd name, but that&#x2019;s what the Athena stripchart widget uses).
64885 For example, if your X server is running Unix, you could set up lighter
64886 reference lines in the stripcharts by obeying
64887 </para>
64888 <literallayout class="monospaced">
64889 xrdb -merge &lt;&lt;End
64890 Eximon*highlight: gray
64891 End
64892 </literallayout>
64893 <para>
64894 <indexterm role="concept">
64895 <primary>admin user</primary>
64896 </indexterm>
64897 In order to see the contents of messages on the queue, and to operate on them,
64898 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
64899 </para>
64900 <para>
64901 The command-line parameters of <emphasis>eximon</emphasis> are passed to <filename>eximon.bin</filename> and may
64902 contain X11 resource parameters interpreted by the X11 library.  In addition,
64903 if the first parameter starts with the string "gdb" then it is removed and the
64904 binary is invoked under gdb (the parameter is used as the gdb command-name, so
64905 versioned variants of gdb can be invoked).
64906 </para>
64907 <para>
64908 The monitor&#x2019;s window is divided into three parts. The first contains one or
64909 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
64910 main log file, and the third is a display of the queue of messages awaiting
64911 delivery, with two more action buttons. The following sections describe these
64912 different parts of the display.
64913 </para>
64914 </section>
64915 <section id="SECID265">
64916 <title>The stripcharts</title>
64917 <para>
64918 <indexterm role="concept">
64919 <primary>stripchart</primary>
64920 </indexterm>
64921 The first stripchart is always a count of messages on the queue. Its name can
64922 be configured by setting QUEUE_STRIPCHART_NAME in the
64923 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
64924 configuration script by regular expression matches on log file entries, making
64925 it possible to display, for example, counts of messages delivered to certain
64926 hosts or using certain transports. The supplied defaults display counts of
64927 received and delivered messages, and of local and SMTP deliveries. The default
64928 period between stripchart updates is one minute; this can be adjusted by a
64929 parameter in the <filename>Local/eximon.conf</filename> file.
64930 </para>
64931 <para>
64932 The stripchart displays rescale themselves automatically as the value they are
64933 displaying changes. There are always 10 horizontal lines in each chart; the
64934 title string indicates the value of each division when it is greater than one.
64935 For example, <quote>x2</quote> means that each division represents a value of 2.
64936 </para>
64937 <para>
64938 It is also possible to have a stripchart which shows the percentage fullness of
64939 a particular disk partition, which is useful when local deliveries are confined
64940 to a single partition.
64941 </para>
64942 <para>
64943 <indexterm role="concept">
64944 <primary><option>statvfs</option> function</primary>
64945 </indexterm>
64946 This relies on the availability of the <function>statvfs()</function> function or equivalent in
64947 the operating system. Most, but not all versions of Unix that support Exim have
64948 this. For this particular stripchart, the top of the chart always represents
64949 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
64950 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
64951 <filename>Local/eximon.conf</filename> file.
64952 </para>
64953 </section>
64954 <section id="SECID266">
64955 <title>Main action buttons</title>
64956 <para>
64957 <indexterm role="concept">
64958 <primary>size</primary>
64959 <secondary>of monitor window</secondary>
64960 </indexterm>
64961 <indexterm role="concept">
64962 <primary>Exim monitor</primary>
64963 <secondary>window size</secondary>
64964 </indexterm>
64965 <indexterm role="concept">
64966 <primary>window size</primary>
64967 </indexterm>
64968 Below the stripcharts there is an action button for quitting the monitor. Next
64969 to this is another button marked <quote>Size</quote>. They are placed here so that
64970 shrinking the window to its default minimum size leaves just the queue count
64971 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
64972 the window to expand to its maximum size, unless it is already at the maximum,
64973 in which case it is reduced to its minimum.
64974 </para>
64975 <para>
64976 When expanding to the maximum, if the window cannot be fully seen where it
64977 currently is, it is moved back to where it was the last time it was at full
64978 size. When it is expanding from its minimum size, the old position is
64979 remembered, and next time it is reduced to the minimum it is moved back there.
64980 </para>
64981 <para>
64982 The idea is that you can keep a reduced window just showing one or two
64983 stripcharts at a convenient place on your screen, easily expand it to show
64984 the full window when required, and just as easily put it back to what it was.
64985 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
64986 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
64987 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
64988 </para>
64989 <para>
64990 Normally, the monitor starts up with the window at its full size, but it can be
64991 built so that it starts up with the window at its smallest size, by setting
64992 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
64993 </para>
64994 </section>
64995 <section id="SECID267">
64996 <title>The log display</title>
64997 <para>
64998 <indexterm role="concept">
64999 <primary>log</primary>
65000 <secondary>tail of; in monitor</secondary>
65001 </indexterm>
65002 The second section of the window is an area in which a display of the tail of
65003 the main log is maintained.
65004 To save space on the screen, the timestamp on each log line is shortened by
65005 removing the date and, if <option>log_timezone</option> is set, the timezone.
65006 The log tail is not available when the only destination for logging data is
65007 syslog, unless the syslog lines are routed to a local file whose name is passed
65008 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
65009 </para>
65010 <para>
65011 The log sub-window has a scroll bar at its lefthand side which can be used to
65012 move back to look at earlier text, and the up and down arrow keys also have a
65013 scrolling effect. The amount of log that is kept depends on the setting of
65014 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
65015 to use. When this is full, the earlier 50% of data is discarded &ndash; this is
65016 much more efficient than throwing it away line by line. The sub-window also has
65017 a horizontal scroll bar for accessing the ends of long log lines. This is the
65018 only means of horizontal scrolling; the right and left arrow keys are not
65019 available. Text can be cut from this part of the window using the mouse in the
65020 normal way. The size of this subwindow is controlled by parameters in the
65021 configuration file <filename>Local/eximon.conf</filename>.
65022 </para>
65023 <para>
65024 Searches of the text in the log window can be carried out by means of the ^R
65025 and ^S keystrokes, which default to a reverse and a forward search,
65026 respectively. The search covers only the text that is displayed in the window.
65027 It cannot go further back up the log.
65028 </para>
65029 <para>
65030 The point from which the search starts is indicated by a caret marker. This is
65031 normally at the end of the text in the window, but can be positioned explicitly
65032 by pointing and clicking with the left mouse button, and is moved automatically
65033 by a successful search. If new text arrives in the window when it is scrolled
65034 back, the caret remains where it is, but if the window is not scrolled back,
65035 the caret is moved to the end of the new text.
65036 </para>
65037 <para>
65038 Pressing ^R or ^S pops up a window into which the search text can be typed.
65039 There are buttons for selecting forward or reverse searching, for carrying out
65040 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
65041 happens and the window remains so that further searches can be done. If the
65042 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
65043 ^C is typed the search is cancelled.
65044 </para>
65045 <para>
65046 The searching facility is implemented using the facilities of the Athena text
65047 widget. By default this pops up a window containing both <quote>search</quote> and
65048 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
65049 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
65050 However, the linkers in BSDI and HP-UX seem unable to handle an externally
65051 provided version of <option>TextPop</option> when the remaining parts of the text widget
65052 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
65053 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
65054 on these systems, at the expense of having unwanted items in the search popup
65055 window.
65056 </para>
65057 </section>
65058 <section id="SECID268">
65059 <title>The queue display</title>
65060 <para>
65061 <indexterm role="concept">
65062 <primary>queue</primary>
65063 <secondary>display in monitor</secondary>
65064 </indexterm>
65065 The bottom section of the monitor window contains a list of all messages that
65066 are on the queue, which includes those currently being received or delivered,
65067 as well as those awaiting delivery. The size of this subwindow is controlled by
65068 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
65069 at which it is updated is controlled by another parameter in the same file &ndash;
65070 the default is 5 minutes, since queue scans can be quite expensive. However,
65071 there is an <quote>Update</quote> action button just above the display which can be used
65072 to force an update of the queue display at any time.
65073 </para>
65074 <para>
65075 When a host is down for some time, a lot of pending mail can build up for it,
65076 and this can make it hard to deal with other messages on the queue. To help
65077 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
65078 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
65079 type anything in here and press <quote>Return</quote>, the text is added to a chain of
65080 such texts, and if every undelivered address in a message matches at least one
65081 of the texts, the message is not displayed.
65082 </para>
65083 <para>
65084 If there is an address that does not match any of the texts, all the addresses
65085 are displayed as normal. The matching happens on the ends of addresses so, for
65086 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
65087 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
65088 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
65089 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
65090 a hide request is automatically cancelled after one hour.
65091 </para>
65092 <para>
65093 While the dialogue box is displayed, you can&#x2019;t press any buttons or do anything
65094 else to the monitor window. For this reason, if you want to cut text from the
65095 queue display to use in the dialogue box, you have to do the cutting before
65096 pressing the <quote>Hide</quote> button.
65097 </para>
65098 <para>
65099 The queue display contains, for each unhidden queued message, the length of
65100 time it has been on the queue, the size of the message, the message id, the
65101 message sender, and the first undelivered recipient, all on one line. If it is
65102 a bounce message, the sender is shown as <quote>&lt;&gt;</quote>. If there is more than one
65103 recipient to which the message has not yet been delivered, subsequent ones are
65104 listed on additional lines, up to a maximum configured number, following which
65105 an ellipsis is displayed. Recipients that have already received the message are
65106 not shown.
65107 </para>
65108 <para>
65109 <indexterm role="concept">
65110 <primary>frozen messages</primary>
65111 <secondary>display</secondary>
65112 </indexterm>
65113 If a message is frozen, an asterisk is displayed at the left-hand side.
65114 </para>
65115 <para>
65116 The queue display has a vertical scroll bar, and can also be scrolled by means
65117 of the arrow keys. Text can be cut from it using the mouse in the normal way.
65118 The text searching facilities, as described above for the log window, are also
65119 available, but the caret is always moved to the end of the text when the queue
65120 display is updated.
65121 </para>
65122 </section>
65123 <section id="SECID269">
65124 <title>The queue menu</title>
65125 <para>
65126 <indexterm role="concept">
65127 <primary>queue</primary>
65128 <secondary>menu in monitor</secondary>
65129 </indexterm>
65130 If the <option>shift</option> key is held down and the left button is clicked when the mouse
65131 pointer is over the text for any message, an action menu pops up, and the first
65132 line of the queue display for the message is highlighted. This does not affect
65133 any selected text.
65134 </para>
65135 <para>
65136 If you want to use some other event for popping up the menu, you can set the
65137 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
65138 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
65139 value set in this parameter is a standard X event description. For example, to
65140 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
65141 </para>
65142 <literallayout class="monospaced">
65143 EXIMON_MENU_EVENT='Ctrl&lt;Btn1Down&gt;' eximon
65144 </literallayout>
65145 <para>
65146 The title of the menu is the message id, and it contains entries which act as
65147 follows:
65148 </para>
65149 <itemizedlist>
65150 <listitem>
65151 <para>
65152 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
65153 in a new text window.
65154 </para>
65155 </listitem>
65156 <listitem>
65157 <para>
65158 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
65159 information and headers is displayed in a new text window. See chapter
65160 <xref linkend="CHAPspool"/> for a description of the format of spool files.
65161 </para>
65162 </listitem>
65163 <listitem>
65164 <para>
65165 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
65166 displayed in a new text window. There is a default limit of 20,000 bytes to the
65167 amount of data displayed. This can be changed by setting the BODY_MAX
65168 option at compile time, or the EXIMON_BODY_MAX option at run time.
65169 </para>
65170 </listitem>
65171 <listitem>
65172 <para>
65173 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
65174 delivery of the message. This causes an automatic thaw if the message is
65175 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
65176 a new text window. The delivery is run in a separate process, to avoid holding
65177 up the monitor while the delivery proceeds.
65178 </para>
65179 </listitem>
65180 <listitem>
65181 <para>
65182 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
65183 that the message be frozen.
65184 </para>
65185 </listitem>
65186 <listitem>
65187 <para>
65188 <indexterm role="concept">
65189 <primary>thawing messages</primary>
65190 </indexterm>
65191 <indexterm role="concept">
65192 <primary>unfreezing messages</primary>
65193 </indexterm>
65194 <indexterm role="concept">
65195 <primary>frozen messages</primary>
65196 <secondary>thawing</secondary>
65197 </indexterm>
65198 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
65199 that the message be thawed.
65200 </para>
65201 </listitem>
65202 <listitem>
65203 <para>
65204 <indexterm role="concept">
65205 <primary>delivery</primary>
65206 <secondary>forcing failure</secondary>
65207 </indexterm>
65208 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
65209 that Exim gives up trying to deliver the message. A bounce message is generated
65210 for any remaining undelivered addresses.
65211 </para>
65212 </listitem>
65213 <listitem>
65214 <para>
65215 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
65216 that the message be deleted from the system without generating a bounce
65217 message.
65218 </para>
65219 </listitem>
65220 <listitem>
65221 <para>
65222 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
65223 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
65224 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
65225 Otherwise it must be entered as a fully qualified address. Pressing RETURN
65226 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
65227 additional recipient be added to the message, unless the entry box is empty, in
65228 which case no action is taken.
65229 </para>
65230 </listitem>
65231 <listitem>
65232 <para>
65233 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
65234 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
65235 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
65236 Otherwise it must be entered as a fully qualified address. Pressing RETURN
65237 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
65238 recipient address as already delivered, unless the entry box is empty, in which
65239 case no action is taken.
65240 </para>
65241 </listitem>
65242 <listitem>
65243 <para>
65244 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
65245 mark all recipient addresses as already delivered.
65246 </para>
65247 </listitem>
65248 <listitem>
65249 <para>
65250 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
65251 sender&#x2019;s address. Pressing RETURN causes a call to Exim to be made using the
65252 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
65253 in which case no action is taken. If you want to set an empty sender (as in
65254 bounce messages), you must specify it as <quote>&lt;&gt;</quote>. Otherwise, if the address is
65255 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
65256 the address is qualified with that domain.
65257 </para>
65258 </listitem>
65259 </itemizedlist>
65260 <para>
65261 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
65262 other cases when a call to Exim is made, if there is any output from Exim (in
65263 particular, if the command fails) a window containing the command and the
65264 output is displayed. Otherwise, the results of the action are normally apparent
65265 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
65266 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
65267 if no output is generated.
65268 </para>
65269 <para>
65270 The queue display is automatically updated for actions such as freezing and
65271 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
65272 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
65273 force an update of the display after one of these actions.
65274 </para>
65275 <para>
65276 In any text window that is displayed as result of a menu action, the normal
65277 cut-and-paste facility is available, and searching can be carried out using ^R
65278 and ^S, as described above for the log tail window.
65279 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
65280 </para>
65281 </section>
65282 </chapter>
65283
65284 <chapter id="CHAPsecurity">
65285 <title>Security considerations</title>
65286 <para>
65287 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
65288 <primary>security</primary>
65289 <secondary>discussion of</secondary>
65290 </indexterm>
65291 This chapter discusses a number of issues concerned with security, some of
65292 which are also covered in other parts of this manual.
65293 </para>
65294 <para>
65295 For reasons that this author does not understand, some people have promoted
65296 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
65297 existence of this chapter in the documentation. However, the intent of the
65298 chapter is simply to describe the way Exim works in relation to certain
65299 security concerns, not to make any specific claims about the effectiveness of
65300 its security as compared with other MTAs.
65301 </para>
65302 <para>
65303 What follows is a description of the way Exim is supposed to be. Best efforts
65304 have been made to try to ensure that the code agrees with the theory, but an
65305 absence of bugs can never be guaranteed. Any that are reported will get fixed
65306 as soon as possible.
65307 </para>
65308 <section id="SECID286">
65309 <title>Building a more <quote>hardened</quote> Exim</title>
65310 <para>
65311 <indexterm role="concept">
65312 <primary>security</primary>
65313 <secondary>build-time features</secondary>
65314 </indexterm>
65315 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
65316 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
65317 Exim administrator who does not have the root password, or by someone who has
65318 penetrated the Exim (but not the root) account. These options are as follows:
65319 </para>
65320 <itemizedlist>
65321 <listitem>
65322 <para>
65323 ALT_CONFIG_PREFIX can be set to a string that is required to match the
65324 start of any file names used with the <option>-C</option> option. When it is set, these file
65325 names are also not allowed to contain the sequence <quote>/../</quote>. (However, if the
65326 value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
65327 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
65328 default setting for <option>ALT_CONFIG_PREFIX</option>.
65329 </para>
65330 <para>
65331 If the permitted configuration files are confined to a directory to
65332 which only root has access, this guards against someone who has broken
65333 into the Exim account from running a privileged Exim with an arbitrary
65334 configuration file, and using it to break into other accounts.
65335 </para>
65336 </listitem>
65337 <listitem>
65338 <para>
65339 If a non-trusted configuration file (i.e. not the default configuration file
65340 or one which is trusted by virtue of being listed in the TRUSTED_CONFIG_LIST
65341 file) is specified with <option>-C</option>, or if macros are given with <option>-D</option> (but see
65342 the next item), then root privilege is retained only if the caller of Exim is
65343 root. This locks out the possibility of testing a configuration using <option>-C</option>
65344 right through message reception and delivery, even if the caller is root. The
65345 reception works, but by that time, Exim is running as the Exim user, so when
65346 it re-execs to regain privilege for the delivery, the use of <option>-C</option> causes
65347 privilege to be lost. However, root can test reception and delivery using two
65348 separate commands.
65349 </para>
65350 </listitem>
65351 <listitem>
65352 <para>
65353 The WHITELIST_D_MACROS build option declares some macros to be safe to override
65354 with <option>-D</option> if the real uid is one of root, the Exim run-time user or the
65355 CONFIGURE_OWNER, if defined.  The potential impact of this option is limited by
65356 requiring the run-time value supplied to <option>-D</option> to match a regex that errs on
65357 the restrictive side.  Requiring build-time selection of safe macros is onerous
65358 but this option is intended solely as a transition mechanism to permit
65359 previously-working configurations to continue to work after release 4.73.
65360 </para>
65361 </listitem>
65362 <listitem>
65363 <para>
65364 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
65365 is disabled.
65366 </para>
65367 </listitem>
65368 <listitem>
65369 <para>
65370 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
65371 never to be used for any deliveries. This is like the <option>never_users</option> runtime
65372 option, but it cannot be overridden; the runtime option adds additional users
65373 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
65374 is permitted to modify the runtime file from using Exim as a way to get root.
65375 </para>
65376 </listitem>
65377 </itemizedlist>
65378 </section>
65379 <section id="SECID270">
65380 <title>Root privilege</title>
65381 <para>
65382 <indexterm role="concept">
65383 <primary>setuid</primary>
65384 </indexterm>
65385 <indexterm role="concept">
65386 <primary>root privilege</primary>
65387 </indexterm>
65388 The Exim binary is normally setuid to root, which means that it gains root
65389 privilege (runs as root) when it starts execution. In some special cases (for
65390 example, when the daemon is not in use and there are no local deliveries), it
65391 may be possible to run Exim setuid to some user other than root. This is
65392 discussed in the next section. However, in most installations, root privilege
65393 is required for two things:
65394 </para>
65395 <itemizedlist>
65396 <listitem>
65397 <para>
65398 To set up a socket connected to the standard SMTP port (25) when initialising
65399 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
65400 not required.
65401 </para>
65402 </listitem>
65403 <listitem>
65404 <para>
65405 To be able to change uid and gid in order to read users&#x2019; <filename>.forward</filename> files and
65406 perform local deliveries as the receiving user or as specified in the
65407 configuration.
65408 </para>
65409 </listitem>
65410 </itemizedlist>
65411 <para>
65412 It is not necessary to be root to do any of the other things Exim does, such as
65413 receiving messages and delivering them externally over SMTP, and it is
65414 obviously more secure if Exim does not run as root except when necessary.
65415 For this reason, a user and group for Exim to use must be defined in
65416 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
65417 group</quote>. Their values can be changed by the run time configuration, though this
65418 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
65419 <emphasis>mail</emphasis> or another user name altogether.
65420 </para>
65421 <para>
65422 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
65423 abdication; the process cannot regain root afterwards. Prior to release 4.00,
65424 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
65425 </para>
65426 <para>
65427 After a new Exim process has interpreted its command line options, it changes
65428 uid and gid in the following cases:
65429 </para>
65430 <itemizedlist>
65431 <listitem>
65432 <para>
65433 <indexterm role="option">
65434 <primary><option>-C</option></primary>
65435 </indexterm>
65436 <indexterm role="option">
65437 <primary><option>-D</option></primary>
65438 </indexterm>
65439 If the <option>-C</option> option is used to specify an alternate configuration file, or if
65440 the <option>-D</option> option is used to define macro values for the configuration, and the
65441 calling process is not running as root, the uid and gid are changed to those of
65442 the calling process.
65443 However, if DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the <option>-D</option>
65444 option may not be used at all.
65445 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename>, then some macro values
65446 can be supplied if the calling process is running as root, the Exim run-time
65447 user or CONFIGURE_OWNER, if defined.
65448 </para>
65449 </listitem>
65450 <listitem>
65451 <para>
65452 <indexterm role="option">
65453 <primary><option>-be</option></primary>
65454 </indexterm>
65455 <indexterm role="option">
65456 <primary><option>-bf</option></primary>
65457 </indexterm>
65458 <indexterm role="option">
65459 <primary><option>-bF</option></primary>
65460 </indexterm>
65461 If the expansion test option (<option>-be</option>) or one of the filter testing options
65462 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
65463 calling process.
65464 </para>
65465 </listitem>
65466 <listitem>
65467 <para>
65468 If the process is not a daemon process or a queue runner process or a delivery
65469 process or a process for testing address routing (started with <option>-bt</option>), the
65470 uid and gid are changed to the Exim user and group. This means that Exim always
65471 runs under its own uid and gid when receiving messages. This also applies when
65472 testing address verification
65473 <indexterm role="option">
65474 <primary><option>-bv</option></primary>
65475 </indexterm>
65476 <indexterm role="option">
65477 <primary><option>-bh</option></primary>
65478 </indexterm>
65479 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
65480 option).
65481 </para>
65482 </listitem>
65483 <listitem>
65484 <para>
65485 For a daemon, queue runner, delivery, or address testing process, the uid
65486 remains as root at this stage, but the gid is changed to the Exim group.
65487 </para>
65488 </listitem>
65489 </itemizedlist>
65490 <para>
65491 The processes that initially retain root privilege behave as follows:
65492 </para>
65493 <itemizedlist>
65494 <listitem>
65495 <para>
65496 A daemon process changes the gid to the Exim group and the uid to the Exim
65497 user after setting up one or more listening sockets. The <function>initgroups()</function>
65498 function is called, so that if the Exim user is in any additional groups, they
65499 will be used during message reception.
65500 </para>
65501 </listitem>
65502 <listitem>
65503 <para>
65504 A queue runner process retains root privilege throughout its execution. Its
65505 job is to fork a controlled sequence of delivery processes.
65506 </para>
65507 </listitem>
65508 <listitem>
65509 <para>
65510 A delivery process retains root privilege throughout most of its execution,
65511 but any actual deliveries (that is, the transports themselves) are run in
65512 subprocesses which always change to a non-root uid and gid. For local
65513 deliveries this is typically the uid and gid of the owner of the mailbox; for
65514 remote deliveries, the Exim uid and gid are used. Once all the delivery
65515 subprocesses have been run, a delivery process changes to the Exim uid and gid
65516 while doing post-delivery tidying up such as updating the retry database and
65517 generating bounce and warning messages.
65518 </para>
65519 <para>
65520 While the recipient addresses in a message are being routed, the delivery
65521 process runs as root. However, if a user&#x2019;s filter file has to be processed,
65522 this is done in a subprocess that runs under the individual user&#x2019;s uid and
65523 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
65524 </para>
65525 </listitem>
65526 <listitem>
65527 <para>
65528 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
65529 the routing is done in the same environment as a message delivery.
65530 </para>
65531 </listitem>
65532 </itemizedlist>
65533 </section>
65534 <section id="SECTrunexiwitpri">
65535 <title>Running Exim without privilege</title>
65536 <para>
65537 <indexterm role="concept">
65538 <primary>privilege, running without</primary>
65539 </indexterm>
65540 <indexterm role="concept">
65541 <primary>unprivileged running</primary>
65542 </indexterm>
65543 <indexterm role="concept">
65544 <primary>root privilege</primary>
65545 <secondary>running without</secondary>
65546 </indexterm>
65547 Some installations like to run Exim in an unprivileged state for more of its
65548 operation, for added security. Support for this mode of operation is provided
65549 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
65550 gid are changed to the Exim user and group at the start of a delivery process
65551 (and also queue runner and address testing processes). This means that address
65552 routing is no longer run as root, and the deliveries themselves cannot change
65553 to any other uid.
65554 </para>
65555 <para>
65556 <indexterm role="concept">
65557 <primary>SIGHUP</primary>
65558 </indexterm>
65559 <indexterm role="concept">
65560 <primary>daemon</primary>
65561 <secondary>restarting</secondary>
65562 </indexterm>
65563 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
65564 that the daemon can still be started in the usual way, and it can respond
65565 correctly to SIGHUP because the re-invocation regains root privilege.
65566 </para>
65567 <para>
65568 An alternative approach is to make Exim setuid to the Exim user and also setgid
65569 to the Exim group. If you do this, the daemon must be started from a root
65570 process. (Calling Exim from a root process makes it behave in the way it does
65571 when it is setuid root.) However, the daemon cannot restart itself after a
65572 SIGHUP signal because it cannot regain privilege.
65573 </para>
65574 <para>
65575 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
65576 stops Exim from trying to re-invoke itself to do a delivery after a message has
65577 been received. Such a re-invocation is a waste of resources because it has no
65578 effect.
65579 </para>
65580 <para>
65581 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
65582 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
65583 to the Exim user seems a clean approach, but there is one complication:
65584 </para>
65585 <para>
65586 In this style of operation, Exim is running with the real uid and gid set to
65587 those of the calling process, and the effective uid/gid set to Exim&#x2019;s values.
65588 Ideally, any association with the calling process&#x2019; uid/gid should be dropped,
65589 that is, the real uid/gid should be reset to the effective values so as to
65590 discard any privileges that the caller may have. While some operating systems
65591 have a function that permits this action for a non-root effective uid, quite a
65592 number of them do not. Because of this lack of standardization, Exim does not
65593 address this problem at this time.
65594 </para>
65595 <para>
65596 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
65597 is to keep the Exim binary setuid to root, and to set
65598 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
65599 be used in the most straightforward way.
65600 </para>
65601 <para>
65602 If you configure Exim not to run delivery processes as root, there are a
65603 number of restrictions on what you can do:
65604 </para>
65605 <itemizedlist>
65606 <listitem>
65607 <para>
65608 You can deliver only as the Exim user/group. You should  explicitly use the
65609 <option>user</option> and <option>group</option> options to override routers or local transports that
65610 normally deliver as the recipient. This makes sure that configurations that
65611 work in this mode function the same way in normal mode. Any implicit or
65612 explicit specification of another user causes an error.
65613 </para>
65614 </listitem>
65615 <listitem>
65616 <para>
65617 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
65618 not worthwhile to include them in the configuration.
65619 </para>
65620 </listitem>
65621 <listitem>
65622 <para>
65623 Users who wish to use <filename>.forward</filename> would have to make their home directory and
65624 the file itself accessible to the Exim user. Pipe and append-to-file entries,
65625 and their equivalents in Exim filters, cannot be used. While they could be
65626 enabled in the Exim user&#x2019;s name, that would be insecure and not very useful.
65627 </para>
65628 </listitem>
65629 <listitem>
65630 <para>
65631 Unless the local user mailboxes are all owned by the Exim user (possible in
65632 some POP3 or IMAP-only environments):
65633 </para>
65634 <orderedlist numeration="arabic">
65635 <listitem>
65636 <para>
65637 They must be owned by the Exim group and be writeable by that group. This
65638 implies you must set <option>mode</option> in the appendfile configuration, as well as the
65639 mode of the mailbox files themselves.
65640 </para>
65641 </listitem>
65642 <listitem>
65643 <para>
65644 You must set <option>no_check_owner</option>, since most or all of the files will not be
65645 owned by the Exim user.
65646 </para>
65647 </listitem>
65648 <listitem>
65649 <para>
65650 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
65651 on a newly created mailbox when unprivileged. This also implies that new
65652 mailboxes need to be created manually.
65653 </para>
65654 </listitem>
65655 </orderedlist>
65656 </listitem>
65657 </itemizedlist>
65658 <para>
65659 These restrictions severely restrict what can be done in local deliveries.
65660 However, there are no restrictions on remote deliveries. If you are running a
65661 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
65662 gives more security at essentially no cost.
65663 </para>
65664 <para>
65665 If you are using the <option>mua_wrapper</option> facility (see chapter
65666 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
65667 </para>
65668 </section>
65669 <section id="SECID271">
65670 <title>Delivering to local files</title>
65671 <para>
65672 Full details of the checks applied by <command>appendfile</command> before it writes to a file
65673 are given in chapter <xref linkend="CHAPappendfile"/>.
65674 </para>
65675 </section>
65676 <section id="SECTsecconslocalcmds">
65677 <title>Running local commands</title>
65678 <para>
65679 <indexterm role="concept">
65680 <primary>security</primary>
65681 <secondary>local commands</secondary>
65682 </indexterm>
65683 <indexterm role="concept">
65684 <primary>security</primary>
65685 <secondary>command injection attacks</secondary>
65686 </indexterm>
65687 There are a number of ways in which an administrator can configure Exim to run
65688 commands based upon received, untrustworthy, data. Further, in some
65689 configurations a user who can control a <filename>.forward</filename> file can also arrange to
65690 run commands. Configuration to check includes, but is not limited to:
65691 </para>
65692 <itemizedlist>
65693 <listitem>
65694 <para>
65695 Use of <option>use_shell</option> in the pipe transport: various forms of shell command
65696 injection may be possible with this option present. It is dangerous and should
65697 be used only with considerable caution. Consider constraints which whitelist
65698 allowed characters in a variable which is to be used in a pipe transport that
65699 has <option>use_shell</option> enabled.
65700 </para>
65701 </listitem>
65702 <listitem>
65703 <para>
65704 A number of options such as <option>forbid_filter_run</option>, <option>forbid_filter_perl</option>,
65705 <option>forbid_filter_dlfunc</option> and so forth which restrict facilities available to
65706 <filename>.forward</filename> files in a redirect router. If Exim is running on a central mail
65707 hub to which ordinary users do not have shell access, but home directories are
65708 NFS mounted (for instance) then administrators should review the list of these
65709 forbid options available, and should bear in mind that the options that may
65710 need forbidding can change as new features are added between releases.
65711 </para>
65712 </listitem>
65713 <listitem>
65714 <para>
65715 The <option>${run...}</option> expansion item does not use a shell by default, but
65716 administrators can configure use of <filename>/bin/sh</filename> as part of the command.
65717 Such invocations should be viewed with prejudicial suspicion.
65718 </para>
65719 </listitem>
65720 <listitem>
65721 <para>
65722 Administrators who use embedded Perl are advised to explore how Perl&#x2019;s
65723 taint checking might apply to their usage.
65724 </para>
65725 </listitem>
65726 <listitem>
65727 <para>
65728 Use of <option>${expand...}</option> is somewhat analagous to shell&#x2019;s eval builtin and
65729 administrators are well advised to view its use with suspicion, in case (for
65730 instance) it allows a local-part to contain embedded Exim directives.
65731 </para>
65732 </listitem>
65733 <listitem>
65734 <para>
65735 Use of <option>${match_local_part...}</option> and friends becomes more dangerous if
65736 Exim was built with EXPAND_LISTMATCH_RHS defined: the second string in
65737 each can reference arbitrary lists and files, rather than just being a list
65738 of opaque strings.
65739 The EXPAND_LISTMATCH_RHS option was added and set false by default because of
65740 real-world security vulnerabilities caused by its use with untrustworthy data
65741 injected in, for SQL injection attacks.
65742 Consider the use of the <option>inlisti</option> expansion condition instead.
65743 </para>
65744 </listitem>
65745 </itemizedlist>
65746 </section>
65747 <section id="SECTsecconfdata">
65748 <title>Trust in configuration data</title>
65749 <para>
65750 <indexterm role="concept">
65751 <primary>security</primary>
65752 <secondary>data sources</secondary>
65753 </indexterm>
65754 <indexterm role="concept">
65755 <primary>security</primary>
65756 <secondary>regular expressions</secondary>
65757 </indexterm>
65758 <indexterm role="concept">
65759 <primary>regular expressions</primary>
65760 <secondary>security</secondary>
65761 </indexterm>
65762 <indexterm role="concept">
65763 <primary>PCRE</primary>
65764 <secondary>security</secondary>
65765 </indexterm>
65766 If configuration data for Exim can come from untrustworthy sources, there
65767 are some issues to be aware of:
65768 </para>
65769 <itemizedlist>
65770 <listitem>
65771 <para>
65772 Use of <option>${expand...}</option> may provide a path for shell injection attacks.
65773 </para>
65774 </listitem>
65775 <listitem>
65776 <para>
65777 Letting untrusted data provide a regular expression is unwise.
65778 </para>
65779 </listitem>
65780 <listitem>
65781 <para>
65782 Using <option>${match...}</option> to apply a fixed regular expression against untrusted
65783 data may result in pathological behaviour within PCRE.  Be aware of what
65784 "backtracking" means and consider options for being more strict with a regular
65785 expression. Avenues to explore include limiting what can match (avoiding <literal>.</literal>
65786 when <literal>[a-z0-9]</literal> or other character class will do), use of atomic grouping and
65787 possessive quantifiers or just not using regular expressions against untrusted
65788 data.
65789 </para>
65790 </listitem>
65791 <listitem>
65792 <para>
65793 It can be important to correctly use <option>${quote:...}</option>,
65794 <option>${quote_local_part:...}</option> and <option>${quote_</option>&lt;<emphasis>lookup-type</emphasis>&gt;<option>:...}</option> expansion
65795 items to ensure that data is correctly constructed.
65796 </para>
65797 </listitem>
65798 <listitem>
65799 <para>
65800 Some lookups might return multiple results, even though normal usage is only
65801 expected to yield one result.
65802 </para>
65803 </listitem>
65804 </itemizedlist>
65805 </section>
65806 <section id="SECID272">
65807 <title>IPv4 source routing</title>
65808 <para>
65809 <indexterm role="concept">
65810 <primary>source routing</primary>
65811 <secondary>in IP packets</secondary>
65812 </indexterm>
65813 <indexterm role="concept">
65814 <primary>IP source routing</primary>
65815 </indexterm>
65816 Many operating systems suppress IP source-routed packets in the kernel, but
65817 some cannot be made to do this, so Exim does its own check. It logs incoming
65818 IPv4 source-routed TCP calls, and then drops them. Things are all different in
65819 IPv6. No special checking is currently done.
65820 </para>
65821 </section>
65822 <section id="SECID273">
65823 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
65824 <para>
65825 Support for these SMTP commands is disabled by default. If required, they can
65826 be enabled by defining suitable ACLs.
65827 </para>
65828 </section>
65829 <section id="SECID274">
65830 <title>Privileged users</title>
65831 <para>
65832 <indexterm role="concept">
65833 <primary>trusted users</primary>
65834 </indexterm>
65835 <indexterm role="concept">
65836 <primary>admin user</primary>
65837 </indexterm>
65838 <indexterm role="concept">
65839 <primary>privileged user</primary>
65840 </indexterm>
65841 <indexterm role="concept">
65842 <primary>user</primary>
65843 <secondary>trusted</secondary>
65844 </indexterm>
65845 <indexterm role="concept">
65846 <primary>user</primary>
65847 <secondary>admin</secondary>
65848 </indexterm>
65849 Exim recognizes two sets of users with special privileges. Trusted users are
65850 able to submit new messages to Exim locally, but supply their own sender
65851 addresses and information about a sending host. For other users submitting
65852 local messages, Exim sets up the sender address from the uid, and doesn&#x2019;t
65853 permit a remote host to be specified.
65854 </para>
65855 <para>
65856 <indexterm role="option">
65857 <primary><option>-f</option></primary>
65858 </indexterm>
65859 However, an untrusted user is permitted to use the <option>-f</option> command line option
65860 in the special form <option>-f &lt;&gt;</option> to indicate that a delivery failure for the
65861 message should not cause an error report. This affects the message&#x2019;s envelope,
65862 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
65863 permitted to use specific forms of address with the <option>-f</option> option by setting
65864 the <option>untrusted_set_sender</option> option.
65865 </para>
65866 <para>
65867 Trusted users are used to run processes that receive mail messages from some
65868 other mail domain and pass them on to Exim for delivery either locally, or over
65869 the Internet. Exim trusts a caller that is running as root, as the Exim user,
65870 as any user listed in the <option>trusted_users</option> configuration option, or under any
65871 group listed in the <option>trusted_groups</option> option.
65872 </para>
65873 <para>
65874 Admin users are permitted to do things to the messages on Exim&#x2019;s queue. They
65875 can freeze or thaw messages, cause them to be returned to their senders, remove
65876 them entirely, or modify them in various ways. In addition, admin users can run
65877 the Exim monitor and see all the information it is capable of providing, which
65878 includes the contents of files on the spool.
65879 </para>
65880 <para>
65881 <indexterm role="option">
65882 <primary><option>-M</option></primary>
65883 </indexterm>
65884 <indexterm role="option">
65885 <primary><option>-q</option></primary>
65886 </indexterm>
65887 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
65888 delivery of messages on its queue is restricted to admin users. This
65889 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
65890 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
65891 queue is also restricted to admin users. This restriction can be relaxed by
65892 setting <option>no_queue_list_requires_admin</option>.
65893 </para>
65894 <para>
65895 Exim recognizes an admin user if the calling process is running as root or as
65896 the Exim user or if any of the groups associated with the calling process is
65897 the Exim group. It is not necessary actually to be running under the Exim
65898 group. However, if admin users who are not root or the Exim user are to access
65899 the contents of files on the spool via the Exim monitor (which runs
65900 unprivileged), Exim must be built to allow group read access to its spool
65901 files.
65902 </para>
65903 </section>
65904 <section id="SECID275">
65905 <title>Spool files</title>
65906 <para>
65907 <indexterm role="concept">
65908 <primary>spool directory</primary>
65909 <secondary>files</secondary>
65910 </indexterm>
65911 Exim&#x2019;s spool directory and everything it contains is owned by the Exim user and
65912 set to the Exim group. The mode for spool files is defined in the
65913 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
65914 any user who is a member of the Exim group can access these files.
65915 </para>
65916 </section>
65917 <section id="SECID276">
65918 <title>Use of argv[0]</title>
65919 <para>
65920 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
65921 of specific strings, Exim assumes certain options. For example, calling Exim
65922 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
65923 to calling it with the option <option>-bS</option>. There are no security implications in
65924 this.
65925 </para>
65926 </section>
65927 <section id="SECID277">
65928 <title>Use of %f formatting</title>
65929 <para>
65930 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
65931 are actually stored in integer variables as 1000 times the load average.
65932 Consequently, their range is limited and so therefore is the length of the
65933 converted output.
65934 </para>
65935 </section>
65936 <section id="SECID278">
65937 <title>Embedded Exim path</title>
65938 <para>
65939 Exim uses its own path name, which is embedded in the code, only when it needs
65940 to re-exec in order to regain root privilege. Therefore, it is not root when it
65941 does so. If some bug allowed the path to get overwritten, it would lead to an
65942 arbitrary program&#x2019;s being run as exim, not as root.
65943 </para>
65944 </section>
65945 <section id="SECTdynmoddir">
65946 <title>Dynamic module directory</title>
65947 <para>
65948 Any dynamically loadable modules must be installed into the directory
65949 defined in <literal>LOOKUP_MODULE_DIR</literal> in <filename>Local/Makefile</filename> for Exim to permit
65950 loading it.
65951 </para>
65952 </section>
65953 <section id="SECID279">
65954 <title>Use of sprintf()</title>
65955 <para>
65956 <indexterm role="concept">
65957 <primary><function>sprintf()</function></primary>
65958 </indexterm>
65959 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
65960 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc&#x2019;d store.
65961 The intermediate formatting is done into a large fixed buffer by a function
65962 that runs through the format string itself, and checks the length of each
65963 conversion before performing it, thus preventing buffer overruns.
65964 </para>
65965 <para>
65966 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
65967 the output buffer is known to be sufficiently long to contain the converted
65968 string.
65969 </para>
65970 </section>
65971 <section id="SECID280">
65972 <title>Use of debug_printf() and log_write()</title>
65973 <para>
65974 Arbitrary strings are passed to both these functions, but they do their
65975 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
65976 the format string itself, and checks the length of each conversion.
65977 </para>
65978 </section>
65979 <section id="SECID281">
65980 <title>Use of strcat() and strcpy()</title>
65981 <para>
65982 These are used only in cases where the output buffer is known to be large
65983 enough to hold the result.
65984 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
65985 </para>
65986 </section>
65987 </chapter>
65988
65989 <chapter id="CHAPspool">
65990 <title>Format of spool files</title>
65991 <para>
65992 <indexterm role="concept" id="IIDforspo1" class="startofrange">
65993 <primary>format</primary>
65994 <secondary>spool files</secondary>
65995 </indexterm>
65996 <indexterm role="concept" id="IIDforspo2" class="startofrange">
65997 <primary>spool directory</primary>
65998 <secondary>format of files</secondary>
65999 </indexterm>
66000 <indexterm role="concept" id="IIDforspo3" class="startofrange">
66001 <primary>spool files</primary>
66002 <secondary>format of</secondary>
66003 </indexterm>
66004 <indexterm role="concept">
66005 <primary>spool files</primary>
66006 <secondary>editing</secondary>
66007 </indexterm>
66008 A message on Exim&#x2019;s queue consists of two files, whose names are the message id
66009 followed by -D and -H, respectively. The data portion of the message is kept in
66010 the -D file on its own. The message&#x2019;s envelope, status, and headers are all
66011 kept in the -H file, whose format is described in this chapter. Each of these
66012 two files contains the final component of its own name as its first line. This
66013 is insurance against disk crashes where the directory is lost but the files
66014 themselves are recoverable.
66015 </para>
66016 <para>
66017 Some people are tempted into editing -D files in order to modify messages. You
66018 need to be extremely careful if you do this; it is not recommended and you are
66019 on your own if you do it. Here are some of the pitfalls:
66020 </para>
66021 <itemizedlist>
66022 <listitem>
66023 <para>
66024 You must ensure that Exim does not try to deliver the message while you are
66025 fiddling with it. The safest way is to take out a write lock on the -D file,
66026 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
66027 place, the lock will be retained. If you write a new file and rename it, the
66028 lock will be lost at the instant of rename.
66029 </para>
66030 </listitem>
66031 <listitem>
66032 <para>
66033 <indexterm role="variable">
66034 <primary><varname>$body_linecount</varname></primary>
66035 </indexterm>
66036 If you change the number of lines in the file, the value of
66037 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect. At
66038 present, this value is not used by Exim, but there is no guarantee that this
66039 will always be the case.
66040 </para>
66041 </listitem>
66042 <listitem>
66043 <para>
66044 If the message is in MIME format, you must take care not to break it.
66045 </para>
66046 </listitem>
66047 <listitem>
66048 <para>
66049 If the message is cryptographically signed, any change will invalidate the
66050 signature.
66051 </para>
66052 </listitem>
66053 </itemizedlist>
66054 <para>
66055 All in all, modifying -D files is fraught with danger.
66056 </para>
66057 <para>
66058 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
66059 its subdirectories when <option>split_spool_directory</option> is set). These are journal
66060 files, used to record addresses to which the message has been delivered during
66061 the course of a delivery attempt. If there are still undelivered recipients at
66062 the end, the -H file is updated, and the -J file is deleted. If, however, there
66063 is some kind of crash (for example, a power outage) before this happens, the -J
66064 file remains in existence. When Exim next processes the message, it notices the
66065 -J file and uses it to update the -H file before starting the next delivery
66066 attempt.
66067 </para>
66068 <section id="SECID282">
66069 <title>Format of the -H file</title>
66070 <para>
66071 <indexterm role="concept">
66072 <primary>uid (user id)</primary>
66073 <secondary>in spool file</secondary>
66074 </indexterm>
66075 <indexterm role="concept">
66076 <primary>gid (group id)</primary>
66077 <secondary>in spool file</secondary>
66078 </indexterm>
66079 The second line of the -H file contains the login name for the uid of the
66080 process that called Exim to read the message, followed by the numerical uid and
66081 gid. For a locally generated message, this is normally the user who sent the
66082 message. For a message received over TCP/IP via the daemon, it is
66083 normally the Exim user.
66084 </para>
66085 <para>
66086 The third line of the file contains the address of the message&#x2019;s sender as
66087 transmitted in the envelope, contained in angle brackets. The sender address is
66088 empty for bounce messages. For incoming SMTP mail, the sender address is given
66089 in the MAIL command. For locally generated mail, the sender address is
66090 created by Exim from the login name of the current user and the configured
66091 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
66092 leading <quote>From&nbsp;</quote> line if the caller is trusted, or if the supplied address is
66093 <quote>&lt;&gt;</quote> or an address that matches <option>untrusted_set_senders</option>.
66094 </para>
66095 <para>
66096 The fourth line contains two numbers. The first is the time that the message
66097 was received, in the conventional Unix form &ndash; the number of seconds since the
66098 start of the epoch. The second number is a count of the number of messages
66099 warning of delayed delivery that have been sent to the sender.
66100 </para>
66101 <para>
66102 There follow a number of lines starting with a hyphen. These can appear in any
66103 order, and are omitted when not relevant:
66104 </para>
66105 <variablelist>
66106 <varlistentry>
66107 <term><option>-acl</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
66108 <listitem>
66109 <para>
66110 This item is obsolete, and is not generated from Exim release 4.61 onwards;
66111 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
66112 recognized, to provide backward compatibility. In the old format, a line of
66113 this form is present for every ACL variable that is not empty. The number
66114 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0&ndash;9 and
66115 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10&ndash;19. The length is the length of
66116 the data string for the variable. The string itself starts at the beginning of
66117 the next line, and is followed by a newline character. It may contain internal
66118 newlines.
66119 </para>
66120 </listitem></varlistentry>
66121 <varlistentry>
66122 <term><option>-aclc</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
66123 <listitem>
66124 <para>
66125 A line of this form is present for every ACL connection variable that is
66126 defined. Note that there is a space between <option>-aclc</option> and the rest of the name.
66127 The length is the length of the data string for the variable. The string itself
66128 starts at the beginning of the next line, and is followed by a newline
66129 character. It may contain internal newlines.
66130 </para>
66131 </listitem></varlistentry>
66132 <varlistentry>
66133 <term><option>-aclm</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
66134 <listitem>
66135 <para>
66136 A line of this form is present for every ACL message variable that is defined.
66137 Note that there is a space between <option>-aclm</option> and the rest of the name. The
66138 length is the length of the data string for the variable. The string itself
66139 starts at the beginning of the next line, and is followed by a newline
66140 character. It may contain internal newlines.
66141 </para>
66142 </listitem></varlistentry>
66143 <varlistentry>
66144 <term><option>-active_hostname</option>&nbsp;&lt;<emphasis>hostname</emphasis>&gt;</term>
66145 <listitem>
66146 <para>
66147 This is present if, when the message was received over SMTP, the value of
66148 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
66149 </para>
66150 </listitem></varlistentry>
66151 <varlistentry>
66152 <term><option>-allow_unqualified_recipient</option></term>
66153 <listitem>
66154 <para>
66155 This is present if unqualified recipient addresses are permitted in header
66156 lines (to stop such addresses from being qualified if rewriting occurs at
66157 transport time). Local messages that were input using <option>-bnq</option> and remote
66158 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
66159 </para>
66160 </listitem></varlistentry>
66161 <varlistentry>
66162 <term><option>-allow_unqualified_sender</option></term>
66163 <listitem>
66164 <para>
66165 This is present if unqualified sender addresses are permitted in header lines
66166 (to stop such addresses from being qualified if rewriting occurs at transport
66167 time). Local messages that were input using <option>-bnq</option> and remote messages from
66168 hosts that match <option>sender_unqualified_hosts</option> set this flag.
66169 </para>
66170 </listitem></varlistentry>
66171 <varlistentry>
66172 <term><option>-auth_id</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
66173 <listitem>
66174 <para>
66175 The id information for a message received on an authenticated SMTP connection
66176 &ndash; the value of the <varname>$authenticated_id</varname> variable.
66177 </para>
66178 </listitem></varlistentry>
66179 <varlistentry>
66180 <term><option>-auth_sender</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
66181 <listitem>
66182 <para>
66183 The address of an authenticated sender &ndash; the value of the
66184 <varname>$authenticated_sender</varname> variable.
66185 </para>
66186 </listitem></varlistentry>
66187 <varlistentry>
66188 <term><option>-body_linecount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
66189 <listitem>
66190 <para>
66191 This records the number of lines in the body of the message, and is always
66192 present.
66193 </para>
66194 </listitem></varlistentry>
66195 <varlistentry>
66196 <term><option>-body_zerocount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
66197 <listitem>
66198 <para>
66199 This records the number of binary zero bytes in the body of the message, and is
66200 present if the number is greater than zero.
66201 </para>
66202 </listitem></varlistentry>
66203 <varlistentry>
66204 <term><option>-deliver_firsttime</option></term>
66205 <listitem>
66206 <para>
66207 This is written when a new message is first added to the spool. When the spool
66208 file is updated after a deferral, it is omitted.
66209 </para>
66210 </listitem></varlistentry>
66211 <varlistentry>
66212 <term><option>-frozen</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
66213 <listitem>
66214 <para>
66215 <indexterm role="concept">
66216 <primary>frozen messages</primary>
66217 <secondary>spool data</secondary>
66218 </indexterm>
66219 The message is frozen, and the freezing happened at &lt;<emphasis>time</emphasis>&gt;.
66220 </para>
66221 </listitem></varlistentry>
66222 <varlistentry>
66223 <term><option>-helo_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
66224 <listitem>
66225 <para>
66226 This records the host name as specified by a remote host in a HELO or EHLO
66227 command.
66228 </para>
66229 </listitem></varlistentry>
66230 <varlistentry>
66231 <term><option>-host_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
66232 <listitem>
66233 <para>
66234 This records the IP address of the host from which the message was received and
66235 the remote port number that was used. It is omitted for locally generated
66236 messages.
66237 </para>
66238 </listitem></varlistentry>
66239 <varlistentry>
66240 <term><option>-host_auth</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
66241 <listitem>
66242 <para>
66243 If the message was received on an authenticated SMTP connection, this records
66244 the name of the authenticator &ndash; the value of the
66245 <varname>$sender_host_authenticated</varname> variable.
66246 </para>
66247 </listitem></varlistentry>
66248 <varlistentry>
66249 <term><option>-host_lookup_failed</option></term>
66250 <listitem>
66251 <para>
66252 This is present if an attempt to look up the sending host&#x2019;s name from its IP
66253 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
66254 </para>
66255 </listitem></varlistentry>
66256 <varlistentry>
66257 <term><option>-host_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
66258 <listitem>
66259 <para>
66260 <indexterm role="concept">
66261 <primary>reverse DNS lookup</primary>
66262 </indexterm>
66263 <indexterm role="concept">
66264 <primary>DNS</primary>
66265 <secondary>reverse lookup</secondary>
66266 </indexterm>
66267 This records the name of the remote host from which the message was received,
66268 if the host name was looked up from the IP address when the message was being
66269 received. It is not present if no reverse lookup was done.
66270 </para>
66271 </listitem></varlistentry>
66272 <varlistentry>
66273 <term><option>-ident</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
66274 <listitem>
66275 <para>
66276 For locally submitted messages, this records the login of the originating user,
66277 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
66278 ident value. For messages received over TCP/IP, this records the ident string
66279 supplied by the remote host, if any.
66280 </para>
66281 </listitem></varlistentry>
66282 <varlistentry>
66283 <term><option>-interface_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
66284 <listitem>
66285 <para>
66286 This records the IP address of the local interface and the port number through
66287 which a message was received from a remote host. It is omitted for locally
66288 generated messages.
66289 </para>
66290 </listitem></varlistentry>
66291 <varlistentry>
66292 <term><option>-local</option></term>
66293 <listitem>
66294 <para>
66295 The message is from a local sender.
66296 </para>
66297 </listitem></varlistentry>
66298 <varlistentry>
66299 <term><option>-localerror</option></term>
66300 <listitem>
66301 <para>
66302 The message is a locally-generated bounce message.
66303 </para>
66304 </listitem></varlistentry>
66305 <varlistentry>
66306 <term><option>-local_scan</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
66307 <listitem>
66308 <para>
66309 This records the data string that was returned by the <function>local_scan()</function> function
66310 when the message was received &ndash; the value of the <varname>$local_scan_data</varname>
66311 variable. It is omitted if no data was returned.
66312 </para>
66313 </listitem></varlistentry>
66314 <varlistentry>
66315 <term><option>-manual_thaw</option></term>
66316 <listitem>
66317 <para>
66318 The message was frozen but has been thawed manually, that is, by an explicit
66319 Exim command rather than via the auto-thaw process.
66320 </para>
66321 </listitem></varlistentry>
66322 <varlistentry>
66323 <term><option>-N</option></term>
66324 <listitem>
66325 <para>
66326 A testing delivery process was started using the <option>-N</option> option to suppress any
66327 actual deliveries, but delivery was deferred. At any further delivery attempts,
66328 <option>-N</option> is assumed.
66329 </para>
66330 </listitem></varlistentry>
66331 <varlistentry>
66332 <term><option>-received_protocol</option></term>
66333 <listitem>
66334 <para>
66335 This records the value of the <varname>$received_protocol</varname> variable, which contains
66336 the name of the protocol by which the message was received.
66337 </para>
66338 </listitem></varlistentry>
66339 <varlistentry>
66340 <term><option>-sender_set_untrusted</option></term>
66341 <listitem>
66342 <para>
66343 The envelope sender of this message was set by an untrusted local caller (used
66344 to ensure that the caller is displayed in queue listings).
66345 </para>
66346 </listitem></varlistentry>
66347 <varlistentry>
66348 <term><option>-spam_score_int</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
66349 <listitem>
66350 <para>
66351 If a message was scanned by SpamAssassin, this is present. It records the value
66352 of <varname>$spam_score_int</varname>.
66353 </para>
66354 </listitem></varlistentry>
66355 <varlistentry>
66356 <term><option>-tls_certificate_verified</option></term>
66357 <listitem>
66358 <para>
66359 A TLS certificate was received from the client that sent this message, and the
66360 certificate was verified by the server.
66361 </para>
66362 </listitem></varlistentry>
66363 <varlistentry>
66364 <term><option>-tls_cipher</option>&nbsp;&lt;<emphasis>cipher name</emphasis>&gt;</term>
66365 <listitem>
66366 <para>
66367 When the message was received over an encrypted connection, this records the
66368 name of the cipher suite that was used.
66369 </para>
66370 </listitem></varlistentry>
66371 <varlistentry>
66372 <term><option>-tls_peerdn</option>&nbsp;&lt;<emphasis>peer DN</emphasis>&gt;</term>
66373 <listitem>
66374 <para>
66375 When the message was received over an encrypted connection, and a certificate
66376 was received from the client, this records the Distinguished Name from that
66377 certificate.
66378 </para>
66379 </listitem></varlistentry>
66380 </variablelist>
66381 <para>
66382 Following the options there is a list of those addresses to which the message
66383 is not to be delivered. This set of addresses is initialized from the command
66384 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
66385 is set; otherwise it starts out empty. Whenever a successful delivery is made,
66386 the address is added to this set. The addresses are kept internally as a
66387 balanced binary tree, and it is a representation of that tree which is written
66388 to the spool file. If an address is expanded via an alias or forward file, the
66389 original address is added to the tree when deliveries to all its child
66390 addresses are complete.
66391 </para>
66392 <para>
66393 If the tree is empty, there is a single line in the spool file containing just
66394 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
66395 Y or N, followed by an address. The address is the value for the node of the
66396 tree, and the letters indicate whether the node has a left branch and/or a
66397 right branch attached to it, respectively. If branches exist, they immediately
66398 follow. Here is an example of a three-node tree:
66399 </para>
66400 <literallayout class="monospaced">
66401 YY darcy@austen.fict.example
66402 NN alice@wonderland.fict.example
66403 NN editor@thesaurus.ref.example
66404 </literallayout>
66405 <para>
66406 After the non-recipients tree, there is a list of the message&#x2019;s recipients.
66407 This is a simple list, preceded by a count. It includes all the original
66408 recipients of the message, including those to whom the message has already been
66409 delivered. In the simplest case, the list contains one address per line. For
66410 example:
66411 </para>
66412 <literallayout class="monospaced">
66413 4
66414 editor@thesaurus.ref.example
66415 darcy@austen.fict.example
66416 rdo@foundation
66417 alice@wonderland.fict.example
66418 </literallayout>
66419 <para>
66420 However, when a child address has been added to the top-level addresses as a
66421 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
66422 line is of the following form:
66423 </para>
66424 <literallayout>
66425 &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;
66426 </literallayout>
66427 <para>
66428 The 01 flag bit indicates the presence of the three other fields that follow
66429 the top-level address. Other bits may be used in future to support additional
66430 fields. The &lt;<emphasis>parent number</emphasis>&gt; is the offset in the recipients list of the
66431 original parent of the <quote>one time</quote> address. The first two fields are the
66432 envelope sender that is associated with this address and its length. If the
66433 length is zero, there is no special envelope sender (there are then two space
66434 characters in the line). A non-empty field can arise from a <command>redirect</command> router
66435 that has an <option>errors_to</option> setting.
66436 </para>
66437 <para>
66438 A blank line separates the envelope and status information from the headers
66439 which follow. A header may occupy several lines of the file, and to save effort
66440 when reading it in, each header is preceded by a number and an identifying
66441 character. The number is the number of characters in the header, including any
66442 embedded newlines and the terminating newline. The character is one of the
66443 following:
66444 </para>
66445 <informaltable frame="none">
66446 <tgroup cols="2" colsep="0" rowsep="0">
66447 <colspec colwidth="50pt" align="left"/>
66448 <colspec colwidth="254pt" align="left"/>
66449 <tbody>
66450 <row>
66451 <entry>&lt;<emphasis>blank</emphasis>&gt;</entry>
66452 <entry>header in which Exim has no special interest</entry>
66453 </row>
66454 <row>
66455 <entry><literal>B</literal></entry>
66456 <entry><emphasis>Bcc:</emphasis> header</entry>
66457 </row>
66458 <row>
66459 <entry><literal>C</literal></entry>
66460 <entry><emphasis>Cc:</emphasis> header</entry>
66461 </row>
66462 <row>
66463 <entry><literal>F</literal></entry>
66464 <entry><emphasis>From:</emphasis> header</entry>
66465 </row>
66466 <row>
66467 <entry><literal>I</literal></entry>
66468 <entry><emphasis>Message-id:</emphasis> header</entry>
66469 </row>
66470 <row>
66471 <entry><literal>P</literal></entry>
66472 <entry><emphasis>Received:</emphasis> header &ndash; P for <quote>postmark</quote></entry>
66473 </row>
66474 <row>
66475 <entry><literal>R</literal></entry>
66476 <entry><emphasis>Reply-To:</emphasis> header</entry>
66477 </row>
66478 <row>
66479 <entry><literal>S</literal></entry>
66480 <entry><emphasis>Sender:</emphasis> header</entry>
66481 </row>
66482 <row>
66483 <entry><literal>T</literal></entry>
66484 <entry><emphasis>To:</emphasis> header</entry>
66485 </row>
66486 <row>
66487 <entry><literal>*</literal></entry>
66488 <entry>replaced or deleted header</entry>
66489 </row>
66490 </tbody>
66491 </tgroup>
66492 </informaltable>
66493 <para>
66494 Deleted or replaced (rewritten) headers remain in the spool file for debugging
66495 purposes. They are not transmitted when the message is delivered. Here is a
66496 typical set of headers:
66497 </para>
66498 <literallayout class="monospaced">
66499 111P Received: by hobbit.fict.example with local (Exim 4.00)
66500 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
66501 049  Message-Id: &lt;E14y9EI-00026G-00@hobbit.fict.example&gt;
66502 038* X-rewrote-sender: bb@hobbit.fict.example
66503 042* From: Bilbo Baggins &lt;bb@hobbit.fict.example&gt;
66504 049F From: Bilbo Baggins &lt;B.Baggins@hobbit.fict.example&gt;
66505 099* To: alice@wonderland.fict.example, rdo@foundation,
66506 darcy@austen.fict.example, editor@thesaurus.ref.example
66507 104T To: alice@wonderland.fict.example, rdo@foundation.example,
66508 darcy@austen.fict.example, editor@thesaurus.ref.example
66509 038  Date: Fri, 11 May 2001 10:28:59 +0100
66510 </literallayout>
66511 <para>
66512 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
66513 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
66514 unqualified domain <emphasis>foundation</emphasis>.
66515 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
66516 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
66517 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
66518 </para>
66519 </section>
66520 </chapter>
66521
66522 <chapter id="CHAPdkim">
66523 <title>Support for DKIM (DomainKeys Identified Mail)</title>
66524 <titleabbrev>DKIM Support</titleabbrev>
66525 <para>
66526 <indexterm role="concept">
66527 <primary>DKIM</primary>
66528 </indexterm>
66529 </para>
66530 <para>
66531 DKIM is a mechanism by which messages sent by some entity can be provably
66532 linked to a domain which that entity controls.  It permits reputation to
66533 be tracked on a per-domain basis, rather than merely upon source IP address.
66534 DKIM is documented in RFC 4871.
66535 </para>
66536 <para>
66537 Since version 4.70, DKIM support is compiled into Exim by default. It can be
66538 disabled by setting DISABLE_DKIM=yes in Local/Makefile.
66539 </para>
66540 <para>
66541 Exim&#x2019;s DKIM implementation allows to
66542 </para>
66543 <orderedlist numeration="arabic">
66544 <listitem>
66545 <para>
66546 Sign outgoing messages: This function is implemented in the SMTP transport.
66547 It can co-exist with all other Exim features
66548 (including transport filters)
66549 except cutthrough delivery.
66550 </para>
66551 </listitem>
66552 <listitem>
66553 <para>
66554 Verify signatures in incoming messages: This is implemented by an additional
66555 ACL (acl_smtp_dkim), which can be called several times per message, with
66556 different signature contexts.
66557 </para>
66558 </listitem>
66559 </orderedlist>
66560 <para>
66561 In typical Exim style, the verification implementation does not include any
66562 default "policy". Instead it enables you to build your own policy using
66563 Exim&#x2019;s standard controls.
66564 </para>
66565 <para>
66566 Please note that verification of DKIM signatures in incoming mail is turned
66567 on by default for logging purposes. For each signature in incoming email,
66568 exim will log a line displaying the most important signature details, and the
66569 signature status. Here is an example (with line-breaks added for clarity):
66570 </para>
66571 <literallayout class="monospaced">
66572 2009-09-09 10:22:28 1MlIRf-0003LU-U3 DKIM:
66573     d=facebookmail.com s=q1-2009b
66574     c=relaxed/relaxed a=rsa-sha1
66575     i=@facebookmail.com t=1252484542 [verification succeeded]
66576 </literallayout>
66577 <para>
66578 You might want to turn off DKIM verification processing entirely for internal
66579 or relay mail sources. To do that, set the <option>dkim_disable_verify</option> ACL
66580 control modifier. This should typically be done in the RCPT ACL, at points
66581 where you accept mail from relay sources (internal hosts or authenticated
66582 senders).
66583 </para>
66584 <section id="SECID513">
66585 <title>Signing outgoing messages</title>
66586 <para>
66587 <indexterm role="concept">
66588 <primary>DKIM</primary>
66589 <secondary>signing</secondary>
66590 </indexterm>
66591 </para>
66592 <para>
66593 Signing is implemented by setting private options on the SMTP transport.
66594 These options take (expandable) strings as arguments.
66595 </para>
66596 <para>
66597 <indexterm role="option">
66598 <primary><option>dkim_domain</option></primary>
66599 </indexterm>
66600 </para>
66601 <informaltable frame="all">
66602 <tgroup cols="4" colsep="0" rowsep="0">
66603 <colspec colwidth="8*" align="left"/>
66604 <colspec colwidth="6*" align="center"/>
66605 <colspec colwidth="6*" align="center"/>
66606 <colspec colwidth="6*" align="right"/>
66607 <tbody>
66608 <row>
66609 <entry><option>dkim_domain</option></entry>
66610 <entry>Use: <emphasis>smtp</emphasis></entry>
66611 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
66612 <entry>Default: <emphasis>unset</emphasis></entry>
66613 </row>
66614 </tbody>
66615 </tgroup>
66616 </informaltable>
66617 <para>
66618 MANDATORY:
66619 The domain you want to sign with. The result of this expanded
66620 option is put into the <option>$dkim_domain</option> expansion variable.
66621 </para>
66622 <para>
66623 <indexterm role="option">
66624 <primary><option>dkim_selector</option></primary>
66625 </indexterm>
66626 </para>
66627 <informaltable frame="all">
66628 <tgroup cols="4" colsep="0" rowsep="0">
66629 <colspec colwidth="8*" align="left"/>
66630 <colspec colwidth="6*" align="center"/>
66631 <colspec colwidth="6*" align="center"/>
66632 <colspec colwidth="6*" align="right"/>
66633 <tbody>
66634 <row>
66635 <entry><option>dkim_selector</option></entry>
66636 <entry>Use: <emphasis>smtp</emphasis></entry>
66637 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
66638 <entry>Default: <emphasis>unset</emphasis></entry>
66639 </row>
66640 </tbody>
66641 </tgroup>
66642 </informaltable>
66643 <para>
66644 MANDATORY:
66645 This sets the key selector string. You can use the <option>$dkim_domain</option> expansion
66646 variable to look up a matching selector. The result is put in the expansion
66647 variable <option>$dkim_selector</option> which should be used in the <option>dkim_private_key</option>
66648 option along with <option>$dkim_domain</option>.
66649 </para>
66650 <para>
66651 <indexterm role="option">
66652 <primary><option>dkim_private_key</option></primary>
66653 </indexterm>
66654 </para>
66655 <informaltable frame="all">
66656 <tgroup cols="4" colsep="0" rowsep="0">
66657 <colspec colwidth="8*" align="left"/>
66658 <colspec colwidth="6*" align="center"/>
66659 <colspec colwidth="6*" align="center"/>
66660 <colspec colwidth="6*" align="right"/>
66661 <tbody>
66662 <row>
66663 <entry><option>dkim_private_key</option></entry>
66664 <entry>Use: <emphasis>smtp</emphasis></entry>
66665 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
66666 <entry>Default: <emphasis>unset</emphasis></entry>
66667 </row>
66668 </tbody>
66669 </tgroup>
66670 </informaltable>
66671 <para>
66672 MANDATORY:
66673 This sets the private key to use. You can use the <option>$dkim_domain</option> and
66674 <option>$dkim_selector</option> expansion variables to determine the private key to use.
66675 The result can either
66676 </para>
66677 <itemizedlist>
66678 <listitem>
66679 <para>
66680 be a valid RSA private key in ASCII armor, including line breaks.
66681 </para>
66682 </listitem>
66683 <listitem>
66684 <para>
66685 start with a slash, in which case it is treated as a file that contains
66686 the private key.
66687 </para>
66688 </listitem>
66689 <listitem>
66690 <para>
66691 be "0", "false" or the empty string, in which case the message will not
66692 be signed. This case will not result in an error, even if <option>dkim_strict</option>
66693 is set.
66694 </para>
66695 </listitem>
66696 </itemizedlist>
66697 <para>
66698 <indexterm role="option">
66699 <primary><option>dkim_canon</option></primary>
66700 </indexterm>
66701 </para>
66702 <informaltable frame="all">
66703 <tgroup cols="4" colsep="0" rowsep="0">
66704 <colspec colwidth="8*" align="left"/>
66705 <colspec colwidth="6*" align="center"/>
66706 <colspec colwidth="6*" align="center"/>
66707 <colspec colwidth="6*" align="right"/>
66708 <tbody>
66709 <row>
66710 <entry><option>dkim_canon</option></entry>
66711 <entry>Use: <emphasis>smtp</emphasis></entry>
66712 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
66713 <entry>Default: <emphasis>unset</emphasis></entry>
66714 </row>
66715 </tbody>
66716 </tgroup>
66717 </informaltable>
66718 <para>
66719 OPTIONAL:
66720 This option sets the canonicalization method used when signing a message.
66721 The DKIM RFC currently supports two methods: "simple" and "relaxed".
66722 The option defaults to "relaxed" when unset. Note: the current implementation
66723 only supports using the same canonicalization method for both headers and body.
66724 </para>
66725 <para>
66726 <indexterm role="option">
66727 <primary><option>dkim_strict</option></primary>
66728 </indexterm>
66729 </para>
66730 <informaltable frame="all">
66731 <tgroup cols="4" colsep="0" rowsep="0">
66732 <colspec colwidth="8*" align="left"/>
66733 <colspec colwidth="6*" align="center"/>
66734 <colspec colwidth="6*" align="center"/>
66735 <colspec colwidth="6*" align="right"/>
66736 <tbody>
66737 <row>
66738 <entry><option>dkim_strict</option></entry>
66739 <entry>Use: <emphasis>smtp</emphasis></entry>
66740 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
66741 <entry>Default: <emphasis>unset</emphasis></entry>
66742 </row>
66743 </tbody>
66744 </tgroup>
66745 </informaltable>
66746 <para>
66747 OPTIONAL:
66748 This  option  defines  how  Exim  behaves  when  signing a message that
66749 should be signed fails for some reason.  When the expansion evaluates to
66750 either "1" or "true", Exim will defer. Otherwise Exim will send the message
66751 unsigned. You can use the <option>$dkim_domain</option> and <option>$dkim_selector</option> expansion
66752 variables here.
66753 </para>
66754 <para>
66755 <indexterm role="option">
66756 <primary><option>dkim_sign_headers</option></primary>
66757 </indexterm>
66758 </para>
66759 <informaltable frame="all">
66760 <tgroup cols="4" colsep="0" rowsep="0">
66761 <colspec colwidth="8*" align="left"/>
66762 <colspec colwidth="6*" align="center"/>
66763 <colspec colwidth="6*" align="center"/>
66764 <colspec colwidth="6*" align="right"/>
66765 <tbody>
66766 <row>
66767 <entry><option>dkim_sign_headers</option></entry>
66768 <entry>Use: <emphasis>smtp</emphasis></entry>
66769 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
66770 <entry>Default: <emphasis>unset</emphasis></entry>
66771 </row>
66772 </tbody>
66773 </tgroup>
66774 </informaltable>
66775 <para>
66776 OPTIONAL:
66777 When set, this option must expand to (or be specified as) a colon-separated
66778 list of header names. Headers with these names will be included in the message
66779 signature. When unspecified, the header names recommended in RFC4871 will be
66780 used.
66781 </para>
66782 </section>
66783 <section id="SECID514">
66784 <title>Verifying DKIM signatures in incoming mail</title>
66785 <para>
66786 <indexterm role="concept">
66787 <primary>DKIM</primary>
66788 <secondary>verification</secondary>
66789 </indexterm>
66790 </para>
66791 <para>
66792 Verification of DKIM signatures in incoming email is implemented via the
66793 <option>acl_smtp_dkim</option> ACL. By default, this ACL is called once for each
66794 syntactically(!) correct signature in the incoming message.
66795 A missing ACL definition defaults to accept.
66796 If any ACL call does not acccept, the message is not accepted.
66797 If a cutthrough delivery was in progress for the message it is
66798 summarily dropped (having wasted the transmission effort).
66799 </para>
66800 <para>
66801 To evaluate the signature in the ACL a large number of expansion variables
66802 containing the signature status and its details are set up during the
66803 runtime of the ACL.
66804 </para>
66805 <para>
66806 Calling the ACL only for existing signatures is not sufficient to build
66807 more advanced policies. For that reason, the global option
66808 <option>dkim_verify_signers</option>, and a global expansion variable
66809 <option>$dkim_signers</option> exist.
66810 </para>
66811 <para>
66812 The global option <option>dkim_verify_signers</option> can be set to a colon-separated
66813 list of DKIM domains or identities for which the ACL <option>acl_smtp_dkim</option> is
66814 called. It is expanded when the message has been received. At this point,
66815 the expansion variable <option>$dkim_signers</option> already contains a colon-separated
66816 list of signer domains and identities for the message. When
66817 <option>dkim_verify_signers</option> is not specified in the main configuration,
66818 it defaults as:
66819 </para>
66820 <literallayout class="monospaced">
66821 dkim_verify_signers = $dkim_signers
66822 </literallayout>
66823 <para>
66824 This leads to the default behaviour of calling <option>acl_smtp_dkim</option> for each
66825 DKIM signature in the message. Current DKIM verifiers may want to explicitly
66826 call the ACL for known domains or identities. This would be achieved as follows:
66827 </para>
66828 <literallayout class="monospaced">
66829 dkim_verify_signers = paypal.com:ebay.com:$dkim_signers
66830 </literallayout>
66831 <para>
66832 This would result in <option>acl_smtp_dkim</option> always being called for "paypal.com"
66833 and "ebay.com", plus all domains and identities that have signatures in the message.
66834 You can also be more creative in constructing your policy. For example:
66835 </para>
66836 <literallayout class="monospaced">
66837 dkim_verify_signers = $sender_address_domain:$dkim_signers
66838 </literallayout>
66839 <para>
66840 If a domain or identity is listed several times in the (expanded) value of
66841 <option>dkim_verify_signers</option>, the ACL is only called once for that domain or identity.
66842 </para>
66843 <para>
66844 Inside the <option>acl_smtp_dkim</option>, the following expansion variables are
66845 available (from most to least important):
66846 </para>
66847 <variablelist>
66848 <varlistentry>
66849 <term><option>$dkim_cur_signer</option></term>
66850 <listitem>
66851 <para>
66852 The signer that is being evaluated in this ACL run. This can be a domain or
66853 an identity. This is one of the list items from the expanded main option
66854 <option>dkim_verify_signers</option> (see above).
66855 </para>
66856 </listitem></varlistentry>
66857 <varlistentry>
66858 <term><option>$dkim_verify_status</option></term>
66859 <listitem>
66860 <para>
66861 A string describing the general status of the signature. One of
66862 </para>
66863 <itemizedlist>
66864 <listitem>
66865 <para>
66866 <option>none</option>: There is no signature in the message for the current domain or
66867 identity (as reflected by <option>$dkim_cur_signer</option>).
66868 </para>
66869 </listitem>
66870 <listitem>
66871 <para>
66872 <option>invalid</option>: The signature could not be verified due to a processing error.
66873 More detail is available in <option>$dkim_verify_reason</option>.
66874 </para>
66875 </listitem>
66876 <listitem>
66877 <para>
66878 <option>fail</option>: Verification of the signature failed.  More detail is
66879 available in <option>$dkim_verify_reason</option>.
66880 </para>
66881 </listitem>
66882 <listitem>
66883 <para>
66884 <option>pass</option>: The signature passed verification. It is valid.
66885 </para>
66886 </listitem>
66887 </itemizedlist>
66888 </listitem></varlistentry>
66889 <varlistentry>
66890 <term><option>$dkim_verify_reason</option></term>
66891 <listitem>
66892 <para>
66893 A string giving a litte bit more detail when <option>$dkim_verify_status</option> is either
66894 "fail" or "invalid". One of
66895 </para>
66896 <itemizedlist>
66897 <listitem>
66898 <para>
66899 <option>pubkey_unavailable</option> (when <option>$dkim_verify_status</option>="invalid"): The public
66900 key for the domain could not be retrieved. This may be a temporary problem.
66901 </para>
66902 </listitem>
66903 <listitem>
66904 <para>
66905 <option>pubkey_syntax</option> (when <option>$dkim_verify_status</option>="invalid"): The public key
66906 record for the domain is syntactically invalid.
66907 </para>
66908 </listitem>
66909 <listitem>
66910 <para>
66911 <option>bodyhash_mismatch</option> (when <option>$dkim_verify_status</option>="fail"): The calculated
66912 body hash does not match the one specified in the signature header. This
66913 means that the message body was modified in transit.
66914 </para>
66915 </listitem>
66916 <listitem>
66917 <para>
66918 <option>signature_incorrect</option> (when <option>$dkim_verify_status</option>="fail"): The signature
66919 could not be verified. This may mean that headers were modified,
66920 re-written or otherwise changed in a way which is incompatible with
66921 DKIM verification. It may of course also mean that the signature is forged.
66922 </para>
66923 </listitem>
66924 </itemizedlist>
66925 </listitem></varlistentry>
66926 <varlistentry>
66927 <term><option>$dkim_domain</option></term>
66928 <listitem>
66929 <para>
66930 The signing domain. IMPORTANT: This variable is only populated if there is
66931 an actual signature in the message for the current domain or identity (as
66932 reflected by <option>$dkim_cur_signer</option>).
66933 </para>
66934 </listitem></varlistentry>
66935 <varlistentry>
66936 <term><option>$dkim_identity</option></term>
66937 <listitem>
66938 <para>
66939 The signing identity, if present. IMPORTANT: This variable is only populated
66940 if there is an actual signature in the message for the current domain or
66941 identity (as reflected by <option>$dkim_cur_signer</option>).
66942 </para>
66943 </listitem></varlistentry>
66944 <varlistentry>
66945 <term><option>$dkim_selector</option></term>
66946 <listitem>
66947 <para>
66948 The key record selector string.
66949 </para>
66950 </listitem></varlistentry>
66951 <varlistentry>
66952 <term><option>$dkim_algo</option></term>
66953 <listitem>
66954 <para>
66955 The algorithm used. One of &#x2019;rsa-sha1&#x2019; or &#x2019;rsa-sha256&#x2019;.
66956 </para>
66957 </listitem></varlistentry>
66958 <varlistentry>
66959 <term><option>$dkim_canon_body</option></term>
66960 <listitem>
66961 <para>
66962 The body canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
66963 </para>
66964 </listitem></varlistentry>
66965 <varlistentry>
66966 <term><option>dkim_canon_headers</option></term>
66967 <listitem>
66968 <para>
66969 The header canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
66970 </para>
66971 </listitem></varlistentry>
66972 <varlistentry>
66973 <term><option>$dkim_copiedheaders</option></term>
66974 <listitem>
66975 <para>
66976 A transcript of headers and their values which are included in the signature
66977 (copied from the &#x2019;z=&#x2019; tag of the signature).
66978 </para>
66979 </listitem></varlistentry>
66980 <varlistentry>
66981 <term><option>$dkim_bodylength</option></term>
66982 <listitem>
66983 <para>
66984 The number of signed body bytes. If zero ("0"), the body is unsigned. If no
66985 limit was set by the signer, "9999999999999" is returned. This makes sure
66986 that this variable always expands to an integer value.
66987 </para>
66988 </listitem></varlistentry>
66989 <varlistentry>
66990 <term><option>$dkim_created</option></term>
66991 <listitem>
66992 <para>
66993 UNIX timestamp reflecting the date and time when the signature was created.
66994 When this was not specified by the signer, "0" is returned.
66995 </para>
66996 </listitem></varlistentry>
66997 <varlistentry>
66998 <term><option>$dkim_expires</option></term>
66999 <listitem>
67000 <para>
67001 UNIX timestamp reflecting the date and time when the signer wants the
67002 signature to be treated as "expired". When this was not specified by the
67003 signer, "9999999999999" is returned. This makes it possible to do useful
67004 integer size comparisons against this value.
67005 </para>
67006 </listitem></varlistentry>
67007 <varlistentry>
67008 <term><option>$dkim_headernames</option></term>
67009 <listitem>
67010 <para>
67011 A colon-separated list of names of headers included in the signature.
67012 </para>
67013 </listitem></varlistentry>
67014 <varlistentry>
67015 <term><option>$dkim_key_testing</option></term>
67016 <listitem>
67017 <para>
67018 "1" if the key record has the "testing" flag set, "0" if not.
67019 </para>
67020 </listitem></varlistentry>
67021 <varlistentry>
67022 <term><option>$dkim_key_nosubdomains</option></term>
67023 <listitem>
67024 <para>
67025 "1" if the key record forbids subdomaining, "0" otherwise.
67026 </para>
67027 </listitem></varlistentry>
67028 <varlistentry>
67029 <term><option>$dkim_key_srvtype</option></term>
67030 <listitem>
67031 <para>
67032 Service type (tag s=) from the key record. Defaults to "*" if not specified
67033 in the key record.
67034 </para>
67035 </listitem></varlistentry>
67036 <varlistentry>
67037 <term><option>$dkim_key_granularity</option></term>
67038 <listitem>
67039 <para>
67040 Key granularity (tag g=) from the key record. Defaults to "*" if not specified
67041 in the key record.
67042 </para>
67043 </listitem></varlistentry>
67044 <varlistentry>
67045 <term><option>$dkim_key_notes</option></term>
67046 <listitem>
67047 <para>
67048 Notes from the key record (tag n=).
67049 </para>
67050 </listitem></varlistentry>
67051 </variablelist>
67052 <para>
67053 In addition, two ACL conditions are provided:
67054 </para>
67055 <variablelist>
67056 <varlistentry>
67057 <term><option>dkim_signers</option></term>
67058 <listitem>
67059 <para>
67060 ACL condition that checks a colon-separated list of domains or identities
67061 for a match against the domain or identity that the ACL is currently verifying
67062 (reflected by <option>$dkim_cur_signer</option>). This is typically used to restrict an ACL
67063 verb to a group of domains or identities. For example:
67064 </para>
67065 <literallayout class="monospaced">
67066 # Warn when Mail purportedly from GMail has no signature at all
67067 warn log_message = GMail sender without DKIM signature
67068      sender_domains = gmail.com
67069      dkim_signers = gmail.com
67070      dkim_status = none
67071 </literallayout>
67072 </listitem></varlistentry>
67073 <varlistentry>
67074 <term><option>dkim_status</option></term>
67075 <listitem>
67076 <para>
67077 ACL condition that checks a colon-separated list of possible DKIM verification
67078 results against the actual result of verification. This is typically used
67079 to restrict an ACL verb to a list of verification outcomes, for example:
67080 </para>
67081 <literallayout class="monospaced">
67082 deny message = Mail from Paypal with invalid/missing signature
67083      sender_domains = paypal.com:paypal.de
67084      dkim_signers = paypal.com:paypal.de
67085      dkim_status = none:invalid:fail
67086 </literallayout>
67087 <para>
67088 The possible status keywords are: &#x2019;none&#x2019;,&#x2019;invalid&#x2019;,&#x2019;fail&#x2019; and &#x2019;pass&#x2019;. Please
67089 see the documentation of the <option>$dkim_verify_status</option> expansion variable above
67090 for more information of what they mean.
67091 </para>
67092 </listitem></varlistentry>
67093 </variablelist>
67094 </section>
67095 </chapter>
67096
67097 <chapter id="CHID13">
67098 <title>Adding new drivers or lookup types</title>
67099 <titleabbrev>Adding drivers or lookups</titleabbrev>
67100 <para>
67101 <indexterm role="concept">
67102 <primary>adding drivers</primary>
67103 </indexterm>
67104 <indexterm role="concept">
67105 <primary>new drivers, adding</primary>
67106 </indexterm>
67107 <indexterm role="concept">
67108 <primary>drivers</primary>
67109 <secondary>adding new</secondary>
67110 </indexterm>
67111 The following actions have to be taken in order to add a new router, transport,
67112 authenticator, or lookup type to Exim:
67113 </para>
67114 <orderedlist numeration="arabic">
67115 <listitem>
67116 <para>
67117 Choose a name for the driver or lookup type that does not conflict with any
67118 existing name; I will use <quote>newdriver</quote> in what follows.
67119 </para>
67120 </listitem>
67121 <listitem>
67122 <para>
67123 Add to <filename>src/EDITME</filename> the line:
67124 </para>
67125 <literallayout>
67126 &lt;<emphasis>type</emphasis>&gt;<literal>_NEWDRIVER=yes</literal>
67127 </literallayout>
67128 <para>
67129 where &lt;<emphasis>type</emphasis>&gt; is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
67130 code is not to be included in the binary by default, comment this line out. You
67131 should also add any relevant comments about the driver or lookup type.
67132 </para>
67133 </listitem>
67134 <listitem>
67135 <para>
67136 Add to <filename>src/config.h.defaults</filename> the line:
67137 </para>
67138 <literallayout class="monospaced">
67139 #define &lt;type&gt;_NEWDRIVER
67140 </literallayout>
67141 </listitem>
67142 <listitem>
67143 <para>
67144 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
67145 and create a table entry as is done for all the other drivers and lookup types.
67146 </para>
67147 </listitem>
67148 <listitem>
67149 <para>
67150 Edit <filename>scripts/lookups-Makefile</filename> if this is a new lookup; there is a for-loop
67151 near the bottom, ranging the <literal>name_mod</literal> variable over a list of all lookups.
67152 Add your <literal>NEWDRIVER</literal> to that list.
67153 As long as the dynamic module would be named <filename>newdriver.so</filename>, you can use the
67154 simple form that most lookups have.
67155 </para>
67156 </listitem>
67157 <listitem>
67158 <para>
67159 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
67160 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
67161 driver or lookup type and add it to the definition of OBJ.
67162 </para>
67163 </listitem>
67164 <listitem>
67165 <para>
67166 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
67167 <filename>src</filename>.
67168 </para>
67169 </listitem>
67170 <listitem>
67171 <para>
67172 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
67173 as for other drivers and lookups.
67174 </para>
67175 </listitem>
67176 </orderedlist>
67177 <para>
67178 Then all you need to do is write the code! A good way to start is to make a
67179 proforma by copying an existing module of the same type, globally changing all
67180 occurrences of the name, and cutting out most of the code. Note that any
67181 options you create must be listed in alphabetical order, because the tables are
67182 searched using a binary chop procedure.
67183 </para>
67184 <para>
67185 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
67186 the interface that is expected.
67187 </para>
67188 <?sdop
67189   format="newpage"
67190   foot_right_recto="&chaptertitle;"
67191   foot_right_verso="&chaptertitle;"
67192 ?>
67193 </chapter>
67194
67195 <index role="option">
67196 <title>Options index</title>
67197 </index>
67198
67199 <index role="variable">
67200 <title>Variables index</title>
67201 </index>
67202
67203 <index role="concept">
67204 <title>Concept index</title>
67205 </index>
67206
67207 </book>